Merge pull request #3788 from HDInnovations/Commands

(Update) Commands
This commit is contained in:
HDVinnie
2024-05-06 16:08:59 -04:00
committed by GitHub
52 changed files with 244 additions and 765 deletions
-1
View File
@@ -15,7 +15,6 @@ DB_PORT=3306
DB_DATABASE=unit3d
DB_USERNAME=root
DB_PASSWORD=
#PRISTINE_DB_FILE=/home/vagrant/code/database/unit3d_test.sql
BROADCAST_CONNECTION=redis
CACHE_STORE=redis
@@ -22,10 +22,8 @@ use App\Rules\EmailBlacklist;
use App\Services\Unit3dAnnounce;
use Illuminate\Console\Command;
use Exception;
use Throwable;
/**
* @see \Tests\Todo\Unit\Console\Commands\AutoBanDisposableUsersTest
*/
class AutoBanDisposableUsers extends Command
{
/**
@@ -45,9 +43,9 @@ class AutoBanDisposableUsers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$bannedGroup = cache()->rememberForever('banned_group', fn () => Group::where('slug', '=', 'banned')->pluck('id'));
@@ -18,6 +18,7 @@ use App\Models\Tv;
use Illuminate\Console\Command;
use Exception;
use Illuminate\Support\Facades\Redis;
use Throwable;
class AutoCacheRandomMediaIds extends Command
{
@@ -38,9 +39,9 @@ class AutoCacheRandomMediaIds extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$movieIds = Movie::query()
->select('id')
@@ -55,11 +56,9 @@ class AutoCacheRandomMediaIds extends Command
->pluck('id');
$cacheKey = config('cache.prefix').':random-media-movie-ids';
Redis::connection('cache')->command('SADD', [$cacheKey, ...$movieIds]);
$cacheKey = config('cache.prefix').':random-media-tv-ids';
Redis::connection('cache')->command('SADD', [$cacheKey, ...$tvIds]);
$this->comment($movieIds->count().' movie ids and '.$tvIds->count().' tv ids cached.');
@@ -16,6 +16,7 @@ namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Exception;
use Throwable;
class AutoCacheUserLeechCounts extends Command
{
@@ -36,9 +37,9 @@ class AutoCacheUserLeechCounts extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$peerCounts = User::withoutGlobalScopes()
->selectRaw("CONCAT('user-leeching-count:', id) as cacheKey")
+3 -5
View File
@@ -18,10 +18,8 @@ use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Exception;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoCorrectHistoryTest
*/
class AutoCorrectHistory extends Command
{
/**
@@ -41,9 +39,9 @@ class AutoCorrectHistory extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
History::select(['id', 'active', 'updated_at'])
->where('active', '=', 1)
@@ -18,12 +18,11 @@ use App\Notifications\UserManualWarningExpire;
use App\Notifications\UserWarningExpire;
use App\Services\Unit3dAnnounce;
use Carbon\Carbon;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoDeactivateWarningTest
*/
class AutoDeactivateWarning extends Command
{
/**
@@ -42,8 +41,10 @@ class AutoDeactivateWarning extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$warnings = Warning::with(['warneduser', 'torrenttitle'])
@@ -13,9 +13,10 @@
namespace App\Console\Commands;
use App\Models\Peer;
use Illuminate\Console\Command;
use Exception;
use Illuminate\Support\Facades\DB;
use Throwable;
class AutoDeleteStoppedPeers extends Command
{
@@ -36,11 +37,16 @@ class AutoDeleteStoppedPeers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
Peer::where('active', '=', 0)->where('updated_at', '>', now()->subHours(2))->delete();
DB::transaction(static function (): void {
DB::table('peers')
->where('active', '=', 0)
->where('updated_at', '>', now()->subHours(2))
->delete();
}, 5);
$this->comment('Automated delete stopped peers command complete');
}
@@ -20,10 +20,8 @@ use App\Services\Unit3dAnnounce;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoDisableInactiveUsersTest
*/
class AutoDisableInactiveUsers extends Command
{
/**
@@ -43,9 +41,9 @@ class AutoDisableInactiveUsers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
if (config('pruning.user_pruning')) {
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
+3 -5
View File
@@ -19,10 +19,8 @@ use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Exception;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoFlushPeersTest
*/
class AutoFlushPeers extends Command
{
/**
@@ -42,9 +40,9 @@ class AutoFlushPeers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$carbon = new Carbon();
$peers = Peer::select(['id', 'torrent_id', 'user_id', 'seeder', 'updated_at'])
+5 -4
View File
@@ -17,13 +17,12 @@ use App\Enums\UserGroup;
use App\Models\Group;
use App\Models\User;
use App\Services\Unit3dAnnounce;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoGroupTest
*/
class AutoGroup extends Command
{
/**
@@ -42,8 +41,10 @@ class AutoGroup extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$now = now();
$current = Carbon::now();
+5 -4
View File
@@ -17,12 +17,11 @@ use App\Models\Peer;
use App\Models\Scopes\ApprovedScope;
use App\Models\Seedbox;
use App\Models\Torrent;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoHighspeedTagTest
*/
class AutoHighspeedTag extends Command
{
/**
@@ -41,8 +40,10 @@ class AutoHighspeedTag extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$seedboxIps = Seedbox::all()
->pluck('ip')
+20 -22
View File
@@ -13,18 +13,12 @@
namespace App\Console\Commands;
use App\Models\Ban;
use App\Models\Peer;
use App\Models\Torrent;
use App\Models\User;
use App\Models\Warning;
use App\Repositories\ChatRepository;
use Illuminate\Console\Command;
use Exception;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Todo\Unit\Console\Commands\AutoNerdStatTest
*/
class AutoNerdStat extends Command
{
/**
@@ -52,11 +46,13 @@ class AutoNerdStat extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
// Check if the nerd bot is enabled in the configuration.
if (config('chat.nerd_bot')) {
// Define the possible stats.
$stats = collect([
'birthday',
'logins',
@@ -73,27 +69,29 @@ class AutoNerdStat extends Command
'king',
])->random();
// Generate the message based on the selected stat.
$message = match ($stats) {
'birthday' => config('other.title').' Birthday Is [b]'.config('other.birthdate').'[/b]!',
'logins' => 'In The Last 24 Hours [color=#93c47d][b]'.User::whereNotNull('last_login')->where('last_login', '>', now()->subDay())->count().'[/b][/color] Unique Users Have Logged Into '.config('other.title').'!',
'uploads' => 'In The Last 24 Hours [color=#93c47d][b]'.Torrent::where('created_at', '>', now()->subDay())->count().'[/b][/color] Torrents Have Been Uploaded To '.config('other.title').'!',
'users' => 'In The Last 24 Hours [color=#93c47d][b]'.User::where('created_at', '>', now()->subDay())->count().'[/b][/color] Users Have Registered To '.config('other.title').'!',
'fl25' => 'There Are Currently [color=#93c47d][b]'.Torrent::where('free', '=', 25)->count().'[/b][/color] 25% Freeleech Torrents On '.config('other.title').'!',
'fl50' => 'There Are Currently [color=#93c47d][b]'.Torrent::where('free', '=', 50)->count().'[/b][/color] 50% Freeleech Torrents On '.config('other.title').'!',
'fl75' => 'There Are Currently [color=#93c47d][b]'.Torrent::where('free', '=', 75)->count().'[/b][/color] 75% Freeleech Torrents On '.config('other.title').'!',
'fl100' => 'There Are Currently [color=#93c47d][b]'.Torrent::where('free', '=', 100)->count().'[/b][/color] 100% Freeleech Torrents On '.config('other.title').'!',
'du' => 'There Are Currently [color=#93c47d][b]'.Torrent::where('doubleup', '=', 1)->count().'[/b][/color] Double Upload Torrents On '.config('other.title').'!',
'peers' => 'Currently There Are [color=#93c47d][b]'.Peer::where('active', '=', 1)->count().'[/b][/color] Peers On '.config('other.title').'!',
'bans' => 'In The Last 24 Hours [color=#dd7e6b][b]'.Ban::whereNull('unban_reason')->whereNull('removed_at')->where('created_at', '>', now()->subDay())->count().'[/b][/color] Users Have Been Banned From '.config('other.title').'!',
'warnings' => 'In The Last 24 Hours [color=#dd7e6b][b]'.Warning::where('created_at', '>', now()->subDay())->count().'[/b][/color] Hit and Run Warnings Have Been Issued On '.config('other.title').'!',
'logins' => 'In The Last 24 Hours [color=#93c47d][b]'.DB::table('users')->whereNotNull('last_login')->where('last_login', '>', now()->subDay())->count().'[/b][/color] Unique Users Have Logged Into '.config('other.title').'!',
'uploads' => 'In The Last 24 Hours [color=#93c47d][b]'.DB::table('torrents')->where('created_at', '>', now()->subDay())->count().'[/b][/color] Torrents Have Been Uploaded To '.config('other.title').'!',
'users' => 'In The Last 24 Hours [color=#93c47d][b]'.DB::table('users')->where('created_at', '>', now()->subDay())->count().'[/b][/color] Users Have Registered To '.config('other.title').'!',
'fl25' => 'There Are Currently [color=#93c47d][b]'.DB::table('torrents')->where('free', '=', 25)->count().'[/b][/color] 25% Freeleech Torrents On '.config('other.title').'!',
'fl50' => 'There Are Currently [color=#93c47d][b]'.DB::table('torrents')->where('free', '=', 50)->count().'[/b][/color] 50% Freeleech Torrents On '.config('other.title').'!',
'fl75' => 'There Are Currently [color=#93c47d][b]'.DB::table('torrents')->where('free', '=', 75)->count().'[/b][/color] 75% Freeleech Torrents On '.config('other.title').'!',
'fl100' => 'There Are Currently [color=#93c47d][b]'.DB::table('torrents')->where('free', '=', 100)->count().'[/b][/color] 100% Freeleech Torrents On '.config('other.title').'!',
'du' => 'There Are Currently [color=#93c47d][b]'.DB::table('torrents')->where('doubleup', '=', 1)->count().'[/b][/color] Double Upload Torrents On '.config('other.title').'!',
'peers' => 'Currently There Are [color=#93c47d][b]'.DB::table('peers')->where('active', '=', 1)->count().'[/b][/color] Peers On '.config('other.title').'!',
'bans' => 'In The Last 24 Hours [color=#dd7e6b][b]'.DB::table('bans')->whereNull('unban_reason')->whereNull('removed_at')->where('created_at', '>', now()->subDay())->count().'[/b][/color] Users Have Been Banned From '.config('other.title').'!',
'warnings' => 'In The Last 24 Hours [color=#dd7e6b][b]'.DB::table('warnings')->where('created_at', '>', now()->subDay())->count().'[/b][/color] Hit and Run Warnings Have Been Issued On '.config('other.title').'!',
'king' => config('other.title').' Is King!',
default => 'Nerd Stat Error!',
};
// Auto Shout Nerd Stat
// Post the message to the chatbox.
$this->chatRepository->systemMessage($message);
}
// Output a success message to the console.
$this->comment('Automated Nerd Stat Command Complete');
}
}
+3 -5
View File
@@ -19,10 +19,8 @@ use App\Notifications\UserPreWarning;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoPreWarningTest
*/
class AutoPreWarning extends Command
{
/**
@@ -42,9 +40,9 @@ class AutoPreWarning extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
if (config('hitrun.enabled') === true) {
$carbon = new Carbon();
+5 -4
View File
@@ -14,12 +14,11 @@
namespace App\Console\Commands;
use App\Models\Audit;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRecycleAuditsTest
*/
class AutoRecycleAudits extends Command
{
/**
@@ -38,8 +37,10 @@ class AutoRecycleAudits extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$audits = Audit::where('created_at', '<', $current->copy()->subDays(config('audit.recycle'))->toDateTimeString())->get();
@@ -19,10 +19,8 @@ use App\Repositories\ChatRepository;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRecycleClaimedTorrentRequestsTest
*/
class AutoRecycleClaimedTorrentRequests extends Command
{
/**
@@ -50,9 +48,9 @@ class AutoRecycleClaimedTorrentRequests extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$torrentRequests = TorrentRequest::where('claimed', '=', 1)
@@ -14,12 +14,11 @@
namespace App\Console\Commands;
use App\Models\FailedLoginAttempt;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRecycleFailedLoginsTest
*/
class AutoRecycleFailedLogins extends Command
{
/**
@@ -38,8 +37,10 @@ class AutoRecycleFailedLogins extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$failedLogins = FailedLoginAttempt::where('created_at', '<', $current->copy()->subDays(30)->toDateTimeString())->get();
+5 -4
View File
@@ -14,12 +14,11 @@
namespace App\Console\Commands;
use App\Models\Invite;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRecycleInvitesTest
*/
class AutoRecycleInvites extends Command
{
/**
@@ -38,8 +37,10 @@ class AutoRecycleInvites extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$invites = Invite::whereNull('accepted_by')->whereNull('accepted_at')->where('expires_on', '<', $current)->get();
+5 -1
View File
@@ -14,9 +14,11 @@
namespace App\Console\Commands;
use App\Models\History;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Throwable;
class AutoRefundDownload extends Command
{
@@ -36,8 +38,10 @@ class AutoRefundDownload extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$now = Carbon::now();
$MIN_SEEDTIME = config('hitrun.seedtime');
@@ -17,12 +17,11 @@ use App\Models\FeaturedTorrent;
use App\Models\Torrent;
use App\Repositories\ChatRepository;
use App\Services\Unit3dAnnounce;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRemoveFeaturedTorrentTest
*/
class AutoRemoveFeaturedTorrent extends Command
{
/**
@@ -49,8 +48,10 @@ class AutoRemoveFeaturedTorrent extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$featuredTorrents = FeaturedTorrent::where('created_at', '<', $current->copy()->subDays(7)->toDateTimeString())->get();
@@ -17,12 +17,11 @@ use App\Models\PersonalFreeleech;
use App\Models\PrivateMessage;
use App\Models\User;
use App\Services\Unit3dAnnounce;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRemovePersonalFreeleechTest
*/
class AutoRemovePersonalFreeleech extends Command
{
/**
@@ -41,8 +40,10 @@ class AutoRemovePersonalFreeleech extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$current = Carbon::now();
$personalFreeleech = PersonalFreeleech::where('created_at', '<', $current->copy()->subDays(1)->toDateTimeString())->get();
@@ -15,12 +15,11 @@ namespace App\Console\Commands;
use App\Models\Torrent;
use App\Services\Unit3dAnnounce;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoRemoveTimedTorrentBuffs
*/
class AutoRemoveTimedTorrentBuffs extends Command
{
/**
@@ -39,8 +38,10 @@ class AutoRemoveTimedTorrentBuffs extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$flTorrents = Torrent::whereNotNull('fl_until')->where('fl_until', '<', Carbon::now()->toDateTimeString())->get();
@@ -14,7 +14,9 @@
namespace App\Console\Commands;
use App\Models\User;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class AutoResetUserFlushes extends Command
{
@@ -34,8 +36,10 @@ class AutoResetUserFlushes extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
// Updates own_flushes for each user
User::where('own_flushes', '<', '2')->update(['own_flushes' => '2']);
@@ -20,16 +20,15 @@ use App\Models\Torrent;
use App\Models\User;
use App\Repositories\ChatRepository;
use App\Services\Unit3dAnnounce;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoGraveyardTest
*/
class AutoRewardResurrection extends Command
{
/**
* AutoRewardResurrection's Constructor.
* AutoRewardResurrection Constructor.
*/
public function __construct(private readonly ChatRepository $chatRepository)
{
@@ -52,8 +51,10 @@ class AutoRewardResurrection extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
foreach (Resurrection::where('rewarded', '!=', 1)->oldest()->get() as $resurrection) {
$user = User::find($resurrection->user_id);
@@ -33,10 +33,8 @@ use App\Models\User;
use App\Services\Unit3dAnnounce;
use Illuminate\Console\Command;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoSoftDeleteDisabledUsersTest
*/
class AutoSoftDeleteDisabledUsers extends Command
{
/**
@@ -56,9 +54,9 @@ class AutoSoftDeleteDisabledUsers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
if (config('pruning.user_pruning')) {
$disabledGroup = cache()->rememberForever('disabled_group', fn () => Group::where('slug', '=', 'disabled')->pluck('id'));
+5 -1
View File
@@ -14,8 +14,10 @@
namespace App\Console\Commands;
use App\Models\Peer;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Throwable;
class AutoStatsClients extends Command
{
@@ -35,8 +37,10 @@ class AutoStatsClients extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$clients = Peer::selectRaw('agent, count(*) as count')
->fromSub(
+19 -14
View File
@@ -13,9 +13,10 @@
namespace App\Console\Commands;
use App\Models\Torrent;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Throwable;
class AutoTorrentBalance extends Command
{
@@ -35,21 +36,25 @@ class AutoTorrentBalance extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
Torrent::joinSub(
DB::table('history')
->select('torrent_id')
->selectRaw('SUM(actual_uploaded) - SUM(actual_downloaded) AS balance')
->groupBy('torrent_id'),
'balances',
fn ($join) => $join->on('balances.torrent_id', '=', 'torrents.id')
)
->update([
'torrents.balance' => DB::raw('balances.balance'),
'updated_at' => DB::raw('updated_at'),
]);
DB::transaction(static function (): void {
DB::table('torrents')->joinSub(
DB::table('history')
->select('torrent_id')
->selectRaw('SUM(actual_uploaded) - SUM(actual_downloaded) AS balance')
->groupBy('torrent_id'),
'balances',
static fn ($join) => $join->on('balances.torrent_id', '=', 'torrents.id')
)
->update([
'torrents.balance' => DB::raw('balances.balance'),
'updated_at' => DB::raw('updated_at'),
]);
}, 5);
$this->comment('Torrent balance calculations completed.');
}
@@ -13,10 +13,11 @@
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Exception;
use Throwable;
class AutoUpdateUserLastActions extends Command
{
@@ -37,18 +38,24 @@ class AutoUpdateUserLastActions extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$key = config('cache.prefix').':user-last-actions:batch';
$userIdCount = Redis::command('LLEN', [$key]);
$userIds = Redis::command('LPOP', [$key, $userIdCount]);
if ($userIds !== false) {
User::whereIntegerInRaw('id', $userIds)->update([
'last_action' => now(),
]);
DB::transaction(static function () use ($userIds): void {
DB::table('users')
->whereIntegerInRaw('id', $userIds)
->update([
'last_action' => now(),
]);
}, 5);
}
$this->comment('Automated upsert histories command complete');
+3 -2
View File
@@ -18,6 +18,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Exception;
use Throwable;
class AutoUpsertAnnounces extends Command
{
@@ -38,9 +39,9 @@ class AutoUpsertAnnounces extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
/**
* MySql can handle a max of 65535 placeholders per query,
+3 -2
View File
@@ -18,6 +18,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Exception;
use Throwable;
class AutoUpsertHistories extends Command
{
@@ -38,9 +39,9 @@ class AutoUpsertHistories extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
/**
* MySql can handle a max of 65535 placeholders per query,
+3 -5
View File
@@ -18,10 +18,8 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoFlushPeersTest
*/
class AutoUpsertPeers extends Command
{
/**
@@ -41,9 +39,9 @@ class AutoUpsertPeers extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
/**
* MySql can handle a max of 65k placeholders per query,
+3 -5
View File
@@ -22,10 +22,8 @@ use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Exception;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\AutoWarningTest
*/
class AutoWarning extends Command
{
/**
@@ -45,9 +43,9 @@ class AutoWarning extends Command
/**
* Execute the console command.
*
* @throws Exception
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
if (config('hitrun.enabled') === true) {
$carbon = new Carbon();
@@ -14,7 +14,9 @@
namespace App\Console\Commands;
use App\Models\Ticket;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class CheckForStaleTickets extends Command
{
@@ -34,8 +36,10 @@ class CheckForStaleTickets extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
Ticket::checkForStaleTickets();
}
+5 -4
View File
@@ -13,11 +13,10 @@
namespace App\Console\Commands;
use Exception;
use Illuminate\Console\Command;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\ClearCacheTest
*/
class ClearCache extends Command
{
/**
@@ -36,8 +35,10 @@ class ClearCache extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->comment("Clearing several common cache's ...");
$this->call('view:clear');
-74
View File
@@ -1,74 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Console\Commands;
use Illuminate\Console\Command;
class DbDump extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'db:dump';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Dumps the contents of the database to disk in a format suitable for import with db:load';
/**
* Execute the console command.
*/
public function handle(): void
{
$outfile = config('database.pristine-db-file');
$host = config('database.connections.mysql.host');
$db = config('database.connections.mysql.database');
$user = config('database.connections.mysql.username');
$password = config('database.connections.mysql.password');
if (!$outfile) {
$this->error('The dump file location is not set in the configuration. If you\'ve tried to set it, you may need to call "php artisan cache:clear" and/or specify the environment when calling Artisan, e.g., "php artisan --env=testing db:dump".');
return;
}
// Necessary to avoid warning about supplying password on CLI.
putenv(sprintf('MYSQL_PWD=%s', $password));
$cmd = sprintf(
'mysqldump --user=%s --databases %s --add-drop-database --add-drop-table --default-character-set=utf8mb4 --skip-extended-insert --host=%s --quick --quote-names --routines --set-charset --single-transaction --triggers --tz-utc %s> %s;',
escapeshellarg((string) $user),
escapeshellarg((string) $db),
escapeshellarg((string) $host),
$this->option('verbose') ? '--verbose ' : '',
escapeshellarg((string) $outfile)
);
$return = null;
$output = null;
exec($cmd, $output, $return);
if ($return !== 0) {
$this->error(sprintf('Could not dump database to file %s', $outfile));
}
}
}
-67
View File
@@ -1,67 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Console\Commands;
use Illuminate\Console\Command;
use RuntimeException;
use Exception;
class DbLoad extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'db:load';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Loads a pristine copy of the database (useful for testing locally)';
/**
* Execute the console command.
*
* @throws Exception
*/
public function handle(): void
{
$input = config('database.pristine-db-file');
$db = config('database.connections.mysql.database');
$user = config('database.connections.mysql.username');
$password = config('database.connections.mysql.password');
// Necessary to avoid warning about supplying password on CLI.
putenv(sprintf('MYSQL_PWD=%s', $password));
$cmd = sprintf(
'mysql -u %s %s < %s',
escapeshellarg((string) $user),
escapeshellarg((string) $db),
escapeshellarg((string) $input)
);
$return = null;
$output = null;
exec($cmd, $output, $return);
throw_if($return !== 0, new RuntimeException(sprintf('Could not load database from file %s', $input)));
}
}
+6 -3
View File
@@ -20,6 +20,7 @@ use App\Services\Tmdb\Client\TV;
use App\Services\Tmdb\TMDBScraper;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class DemoSeed extends Command
{
@@ -39,8 +40,10 @@ class DemoSeed extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->alert('Demo Seeder v2.0 (Author: Poppabear)');
$this->warn('*** This process could take a few minutes ***');
@@ -473,7 +476,7 @@ Menu
}
}
private function fetchMovie($id)
private function fetchMovie($id): mixed
{
sleep(2);
$tmdbScraper = new TMDBScraper();
@@ -482,7 +485,7 @@ Menu
return (new Movie($id))->data;
}
private function fetchTv($id)
private function fetchTv($id): mixed
{
sleep(2);
$tmdbScraper = new TMDBScraper();
@@ -14,7 +14,9 @@
namespace App\Console\Commands;
use App\Helpers\EmailBlacklistUpdater;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class EmailBlacklistUpdate extends Command
{
@@ -34,8 +36,10 @@ class EmailBlacklistUpdate extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$count = EmailBlacklistUpdater::update();
+5 -1
View File
@@ -15,7 +15,9 @@ namespace App\Console\Commands;
use App\Models\Torrent;
use App\Services\Tmdb\TMDBScraper;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class FetchMeta extends Command
{
@@ -35,8 +37,10 @@ class FetchMeta extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->alert('Meta Fetcher Started');
+5 -4
View File
@@ -17,11 +17,10 @@ use App\Models\Movie;
use App\Models\Scopes\ApprovedScope;
use App\Models\Torrent;
use App\Models\Tv;
use Exception;
use Illuminate\Console\Command;
use Throwable;
/**
* @see \Tests\Todo\Unit\Console\Commands\FetchReleaseYearsTest
*/
class FetchReleaseYears extends Command
{
/**
@@ -40,8 +39,10 @@ class FetchReleaseYears extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$appurl = config('app.url');
+9 -8
View File
@@ -14,16 +14,15 @@
namespace App\Console\Commands;
use App\Console\ConsoleTools;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use RuntimeException;
use Throwable;
/**
* @see \Tests\Todo\Unit\Console\Commands\GitUpdaterTest
*/
class GitUpdater extends Command
{
use ConsoleTools;
@@ -57,8 +56,10 @@ class GitUpdater extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->input = new ArgvInput();
$this->output = new ConsoleOutput();
@@ -191,7 +192,7 @@ class GitUpdater extends Command
return $updating;
}
private function manualUpdate($updating): void
private function manualUpdate(array $updating): void
{
$this->alertInfo('Manual Update');
$this->red('Updating will cause you to LOSE any changes you might have made to the file!');
@@ -205,7 +206,7 @@ class GitUpdater extends Command
$this->done();
}
private function updateFile($file): void
private function updateFile(string $file): void
{
$this->process(sprintf('git checkout origin/master -- %s', $file));
}
@@ -332,14 +333,14 @@ class GitUpdater extends Command
$this->done();
}
private function validatePath($path): void
private function validatePath(string $path): void
{
if (!is_file(base_path($path)) && !is_dir(base_path($path))) {
$this->red(sprintf("The path '%s' is invalid", $path));
}
}
private function createBackupPath($path): void
private function createBackupPath(string $path): void
{
if (!is_dir(storage_path(sprintf('gitupdate/%s', $path))) && !is_file(base_path($path))) {
if (!mkdir($concurrentDirectory = storage_path(sprintf('gitupdate/%s', $path)), 0775, true) && !is_dir($concurrentDirectory)) {
+5 -1
View File
@@ -14,8 +14,10 @@
namespace App\Console\Commands;
use App\Bots\IRCAnnounceBot;
use Exception;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Throwable;
class IrcMessage extends Command
{
@@ -35,8 +37,10 @@ class IrcMessage extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->info('Messaging '.$this->argument('channel').': '.$this->argument('message'));
+5 -4
View File
@@ -13,11 +13,10 @@
namespace App\Console\Commands;
use Exception;
use Illuminate\Console\Command;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\SetCacheTest
*/
class SetCache extends Command
{
/**
@@ -36,8 +35,10 @@ class SetCache extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$this->comment("Setting several common cache's ...");
$this->call('view:cache');
+3 -5
View File
@@ -16,13 +16,11 @@ namespace App\Console\Commands;
use App\Models\Peer;
use App\Models\Scopes\ApprovedScope;
use App\Models\Torrent;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Throwable;
/**
* @see \Tests\Unit\Console\Commands\SyncPeersTest
*/
class SyncPeers extends Command
{
/**
@@ -42,9 +40,9 @@ class SyncPeers extends Command
/**
* Execute the console command.
*
* @throws Throwable
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
DB::transaction(function (): void {
Torrent::withoutGlobalScope(ApprovedScope::class)
@@ -15,7 +15,9 @@ namespace App\Console\Commands;
use App\Models\Scopes\ApprovedScope;
use App\Models\Torrent;
use Exception;
use Illuminate\Console\Command;
use Throwable;
class SyncTorrentSeasonEpisode extends Command
{
@@ -35,8 +37,10 @@ class SyncTorrentSeasonEpisode extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
foreach (Torrent::withoutGlobalScope(ApprovedScope::class)->with(['category'])->whereNull('season_number')->orWhereNull('episode_number')->get() as $torrent) {
// Skip if not TV
+4 -4
View File
@@ -17,10 +17,8 @@ use App\Mail\TestEmail;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Exception;
use Throwable;
/**
* @see \Tests\Todo\Unit\Console\Commands\TestMailSettingsTest
*/
class TestMailSettings extends Command
{
/**
@@ -39,8 +37,10 @@ class TestMailSettings extends Command
/**
* Execute the console command.
*
* @throws Exception|Throwable If there is an error during the execution of the command.
*/
public function handle(): void
final public function handle(): void
{
$owner = config('other.email');
-208
View File
@@ -1,208 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Console\Commands;
use FilesystemIterator;
use Illuminate\Console\Command;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
/**
* @see \Tests\Todo\Unit\Console\Commands\VendorCleanupTest
*/
class VendorCleanup extends Command
{
protected $signature = 'vendor:cleanup {--check : Runs in dry mode without deleting files.}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Cleans up useless files from vendor folder.';
protected array $patterns =
[
'test',
'tests',
'.github',
'README',
'CHANGELOG',
'FAQ',
'CONTRIBUTING',
'HISTORY',
'UPGRADING',
'UPGRADE',
'demo',
'example',
'examples',
'.doc',
'readme',
'changelog',
'composer',
'.git',
'.gitignore',
'*.md',
'.*.yml',
'*.yml',
'*.txt',
'*.dist',
'LICENSE',
'AUTHORS',
'.eslintrc',
'ChangeLog',
'.editorconfig',
'*.xml',
'.npmignore',
'.jshintrc',
'Makefile',
'.keep',
];
/**
* List of File and Folders Patters Going To Be Excluded.
*/
protected array $excluded =
[
/*List of Folders*/
'src',
/*List of Files*/
'*.php',
'*.stub',
'*.js',
'*.json',
'.gitignore',
];
/**
* Execute the console command.
*/
public function handle(): void
{
$patterns = array_diff($this->patterns, $this->excluded);
$directories = $this->expandDirectoryTree(base_path('vendor'));
$isDry = $this->option('check');
foreach ($directories as $directory) {
foreach ($patterns as $pattern) {
$casePattern = preg_replace_callback('#([a-z])#i', fn ($matches) => $this->prepareWord($matches), (string) $pattern);
$files = glob($directory.'/'.$casePattern, GLOB_BRACE);
if (!$files) {
continue;
}
$files = array_diff($files, $this->excluded);
foreach ($this->excluded as $excluded) {
$key = $this->arrayFind($excluded, $files);
if ($key !== false) {
$this->out('SKIPPED: '.$files[$key]);
unset($files[$key]);
}
}
foreach ($files as $file) {
if (is_dir($file)) {
$this->out('DELETING DIR: '.$file);
if (!$isDry) {
$this->delTree($file);
}
} else {
$this->out('DELETING FILE: '.$file);
if (!$isDry) {
@unlink($file);
}
}
}
}
}
$this->out('Vendor Cleanup Done!');
}
/**
* Recursively traverses the directory tree.
*/
protected function expandDirectoryTree(string $dir): array
{
$directories = [];
foreach (array_diff(scandir($dir), ['.', '..']) as $file) {
$directory = $dir.'/'.$file;
if (is_dir($directory)) {
$directories[] = $directory;
$directories = array_merge($directories, $this->expandDirectoryTree($directory));
}
}
return $directories;
}
/**
* Recursively deletes the directory.
*/
protected function delTree(string $dir)
{
if (!file_exists($dir) || !is_dir($dir)) {
return false;
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($iterator as $filename => $fileInfo) {
if ($fileInfo->isDir()) {
@rmdir($filename);
} else {
@unlink($filename);
}
}
@rmdir($dir);
}
/**
* Prepare word.
*/
protected function prepareWord(array $matches): string
{
return '['.strtolower((string) $matches[1]).strtoupper((string) $matches[1]).']';
}
protected function arrayFind($needle, array $haystack): int|string|bool
{
foreach ($haystack as $key => $value) {
if (false !== stripos((string) $value, (string) $needle)) {
return $key;
}
}
return false;
}
protected function out($message): void
{
echo $message.PHP_EOL;
}
}
+14 -19
View File
@@ -20,37 +20,34 @@ use Symfony\Component\Process\Process;
trait ConsoleTools
{
/**
* @var SymfonyStyle
*/
protected $io;
protected SymfonyStyle $io;
private function cyan($line): void
private function cyan(string $line): void
{
$this->io->writeln(sprintf('<fg=cyan>%s</>', $line));
}
private function white($line): void
private function white(string $line): void
{
$this->io->writeln(PHP_EOL.$line);
}
private function magenta($line): void
private function magenta(string $line): void
{
$this->io->writeln(sprintf('<fg=magenta>%s</>', $line));
}
private function green($line): void
private function green(string $line): void
{
$this->io->writeln(sprintf('<fg=green>%s</>', $line));
}
private function red($line): void
private function red(string $line): void
{
$this->io->writeln(sprintf('<fg=red>%s</>', $line));
}
private function blue($line): void
private function blue(string $line): void
{
$this->io->writeln(sprintf('<fg=blue>%s</>', $line));
}
@@ -60,34 +57,34 @@ trait ConsoleTools
$this->green('<fg=white>[</>Done<fg=white>]</>');
}
private function header($line): void
private function header(string $line): void
{
$this->blue(str_repeat('=', 50));
$this->io->write($line);
$this->blue(str_repeat('=', 50));
}
private function alertSuccess($line): void
private function alertSuccess(string $line): void
{
$this->io->writeln(sprintf('<fg=white>[</><fg=green> !! %s !! </><fg=white>]</>', $line));
}
private function alertDanger($line): void
private function alertDanger(string $line): void
{
$this->io->writeln(sprintf('<fg=white>[</><fg=red> !! %s !! </><fg=white>]</>', $line));
}
private function alertInfo($line): void
private function alertInfo(string $line): void
{
$this->io->writeln(sprintf('<fg=white>[</><fg=cyan> !! %s !! </><fg=white>]</>', $line));
}
private function alertWarning($line): void
private function alertWarning(string $line): void
{
$this->io->writeln(sprintf('<fg=white>[</><fg=yellow> !! %s !! </><fg=white>]</>', $line));
}
private function commands(array $commands, $silent = false): void
private function commands(array $commands, bool $silent = false): void
{
foreach ($commands as $command) {
$process = $this->process($command, $silent);
@@ -99,7 +96,7 @@ trait ConsoleTools
}
}
private function process($command, $silent = false): Process
private function process(string $command, bool $silent = false): Process
{
if (!$silent) {
$this->cyan($command);
@@ -132,7 +129,6 @@ trait ConsoleTools
if (!$process->isSuccessful()) {
$this->red($process->getErrorOutput());
//die();
}
return $process;
@@ -144,7 +140,6 @@ trait ConsoleTools
$bar->setBarCharacter('<fg=magenta>=</>');
$bar->setFormat('[%bar%] (<fg=cyan>%message%</>)');
$bar->setMessage('Please Wait ...');
//$bar->setRedrawFrequency(20); todo: may be useful for platforms like CentOS
$bar->start();
return $bar;
-2
View File
@@ -186,6 +186,4 @@ return [
'read_write_timeout' => -1,
],
],
'pristine-db-file' => env('PRISTINE_DB_FILE'),
];
+1 -141
View File
@@ -35,21 +35,11 @@ parameters:
count: 1
path: app/Console/Commands/AutoRemoveFeaturedTorrent.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\DemoSeed\\:\\:fetchMovie\\(\\) has no return type specified\\.$#"
count: 1
path: app/Console/Commands/DemoSeed.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\DemoSeed\\:\\:fetchMovie\\(\\) has parameter \\$id with no type specified\\.$#"
count: 1
path: app/Console/Commands/DemoSeed.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\DemoSeed\\:\\:fetchTv\\(\\) has no return type specified\\.$#"
count: 1
path: app/Console/Commands/DemoSeed.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\DemoSeed\\:\\:fetchTv\\(\\) has parameter \\$id with no type specified\\.$#"
count: 1
@@ -70,36 +60,11 @@ parameters:
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:alertDanger\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:alertInfo\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:alertSuccess\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:alertWarning\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:backup\\(\\) has parameter \\$paths with no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:blue\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:checkForUpdates\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
@@ -111,37 +76,7 @@ parameters:
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:commands\\(\\) has parameter \\$silent with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:createBackupPath\\(\\) has parameter \\$path with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:cyan\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:green\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:header\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:magenta\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:manualUpdate\\(\\) has parameter \\$updating with no type specified\\.$#"
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:manualUpdate\\(\\) has parameter \\$updating with no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
@@ -150,41 +85,11 @@ parameters:
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:process\\(\\) has parameter \\$command with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:process\\(\\) has parameter \\$silent with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:red\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:restore\\(\\) has parameter \\$paths with no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:updateFile\\(\\) has parameter \\$file with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:validatePath\\(\\) has parameter \\$path with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\GitUpdater\\:\\:white\\(\\) has parameter \\$line with no type specified\\.$#"
count: 1
path: app/Console/Commands/GitUpdater.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(string\\)\\: bool\\)\\|null, 'strlen' given\\.$#"
count: 2
@@ -200,51 +105,6 @@ parameters:
count: 1
path: app/Console/Commands/IrcMessage.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:arrayFind\\(\\) has parameter \\$haystack with no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:arrayFind\\(\\) has parameter \\$needle with no type specified\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:delTree\\(\\) has no return type specified\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:expandDirectoryTree\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:out\\(\\) has parameter \\$message with no type specified\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:prepareWord\\(\\) has parameter \\$matches with no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Parameter \\#1 \\$array of function array_diff expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Property App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:\\$excluded type has no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Property App\\\\Console\\\\Commands\\\\VendorCleanup\\:\\:\\$patterns type has no value type specified in iterable type array\\.$#"
count: 1
path: app/Console/Commands/VendorCleanup.php
-
message: "#^Method App\\\\Events\\\\Chatter\\:\\:__construct\\(\\) has parameter \\$payload with no type specified\\.$#"
count: 1
@@ -1,23 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
/**
* @see App\Console\Commands\DbDump
*/
it('runs successfully', function (): void {
$this->artisan('db:dump')
->assertExitCode(0)
->run();
// TODO: perform additional assertions to ensure the command behaved as expected
});
@@ -1,23 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
/**
* @see App\Console\Commands\DbLoad
*/
it('runs successfully', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$this->artisan('db:load')
->assertExitCode(0)
->run();
});
@@ -1,25 +0,0 @@
<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
/**
* @see App\Console\Commands\VendorCleanup
*/
it('runs successfully', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$this->artisan('vendor:cleanup')
->assertExitCode(0)
->run();
// TODO: perform additional assertions to ensure the command behaved as expected
});