Skip to content

Commit

Permalink
Merge pull request #26 from ipkpjersi/develop
Browse files Browse the repository at this point in the history
Upgraded to Laravel 11 plus extra fixes
  • Loading branch information
ipkpjersi authored Jun 30, 2024
2 parents dcd98f5 + c9390d2 commit e016000
Show file tree
Hide file tree
Showing 3,640 changed files with 60,897 additions and 75,225 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 14 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_TIMEZONE=UTC
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Expand All @@ -15,12 +24,15 @@ DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
BROADCAST_CONNECTION=log
CACHE_STORE=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

MEMCACHED_HOST=127.0.0.1

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
## 🚀 Getting Started

### Prerequisites:
- PHP >= 8.1
- PHP >= 8.2
- Composer
- Node.js & npm
- A MySQL database
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/AppBackupRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\ConsoleOutput;

class AppBackupRunCommand extends Command
{
protected $signature = 'app:backup:run';

protected $description = 'Alias for backup:run command. This is the recommended backup command.';

public function handle()
public function handle(): void
{
$this->info('Running backup:run command via app:backup:run...');
Artisan::call('backup:run', [], new ConsoleOutput);
Expand Down
8 changes: 3 additions & 5 deletions app/Console/Commands/BackupDatabase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace App\Console\Commands;

use App\Services\DatabaseBackupService;
Expand All @@ -22,11 +23,8 @@ class BackupDatabase extends Command

/**
* Execute the console command.
*
* @param DatabaseBackupService $backupService
* @return void
*/
public function handle(DatabaseBackupService $backupService)
public function handle(DatabaseBackupService $backupService): void
{
$this->info('Starting database backup...');

Expand All @@ -37,7 +35,7 @@ public function handle(DatabaseBackupService $backupService)
$backupPath = $backupService->backupDatabase($logger);

if ($backupPath) {
$this->info("Database backed up successfully.");
$this->info('Database backed up successfully.');
} else {
$this->error('Failed to back up the database.');
}
Expand Down
5 changes: 1 addition & 4 deletions app/Console/Commands/CheckForDuplicateAnime.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ class CheckForDuplicateAnime extends Command

/**
* Execute the console command.
*
* @param DuplicateAnimeService $duplicateAnimeService
* @return void
*/
public function handle(DuplicateAnimeService $duplicateAnimeService)
public function handle(DuplicateAnimeService $duplicateAnimeService): void
{
$this->info('Starting the process of checking for duplicate anime entries.');

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

namespace App\Console\Commands;

use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class ClearAnimeDescriptions extends Command
{
Expand All @@ -23,20 +23,18 @@ class ClearAnimeDescriptions extends Command

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->info("Starting to clear all anime descriptions...");
$this->info('Starting to clear all anime descriptions...');

try {
// Clear all anime descriptions and api empty flag so all can be downloaded again
DB::table('anime')->update(['description' => null, 'api_descriptions_empty' => false]);

$this->info("All anime descriptions have been cleared.");
$this->info('All anime descriptions have been cleared.');
} catch (\Exception $e) {
$this->error('An error occurred: ' . $e);
$this->error('An error occurred: '.$e);
}
}
}
12 changes: 5 additions & 7 deletions app/Console/Commands/ClearAnimeGenres.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Console\Commands;

use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class ClearAnimeGenres extends Command
{
Expand All @@ -23,20 +23,18 @@ class ClearAnimeGenres extends Command

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->info("Starting to clear all anime genres...");
$this->info('Starting to clear all anime genres...');

try {
// Clear all anime genres and api empty flag so all can be downloaded again
DB::table('anime')->update(['genres' => null, 'api_descriptions_empty' => false]);

$this->info("All anime genres have been cleared.");
$this->info('All anime genres have been cleared.');
} catch (\Exception $e) {
$this->error('An error occurred: ' . $e);
$this->error('An error occurred: '.$e);
}
}
}
22 changes: 11 additions & 11 deletions app/Console/Commands/ClearAnimeImageDownloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace App\Console\Commands;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class ClearAnimeImageDownloads extends Command
{
protected $signature = 'app:clear-anime-image-downloads {deleteFiles=false : Whether to delete the actual files (true/false)}';

protected $description = 'Clears the anime image download flags, optionally deleting the files.';

public function handle()
public function handle(): void
{
$this->info("Starting to clear all anime image download flags...");
$this->info('Starting to clear all anime image download flags...');

$deleteFiles = $this->argument('deleteFiles') === 'true';

Expand All @@ -28,16 +28,16 @@ public function handle()
'picture/file',
'thumbnail/images/anime',
'thumbnail/anime',
'thumbnail/file'
'thumbnail/file',
];
foreach ($folders as $folder) {
$dir = public_path($folder);
if (is_dir($dir)) {
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
$files = new \RecursiveIteratorIterator($it,
\RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
\RecursiveIteratorIterator::CHILD_FIRST);
foreach ($files as $file) {
if ($file->isDir()) {
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());
Expand All @@ -46,12 +46,12 @@ public function handle()
rmdir($dir);
}
}
$this->info("The actual image files have been deleted.");
$this->info('The actual image files have been deleted.');
}

$this->info("All anime image download flags have been cleared.");
$this->info('All anime image download flags have been cleared.');
} catch (\Exception $e) {
$this->error('An error occurred: ' . $e);
$this->error('An error occurred: '.$e);
}
}
}
18 changes: 8 additions & 10 deletions app/Console/Commands/ClearAnimeImageFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;

