Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Asnxthaony committed Dec 1, 2022
1 parent de778f1 commit 934ccfe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
5 changes: 2 additions & 3 deletions plugins/insane-profile-cache/src/Commands/Clean.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace InsaneProfileCache\Commands;

use File;
use Illuminate\Console\Command;

class Clean extends Command
Expand All @@ -14,8 +13,8 @@ class Clean extends Command
public function handle()
{
$dir = storage_path('insane-profile-cache');
if (File::exists($dir)) {
File::deleteDirectory(storage_path('insane-profile-cache'));
if (\File::exists($dir)) {
\File::deleteDirectory(storage_path('insane-profile-cache'));
}

$this->info('Cache deleted.');
Expand Down
9 changes: 4 additions & 5 deletions plugins/insane-profile-cache/src/Commands/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace InsaneProfileCache\Commands;

use App\Models\Player;
use File;
use Illuminate\Console\Command;

class Generate extends Command
Expand All @@ -15,8 +14,8 @@ class Generate extends Command
public function handle()
{
$dir = storage_path('insane-profile-cache');
if (File::missing($dir)) {
File::makeDirectory($dir);
if (\File::missing($dir)) {
\File::makeDirectory($dir);
}

$players = Player::all();
Expand All @@ -25,8 +24,8 @@ public function handle()
$players->each(function ($player) use ($dir, $bar) {
$cachePath = storage_path('insane-profile-cache/'.$player->name.'.json');

if (File::dirname($cachePath) === $dir) {
File::put($cachePath, $player->toJson());
if (\File::dirname($cachePath) === $dir) {
\File::put($cachePath, $player->toJson());
}

$bar->advance();
Expand Down
8 changes: 3 additions & 5 deletions plugins/insane-profile-cache/src/Listener/DeleteFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

namespace InsaneProfileCache\Listener;

use File;

class DeleteFileCache
{
public function handle($event)
{
$dir = storage_path('insane-profile-cache');
if (File::missing($dir)) {
if (\File::missing($dir)) {
return;
}

$cachePath = storage_path('insane-profile-cache/'.$event->playerName.'.json');

if (File::dirname($cachePath) === $dir) {
File::delete($cachePath);
if (\File::dirname($cachePath) === $dir) {
\File::delete($cachePath);
}
}
}
10 changes: 4 additions & 6 deletions plugins/insane-profile-cache/src/Listener/UpdateFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

namespace InsaneProfileCache\Listener;

use File;

class UpdateFileCache
{
public function handle($event)
{
$dir = storage_path('insane-profile-cache');
if (File::missing($dir)) {
File::makeDirectory($dir);
if (\File::missing($dir)) {
\File::makeDirectory($dir);
}

$player = $event->player;
$cachePath = storage_path('insane-profile-cache/'.$player->name.'.json');

if (File::dirname($cachePath) === $dir) {
File::put($cachePath, $player->toJson());
if (\File::dirname($cachePath) === $dir) {
\File::put($cachePath, $player->toJson());
}
}
}

0 comments on commit 934ccfe

Please sign in to comment.