Skip to content

Commit

Permalink
Upgrade version (#721)
Browse files Browse the repository at this point in the history
* migrate files to Laravel 8.0.1, includes change in route description
* move models to App/Models/ as pre defined in the new version of Laravel
* sync Lychee-front, fix links in head.blade.php
  • Loading branch information
ildyria authored Sep 17, 2020
1 parent f7a379c commit dd979ab
Show file tree
Hide file tree
Showing 168 changed files with 2,192 additions and 1,772 deletions.
2 changes: 1 addition & 1 deletion app/Assets/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Assets;

use App\Configs;
use App\Exceptions\DivideByZeroException;
use App\Models\Configs;
use Illuminate\Support\Facades\File;
use WhichBrowser\Parser as BrowserParser;

Expand Down
24 changes: 3 additions & 21 deletions app/Console/Commands/DecodeGpsLocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace App\Console\Commands;

use App\Metadata\Extractor;
use App\Metadata\Geodecoder;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Photo;
use Illuminate\Console\Command;

class DecodeGpsLocations extends Command
Expand All @@ -24,29 +22,14 @@ class DecodeGpsLocations extends Command
*/
protected $description = 'Decodes the GPS location data and adds street, city, country, etc. to the tags';

/**
* @var PhotoFunctions
*/
private $photoFunctions;

/**
* @var Extractor
*/
private $metadataExtractor;

/**
* Create a new command instance.
*
* @param PhotoFunctions $photoFunctions
*
* @return void
*/
public function __construct(PhotoFunctions $photoFunctions, Extractor $metadataExtractor)
public function __construct()
{
parent::__construct();

$this->photoFunctions = $photoFunctions;
$this->metadataExtractor = $metadataExtractor;
}

/**
Expand All @@ -57,8 +40,7 @@ public function __construct(PhotoFunctions $photoFunctions, Extractor $metadataE
public function handle()
{
$photos = Photo::whereNotNull('latitude')->whereNotNull('longitude')->whereNull('location')
->get()
;
->get();

if (count($photos) == 0) {
$this->line('No photos or videos require processing.');
Expand Down
44 changes: 2 additions & 42 deletions app/Console/Commands/Diagnostics.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,11 @@
namespace App\Console\Commands;

use App\Console\Commands\Utilities\Colorize;
use App\ControllerFunctions\Update\Check as CheckUpdate;
use App\Http\Controllers\DiagnosticsController;
use App\Metadata\DiskUsage;
use App\Metadata\LycheeVersion;
use App\ModelFunctions\ConfigFunctions;
use App\ModelFunctions\SessionFunctions;
use Illuminate\Console\Command;

class Diagnostics extends Command
{
/**
* @var ConfigFunctions
*/
private $configFunctions;

/**
* @var LycheeVersion
*/
private $lycheeVersion;

/**
* @var SessionFunctions
*/
private $sessionFunctions;

/**
* @var DiskUsage
*/
private $diskUsage;

/**
* @var CheckUpdate
*/
private $checkUpdate;

/**
* Add color to the command line output.
*
Expand Down Expand Up @@ -65,20 +35,10 @@ class Diagnostics extends Command
* @return void
*/
public function __construct(
ConfigFunctions $configFunctions,
LycheeVersion $lycheeVersion,
SessionFunctions $sessionFunctions,
DiskUsage $diskUsage,
CheckUpdate $checkUpdate,
Colorize $colorize
) {
parent::__construct();

$this->configFunctions = $configFunctions;
$this->lycheeVersion = $lycheeVersion;
$this->sessionFunctions = $sessionFunctions;
$this->diskUsage = $diskUsage;
$this->checkUpdate = $checkUpdate;
$this->col = $colorize;
}

Expand All @@ -104,7 +64,7 @@ private function block(string $str, array $array)
*/
public function handle()
{
$ctrl = new DiagnosticsController($this->configFunctions, $this->lycheeVersion, $this->sessionFunctions, $this->diskUsage, $this->checkUpdate);
$ctrl = resolve(DiagnosticsController::class);

$this->line('');
$this->line('');
Expand All @@ -114,4 +74,4 @@ public function handle()
$this->line('');
$this->block('Config Information', $ctrl->get_config());
}
}
}
2 changes: 1 addition & 1 deletion app/Console/Commands/ExifLens.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use App\Metadata\Extractor;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Photo;
use Illuminate\Console\Command;
use Storage;

Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/GenerateThumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Console\Commands;

use App\Configs;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Configs;
use App\Models\Photo;
use Illuminate\Console\Command;

