From e2225e337860a4944e27da67e200242f6bdf5070 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Sat, 12 Sep 2015 14:56:09 -0700 Subject: [PATCH] T350: Updated configuration files for Laravel 5. --- .env.example | 7 +- app/Album.php | 4 +- app/Console/Commands/ImportMLPMA.php | 8 +- app/Console/Commands/MigrateOldData.php | 2 +- app/Http/routes.php | 2 +- app/Image.php | 4 +- app/Library/getid3/.gitattributes | 22 +++ app/Library/getid3/.gitignore | 167 +++++++++++++++++++ app/Track.php | 4 +- app/TrackFile.php | 4 +- config/app.php | 6 +- config/cache.php | 2 +- config/poniverse.php | 21 +-- config/ponyfm.php | 31 ++++ config/session.php | 2 +- resources/views/shared/_app_layout.blade.php | 6 +- vagrant/.env.local | 24 +++ vagrant/copy-and-restart-configs.sh | 3 +- vagrant/install.sh | 2 +- vagrant/reload-config.sh | 3 +- 20 files changed, 288 insertions(+), 36 deletions(-) create mode 100755 app/Library/getid3/.gitattributes create mode 100755 app/Library/getid3/.gitignore create mode 100644 config/ponyfm.php create mode 100644 vagrant/.env.local diff --git a/.env.example b/.env.example index 214b4621..723ea439 100644 --- a/.env.example +++ b/.env.example @@ -16,4 +16,9 @@ MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null -MAIL_ENCRYPTION=null \ No newline at end of file +MAIL_ENCRYPTION=null + +PONI_CLIENT_ID=null +PONI_CLIENT_SECRET=null + +PONYFM_DATASTORE=null diff --git a/app/Album.php b/app/Album.php index ec27190e..87904abb 100644 --- a/app/Album.php +++ b/app/Album.php @@ -211,7 +211,7 @@ class Album extends Model { $dir = (string)(floor($this->id / 100) * 100); - return \Config::get('app.files_directory') . '/tracks/' . $dir; + return \Config::get('ponyfm.files_directory') . '/tracks/' . $dir; } public function getDates() @@ -316,4 +316,4 @@ class Album extends Model { return 'album-' . $this->id . '-' . $key; } -} \ No newline at end of file +} diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index 6a54a36a..2576aa9d 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -17,7 +17,7 @@ use Illuminate\Support\Str; use Input; use Symfony\Component\HttpFoundation\File\UploadedFile; -//require_once(app_path() . '/Library/getid3/getid3/getid3.php'); +require_once(app_path() . '/Library/getid3/getid3/getid3.php'); class ImportMLPMA extends Command { @@ -82,8 +82,8 @@ class ImportMLPMA extends Command { pcntl_signal(SIGINT, [$this, 'handleInterrupt']); - $mlpmaPath = Config::get('app.files_directory') . 'mlpma'; - $tmpPath = Config::get('app.files_directory') . 'tmp'; + $mlpmaPath = Config::get('ponyfm.files_directory') . 'mlpma'; + $tmpPath = Config::get('ponyfm.files_directory') . 'tmp'; if (!File::exists($tmpPath)) { File::makeDirectory($tmpPath); @@ -497,4 +497,4 @@ class ImportMLPMA extends Command ]; } -} \ No newline at end of file +} diff --git a/app/Console/Commands/MigrateOldData.php b/app/Console/Commands/MigrateOldData.php index 53287bde..e4cae80e 100644 --- a/app/Console/Commands/MigrateOldData.php +++ b/app/Console/Commands/MigrateOldData.php @@ -376,7 +376,7 @@ class MigrateOldData extends Command { $dir = (string)(floor($id / 100) * 100); - return \Config::get('app.files_directory') . '/' . $type . '/' . $dir; + return \Config::get('ponyfm.files_directory') . '/' . $type . '/' . $dir; } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 51ffc6a1..6c8eba75 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -158,4 +158,4 @@ Route::group(['domain' => 'api.pony.fm'], function() { Route::get('tracks/popular', [ 'uses' => 'Api\Mobile\TracksController@popular']); /* Route::get('tracks/id', [ 'uses' => 'Api\Mobile\TracksController@track']); Route::get('user', ['uses' => 'Api\Mobile\UserController@user']);*/ -}); \ No newline at end of file +}); diff --git a/app/Image.php b/app/Image.php index f638df7a..14ba1e52 100644 --- a/app/Image.php +++ b/app/Image.php @@ -102,7 +102,7 @@ class Image extends Model { $dir = (string)(floor($this->id / 100) * 100); - return Config::get('app.files_directory') . '/images/' . $dir; + return Config::get('ponyfm.files_directory') . '/images/' . $dir; } public function ensureDirectoryExists() @@ -114,4 +114,4 @@ class Image extends Model mkdir($destination, 0777, true); } } -} \ No newline at end of file +} diff --git a/app/Library/getid3/.gitattributes b/app/Library/getid3/.gitattributes new file mode 100755 index 00000000..412eeda7 --- /dev/null +++ b/app/Library/getid3/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/app/Library/getid3/.gitignore b/app/Library/getid3/.gitignore new file mode 100755 index 00000000..ecc47c4f --- /dev/null +++ b/app/Library/getid3/.gitignore @@ -0,0 +1,167 @@ +helperapps/sha1sum.exe +helperapps/*.dll + + +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/app/Track.php b/app/Track.php index e30cc8bf..b6e25417 100644 --- a/app/Track.php +++ b/app/Track.php @@ -483,7 +483,7 @@ class Track extends Model { $dir = (string)(floor($this->id / 100) * 100); - return \Config::get('app.files_directory') . '/tracks/' . $dir; + return \Config::get('ponyfm.files_directory') . '/tracks/' . $dir; } public function getDates() @@ -634,4 +634,4 @@ class Track extends Model { return 'track-' . $this->id . '-' . $key; } -} \ No newline at end of file +} diff --git a/app/TrackFile.php b/app/TrackFile.php index f65b38ff..741231a4 100644 --- a/app/TrackFile.php +++ b/app/TrackFile.php @@ -94,7 +94,7 @@ class TrackFile extends Model { $dir = (string)(floor($this->track_id / 100) * 100); - return \Config::get('app.files_directory') . '/tracks/' . $dir; + return \Config::get('ponyfm.files_directory') . '/tracks/' . $dir; } public function getFile() @@ -116,4 +116,4 @@ class TrackFile extends Model { return 'track_file-' . $this->id . '-' . $key; } -} \ No newline at end of file +} diff --git a/config/app.php b/config/app.php index 01594c6f..97e4e954 100644 --- a/config/app.php +++ b/config/app.php @@ -26,7 +26,7 @@ return [ | */ - 'url' => 'http://pony.fm', + 'url' => env('APP_URL', 'https://pony.fm'), /* |-------------------------------------------------------------------------- @@ -78,9 +78,9 @@ return [ | */ - 'key' => env('APP_KEY', 'AQUSDTDK5xA04yb9eO9iwlm72NpC8e90'), + 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', + 'cipher' => MCRYPT_RIJNDAEL_256, /* |-------------------------------------------------------------------------- diff --git a/config/cache.php b/config/cache.php index 379135b0..f4098123 100644 --- a/config/cache.php +++ b/config/cache.php @@ -74,6 +74,6 @@ return [ | */ - 'prefix' => 'laravel', + 'prefix' => 'ponyfm', ]; diff --git a/config/poniverse.php b/config/poniverse.php index 09a5b33a..15cab0bf 100644 --- a/config/poniverse.php +++ b/config/poniverse.php @@ -1,11 +1,12 @@ 1, - 'urls' => [ - 'api' => '', - 'auth' => '', - 'token' => '' - ], - 'client_id' => 0, - 'secret' => '' - ]; \ No newline at end of file +return [ + 'version' => 1, + 'urls' => [ + 'api' => env('PONI_API_URL', 'https://api.poniverse.net/v1/'), + 'register' => env('PONI_REGISTER_URL', 'https://poniverse.net/register?site=pony.fm'), + 'auth' => env('PONI_AUTH_URL', 'https://poniverse.net/oauth/authorize'), + 'token' => env('PONI_TOKEN_URL', 'https://poniverse.net/oauth/access_token') + ], + 'client_id' => env('PONI_CLIENT_ID'), + 'secret' => env('PONI_CLIENT_SECRET') +]; diff --git a/config/ponyfm.php b/config/ponyfm.php new file mode 100644 index 00000000..e10a1967 --- /dev/null +++ b/config/ponyfm.php @@ -0,0 +1,31 @@ + env('PONYFM_DATASTORE'), + + /* + |-------------------------------------------------------------------------- + | Use sendfile? + |-------------------------------------------------------------------------- + | + | sendfile is a way of letting the web server serve files that aren't + | normally in its document root. If the web server is configured for it, + | use this setting - otherwise, track files and images will be served by + | the PHP process. + | + */ + + 'sendfile' => env('USE_SENDFILE', true), + +]; diff --git a/config/session.php b/config/session.php index f1b00421..d4ad0f16 100644 --- a/config/session.php +++ b/config/session.php @@ -109,7 +109,7 @@ return [ | */ - 'cookie' => 'laravel_session', + 'cookie' => 'IfYouAreReadingThisWeWantToWorkWithYou_PleaseDropAnEmailTo_HelloAtPoniverseDotNet', /* |-------------------------------------------------------------------------- diff --git a/resources/views/shared/_app_layout.blade.php b/resources/views/shared/_app_layout.blade.php index 10869add..40b0b7b9 100644 --- a/resources/views/shared/_app_layout.blade.php +++ b/resources/views/shared/_app_layout.blade.php @@ -98,11 +98,11 @@ @section('scripts')