Files
newznab-tmux-NNTmux/app/Services/Tmux/Scripts/groupfixrelnames.php
T
2026-08-04 08:49:07 +02:00

51 lines
1.5 KiB
PHP

#!/usr/bin/env php
<?php
/**
* Group Fix Release Names - Utility Script
*
* This script is called from multiprocessing to fix release names using various methods.
*
* Modernized version - now delegates to Artisan command
* Original location: misc/update/tmux/bin/groupfixrelnames.php
* New location: app/Services/Tmux/Scripts/groupfixrelnames.php
*/
if (! isset($argv[1])) {
fwrite(STDERR, "This script is not intended to be run manually, it is called from Multiprocessing.\n");
exit(1);
}
// Parse arguments: "type guidChar maxPerRun worker workers"
[$type, $guidChar, $maxPerRun, $thread, $workers] = array_pad(explode(' ', $argv[1]), 5, '1');
// Build artisan command based on type
$artisan = dirname(__DIR__, 4).'/artisan';
switch ($type) {
case 'standard':
if ($guidChar === '' || $maxPerRun === '' || ! is_numeric($maxPerRun)) {
fwrite(STDERR, "Invalid arguments for standard type\n");
exit(1);
}
$command = "php {$artisan} releases:fix-names-group standard --guid-char={$guidChar} --limit={$maxPerRun}";
break;
case 'predbft':
if (! is_numeric($maxPerRun) || ! is_numeric($thread)) {
fwrite(STDERR, "Invalid arguments for predbft type\n");
exit(1);
}
$command = "php {$artisan} releases:fix-names-group predbft --limit={$maxPerRun} --thread={$thread} --workers={$workers}";
break;
default:
fwrite(STDERR, "Unknown type: {$type}\n");
exit(1);
}
// Execute the command
passthru($command, $exitCode);
exit($exitCode);