class GenerateThumbs extends Command
Expand Down Expand Up @@ -109,8 +109,8 @@ public function handle()
$photo,
$type,
$maxWidth,
$maxHeight)
) {
$maxHeight
)) {
$photo->save();
$this->line(' ' . $type . ' (' . $photo->{$type} . ') for ' . $photo->title . ' created.');
} else {
Expand Down
13 changes: 3 additions & 10 deletions app/Console/Commands/Ghostbuster.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
namespace App\Console\Commands;

use App\Console\Commands\Utilities\Colorize;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Photo;
use Illuminate\Console\Command;
use Storage;

class Ghostbuster extends Command
{
/**
* @var PhotoFunctions
*/
private $photoFunctions;

/**
* Add color to the command line output.
*
Expand All @@ -39,15 +33,14 @@ class Ghostbuster extends Command
/**
* Create a new command instance.
*
* @param PhotoFunctions $photoFunctions
* @param Colorize $colorize
*
* @return void
*/
public function __construct(PhotoFunctions $photoFunctions, Colorize $colorize)
public function __construct(Colorize $colorize)
{
parent::__construct();

$this->photoFunctions = $photoFunctions;
$this->col = $colorize;
}

Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/ResetAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Console\Commands;

use App\Configs;
use App\Console\Commands\Utilities\Colorize;
use App\Models\Configs;
use Illuminate\Console\Command;

class ResetAdmin extends Command
Expand Down Expand Up @@ -51,4 +51,4 @@ public function handle()
Configs::where('key', '=', 'username')->orWhere('key', '=', 'password')->update(['value' => '']);
$this->line($this->col->yellow('Admin username and password reset.'));
}
}
}
4 changes: 2 additions & 2 deletions app/Console/Commands/ShowLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Console\Commands;

use App\Console\Commands\Utilities\Colorize;
use App\Logs;
use App\Models\Logs;
use Illuminate\Console\Command;

class ShowLogs extends Command
Expand Down Expand Up @@ -101,4 +101,4 @@ private function color_type($type)
return $type;
}
}
}
}
30 changes: 2 additions & 28 deletions app/Console/Commands/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace App\Console\Commands;

use App\Http\Controllers\ImportController;
use App\ModelFunctions\AlbumFunctions;
use App\ModelFunctions\PhotoFunctions;
use App\ModelFunctions\SessionFunctions;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Session;
Expand All @@ -26,37 +23,14 @@ class Sync extends Command
*/
protected $description = 'Sync a directory to lychee';

/**
* @var AlbumFunctions
*/
private $albumFunctions;

/**
* @var PhotoFunctions
*/
private $photoFunctions;

/**
* @var SessionFunctions
*/
private $sessionFunctions;

/**
* Create a new command instance.
*
* @param PhotoFunctions $photoFunctions
* @param AlbumFunctions $albumFunctions
* @param SessionFunctions $sessionFunctions
*
* @return void
*/
public function __construct(PhotoFunctions $photoFunctions, AlbumFunctions $albumFunctions, SessionFunctions $sessionFunctions)
public function __construct()
{
parent::__construct();

$this->photoFunctions = $photoFunctions;
$this->albumFunctions = $albumFunctions;
$this->sessionFunctions = $sessionFunctions;
}

/**
Expand All @@ -73,7 +47,7 @@ public function handle()
$resync_metadata = $this->option('resync_metadata');
$delete_imported = false; // we want to sync -> do not delete imported files
$force_skip_duplicates = true;
$import_controller = new ImportController($this->photoFunctions, $this->albumFunctions, $this->sessionFunctions);
$import_controller = resolve(ImportController::class);

// Enable CLI formatting of status
$import_controller->enableCLIStatus();
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Takedate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Metadata\Extractor;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Photo;
use Illuminate\Console\Command;
use Storage;

Expand Down
7 changes: 3 additions & 4 deletions app/Console/Commands/VideoData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Console\Commands;

use App\Logs;
use App\Metadata\Extractor;
use App\ModelFunctions\PhotoFunctions;
use App\Photo;
use App\Models\Logs;
use App\Models\Photo;
use Illuminate\Console\Command;
use Storage;

Expand Down Expand Up @@ -70,8 +70,7 @@ public function handle()
$photos = Photo::where('type', 'like', 'video/%')
->where('width', '=', 0)
->take($this->argument('count'))
->get()
;
->get();

if (count($photos) == 0) {
$this->line('No videos require processing');
Expand Down
3 changes: 1 addition & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
// $schedule->command('inspire')->hourly();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/ControllerFunctions/Diagnostics/ConfigSanityCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\ControllerFunctions\Diagnostics;

use App\Configs;
use App\ModelFunctions\ConfigFunctions;
use App\Models\Configs;

class ConfigSanityCheck implements DiagnosticCheckInterface
{
Expand Down
2 changes: 1 addition & 1 deletion app/ControllerFunctions/Diagnostics/ImageOptCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\ControllerFunctions\Diagnostics;

use App\Configs;
use App\Models\Configs;
use Spatie\ImageOptimizer\Optimizers\Cwebp;
use Spatie\ImageOptimizer\Optimizers\Gifsicle;
use Spatie\ImageOptimizer\Optimizers\Jpegoptim;
Expand Down
2 changes: 1 addition & 1 deletion app/ControllerFunctions/Diagnostics/IniSettingsCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\ControllerFunctions\Diagnostics;

use App\Configs;
use App\Models\Configs;

class IniSettingsCheck implements DiagnosticCheckInterface
{
Expand Down
7 changes: 3 additions & 4 deletions app/ControllerFunctions/ReadAccessFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace App\ControllerFunctions;

use App\Album;
use App\Configs;
use App\Exceptions\AlbumDoesNotExistsException;
use App\ModelFunctions\SessionFunctions;
use App\Photo;
use App\User;
use App\Models\Album;
use App\Models\Configs;
use App\Models\Photo;

class ReadAccessFunctions
{
Expand Down
Loading

0 comments on commit dd979ab

Please sign in to comment.