Upgrade Checker (#151)

Upgrade Checker
This commit is contained in:
Adam Lavin 2021-02-14 19:44:17 +00:00 committed by GitHub
commit e030bf2591
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 98 additions and 98 deletions

View file

@ -88,7 +88,7 @@ class CreateCommentCommand extends CommandBase
if ($this->_type == 'playlist') {
$column = 'playlist_id';
} else {
App::abort(500);
abort(500);
}
}
}
@ -107,7 +107,7 @@ class CreateCommentCommand extends CommandBase
} elseif ($this->_type === 'user') {
$entity = User::find($this->_id);
} else {
App::abort(400, 'This comment is being added to an invalid entity!');
abort(400, 'This comment is being added to an invalid entity!');
}
$entity->comment_count = Comment::where($column, $this->_id)->count();

View file

@ -278,7 +278,7 @@ class ParseTrackTagsCommand extends CommandBase
}
// write temporary image file
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
$tmpPath = config('ponyfm.files_directory').'/tmp';
$filename = $file->getFilename().".cover.${extension}";
$imageFilePath = "${tmpPath}/${filename}";

View file

@ -134,15 +134,15 @@ class UploadTrackCommand extends CommandBase
}
$this->_track->ensureDirectoryExists();
if (! is_dir(Config::get('ponyfm.files_directory').'/tmp')) {
mkdir(Config::get('ponyfm.files_directory').'/tmp', 0755, true);
if (! is_dir(config('ponyfm.files_directory').'/tmp')) {
mkdir(config('ponyfm.files_directory').'/tmp', 0755, true);
}
if (! is_dir(Config::get('ponyfm.files_directory').'/queued-tracks')) {
mkdir(Config::get('ponyfm.files_directory').'/queued-tracks', 0755, true);
if (! is_dir(config('ponyfm.files_directory').'/queued-tracks')) {
mkdir(config('ponyfm.files_directory').'/queued-tracks', 0755, true);
}
$trackFile = $trackFile->move(Config::get('ponyfm.files_directory').'/queued-tracks', $this->_track->id.'v'.$this->_version);
$trackFile = $trackFile->move(config('ponyfm.files_directory').'/queued-tracks', $this->_track->id.'v'.$this->_version);
$input = Request::all();
$input['track'] = $trackFile;

View file

@ -77,8 +77,8 @@ class FixMLPMAImages extends Command
*/
public function handle()
{
$mlpmaPath = Config::get('ponyfm.files_directory').'/mlpma';
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
$mlpmaPath = config('ponyfm.files_directory').'/mlpma';
$tmpPath = config('ponyfm.files_directory').'/tmp';
$this->comment('Enumerating MLP Music Archive source files...');
$files = File::allFiles($mlpmaPath);

View file

@ -86,7 +86,7 @@ class ImportEQBeats extends Command
pcntl_signal(SIGINT, [$this, 'handleInterrupt']);
$archivePath = $this->argument('archiveFolder');
$tmpPath = Config::get('ponyfm.files_directory').'/tmp';
$tmpPath = config('ponyfm.files_directory').'/tmp';
if (! File::exists($tmpPath)) {
File::makeDirectory($tmpPath);

View file

@ -399,6 +399,6 @@ class MigrateOldData extends Command
{
$dir = (string) (floor($id / 100) * 100);
return \Config::get('ponyfm.files_directory').'/'.$type.'/'.$dir;
return config('ponyfm.files_directory').'/'.$type.'/'.$dir;
}
}

View file

@ -28,16 +28,16 @@ class AccountController extends Controller
{
public function getIndex()
{
return View::make('shared.null');
return view('shared.null');
}
public function getRegister()
{
return Redirect::to(Config::get('poniverse.urls')['register']);
return redirect(config('poniverse.urls')['register']);
}
public function getNotifications()
{
return View::make('shared.null');
return view('shared.null');
}
}

View file

@ -26,36 +26,36 @@ class AdminController extends Controller
{
public function getIndex()
{
return View::make('shared.null');
return view('shared.null');
}
public function getGenres()
{
return View::make('shared.null');
return view('shared.null');
}
public function getTracks()
{
return View::make('shared.null');
return view('shared.null');
}
public function getShowSongs()
{
return View::make('shared.null');
return view('shared.null');
}
public function getUsers()
{
return View::make('shared.null');
return view('shared.null');
}
public function getClassifierQueue()
{
return View::make('shared.null');
return view('shared.null');
}
public function getAnnouncements()
{
return View::make('shared.null');
return view('shared.null');
}
}

View file

@ -32,28 +32,28 @@ class AlbumsController extends Controller
{
public function getIndex()
{
return View::make('albums.index');
return view('albums.index');
}
public function getShow($id, $slug)
{
$album = Album::find($id);
if (! $album) {
App::abort(404);
abort(404);
}
if ($album->slug != $slug) {
return Redirect::action('AlbumsController@getAlbum', [$id, $album->slug]);
}
return View::make('albums.show');
return view('albums.show');
}
public function getShortlink($id)
{
$album = Album::find($id);
if (! $album) {
App::abort(404);
abort(404);
}
return Redirect::action('AlbumsController@getShow', [$id, $album->slug]);
@ -63,7 +63,7 @@ class AlbumsController extends Controller
{
$album = Album::with('tracks', 'tracks.trackFiles', 'user')->find($id);
if (! $album) {
App::abort(404);
abort(404);
}
$format = null;
@ -78,11 +78,11 @@ class AlbumsController extends Controller
}
if ($format == null) {
App::abort(404);
abort(404);
}
if (! $album->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
App::abort(404);
abort(404);
}
ResourceLogItem::logItem('album', $id, ResourceLogItem::DOWNLOAD, $format['index']);

View file

@ -72,7 +72,7 @@ class AlbumsController extends ApiControllerBase
->find($id);
if (! $album) {
App::abort(404);
abort(404);
}
if (Request::get('log')) {

View file

@ -42,7 +42,7 @@ class ArtistsController extends ApiControllerBase
{
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
if (! $user) {
App::abort(404);
abort(404);
}
$favs = Favourite::where('user_id', $user->id)
@ -88,7 +88,7 @@ class ArtistsController extends ApiControllerBase
{
$user = User::where('slug', $slug)->whereNull('disabled_at')->first();
if (! $user) {
App::abort(404);
abort(404);
}
$query = Track::summary()
@ -137,7 +137,7 @@ class ArtistsController extends ApiControllerBase
])
->first();
if (! $user) {
App::abort(404);
abort(404);
}
$trackQuery = Track::summary()

View file

@ -50,7 +50,7 @@ class CommentsController extends ApiControllerBase
if ($type == 'playlist') {
$column = 'playlist_id';
} else {
App::abort(500);
abort(500);
}
}
}

View file

@ -116,7 +116,7 @@ class PlaylistsController extends ApiControllerBase
'comments.user',
])->userDetails()->find($id);
if (! $playlist || ! $playlist->canView(Auth::user())) {
App::abort('404');
abort('404');
}
if (Request::get('log')) {

View file

@ -29,7 +29,7 @@ class ArtistsController extends Controller
{
public function getIndex()
{
return View::make('artists.index');
return view('artists.index');
}
public function getFavourites($slug)
@ -56,12 +56,12 @@ class ArtistsController extends Controller
}
if ($user->disabled_at) {
App::abort('404');
abort('404');
}
return View::make('artists.profile');
return view('artists.profile');
} else {
App::abort('404');
abort('404');
}
}
@ -69,7 +69,7 @@ class ArtistsController extends Controller
{
$user = User::find($id);
if (! $user || $user->disabled_at !== null) {
App::abort('404');
abort('404');
}
return Redirect::action('ArtistsController@getProfile', [$user->slug]);

View file

@ -44,20 +44,20 @@ class AuthController extends Controller
public function getLogin()
{
if (Auth::guest()) {
return Redirect::to(
return redirect(
$this->poniverse
->getOAuthProvider(['redirectUri' => action('AuthController@getOAuth')])
->getAuthorizationUrl());
}
return Redirect::to('/');
return redirect('/');
}
public function postLogout()
{
Auth::logout();
return Redirect::to('/');
return redirect('/');
}
public function getOAuth()
@ -74,7 +74,7 @@ class AuthController extends Controller
} catch (IdentityProviderException $e) {
Log::error($e);
return Redirect::to('/')->with(
return redirect('/')->with(
'message',
'Unfortunately we are having problems attempting to log you in at the moment. Please try again at a later time.'
);
@ -161,6 +161,6 @@ class AuthController extends Controller
{
Auth::login($user, $rememberMe);
return Redirect::to('/');
return redirect('/');
}
}

View file

@ -26,16 +26,16 @@ class ContentController extends Controller
{
public function getTracks()
{
return View::make('shared.null');
return view('shared.null');
}
public function getAlbums()
{
return View::make('shared.null');
return view('shared.null');
}
public function getPlaylist()
{
return View::make('shared.null');
return view('shared.null');
}
}

View file

@ -26,6 +26,6 @@ class HomeController extends Controller
{
public function getIndex()
{
return View::make('home.index');
return view('home.index');
}
}

View file

@ -33,24 +33,24 @@ class ImagesController extends Controller
$coverType = Image::getImageTypeFromName($type);
if ($coverType == null) {
App::abort(404);
abort(404);
}
$image = Image::find($id);
if (! $image) {
App::abort(404);
abort(404);
}
$response = Response::make('', 200);
$response = response('', 200);
$filename = $image->getFile($coverType['id']);
if (! is_file($filename)) {
$redirect = url('/images/icons/profile_'.Image::$ImageTypes[$coverType['id']]['name'].'.png');
return Redirect::to($redirect);
return redirect($redirect);
}
if (Config::get('app.sendfile')) {
if (config('app.sendfile')) {
$response->header('X-Sendfile', $filename);
} else {
$response->header('X-Accel-Redirect', $filename);

View file

@ -68,6 +68,6 @@ class NotificationsController extends Controller
public function getEmailUnsubscribePage()
{
return View::make('shared.null');
return view('shared.null');
}
}

View file

@ -33,28 +33,28 @@ class PlaylistsController extends Controller
{
public function getIndex()
{
return View::make('playlists.index');
return view('playlists.index');
}
public function getPlaylist($id, $slug)
{
$playlist = Playlist::find($id);
if (! $playlist || ! $playlist->canView(Auth::user())) {
App::abort(404);
abort(404);
}
if ($playlist->slug != $slug) {
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
}
return View::make('playlists.show');
return view('playlists.show');
}
public function getShortlink($id)
{
$playlist = Playlist::find($id);
if (! $playlist || ! $playlist->canView(Auth::user())) {
App::abort(404);
abort(404);
}
return Redirect::action('PlaylistsController@getPlaylist', [$id, $playlist->slug]);
@ -64,7 +64,7 @@ class PlaylistsController extends Controller
{
$playlist = Playlist::with('tracks', 'tracks.trackFiles', 'user', 'tracks.album')->find($id);
if (! $playlist || ! $playlist->canView(Auth::user())) {
App::abort(404);
abort(404);
}
$format = null;
@ -79,11 +79,11 @@ class PlaylistsController extends Controller
}
if ($format == null) {
App::abort(404);
abort(404);
}
if (! $playlist->hasLosslessTracks() && in_array($formatName, Track::$LosslessFormats)) {
App::abort(404);
abort(404);
}
ResourceLogItem::logItem('playlist', $id, ResourceLogItem::DOWNLOAD, $format['index']);

View file

@ -26,6 +26,6 @@ class StatsController extends Controller
{
public function getIndex()
{
return View::make('tracks.stats');
return view('tracks.stats');
}
}

View file

@ -35,7 +35,7 @@ class TracksController extends Controller
{
public function getIndex()
{
return View::make('tracks.index');
return view('tracks.index');
}
public function getEmbed($id)
@ -51,7 +51,7 @@ class TracksController extends Controller
)->first();
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
$userData = [
@ -75,13 +75,13 @@ class TracksController extends Controller
];
}
return View::make('tracks.embed', ['track' => $track, 'user' => $userData]);
return view('tracks.embed', ['track' => $track, 'user' => $userData]);
}
public function getOembed(Request $request)
{
if (! $request->filled('url')) {
App::abort(404);
abort(404);
}
$parsedUrl = parse_url($request->input('url'));
@ -94,7 +94,7 @@ class TracksController extends Controller
->first();
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
$output = [
@ -117,14 +117,14 @@ class TracksController extends Controller
{
$track = Track::find($id);
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
if ($track->slug != $slug) {
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
}
return View::make('tracks.show', ['track' => $track]);
return view('tracks.show', ['track' => $track]);
}
public function getEdit($id, $slug)
@ -136,7 +136,7 @@ class TracksController extends Controller
{
$track = Track::find($id);
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
return Redirect::action('TracksController@getTrack', [$id, $track->slug]);
@ -146,21 +146,21 @@ class TracksController extends Controller
{
$track = Track::find($id);
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
$response = Response::make('', 200);
$response = response('', 200);
$filename = $trackFile->getFile();
if (! file_exists($filename)) {
App::abort(418);
abort(418);
}
ResourceLogItem::logItem('track', $id, ResourceLogItem::PLAY, $trackFile->getFormat()['index']);
if (Config::get('app.sendfile')) {
if (config('app.sendfile')) {
$response->header('X-Sendfile', $filename);
} else {
$response->header('X-Accel-Redirect', $filename);
@ -183,16 +183,16 @@ class TracksController extends Controller
{
$track = Track::find($id);
if (! $track || ! $track->canView(Auth::user())) {
App::abort(404);
abort(404);
}
$trackFile = TrackFile::findOrFailByExtension($track->id, $extension);
ResourceLogItem::logItem('track', $id, ResourceLogItem::DOWNLOAD, $trackFile->getFormat()['index']);
$response = Response::make('', 200);
$response = response('', 200);
$filename = $trackFile->getFile();
if (Config::get('app.sendfile')) {
if (config('app.sendfile')) {
$response->header('X-Sendfile', $filename);
$response->header(
'Content-Disposition',

View file

@ -26,6 +26,6 @@ class UploaderController extends Controller
{
public function getIndex()
{
return View::make('shared.null');
return view('shared.null');
}
}

View file

@ -145,7 +145,7 @@ class EncodeTrackFile extends Job implements ShouldQueue
// Insert the expiration time for cached tracks
if ($this->isExpirable && $this->trackFile->is_cacheable) {
$this->trackFile->expires_at = Carbon::now()->addMinutes(Config::get('ponyfm.track_file_cache_duration'));
$this->trackFile->expires_at = Carbon::now()->addMinutes(config('ponyfm.track_file_cache_duration'));
$this->trackFile->save();
}

View file

@ -32,14 +32,14 @@ class Assets
}
foreach ($scripts as $filename) {
if (Config::get('app.debug') && $filename !== 'templates.js') {
if (config('app.debug') && $filename !== 'templates.js') {
$scriptTags .= "<script src='http://localhost:61999/build/scripts/{$filename}'></script>";
} else {
$scriptTags .= "<script src='/build/scripts/{$filename}?".filemtime(public_path("build/scripts/{$filename}"))."'></script>";
}
}
if (Config::get('app.debug')) {
if (config('app.debug')) {
$scriptTags .= '<script src="http://localhost:61999/webpack-dev-server.js"></script>';
}
@ -48,7 +48,7 @@ class Assets
public static function styleIncludes($area = 'app')
{
if (! Config::get('app.debug')) {
if (! config('app.debug')) {
return '<script>document.write(\'<link rel="stylesheet" href="build/styles/'.$area.'.css?'.
filemtime(public_path("/build/styles/${area}.css"))
.'" />\');</script>';

View file

@ -15,7 +15,7 @@ class File extends \Illuminate\Support\Facades\File
$name = basename($path);
}
$response = Response::make(static::get($path));
$response = response(static::get($path));
$response->header('Content-Type', $mime);
$response->header('Content-Disposition', 'inline; filename="'.$name.'"');

View file

@ -39,9 +39,9 @@ class NativeDriver extends AbstractDriver
*/
private function pushNotifications(Activity $activity, $recipients)
{
if (Config::get('ponyfm.gcm_key') != 'default') {
if (config('ponyfm.gcm_key') != 'default') {
$apiKeys = [
'GCM' => Config::get('ponyfm.gcm_key'),
'GCM' => config('ponyfm.gcm_key'),
];
$webPush = new WebPush($apiKeys);

View file

@ -302,7 +302,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
{
$dir = (string) (floor($this->id / 100) * 100);
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
return config('ponyfm.files_directory').'/tracks/'.$dir;
}
public function getDates()

View file

@ -190,7 +190,7 @@ class Image extends Model
{
$dir = (string) (floor($this->id / 100) * 100);
return Config::get('ponyfm.files_directory').'/images/'.$dir;
return config('ponyfm.files_directory').'/images/'.$dir;
}
public function ensureDirectoryExists()

View file

@ -607,8 +607,8 @@ class Track extends Model implements Searchable, Commentable, Favouritable
],
'streams' => [
'mp3' => $track->getStreamUrl('MP3'),
'aac' => (! Config::get('app.debug') || is_file($track->getFileFor('AAC'))) ? $track->getStreamUrl('AAC') : null,
'ogg' => (Config::get('app.debug') || is_file($track->getFileFor('OGG Vorbis'))) ? $track->getStreamUrl('OGG Vorbis') : null,
'aac' => (! config('app.debug') || is_file($track->getFileFor('AAC'))) ? $track->getStreamUrl('AAC') : null,
'ogg' => (config('app.debug') || is_file($track->getFileFor('OGG Vorbis'))) ? $track->getStreamUrl('OGG Vorbis') : null,
],
'user_data' => $userData,
'permissions' => [
@ -963,7 +963,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
{
$dir = (string) (floor($this->id / 100) * 100);
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
return config('ponyfm.files_directory').'/tracks/'.$dir;
}
public function getDates()
@ -1037,7 +1037,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
*/
public function getTemporarySourceFileForVersion(int $version):string
{
return Config::get('ponyfm.files_directory').'/queued-tracks/'.$this->id.'v'.$version;
return config('ponyfm.files_directory').'/queued-tracks/'.$this->id.'v'.$version;
}
/**

View file

@ -96,7 +96,7 @@ class TrackFile extends Model
{
$track = Track::find($trackId);
if (! $track) {
App::abort(404);
abort(404);
}
// find the extension's format
@ -108,7 +108,7 @@ class TrackFile extends Model
}
}
if ($requestedFormatName === null) {
App::abort(404);
abort(404);
}
$trackFile = static::
@ -119,7 +119,7 @@ class TrackFile extends Model
->first();
if ($trackFile === null) {
App::abort(404);
abort(404);
} else {
return $trackFile;
}
@ -165,7 +165,7 @@ class TrackFile extends Model
{
$dir = (string) (floor($this->track_id / 100) * 100);
return \Config::get('ponyfm.files_directory').'/tracks/'.$dir;
return config('ponyfm.files_directory').'/tracks/'.$dir;
}
public function getFile()

View file

@ -62,7 +62,7 @@ trait IndexedInElasticsearchTrait
private function getElasticsearchParameters(bool $includeBody = true)
{
$parameters = [
'index' => Config::get('ponyfm.elasticsearch_index'),
'index' => config('ponyfm.elasticsearch_index'),
'type' => $this->elasticsearchType,
'id' => $this->id,
];
@ -95,7 +95,7 @@ trait IndexedInElasticsearchTrait
*/
public function updateElasticsearchEntry()
{
$job = (new UpdateSearchIndexForEntity($this))->onQueue(Config::get('ponyfm.indexing_queue'));
$job = (new UpdateSearchIndexForEntity($this))->onQueue(config('ponyfm.indexing_queue'));
$this->dispatch($job);
}