Expand All @@ -25,29 +24,27 @@ class ClearAnimeImageFiles extends Command

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->info("Starting to clear image files...");
$this->info('Starting to clear image files...');

$folders = [
public_path('picture'),
public_path('thumbnail')
public_path('thumbnail'),
];

foreach ($folders as $folder) {
$this->deleteImageFiles($folder);
}

$this->info("Image files cleared.");
$this->info('Image files cleared.');
}

/**
* Deletes image files within the specified folder while retaining the folder structure.
*
* @param string $folder
* @param string $folder
* @return void
*/
private function deleteImageFiles($folder)
Expand All @@ -56,7 +53,7 @@ private function deleteImageFiles($folder)
$it = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($files as $file) {
if (!$file->isDir() && $this->isImageFile($file)) {
if (! $file->isDir() && $this->isImageFile($file)) {
unlink($file->getRealPath());
}
}
Expand All @@ -66,12 +63,13 @@ private function deleteImageFiles($folder)
/**
* Checks if a file is an image file based on its extension.
*
* @param \SplFileInfo $file
* @param \SplFileInfo $file
* @return bool
*/
private function isImageFile($file)
{
$imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff'];

return in_array(strtolower($file->getExtension()), $imageExtensions);
}
}
16 changes: 7 additions & 9 deletions app/Console/Commands/ClearAnimeImageZipFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,27 @@ class ClearAnimeImageZipFiles extends Command

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->info("Starting to clear image zip files...");
$this->info('Starting to clear image zip files...');

$folders = [
public_path('picture'),
public_path('thumbnail')
public_path('thumbnail'),
];

foreach ($folders as $folder) {
$this->deleteZipFiles($folder);
}

$this->info("Image zip files cleared.");
$this->info('Image zip files cleared.');
}

/**
* Deletes zip files within the specified folder while retaining the folder structure.
*
* @param string $folder
* @param string $folder
* @return void
*/
private function deleteZipFiles($folder)
Expand All @@ -55,7 +53,7 @@ private function deleteZipFiles($folder)
$it = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($files as $file) {
if (!$file->isDir() && $this->isZipFile($file)) {
if (! $file->isDir() && $this->isZipFile($file)) {
unlink($file->getRealPath());
}
}
Expand All @@ -65,7 +63,7 @@ private function deleteZipFiles($folder)
/**
* Checks if a file is a zip file based on its extension.
*
* @param \SplFileInfo $file
* @param \SplFileInfo $file
* @return bool
*/
private function isZipFile($file)
Expand Down
12 changes: 5 additions & 7 deletions app/Console/Commands/ClearApiDescriptionsEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Console\Commands;

use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class ClearApiDescriptionsEmpty extends Command
{
Expand All @@ -23,20 +23,18 @@ class ClearApiDescriptionsEmpty extends Command

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->info("Starting to clear all anime API descriptions empty flags...");
$this->info('Starting to clear all anime API descriptions empty flags...');

try {
// Clear all anime genres and api empty flag so all can be downloaded again
DB::table('anime')->update(['api_descriptions_empty' => false]);

$this->info("All anime API descriptions empty flags have been cleared.");
$this->info('All anime API descriptions empty flags have been cleared.');
} catch (\Exception $e) {
$this->error('An error occurred: ' . $e);
$this->error('An error occurred: '.$e);
}
}
}
Loading

0 comments on commit e016000

Please sign in to comment.