diff --git a/Blacklight/Backfill.php b/Blacklight/Backfill.php
index 941cc2ee2..9b3cf363b 100755
--- a/Blacklight/Backfill.php
+++ b/Blacklight/Backfill.php
@@ -123,7 +123,7 @@ class Backfill
);
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::header($dMessage), true);
+ ColorCLI::header($dMessage);
}
if ($articles !== '' && ! is_numeric($articles)) {
@@ -136,7 +136,7 @@ class Backfill
$dMessage = 'Starting group '.$counter.' of '.$groupCount;
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::header($dMessage), true);
+ ColorCLI::header($dMessage);
}
}
$this->backfillGroup($groupArr, $groupCount - $counter, $articles);
@@ -146,13 +146,13 @@ class Backfill
$dMessage = 'Backfilling completed in '.number_format(microtime(true) - $allTime, 2).' seconds.';
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary($dMessage), true);
+ ColorCLI::primary($dMessage);
}
} else {
$dMessage = 'No groups specified. Ensure groups are added to database for updating.';
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::warning($dMessage), true);
+ ColorCLI::warning($dMessage);
}
}
}
@@ -165,7 +165,7 @@ class Backfill
* @param int|string $articles
*
* @return void
- * @throws \Exception
+ * @throws \Throwable
*/
public function backfillGroup($groupArr, $left, $articles = ''): void
{
@@ -184,7 +184,7 @@ class Backfill
'. Otherwise the group is dead, you must disable it.';
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::error($dMessage), true);
+ ColorCLI::error($dMessage);
}
return;
@@ -200,7 +200,7 @@ class Backfill
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary('Processing '.$groupName), true);
+ ColorCLI::primary('Processing '.$groupName);
}
// Check if this is days or post backfill.
@@ -233,28 +233,26 @@ class Backfill
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::notice($dMessage), true);
+ ColorCLI::notice($dMessage);
}
return;
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Group '.
$groupName.
"'s oldest article is ".
number_format($data['first']).
', newest is '.
number_format($data['last']).
- ".\nOur target article is ".
+ '.Our target article is '.
number_format($targetpost).
'. Our oldest article is article '.
number_format($groupArr['first_record']).
'.'
- ), true
- );
+ );
}
// Set first and last, moving the window by max messages.
@@ -270,8 +268,7 @@ class Backfill
$done = false;
while ($done === false) {
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- color('Getting '.
+ ColorCLI::header('Getting '.
number_format($last - $first + 1).
' articles from '.
$groupName.
@@ -279,7 +276,7 @@ class Backfill
$left.
' group(s) left. ('.
number_format($first - $targetpost).
- ' articles in queue')->fg('yellow'), true);
+ ' articles in queue');
}
flush();
@@ -318,17 +315,14 @@ class Backfill
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.
'Group '.
$groupName.
' processed in '.
number_format(microtime(true) - $startGroup, 2).
' seconds.'
- ),
- true
- );
+ );
}
}
diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php
index 05765f550..6b4e6fdb8 100755
--- a/Blacklight/Binaries.php
+++ b/Blacklight/Binaries.php
@@ -346,14 +346,14 @@ class Binaries
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary('Processing '.$groupMySQL['name']), true);
+ ColorCLI::primary('Processing '.$groupMySQL['name']);
}
// Attempt to repair any missing parts before grabbing new ones.
if ((int) $groupMySQL['last_record'] !== 0) {
if ($this->_partRepair) {
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary('Part repair enabled. Checking for missing parts.'), true);
+ ColorCLI::primary('Part repair enabled. Checking for missing parts.');
}
$this->partRepair($groupMySQL);
@@ -363,7 +363,7 @@ class Binaries
$this->partRepair($groupMySQL, $tableNames);
}
} elseif ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary('Part repair disabled by user.'), true);
+ ColorCLI::primary('Part repair disabled by user.');
}
}
@@ -431,8 +431,7 @@ class Binaries
// If total is bigger than 0 it means we have new parts in the newsgroup.
if ($total > 0) {
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
(
(int) $groupMySQL['last_record'] === 0
? 'New group '.$groupNNTP['group'].' starting with '.
@@ -447,9 +446,7 @@ class Binaries
" for next pass.\nServer oldest: ".number_format($groupNNTP['first']).
' Server newest: '.number_format($groupNNTP['last']).
' Local newest: '.number_format($groupMySQL['last_record'])
- ),
- true
- );
+ );
}
$done = false;
@@ -468,13 +465,11 @@ class Binaries
$first++;
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::header(
+ ColorCLI::header(
PHP_EOL.'Getting '.number_format($last - $first + 1).' articles ('.number_format($first).
' to '.number_format($last).') from '.$groupMySQL['name'].' - ('.
number_format($groupLast - $last).' articles in queue).'
- )
- );
+ );
}
// Get article headers from newsgroup.
@@ -539,24 +534,18 @@ class Binaries
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.'Group '.$groupMySQL['name'].' processed in '.
number_format(microtime(true) - $startGroup, 2).' seconds.'
- ),
- true
- );
+ );
}
} elseif ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'No new articles for '.$groupMySQL['name'].' (first '.number_format($first).
', last '.number_format($last).', grouplast '.number_format($groupMySQL['last_record']).
', total '.number_format($total).")\n".'Server oldest: '.number_format($groupNNTP['first']).
' Server newest: '.number_format($groupNNTP['last']).' Local newest: '.number_format($groupMySQL['last_record'])
- ),
- true
- );
+ );
}
}
@@ -782,13 +771,10 @@ class Binaries
$this->addMissingParts($rangeNotReceived, $this->tableNames['prname'], $this->groupMySQL['id']);
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::alternate(
+ ColorCLI::alternate(
'Server did not return '.$notReceivedCount.
' articles from '.$this->groupMySQL['name'].'.'
- ),
- true
- );
+ );
}
}
unset($rangeNotReceived);
@@ -1022,14 +1008,11 @@ class Binaries
*/
protected function outputHeaderInitial(): void
{
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Received '.\count($this->headersReceived).
' articles of '.number_format($this->last - $this->first + 1).' requested, '.
$this->headersBlackListed.' blacklisted, '.$this->notYEnc.' not yEnc.'
- ),
- true
- );
+ );
}
/**
@@ -1039,8 +1022,7 @@ class Binaries
{
$currentMicroTime = microtime(true);
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::alternateOver($this->timeHeaders.'s').
+ ColorCLI::alternateOver($this->timeHeaders.'s').
ColorCLI::primaryOver(' to download articles, ').
ColorCLI::alternateOver($this->timeCleaning.'s').
ColorCLI::primaryOver(' to process collections, ').
@@ -1049,9 +1031,7 @@ class Binaries
ColorCLI::alternateOver(number_format($currentMicroTime - $this->startPR, 2).'s').
ColorCLI::primaryOver(' for part repair, ').
ColorCLI::alternateOver(number_format($currentMicroTime - $this->startLoop, 2).'s').
- ColorCLI::primary(' total.'),
- true
- );
+ ColorCLI::primary(' total.');
}
}
@@ -1106,7 +1086,7 @@ class Binaries
DB::commit();
}
if ($e->getMessage() === 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction') {
- ColorCLI::doEcho(ColorCLI::notice('Deadlock occurred'));
+ ColorCLI::notice('Deadlock occurred');
DB::rollBack();
}
}
@@ -1114,14 +1094,11 @@ class Binaries
$missingCount = \count($missingParts);
if ($missingCount > 0) {
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Attempting to repair '.
number_format($missingCount).
' parts.'
- ),
- true
- );
+ );
}
// Loop through each part to group into continuous ranges with a maximum range of messagebuffer/4.
@@ -1199,14 +1176,11 @@ class Binaries
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.
number_format($partsRepaired).
' parts repaired.'
- ),
- true
- );
+ );
}
}
@@ -1334,12 +1308,9 @@ class Binaries
}
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Searching for an approximate article number for group '.$data['group'].' '.$days.' days back.'
- ),
- true
- );
+ );
}
// Pick the middle to start with
@@ -1395,13 +1366,10 @@ class Binaries
$wantedArticle = (int) $wantedArticle;
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime).
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime)).'days.'
- ),
- true
- );
+ );
}
return $wantedArticle;
@@ -1655,10 +1623,7 @@ class Binaries
private function log($message, $method, $color): void
{
if ($this->_echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::$color($message.' ['.__CLASS__."::$method]"),
- true
- );
+ ColorCLI::$color($message.' ['.__CLASS__."::$method]");
}
}
@@ -1714,11 +1679,11 @@ class Binaries
try {
return DB::insert($query);
} catch (QueryException $e) {
- ColorCLI::doEcho(ColorCLI::debug('Query error occurred.'), true);
+ ColorCLI::debug('Query error occurred.');
} catch (\PDOException $e) {
- ColorCLI::doEcho(ColorCLI::debug('Query error occurred.'), true);
+ ColorCLI::debug('Query error occurred.');
} catch (\Throwable $e) {
- ColorCLI::doEcho(ColorCLI::debug('Query error occurred.'), true);
+ ColorCLI::debug('Query error occurred.');
}
return false;
diff --git a/Blacklight/Books.php b/Blacklight/Books.php
index 458480f8a..2f66f0a61 100755
--- a/Blacklight/Books.php
+++ b/Blacklight/Books.php
@@ -349,12 +349,12 @@ class Books
}
if (isset($response->Items->Item->ItemAttributes->Title)) {
- ColorCLI::doEcho(ColorCLI::info('Found matching title: '.$response->Items->Item->ItemAttributes->Title), true);
+ ColorCLI::info('Found matching title: '.$response->Items->Item->ItemAttributes->Title);
return $response;
}
- ColorCLI::doEcho(ColorCLI::notice('Could not find a match on Amazon!'), true);
+ ColorCLI::notice('Could not find a match on Amazon!');
return false;
}
@@ -399,7 +399,7 @@ class Books
{
if ($res->count() > 0) {
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header("\nProcessing ".$res->count().' book release(s) for categories id '.$categoryID), true);
+ ColorCLI::header("\nProcessing ".$res->count().' book release(s) for categories id '.$categoryID);
}
$bookId = -2;
@@ -417,7 +417,7 @@ class Books
if ($bookInfo !== false) {
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($bookInfo), true);
+ ColorCLI::headerOver('Looking up: ').ColorCLI::primary($bookInfo);
}
// Do a local lookup first
@@ -426,7 +426,7 @@ class Books
if ($bookCheck === null && \in_array($bookInfo, $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
+ ColorCLI::headerOver('Cached previous failure. Skipping.');
}
$bookId = -2;
} elseif ($bookCheck === null) {
@@ -454,7 +454,7 @@ class Books
}
}
} elseif ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header('No book releases to process for categories id '.$categoryID), true);
+ ColorCLI::header('No book releases to process for categories id '.$categoryID);
}
}
@@ -481,10 +481,7 @@ class Books
if ($releasetype === 'ebook') {
if (preg_match('/^([a-z0-9] )+$|ArtofUsenet|ekiosk|(ebook|mobi).+collection|erotica|Full Video|ImwithJamie|linkoff org|Mega.+pack|^[a-z0-9]+ (?!((January|February|March|April|May|June|July|August|September|O([ck])tober|November|De([cz])ember)))[a-z]+( (ebooks?|The))?$|NY Times|(Book|Massive) Dump|Sexual/i', $releasename)) {
if ($this->echooutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Changing category to misc books: ').ColorCLI::primary($releasename),
- true
- );
+ ColorCLI::headerOver('Changing category to misc books: ').ColorCLI::primary($releasename);
}
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_UNKNOWN]);
@@ -493,10 +490,7 @@ class Books
if (preg_match('/^([a-z0-9ΓΌ!]+ ){1,2}(N|Vol)?\d{1,4}([abc])?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun([ e$])|Jul([ y$])|Aug( |ust|$)|Sep( |tember|$)|O([ck])t( |ober|$)|Nov( |ember|$)|De([cz])( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) {
if ($this->echooutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Changing category to magazines: ').ColorCLI::primary($releasename),
- true
- );
+ ColorCLI::headerOver('Changing category to magazines: ').ColorCLI::primary($releasename);
}
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_MAGAZINES]);
@@ -536,7 +530,7 @@ class Books
$amaz = false;
if ($bookInfo !== '') {
- ColorCLI::doEcho(ColorCLI::info('Fetching data from Amazon for '.$bookInfo), true);
+ ColorCLI::info('Fetching data from Amazon for '.$bookInfo);
$amaz = $this->fetchAmazonProperties($bookInfo);
} elseif ($amazdata !== null) {
@@ -654,27 +648,22 @@ class Books
if ($bookId && $bookId !== -2) {
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header('Added/updated book: '), true);
+ ColorCLI::header('Added/updated book: ');
if ($book['author'] !== '') {
- ColorCLI::doEcho(ColorCLI::alternateOver(' Author: ').ColorCLI::primary($book['author']), true);
+ ColorCLI::alternateOver(' Author: ').ColorCLI::primary($book['author']);
}
- echo ColorCLI::alternateOver(' Title: ').ColorCLI::primary(' '.$book['title']);
+ ColorCLI::alternateOver(' Title: ').ColorCLI::primary(' '.$book['title']);
if ($book['genre'] !== 'null') {
- ColorCLI::doEcho(ColorCLI::alternateOver(' Genre: ').ColorCLI::primary(' '.$book['genre']), true);
+ ColorCLI::alternateOver(' Genre: ').ColorCLI::primary(' '.$book['genre']);
}
}
$book['cover'] = $ri->saveImage($bookId, $book['coverurl'], $this->imgSavePath, 250, 250);
- } else {
- if ($this->echooutput) {
- ColorCLI::doEcho(
- ColorCLI::header('Nothing to update: ').
- ColorCLI::header($book['author'].
- ' - '.
- $book['title']),
- true
- );
- }
+ } elseif ($this->echooutput) {
+ ColorCLI::header('Nothing to update: ').
+ ColorCLI::header($book['author'].
+ ' - '.
+ $book['title']);
}
return $bookId;
diff --git a/Blacklight/ColorCLI.php b/Blacklight/ColorCLI.php
index b01542bfe..c8a0a720c 100755
--- a/Blacklight/ColorCLI.php
+++ b/Blacklight/ColorCLI.php
@@ -2,135 +2,119 @@
namespace Blacklight;
+use League\CLImate\CLImate;
+
class ColorCLI
{
/**
- * @param $str
- *
- * @return string
+ * @return \League\CLImate\CLImate
*/
- public static function debug($str)
+ protected static function climate()
{
- return color('Debug: '.$str)->light_gray().PHP_EOL;
+ return new CLImate();
}
/**
* @param $str
- * @return string
*/
- public static function info($str): string
+ public static function debug($str): void
{
- return color('Info: '.$str)->fg('magenta');
+ self::climate()->lightGray()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function notice($str): string
+ public static function info($str): void
{
- return color('Notice: '.$str)->blue();
+ self::climate()->magenta()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function warning($str): string
+ public static function notice($str): void
{
- return color('Warning: '.$str)->fg('yellow');
+ self::climate()->blue()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function error($str): string
+ public static function warning($str): void
{
- return color('Error: '.$str)->fg('red');
+ self::climate()->yellow()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function primary($str): string
+ public static function error($str): void
{
- return color($str)->green().PHP_EOL;
+ self::climate()->red()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function header($str): string
+ public static function primary($str): void
{
- return color($str)->yellow().PHP_EOL;
+ self::climate()->green()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function alternate($str): string
+ public static function header($str): void
{
- return color($str)->magenta()->dark()->bold().PHP_EOL;
+ self::climate()->yellow()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function tmuxOrange($str): string
+ public static function alternate($str): void
{
- return color($str)->yellow()->dark().PHP_EOL;
+ self::climate()->magenta()->bold()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function primaryOver($str): string
+ public static function tmuxOrange($str): void
{
- return color($str)->green();
+ self::climate()->yellow()->bold()->out($str);
}
/**
* @param $str
- * @return string
*/
- public static function headerOver($str): string
+ public static function primaryOver($str): void
{
- return color($str)->yellow();
+ self::climate()->green()->inline($str);
}
/**
* @param $str
- * @return string
*/
- public static function alternateOver($str): string
+ public static function headerOver($str): void
{
- return color($str)->magenta()->dark();
+ self::climate()->yellow()->inline($str);
}
/**
* @param $str
- * @return string
*/
- public static function warningOver($str): string
+ public static function alternateOver($str): void
{
- return color($str)->red();
+ self::climate()->magenta()->bold()->inline($str);
}
/**
- * Echo message to CLI.
- *
- * @param string $message The message.
- * @param bool $nl Add a new line?
- * @void
+ * @param $str
*/
- public static function doEcho($message, $nl = false): void
+ public static function warningOver($str): void
{
- echo $message.($nl ? PHP_EOL : '');
+ self::climate()->red()->inline($str);
}
}
diff --git a/Blacklight/Console.php b/Blacklight/Console.php
index a442275ec..3494ecc9f 100755
--- a/Blacklight/Console.php
+++ b/Blacklight/Console.php
@@ -392,16 +392,13 @@ class Console
$consoleId = $this->_updateConsoleTable($con);
if ($this->echooutput && $consoleId !== -2) {
- ColorCLI::doEcho(
- ColorCLI::header('Added/updated game: ').
+ ColorCLI::header('Added/updated game: ').
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($con['title']).
ColorCLI::alternateOver(' Platform: ').
ColorCLI::primary($con['platform']).
ColorCLI::alternateOver(' Genre: ').
- ColorCLI::primary($con['consolegenre']),
- true
- );
+ ColorCLI::primary($con['consolegenre']);
}
}
} else {
@@ -416,7 +413,7 @@ class Console
$consoleId = $this->_updateConsoleTable($igdb);
if ($this->echooutput && $consoleId !== -2) {
- ColorCLI::doEcho(ColorCLI::header('Added/updated game: ').ColorCLI::alternateOver(' Title: ').ColorCLI::primary($igdb['title']).ColorCLI::alternateOver(' Platform: ').ColorCLI::primary($igdb['platform']).ColorCLI::alternateOver(' Genre: ').ColorCLI::primary($igdb['consolegenre']), true);
+ ColorCLI::header('Added/updated game: ').ColorCLI::alternateOver(' Title: ').ColorCLI::primary($igdb['title']).ColorCLI::alternateOver(' Platform: ').ColorCLI::primary($igdb['platform']).ColorCLI::alternateOver(' Genre: ').ColorCLI::primary($igdb['consolegenre']);
}
}
}
@@ -776,7 +773,7 @@ class Console
$apaiIo = new ApaiIO($conf);
- ColorCLI::doEcho(ColorCLI::info('Trying to find info on Amazon'), true);
+ ColorCLI::info('Trying to find info on Amazon');
$responses = $apaiIo->runOperation($search);
if ($responses === false) {
@@ -786,13 +783,13 @@ class Console
foreach ($responses->Items->Item as $response) {
similar_text($title, $response->ItemAttributes->Title, $percent);
if ($percent > self::MATCH_PERCENT && isset($response->ItemAttributes->Title)) {
- ColorCLI::doEcho(ColorCLI::info('Found matching info on Amazon: '.$response->ItemAttributes->Title), true);
+ ColorCLI::info('Found matching info on Amazon: '.$response->ItemAttributes->Title);
return $response;
}
}
- ColorCLI::doEcho(ColorCLI::info('Could not find match on Amazon'), true);
+ ColorCLI::info('Could not find match on Amazon');
return false;
}
@@ -885,12 +882,12 @@ class Console
return $game;
}
- ColorCLI::doEcho(ColorCLI::notice('IGDB returned no valid results'), true);
+ ColorCLI::notice('IGDB returned no valid results');
return false;
}
- ColorCLI::doEcho(ColorCLI::notice('IGDB found no valid results'), true);
+ ColorCLI::notice('IGDB found no valid results');
return false;
} catch (ClientException $e) {
@@ -917,7 +914,7 @@ class Console
$releaseCount = $res->count();
if ($res instanceof \Traversable && $releaseCount > 0) {
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header('Processing '.$releaseCount.' console release(s).'), true);
+ ColorCLI::header('Processing '.$releaseCount.' console release(s).');
}
foreach ($res as $arr) {
@@ -928,15 +925,12 @@ class Console
if ($gameInfo !== false) {
if ($this->echooutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Looking up: ').
+ ColorCLI::headerOver('Looking up: ').
ColorCLI::primary(
$gameInfo['title'].
' ('.
$gameInfo['platform'].')'
- ),
- true
- );
+ );
}
// Check for existing console entry.
@@ -945,7 +939,7 @@ class Console
if ($gameCheck === false && \in_array($gameInfo['title'].$gameInfo['platform'], $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
+ ColorCLI::headerOver('Cached previous failure. Skipping.');
}
$gameId = -2;
} elseif ($gameCheck === false) {
@@ -957,11 +951,8 @@ class Console
}
} else {
if ($this->echooutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Found Local: ').
- ColorCLI::primary("{$gameCheck['title']} - {$gameCheck['platform']}"),
- true
- );
+ ColorCLI::headerOver('Found Local: ').
+ ColorCLI::primary("{$gameCheck['title']} - {$gameCheck['platform']}");
}
$gameId = $gameCheck['id'];
}
@@ -979,22 +970,22 @@ class Console
}
}
} elseif ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header('No console releases to process.'), true);
+ ColorCLI::header('No console releases to process.');
}
}
/**
- * @param $releasename
+ * @param $releaseName
*
* @return array|false
*/
- public function parseTitle($releasename)
+ public function parseTitle($releaseName)
{
- $releasename = preg_replace('/\sMulti\d?\s/i', '', $releasename);
+ $releaseName = preg_replace('/\sMulti\d?\s/i', '', $releaseName);
$result = [];
// Get name of the game from name of release.
- if (preg_match('/^(.+((abgx360EFNet|EFNet\sFULL|FULL\sabgxEFNet|abgx\sFULL|abgxbox360EFNet)\s|illuminatenboard\sorg|Place2(hom|us)e.net|united-forums? co uk|\(\d+\)))?(?P
.*?)[\.\-_ ](v\.?\d\.\d|PAL|NTSC|EUR|USA|JP|ASIA|JAP|JPN|AUS|MULTI(\.?\d{1,2})?|PATCHED|FULLDVD|DVD5|DVD9|DVDRIP|PROPER|REPACK|RETAIL|DEMO|DISTRIBUTION|REGIONFREE|[\. ]RF[\. ]?|READ\.?NFO|NFOFIX|PSX(2PSP)?|PS[2-4]|PSP|PSVITA|WIIU|WII|X\-?BOX|XBLA|X360|3DS|NDS|N64|NGC)/i', $releasename, $matches)) {
+ if (preg_match('/^(.+((abgx360EFNet|EFNet\sFULL|FULL\sabgxEFNet|abgx\sFULL|abgxbox360EFNet)\s|illuminatenboard\sorg|Place2(hom|us)e.net|united-forums? co uk|\(\d+\)))?(?P.*?)[\.\-_ ](v\.?\d\.\d|PAL|NTSC|EUR|USA|JP|ASIA|JAP|JPN|AUS|MULTI(\.?\d{1,2})?|PATCHED|FULLDVD|DVD5|DVD9|DVDRIP|PROPER|REPACK|RETAIL|DEMO|DISTRIBUTION|REGIONFREE|[\. ]RF[\. ]?|READ\.?NFO|NFOFIX|PSX(2PSP)?|PS[2-4]|PSP|PSVITA|WIIU|WII|X\-?BOX|XBLA|X360|3DS|NDS|N64|NGC)/i', $releaseName, $matches)) {
$title = $matches['title'];
// Replace dots, underscores, or brackets with spaces.
@@ -1022,7 +1013,7 @@ class Console
}
// Get the platform of the release.
- if (preg_match('/[\.\-_ ](?PXBLA|WiiWARE|N64|SNES|NES|PS[2-4]|PS 3|PSX(2PSP)?|PSP|WIIU|WII|XBOX360|XBOXONE|X\-?BOX|X360|3DS|NDS|N?GC)/i', $releasename, $matches)) {
+ if (preg_match('/[\.\-_ ](?PXBLA|WiiWARE|N64|SNES|NES|PS[2-4]|PS 3|PSX(2PSP)?|PSP|WIIU|WII|XBOX360|XBOXONE|X\-?BOX|X360|3DS|NDS|N?GC)/i', $releaseName, $matches)) {
$platform = $matches['platform'];
if (preg_match('/^N?GC$/i', $platform)) {
@@ -1041,7 +1032,7 @@ class Console
$result['platform'] = $platform;
$result['node'] = $browseNode;
}
- $result['release'] = $releasename;
+ $result['release'] = $releaseName;
array_map('trim', $result);
/* Make sure we got a title and platform otherwise the resulting lookup will probably be shit.
diff --git a/Blacklight/ConsoleTools.php b/Blacklight/ConsoleTools.php
index 25c21d5ee..460353aa4 100755
--- a/Blacklight/ConsoleTools.php
+++ b/Blacklight/ConsoleTools.php
@@ -40,7 +40,7 @@ class ConsoleTools
echo str_repeat(\chr(8), $this->lastMessageLength);
$this->lastMessageLength = \strlen($message);
- echo ColorCLI::headerOver($message);
+ ColorCLI::headerOver($message);
}
/**
@@ -58,7 +58,7 @@ class ConsoleTools
echo str_repeat(\chr(8), $this->lastMessageLength);
$this->lastMessageLength = \strlen($message);
- echo ColorCLI::primaryOver($message);
+ ColorCLI::primaryOver($message);
}
/**
diff --git a/Blacklight/Games.php b/Blacklight/Games.php
index be204ec90..df56aa5a6 100755
--- a/Blacklight/Games.php
+++ b/Blacklight/Games.php
@@ -552,12 +552,12 @@ class Games
$game['review'] = (string) $this->_gameResults->deck;
}
} else {
- ColorCLI::doEcho(ColorCLI::notice('GiantBomb returned no valid results'), true);
+ ColorCLI::notice('GiantBomb returned no valid results');
return false;
}
} else {
- ColorCLI::doEcho(ColorCLI::notice('GiantBomb found no valid results'), true);
+ ColorCLI::notice('GiantBomb found no valid results');
return false;
}
@@ -619,12 +619,12 @@ class Games
'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown',
];
} else {
- ColorCLI::doEcho(ColorCLI::notice('IGDB returned no valid results'), true);
+ ColorCLI::notice('IGDB returned no valid results');
return false;
}
} else {
- ColorCLI::doEcho(ColorCLI::notice('IGDB found no valid results'), true);
+ ColorCLI::notice('IGDB found no valid results');
return false;
}
@@ -728,14 +728,11 @@ class Games
if (! empty($gamesId)) {
if ($this->echoOutput) {
- ColorCLI::doEcho(
- ColorCLI::header('Added/updated game: ').
+ ColorCLI::header('Added/updated game: ').
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($game['title']).
ColorCLI::alternateOver(' Source: ').
- ColorCLI::primary($this->_classUsed),
- true
- );
+ ColorCLI::primary($this->_classUsed);
}
if ($game['cover'] === 1) {
$game['cover'] = $ri->saveImage($gamesId, $game['coverurl'], $this->imgSavePath, 250, 250);
@@ -744,11 +741,8 @@ class Games
$game['backdrop'] = $ri->saveImage($gamesId.'-backdrop', $game['backdropurl'], $this->imgSavePath, 1920, 1024);
}
} elseif ($this->echoOutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Nothing to update: ').
- ColorCLI::primary($game['title'].' (PC)'),
- true
- );
+ ColorCLI::headerOver('Nothing to update: ').
+ ColorCLI::primary($game['title'].' (PC)');
}
return ! empty($gamesId) ? $gamesId : false;
@@ -776,7 +770,7 @@ class Games
if ($res->count() > 0) {
if ($this->echoOutput) {
- ColorCLI::doEcho(ColorCLI::header('Processing '.$res->count().' games release(s).'), true);
+ ColorCLI::header('Processing '.$res->count().' games release(s).');
}
foreach ($res as $arr) {
@@ -787,11 +781,8 @@ class Games
$gameInfo = $this->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
if ($this->echoOutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Looking up: ').
- ColorCLI::primary($gameInfo['title'].' (PC)'),
- true
- );
+ ColorCLI::headerOver('Looking up: ').
+ ColorCLI::primary($gameInfo['title'].' (PC)');
}
// Check for existing games entry.
@@ -822,7 +813,7 @@ class Games
}
}
} elseif ($this->echoOutput) {
- ColorCLI::doEcho(ColorCLI::header('No games releases to process.'), true);
+ ColorCLI::header('No games releases to process.');
}
}
diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php
index 31f19bf55..9e3f76341 100755
--- a/Blacklight/Movie.php
+++ b/Blacklight/Movie.php
@@ -609,7 +609,7 @@ class Movie
public function updateMovieInfo($imdbId): bool
{
if ($this->echooutput && $this->service !== '') {
- ColorCLI::doEcho(ColorCLI::primary('Fetching IMDB info from TMDB/IMDB/Trakt/OMDB using IMDB id: '.$imdbId), true);
+ ColorCLI::primary('Fetching IMDB info from TMDB/IMDB/Trakt/OMDB using IMDB id: '.$imdbId);
}
// Check TMDB for IMDB info.
@@ -731,17 +731,14 @@ class Movie
]);
if ($this->echooutput && $this->service !== '') {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Added/updated movie: ').
+ ColorCLI::headerOver('Added/updated movie: ').
ColorCLI::primary(
$mov['title'].
' ('.
$mov['year'].
') - '.
$mov['imdbid']
- ),
- true
- );
+ );
}
return (int) $movieID > 0;
@@ -782,7 +779,7 @@ class Movie
$ret['title'] = $art['name'];
}
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::alternateOver('Fanart Found ').ColorCLI::headerOver($ret['title']), true);
+ ColorCLI::alternateOver('Fanart Found ').ColorCLI::headerOver($ret['title']);
}
return $ret;
@@ -809,7 +806,7 @@ class Movie
try {
$tmdbLookup = $this->tmdbclient->getMoviesApi()->getMovie($lookupId, ['append_to_response' => 'credits']);
} catch (TmdbApiException $error) {
- ColorCLI::doEcho(ColorCLI::error($error->getMessage()), true);
+ ColorCLI::error($error->getMessage());
return false;
}
@@ -894,7 +891,7 @@ class Movie
$ret['backdrop'] = '';
}
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::primaryOver('TMDb Found ').ColorCLI::headerOver($ret['title']), true);
+ ColorCLI::primaryOver('TMDb Found ').ColorCLI::headerOver($ret['title']);
}
return $ret;
@@ -929,7 +926,7 @@ class Movie
];
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('IMDb Found ').ColorCLI::primaryOver($result->orig_title()), true);
+ ColorCLI::headerOver('IMDb Found ').ColorCLI::primaryOver($result->orig_title());
}
return $ret;
@@ -972,7 +969,7 @@ class Movie
return false;
}
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::alternateOver('Trakt Found ').ColorCLI::headerOver($ret['title']), true);
+ ColorCLI::alternateOver('Trakt Found ').ColorCLI::headerOver($ret['title']);
}
return $ret;
@@ -1023,7 +1020,7 @@ class Movie
];
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::alternateOver('OMDbAPI Found ').ColorCLI::headerOver($ret['title']), true);
+ ColorCLI::alternateOver('OMDbAPI Found ').ColorCLI::headerOver($ret['title']);
}
return $ret;
@@ -1062,7 +1059,7 @@ class Movie
if ($imdbID !== false) {
$this->service = $service;
if ($this->echooutput && $this->service !== '') {
- ColorCLI::doEcho(ColorCLI::headerOver($service.' found IMDBid: ').ColorCLI::primary('tt'.$imdbID), true);
+ ColorCLI::headerOver($service.' found IMDBid: ').ColorCLI::primary('tt'.$imdbID);
}
$movieInfoId = MovieInfo::query()->where('imdbid', $imdbID)->first(['id']);
@@ -1127,7 +1124,7 @@ class Movie
if ($movieCount > 0) {
if ($this->echooutput && $movieCount > 1) {
- ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' movie releases.'), true);
+ ColorCLI::header('Processing '.$movieCount.' movie releases.');
}
// Loop over releases.
@@ -1146,7 +1143,7 @@ class Movie
}
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::primaryOver('Looking up: ').ColorCLI::headerOver($movieName), true);
+ ColorCLI::primaryOver('Looking up: ').ColorCLI::headerOver($movieName);
}
$movieUpdated = false;
diff --git a/Blacklight/Music.php b/Blacklight/Music.php
index 17894836a..a064ffdbf 100755
--- a/Blacklight/Music.php
+++ b/Blacklight/Music.php
@@ -499,16 +499,14 @@ class Music
if ($musicId) {
if ($this->echooutput) {
- ColorCLI::doEcho(
+
ColorCLI::header(PHP_EOL.'Added/updated album: ').
ColorCLI::alternateOver(' Artist: ').
ColorCLI::primary($mus['artist']).
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($mus['title']).
ColorCLI::alternateOver(' Year: ').
- ColorCLI::primary($mus['year']),
- true
- );
+ ColorCLI::primary($mus['year']);
}
$mus['cover'] = $ri->saveImage($musicId, $mus['coverurl'], $this->imgSavePath, 250, 250);
} else {
@@ -518,7 +516,7 @@ class Music
} else {
$artist = 'Artist: '.$mus['artist'].', Album: ';
}
- ColorCLI::doEcho(
+
ColorCLI::headerOver('Nothing to update: ').
ColorCLI::primaryOver(
$artist.
@@ -526,9 +524,7 @@ class Music
' ('.
$mus['year'].
')'
- ),
- true
- );
+ );
}
}
@@ -636,12 +632,10 @@ class Music
})->whereIn('categories_id', [Category::MUSIC_MP3, Category::MUSIC_LOSSLESS, Category::MUSIC_OTHER])->orderBy('postdate', 'DESC')->limit($this->musicqty)->get(['searchname', 'id']);
if ($res instanceof \Traversable && ! empty($res)) {
if ($this->echooutput) {
- ColorCLI::doEcho(
+
ColorCLI::header(
'Processing '.$res->count().' music release(s).'
- ),
- true
- );
+ );
}
foreach ($res as $arr) {
@@ -652,7 +646,7 @@ class Music
$newname = $album['name'].' ('.$album['year'].')';
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($newname), true);
+ ColorCLI::headerOver('Looking up: ').ColorCLI::primary($newname);
}
// Do a local lookup first
@@ -661,7 +655,7 @@ class Music
if ($musicCheck === null && \in_array($album['name'].$album['year'], $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
+ ColorCLI::headerOver('Cached previous failure. Skipping.');
}
$albumId = -2;
} elseif ($musicCheck === null && $local === false) {
@@ -691,10 +685,8 @@ class Music
if ($this->echooutput) {
echo "\n";
}
- } else {
- if ($this->echooutput) {
- ColorCLI::doEcho(ColorCLI::header('No music releases to process.'), true);
- }
+ } elseif ($this->echooutput) {
+ ColorCLI::header('No music releases to process.');
}
}
diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php
index af9320b10..02199172a 100755
--- a/Blacklight/NNTP.php
+++ b/Blacklight/NNTP.php
@@ -813,7 +813,7 @@ class NNTP extends \Net_NNTP_Client
$message = "Code {$data->code}: {$data->message}\nSkipping group: {$group}";
if ($this->_echo) {
- ColorCLI::doEcho(ColorCLI::error($message), true);
+ ColorCLI::error($message);
}
$nntp->doQuit();
}
@@ -985,13 +985,10 @@ class NNTP extends \Net_NNTP_Client
if (! empty($deComp)) {
$bytesReceived = \strlen($data);
if ($this->_echo && $bytesReceived > 10240) {
- ColorCLI::doEcho(
- ColorCLI::primaryOver(
+ ColorCLI::primaryOver(
'Received '.round($bytesReceived / 1024).
'KB from group ('.$this->group().').'
- ),
- true
- );
+ );
}
// Split the string of headers into an array of individual headers, then return it.
diff --git a/Blacklight/NZBImport.php b/Blacklight/NZBImport.php
index 00511937d..a8f319bc2 100755
--- a/Blacklight/NZBImport.php
+++ b/Blacklight/NZBImport.php
@@ -458,7 +458,7 @@ class NZBImport
if ($this->browser) {
$this->retVal .= $message.'
';
} elseif ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::notice($message), true);
+ ColorCLI::notice($message);
}
}
diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php
index 8815f6e4b..77e0dbff2 100755
--- a/Blacklight/NameFixer.php
+++ b/Blacklight/NameFixer.php
@@ -219,7 +219,7 @@ class NameFixer
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' releases to process.');
+ ColorCLI::primary(number_format($total).' releases to process.');
foreach ($releases as $rel) {
$releaseRow = DB::select(
@@ -248,7 +248,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' NFO\'s');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -303,7 +303,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' file names to process.');
+ ColorCLI::primary(number_format($total).' file names to process.');
foreach ($releases as $release) {
$this->reset();
@@ -314,7 +314,7 @@ class NameFixer
$this->_echoFoundCount($echo, ' files');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -367,7 +367,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' xxx file names to process.');
+ ColorCLI::primary(number_format($total).' xxx file names to process.');
foreach ($releases as $release) {
$this->reset();
@@ -377,7 +377,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' files');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -432,7 +432,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' srr file extensions to process.');
+ ColorCLI::primary(number_format($total).' srr file extensions to process.');
foreach ($releases as $release) {
$this->reset();
@@ -442,7 +442,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' files');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -490,7 +490,7 @@ class NameFixer
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' releases to process.');
+ ColorCLI::primary(number_format($total).' releases to process.');
$Nfo = new Nfo();
$nzbContents = new NZBContents(
[
@@ -512,7 +512,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' files');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -577,7 +577,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' unique ids to process.');
+ ColorCLI::primary(number_format($total).' unique ids to process.');
foreach ($releases as $rel) {
$this->checked++;
$this->reset();
@@ -586,7 +586,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' UID\'s');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -642,7 +642,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' mediainfo movie names to process.');
+ ColorCLI::primary(number_format($total).' mediainfo movie names to process.');
foreach ($releases as $rel) {
$this->checked++;
$this->reset();
@@ -651,7 +651,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' MediaInfo\'s');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -715,7 +715,7 @@ class NameFixer
$total = \count($releases);
if ($total > 0) {
$this->_totalReleases = $total;
- echo ColorCLI::primary(number_format($total).' hash_16K to process.');
+ ColorCLI::primary(number_format($total).' hash_16K to process.');
foreach ($releases as $rel) {
$this->checked++;
$this->reset();
@@ -724,7 +724,7 @@ class NameFixer
}
$this->_echoFoundCount($echo, ' hashes');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to fix.'), true);
+ ColorCLI::info('Nothing to fix.');
}
}
@@ -742,19 +742,19 @@ class NameFixer
$queryLimit = ($limit === '') ? '' : ' LIMIT '.$limit;
// 24 hours, other cats
if ($time === 1 && $cats === 1) {
- echo ColorCLI::header($query.$this->timeother.$queryLimit.";\n");
+ ColorCLI::header($query.$this->timeother.$queryLimit.";\n");
$releases = DB::select($query.$this->timeother.$queryLimit);
} // 24 hours, all cats
if ($time === 1 && $cats === 2) {
- echo ColorCLI::header($query.$this->timeall.$queryLimit.";\n");
+ ColorCLI::header($query.$this->timeall.$queryLimit.";\n");
$releases = DB::select($query.$this->timeall.$queryLimit);
} //other cats
if ($time === 2 && $cats === 1) {
- echo ColorCLI::header($query.$this->fullother.$queryLimit.";\n");
+ ColorCLI::header($query.$this->fullother.$queryLimit.";\n");
$releases = DB::select($query.$this->fullother.$queryLimit);
} // all cats
if ($time === 2 && $cats === 2) {
- echo ColorCLI::header($query.$this->fullall.$queryLimit.";\n");
+ ColorCLI::header($query.$this->fullall.$queryLimit.";\n");
$releases = DB::select($query.$this->fullall.$queryLimit);
}
@@ -770,7 +770,7 @@ class NameFixer
protected function _echoFoundCount($echo, $type): void
{
if ($echo === true) {
- echo ColorCLI::header(
+ ColorCLI::header(
PHP_EOL.
number_format($this->fixed).
' releases have had their names changed out of: '.
@@ -778,7 +778,7 @@ class NameFixer
$type.'.'
);
} else {
- echo ColorCLI::header(
+ ColorCLI::header(
PHP_EOL.
number_format($this->fixed).
' releases could have their names changed. '.
@@ -794,7 +794,7 @@ class NameFixer
*/
protected function _echoStartMessage($time, $type): void
{
- echo ColorCLI::header(
+ ColorCLI::header(
sprintf(
'Fixing search names %s using %s.',
($time === 1 ? 'in the past 6 hours' : 'since the beginning'),
@@ -809,7 +809,7 @@ class NameFixer
protected function _echoRenamed($show): void
{
if ($this->checked % 500 === 0 && $show === 1) {
- echo ColorCLI::alternate(PHP_EOL.number_format($this->checked).' files processed.'.PHP_EOL);
+ ColorCLI::alternate(PHP_EOL.number_format($this->checked).' files processed.'.PHP_EOL);
}
if ($show === 2) {
@@ -874,8 +874,8 @@ class NameFixer
echo PHP_EOL;
- ColorCLI::doEcho(
- ColorCLI::headerOver('New name: ').
+
+ ColorCLI::headerOver('New name: ').
ColorCLI::primary(substr($newName, 0, 299)).
ColorCLI::headerOver('Old name: ').
ColorCLI::primary($release->searchname).
@@ -890,15 +890,10 @@ class NameFixer
ColorCLI::headerOver('Method: ').
ColorCLI::primary($type.$method).
ColorCLI::headerOver('Releases ID: ').
- ColorCLI::primary($release->releases_id),
- true
- );
+ ColorCLI::primary($release->releases_id);
if (! empty($release->filename)) {
- ColorCLI::doEcho(
- ColorCLI::headerOver('Filename: ').
- ColorCLI::primary($release->filename),
- true
- );
+ ColorCLI::headerOver('Filename: ').
+ ColorCLI::primary($release->filename);
}
if ($type !== 'PAR2, ') {
@@ -1025,16 +1020,14 @@ class NameFixer
]
): void {
echo PHP_EOL;
- ColorCLI::doEcho(
- ColorCLI::headerOver('New name: ').ColorCLI::primaryOver($data['new_name']).
+
+ ColorCLI::headerOver('New name: ').ColorCLI::primaryOver($data['new_name']).
ColorCLI::headerOver('Old name: ').ColorCLI::primaryOver($data['old_name']).
ColorCLI::headerOver('New category: ').ColorCLI::primaryOver($data['new_category']).
ColorCLI::headerOver('Old category: ').ColorCLI::primaryOver($data['old_category']).
ColorCLI::headerOver('Group: ').ColorCLI::primaryOver($data['group']).
ColorCLI::headerOver('Releases ID: ').ColorCLI::primaryOver($data['releases_id']).
- ColorCLI::headerOver('Method: ').ColorCLI::primaryOver($data['method']),
- true
- );
+ ColorCLI::headerOver('Method: ').ColorCLI::primaryOver($data['method']);
}
/**
@@ -1135,8 +1128,8 @@ class NameFixer
$limit = 'LIMIT 1000000';
}
- ColorCLI::doEcho(ColorCLI::header(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now()), true);
- ColorCLI::doEcho(ColorCLI::primary('Matching predb filename to cleaned release_files.name.'), true);
+ ColorCLI::header(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now());
+ ColorCLI::primary('Matching predb filename to cleaned release_files.name.');
$counter = $counted = 0;
$timestart = now();
@@ -1165,7 +1158,7 @@ class NameFixer
$total = \count($query);
if ($total > 0) {
- ColorCLI::doEcho(ColorCLI::header(PHP_EOL.number_format($total).' releases to process.'), true);
+ ColorCLI::header(PHP_EOL.number_format($total).' releases to process.');
foreach (collect($query)->chunk(100) as $chunked) {
foreach ($chunked as $row) {
@@ -1178,9 +1171,9 @@ class NameFixer
}
}
}
- ColorCLI::doEcho(ColorCLI::header(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.'), true);
+ ColorCLI::header(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.');
} else {
- ColorCLI::doEcho(ColorCLI::info('Nothing to do.'), true);
+ ColorCLI::info('Nothing to do.');
}
}
}
@@ -1354,7 +1347,7 @@ class NameFixer
if ($time === 1) {
$te = ' in the past 3 hours';
}
- echo ColorCLI::header('Fixing search names'.$te.' using the predb hash.');
+ ColorCLI::header('Fixing search names'.$te.' using the predb hash.');
}
$regex = 'AND (r.ishashed = 1 OR rf.ishashed = 1)';
@@ -1372,7 +1365,7 @@ class NameFixer
$res = DB::select($query);
$total = \count($res);
- echo ColorCLI::primary(number_format($total).' releases to process.');
+ ColorCLI::primary(number_format($total).' releases to process.');
foreach ($res as $row) {
if (preg_match('/[a-fA-F0-9]{32,40}/i', $row->name, $matches)) {
$updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show);
@@ -1384,9 +1377,9 @@ class NameFixer
}
}
if ($echo === 1) {
- echo ColorCLI::header(PHP_EOL.$updated.' releases have had their names changed out of: '.number_format($checked).' files.');
+ ColorCLI::header(PHP_EOL.$updated.' releases have had their names changed out of: '.number_format($checked).' files.');
} else {
- echo ColorCLI::header(PHP_EOL.$updated.' releases could have their names changed. '.number_format($checked).' files were checked.');
+ ColorCLI::header(PHP_EOL.$updated.' releases could have their names changed. '.number_format($checked).' files were checked.');
}
return $updated;
@@ -2251,13 +2244,16 @@ class NameFixer
public function hashCheck($release, $echo, $type, $nameStatus, $show): bool
{
if ($this->done === false && $this->relid !== (int) $release->releases_id) {
- $result = DB::select(sprintf('
+ $result = DB::select(sprintf(
+ '
SELECT r.id AS releases_id, r.size AS relsize, r.name AS textstring, r.searchname, r.fromname, r.predb_id
FROM releases r
STRAIGHT_JOIN par_hashes ph ON ph.releases_id = r.id
WHERE ph.hash = %s
AND ph.releases_id != %d
- AND (r.predb_id > 0 OR r.anidbid > 0)', escapeString($release->hash), $release->releases_id
+ AND (r.predb_id > 0 OR r.anidbid > 0)',
+ escapeString($release->hash),
+ $release->releases_id
));
foreach ($result as $res) {
diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php
index c7fc02c42..b531ca200 100755
--- a/Blacklight/Nfo.php
+++ b/Blacklight/Nfo.php
@@ -268,16 +268,14 @@ class Nfo
$nfoCount = $res->count();
if ($nfoCount > 0) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.
($guidChar === '' ? '' : '['.$guidChar.'] ').
($groupID === '' ? '' : '['.$groupID.'] ').
'Processing '.$nfoCount.
' NFO(s), starting at '.$this->nzbs.
' * = hidden NFO, + = NFO, - = no NFO, f = download failed.'
- ), true
- );
+ );
if ($this->echo) {
// Get count of releases per nfo status
@@ -310,7 +308,7 @@ class Nfo
foreach ($nfoStats as $row) {
$outString .= ', '.$row['status'].' = '.number_format($row['count']);
}
- ColorCLI::doEcho(ColorCLI::header($outString.'.'), true);
+ ColorCLI::header($outString.'.');
}
}
@@ -372,7 +370,7 @@ class Nfo
echo PHP_EOL;
}
if ($ret > 0) {
- ColorCLI::doEcho($ret.' NFO file(s) found/processed.', true);
+ ColorCLI::primary($ret.' NFO file(s) found/processed.');
}
}
diff --git a/Blacklight/ReleaseImage.php b/Blacklight/ReleaseImage.php
index 880ee3980..2498d36ad 100755
--- a/Blacklight/ReleaseImage.php
+++ b/Blacklight/ReleaseImage.php
@@ -75,20 +75,20 @@ class ReleaseImage
$img = Image::make($imgLoc);
} catch (NotFoundException $e) {
if ($e->getCode() === 404) {
- ColorCLI::doEcho(ColorCLI::notice('Data not available on server'), true);
+ ColorCLI::notice('Data not available on server');
} elseif ($e->getCode() === 503) {
- ColorCLI::doEcho(ColorCLI::notice('Service unavailable'), true);
+ ColorCLI::notice('Service unavailable');
} else {
- ColorCLI::doEcho(ColorCLI::notice('Unable to fetch image: '.$e->getMessage()), true);
+ ColorCLI::notice('Unable to fetch image: '.$e->getMessage());
}
$img = false;
} catch (NotReadableException $e) {
- ColorCLI::doEcho(ColorCLI::notice($e->getMessage()), true);
+ ColorCLI::notice($e->getMessage());
$img = false;
} catch (ImageException $e) {
- ColorCLI::doEcho(ColorCLI::notice('Image error: '.$e->getMessage()), true);
+ ColorCLI::notice('Image error: '.$e->getMessage());
$img = false;
}
diff --git a/Blacklight/ReleaseRemover.php b/Blacklight/ReleaseRemover.php
index d377c12c2..7e1c2bdea 100755
--- a/Blacklight/ReleaseRemover.php
+++ b/Blacklight/ReleaseRemover.php
@@ -177,8 +177,8 @@ class ReleaseRemover
$this->deleteReleases();
if ($this->echoCLI) {
- echo ColorCLI::headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
- echo ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
+ ColorCLI::headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
+ ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
}
return $this->browser
@@ -219,7 +219,7 @@ class ReleaseRemover
if ($time === 'full') {
if ($this->echoCLI) {
- echo ColorCLI::header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.\n');
+ ColorCLI::header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.\n');
}
} else {
if (! is_numeric($time)) {
@@ -228,7 +228,7 @@ class ReleaseRemover
return $this->returnError();
}
if ($this->echoCLI) {
- echo ColorCLI::header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' from the past '.$time.' hour(s).\n');
+ ColorCLI::header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' from the past '.$time.' hour(s).\n');
}
$this->crapTime = ' AND r.adddate > (NOW() - INTERVAL '.$time.' HOUR)';
}
@@ -306,8 +306,8 @@ class ReleaseRemover
}
if ($this->echoCLI) {
- echo ColorCLI::headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
- echo ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
+ ColorCLI::headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
+ ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
}
return $this->browser
@@ -776,7 +776,7 @@ class ReleaseRemover
}
// Provide useful output of operations
- echo ColorCLI::header(
+ ColorCLI::header(
sprintf(
"Finding crap releases for %s: Using %s method against release %s.\n".
'%s',
@@ -809,7 +809,7 @@ class ReleaseRemover
$this->deleteReleases();
}
} else {
- echo ColorCLI::error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid ID.\n");
+ ColorCLI::error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid ID.\n");
}
return true;
@@ -878,7 +878,7 @@ class ReleaseRemover
$ftUsing = PHP_EOL;
// Provide useful output of operations
- echo ColorCLI::header(
+ ColorCLI::header(
sprintf(
'Finding crap releases for %s: Using %s method against release filenames.'.PHP_EOL.
'%s',
@@ -1005,10 +1005,10 @@ class ReleaseRemover
if ($this->delete) {
$this->releases->deleteSingle(['g' => $release->guid, 'i' => $release->id], $this->nzb, $this->releaseImage);
if ($this->echoCLI) {
- echo ColorCLI::primary('Deleting: '.$this->method.': '.$release->searchname);
+ ColorCLI::primary('Deleting: '.$this->method.': '.$release->searchname);
}
} elseif ($this->echoCLI) {
- echo ColorCLI::primary('Would be deleting: '.$this->method.': '.$release->searchname);
+ ColorCLI::primary('Would be deleting: '.$this->method.': '.$release->searchname);
}
$deletedCount++;
}
@@ -1225,7 +1225,7 @@ class ReleaseRemover
}
// Print the query to the user, ask them if they want to continue using it.
- echo ColorCLI::primary(
+ ColorCLI::primary(
'This is the query we have formatted using your criteria, you can run it in SQL to see if you like the results:'.
PHP_EOL.$this->query.';'.PHP_EOL.
'If you are satisfied, type yes and press enter. Anything else will exit.'
@@ -1234,7 +1234,7 @@ class ReleaseRemover
// Check the users response.
$userInput = trim(fgets(fopen('php://stdin', 'rtb')));
if ($userInput !== 'yes') {
- echo ColorCLI::primary('You typed: "'.$userInput.'", the program will exit.');
+ ColorCLI::primary('You typed: "'.$userInput.'", the program will exit.');
return false;
}
@@ -1285,7 +1285,7 @@ class ReleaseRemover
}
if ($this->echoCLI && $this->error !== '') {
- echo ColorCLI::error($this->error);
+ ColorCLI::error($this->error);
}
return false;
diff --git a/Blacklight/Steam.php b/Blacklight/Steam.php
index 15d87376b..faa3bac75 100755
--- a/Blacklight/Steam.php
+++ b/Blacklight/Steam.php
@@ -78,7 +78,7 @@ class Steam
}
if ($res === false) {
- ColorCLI::doEcho(ColorCLI::notice('Steam did not return game data'), true);
+ ColorCLI::notice('Steam did not return game data');
}
return false;
@@ -97,7 +97,7 @@ class Steam
$bestMatch = false;
if (empty($searchTerm)) {
- ColorCLI::doEcho(ColorCLI::notice('Search term cannot be empty'), true);
+ ColorCLI::notice('Search term cannot be empty');
return $bestMatch;
}
@@ -128,7 +128,7 @@ class Steam
}
}
if ($bestMatch === false) {
- ColorCLI::doEcho(ColorCLI::notice('Steam search returned no valid results'), true);
+ ColorCLI::notice('Steam search returned no valid results');
}
return $bestMatch;
@@ -148,7 +148,7 @@ class Steam
$this->setLastUpdated();
$fullAppArray = $this->steamFront->getFullAppList();
$inserted = $dupe = 0;
- echo ColorCLI::info('Populating steam apps table').PHP_EOL;
+ ColorCLI::info('Populating steam apps table').PHP_EOL;
foreach ($fullAppArray as $appsArray) {
foreach ($appsArray as $appArray) {
foreach ($appArray as $app) {
diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php
index adaa52a43..a148856ab 100755
--- a/Blacklight/Tmux.php
+++ b/Blacklight/Tmux.php
@@ -530,12 +530,12 @@ class Tmux
if ($this->isRunning() === true) {
Settings::query()->where(['section' => 'site', 'subsection' => 'tmux', 'setting' => 'running'])->update(['value' => 0]);
$sleep = Settings::settingValue('site.tmux.monitor_delay');
- ColorCLI::doEcho(ColorCLI::header('Stopping tmux scripts and waiting '.$sleep.' seconds for all panes to shutdown'), true);
+ ColorCLI::header('Stopping tmux scripts and waiting '.$sleep.' seconds for all panes to shutdown');
sleep($sleep);
return true;
}
- ColorCLI::doEcho(ColorCLI::info('Tmux scripts are not running!'), true);
+ ColorCLI::info('Tmux scripts are not running!');
return false;
}
diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php
index 3d8a99459..511a5090b 100755
--- a/Blacklight/XXX.php
+++ b/Blacklight/XXX.php
@@ -466,14 +466,14 @@ class XXX
$this->whichClass = 'aebn';
$mov = new AEBN();
$mov->cookie = $this->cookie;
- ColorCLI::doEcho(ColorCLI::info('Checking AEBN for movie info'), true);
+ ColorCLI::info('Checking AEBN for movie info');
$res = $mov->processSite($movie);
if ($res === false) {
$this->whichClass = 'pop';
$mov = new Popporn();
$mov->cookie = $this->cookie;
- ColorCLI::doEcho(ColorCLI::info('Checking PopPorn for movie info'), true);
+ ColorCLI::info('Checking PopPorn for movie info');
$res = $mov->processSite($movie);
}
@@ -481,14 +481,14 @@ class XXX
$this->whichClass = 'adm';
$mov = new ADM();
$mov->cookie = $this->cookie;
- ColorCLI::doEcho(ColorCLI::info('Checking ADM for movie info'), true);
+ ColorCLI::info('Checking ADM for movie info');
$res = $mov->processSite($movie);
}
if ($res === false) {
$this->whichClass = 'ade';
$mov = new ADE();
- ColorCLI::doEcho(ColorCLI::info('Checking ADE for movie info'), true);
+ ColorCLI::info('Checking ADE for movie info');
$res = $mov->processSite($movie);
}
@@ -496,7 +496,7 @@ class XXX
$this->whichClass = 'hotm';
$mov = new Hotmovies();
$mov->cookie = $this->cookie;
- ColorCLI::doEcho(ColorCLI::info('Checking HotMovies for movie info'), true);
+ ColorCLI::info('Checking HotMovies for movie info');
$res = $mov->processSite($movie);
}
@@ -522,7 +522,7 @@ class XXX
default:
$fromstr = '';
}
- ColorCLI::doEcho(ColorCLI::primary('Fetching XXX info from: '.$fromstr), true);
+ ColorCLI::primary('Fetching XXX info from: '.$fromstr);
}
$res = $mov->getAll();
} else {
@@ -601,10 +601,8 @@ class XXX
}
if ($this->echoOutput) {
- ColorCLI::doEcho(
- ColorCLI::headerOver(($xxxID !== false ? 'Added/updated XXX movie: '.ColorCLI::primary($mov['title']) : 'Nothing to update for XXX movie: '.ColorCLI::primary($mov['title']))),
- true
- );
+
+ ColorCLI::headerOver(($xxxID !== false ? 'Added/updated XXX movie: '.ColorCLI::primary($mov['title']) : 'Nothing to update for XXX movie: '.ColorCLI::primary($mov['title'])));
}
return $xxxID;
@@ -639,7 +637,7 @@ class XXX
if ($movieCount > 0) {
if ($this->echoOutput) {
- ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' XXX releases.'), true);
+ ColorCLI::header('Processing '.$movieCount.' XXX releases.');
}
// Loop over releases.
@@ -651,17 +649,17 @@ class XXX
$check = $this->checkXXXInfoExists($this->currentTitle);
if ($check === null) {
if ($this->echoOutput) {
- ColorCLI::doEcho(ColorCLI::primaryOver('Looking up: ').ColorCLI::headerOver($this->currentTitle), true);
+ ColorCLI::primaryOver('Looking up: ').ColorCLI::headerOver($this->currentTitle);
}
- ColorCLI::doEcho(ColorCLI::info('Local match not found, checking web!'), true);
+ ColorCLI::info('Local match not found, checking web!');
$idcheck = $this->updateXXXInfo($this->currentTitle);
} else {
- ColorCLI::doEcho(ColorCLI::info('Local match found for XXX Movie: '.ColorCLI::headerOver($this->currentTitle)), true);
+ ColorCLI::info('Local match found for XXX Movie: '.ColorCLI::headerOver($this->currentTitle));
$idcheck = (int) $check['id'];
}
} else {
- ColorCLI::doEcho('.', true);
+ ColorCLI::primary('.');
}
Release::query()
->where('id', $arr['id'])
@@ -669,7 +667,7 @@ class XXX
->update(['xxxinfo_id' => $idcheck]);
}
} elseif ($this->echoOutput) {
- ColorCLI::doEcho(ColorCLI::header('No xxx releases to process.'), true);
+ ColorCLI::header('No xxx releases to process.');
}
}
diff --git a/Blacklight/db/DbUpdate.php b/Blacklight/db/DbUpdate.php
index c1b4e8557..afa2a8151 100755
--- a/Blacklight/db/DbUpdate.php
+++ b/Blacklight/db/DbUpdate.php
@@ -106,13 +106,13 @@ class DbUpdate
$this->processPatches(['safe' => $options['safe']]); // Make sure we are completely up to date!
- ColorCLI::doEcho(ColorCLI::primaryOver('Looking for new patches...'));
+ ColorCLI::primaryOver('Looking for new patches...');
$files = Utility::getDirFiles($options);
$count = \count($files);
- ColorCLI::doEcho(ColorCLI::header(" $count found"), true);
+ ColorCLI::header(" $count found");
if ($count > 0) {
- ColorCLI::doEcho(ColorCLI::header('Processing...'), true);
+ ColorCLI::header('Processing...');
natsort($files);
$local = $this->isLocalDb() ? '' : 'LOCAL ';
@@ -120,7 +120,7 @@ class DbUpdate
if (! preg_match($options['regex'], $file, $matches)) {
ColorCLI::error("$file does not match the pattern {$options['regex']}\nPlease fix this before continuing");
} else {
- ColorCLI::doEcho(ColorCLI::header('Processing patch file: '.$file), true);
+ ColorCLI::header('Processing patch file: '.$file);
$this->splitSQL($file, ['local' => $local]);
$current = Settings::settingValue('..sqlpatch');
$current++;
@@ -166,7 +166,7 @@ class DbUpdate
if (\count($files)) {
natsort($files);
$local = $this->isLocalDb() ? '' : 'LOCAL ';
- ColorCLI::doEcho(ColorCLI::primary('Looking for unprocessed patches...'), true);
+ ColorCLI::primary('Looking for unprocessed patches...');
foreach ($files as $file) {
$setPatch = false;
$fp = fopen($file, 'rb');
@@ -186,7 +186,7 @@ class DbUpdate
throw new \RuntimeException('No patch information available, stopping!!');
}
if ($patch > $currentVersion) {
- ColorCLI::doEcho(ColorCLI::header('Processing patch file: '.$file), true);
+ ColorCLI::header('Processing patch file: '.$file);
$this->splitSQL($file, ['local' => $local]);
if ($setPatch) {
Settings::query()->where('setting', '=', 'sqlpatch')->update(['value' => $patch]);
@@ -195,11 +195,12 @@ class DbUpdate
}
}
} else {
- exit(ColorCLI::error("\nHave you changed the path to the patches folder, or do you have the right permissions?\n"));
+ ColorCLI::error('Have you changed the path to the patches folder, or do you have the right permissions?');
+ exit();
}
if ($patched === 0) {
- ColorCLI::doEcho(ColorCLI::info("Nothing to patch, you are already on version $currentVersion"), true);
+ ColorCLI::info("Nothing to patch, you are already on version $currentVersion");
}
return $patched;
@@ -239,7 +240,7 @@ class DbUpdate
// Skip comments.
if (preg_match('!^\s*(#|--|//)\s*(.+?)\s*$!', $line, $matches)) {
- echo ColorCLI::info('COMMENT: '.$matches[2]).PHP_EOL;
+ ColorCLI::info('COMMENT: '.$matches[2]).PHP_EOL;
continue;
}
@@ -271,7 +272,7 @@ class DbUpdate
try {
$this->pdo->exec($query);
- ColorCLI::doEcho(ColorCLI::alternateOver('SUCCESS: ').ColorCLI::primary($query), true);
+ ColorCLI::alternateOver('SUCCESS: ').ColorCLI::primary($query);
} catch (\PDOException $e) {
// Log the problem and the query.
file_put_contents(
@@ -288,26 +289,28 @@ class DbUpdate
\in_array($e->errorInfo[0], [23505, 42701, 42703, '42P07', '42P16'], false)
) {
if ($e->errorInfo[1] === 1060) {
- ColorCLI::doEcho(ColorCLI::warning(
+ ColorCLI::warning(
"$query The column already exists - No need to worry \{".
$e->errorInfo[1]."}.\n"
- ), true);
+ );
} else {
- ColorCLI::doEcho(ColorCLI::warning(
+ ColorCLI::warning(
"$query Skipped - No need to worry \{".
$e->errorInfo[1]."}.\n"
- ), true);
+ );
}
} elseif (preg_match('/ALTER IGNORE/i', $query)) {
$this->pdo->exec('SET SESSION old_alter_table = 1');
try {
$this->pdo->exec($query);
- ColorCLI::doEcho(ColorCLI::alternateOver('SUCCESS: ').ColorCLI::primary($query));
+ ColorCLI::alternateOver('SUCCESS: ').ColorCLI::primary($query);
} catch (\PDOException $e) {
- exit(ColorCLI::error("$query Failed \{".$e->errorInfo[1]."}\n\t".$e->errorInfo[2]));
+ ColorCLI::error("$query Failed \{".$e->errorInfo[1]."}\n\t".$e->errorInfo[2]);
+ exit();
}
} else {
- exit(ColorCLI::error("$query Failed \{".$e->errorInfo[1]."}\n\t".$e->errorInfo[2]));
+ ColorCLI::error("$query Failed \{".$e->errorInfo[1]."}\n\t".$e->errorInfo[2]);
+ exit();
}
}
diff --git a/Blacklight/db/populate/AniDB.php b/Blacklight/db/populate/AniDB.php
index e2777b6a8..4fba893bb 100755
--- a/Blacklight/db/populate/AniDB.php
+++ b/Blacklight/db/populate/AniDB.php
@@ -257,7 +257,7 @@ class AniDB
if ($check === false) {
AnidbTitle::insertIgnore(['anidbid' => $id, 'type' => $type, 'lang' => $lang, 'title' => $title]);
} else {
- echo ColorCLI::warning("Duplicate: $id");
+ ColorCLI::warning("Duplicate: $id");
}
}
@@ -327,7 +327,7 @@ class AniDB
if ($current->diff($lastUpdate)->format('%d') > $this->updateInterval) {
if ($this->echooutput) {
- echo ColorCLI::header('Updating anime titles by grabbing full data AniDB dump.');
+ ColorCLI::header('Updating anime titles by grabbing full data AniDB dump.');
}
$animetitles = new \SimpleXMLElement('compress.zlib://http://anidb.net/api/anime-titles.xml.gz', null, true);
@@ -339,7 +339,7 @@ class AniDB
if ($animetitles instanceof \Traversable) {
$count = $animetitles->count();
if ($this->echooutput) {
- echo ColorCLI::header(
+ ColorCLI::header(
'Total of '.number_format($count).' titles to add.'.PHP_EOL
);
}
@@ -399,22 +399,18 @@ class AniDB
$AniDBAPIArray = $this->getAniDbAPI($anidb['anidbid']);
if ($this->banned === true) {
- ColorCLI::doEcho(
+
ColorCLI::error(
'AniDB Banned, import will fail, please wait 24 hours before retrying.'
- ),
- true
- );
+ );
exit;
}
if ($AniDBAPIArray === false && $this->echooutput) {
- ColorCLI::doEcho(
+
ColorCLI::info(
'Anime ID: '.$anidb['anidbid'].' not available for update yet.'
- ),
- true
- );
+ );
} else {
$this->updateAniChildTables($AniDBAPIArray, $anidb['anidbid']);
}
@@ -424,22 +420,18 @@ class AniDB
$AniDBAPIArray = $this->getAniDbAPI($anidbId);
if ($this->banned === true) {
- ColorCLI::doEcho(
+
ColorCLI::error(
'AniDB Banned, import will fail, please wait 24 hours before retrying.'
- ),
- true
- );
+ );
exit;
}
if ($AniDBAPIArray === false && $this->echooutput) {
- ColorCLI::doEcho(
+
ColorCLI::info(
'Anime ID: '.$anidbId.' not available for update yet.'
- ),
- true
- );
+ );
} else {
$this->updateAniChildTables($AniDBAPIArray, $anidbId);
}
diff --git a/Blacklight/libraries/Forking.php b/Blacklight/libraries/Forking.php
index 2aa327cd1..acfdb11a3 100755
--- a/Blacklight/libraries/Forking.php
+++ b/Blacklight/libraries/Forking.php
@@ -211,12 +211,11 @@ class Forking extends \fork_daemon
$this->processEndWork();
if (config('nntmux.echocli')) {
- ColorCLI::doEcho(
+
ColorCLI::header(
'Multi-processing for '.$this->workType.' finished in '.(microtime(true) - $startTime).
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
- ), true
- );
+ );
}
}
@@ -305,22 +304,18 @@ class Forking extends \fork_daemon
$this->_workCount = \count($this->work);
if ($this->_workCount > 0) {
if (config('nntmux.echocli')) {
- ColorCLI::doEcho(
+
ColorCLI::header(
'Multi-processing started at '.date(DATE_RFC2822).' for '.$this->workType.' with '.$this->_workCount.
' job(s) to do using a max of '.$this->maxProcesses.' child process(es).'
- ), true
- );
+ );
}
$this->addwork($this->work);
$this->process_work(true);
- } else {
- if (config('nntmux.echocli')) {
- ColorCLI::doEcho(
- ColorCLI::header('No work to do!'), true
- );
- }
+ } elseif (config('nntmux.echocli')) {
+
+ ColorCLI::header('No work to do!');
}
}
@@ -1107,13 +1102,11 @@ class Forking extends \fork_daemon
public function childExit($pid, $identifier = '')
{
if (config('nntmux.echocli')) {
- ColorCLI::doEcho(
ColorCLI::header(
'Process ID #'.$pid.' has completed.'.PHP_EOL.
'There are '.($this->forked_children_count - 1).' process(es) still active with '.
(--$this->_workCount).' job(s) left in the queue.'.PHP_EOL
- ), true
- );
+ );
}
}
}
diff --git a/Blacklight/libraries/ForkingImportNZB.php b/Blacklight/libraries/ForkingImportNZB.php
index ecaa38579..2ed1b73fa 100755
--- a/Blacklight/libraries/ForkingImportNZB.php
+++ b/Blacklight/libraries/ForkingImportNZB.php
@@ -63,15 +63,15 @@ class ForkingImportNZB extends Forking
$this->_workCount = \count($directories);
if ((int) $this->_workCount === 0) {
- echo ColorCLI::error('No sub-folders were found in your specified folder ('.$folder.').');
+ ColorCLI::error('No sub-folders were found in your specified folder ('.$folder.').');
exit();
}
if (config('nntmux.echocli')) {
- ColorCLI::doEcho(ColorCLI::header(
+ ColorCLI::header(
'Multi-processing started at '.date(DATE_RFC2822).' with '.$this->_workCount.
' job(s) to do using a max of '.$maxProcesses.' child process(es).'
- ), true);
+ );
}
$this->deleteComplete = $deleteComplete;
@@ -86,13 +86,11 @@ class ForkingImportNZB extends Forking
$this->process_work(true);
if (config('nntmux.echocli')) {
- ColorCLI::doEcho(
+
ColorCLI::header(
'Multi-processing for import finished in '.(microtime(true) - $startTime).
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
- ),
- true
- );
+ );
}
}
diff --git a/Blacklight/processing/ProcessReleases.php b/Blacklight/processing/ProcessReleases.php
index 22683c113..c961d9e50 100755
--- a/Blacklight/processing/ProcessReleases.php
+++ b/Blacklight/processing/ProcessReleases.php
@@ -149,7 +149,7 @@ class ProcessReleases
$this->completion = ($dummy !== '' ? (int) $dummy : 0);
if ($this->completion > 100) {
$this->completion = 100;
- echo ColorCLI::error(PHP_EOL.'You have an invalid setting for completion. It cannot be higher than 100.');
+ ColorCLI::error(PHP_EOL.'You have an invalid setting for completion. It cannot be higher than 100.');
}
$this->collectionTimeout = (int) Settings::settingValue('indexer.processing.collection_timeout');
}
@@ -179,15 +179,12 @@ class ProcessReleases
}
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Starting release update process ('.date('Y-m-d H:i:s').')'), true);
+ ColorCLI::header('Starting release update process ('.now()->format('Y-m-d H:i:s').')');
}
if (! file_exists(Settings::settingValue('..nzbpath'))) {
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')),
- true
- );
+ ColorCLI::error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath'));
}
return 0;
@@ -291,7 +288,7 @@ class ProcessReleases
$this->initiateTableNames($groupID);
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Process Releases -> Attempting to find complete collections.'));
+ ColorCLI::header('Process Releases -> Attempting to find complete collections.');
}
$where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' ');
@@ -316,13 +313,11 @@ class ProcessReleases
$where
)
);
- ColorCLI::doEcho(
- ColorCLI::primary(
+
+ ColorCLI::primary(
($count === null ? 0 : $count->complete).' collections were found to be complete. Time: '.
now()->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
}
@@ -337,7 +332,7 @@ class ProcessReleases
$this->initiateTableNames($groupID);
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Process Releases -> Calculating collection sizes (in bytes).'), true);
+ ColorCLI::header('Process Releases -> Calculating collection sizes (in bytes).');
}
// Get the total size in bytes of the collection for collections where filecheck = 2.
$checked = DB::update(
@@ -361,13 +356,10 @@ class ProcessReleases
)
);
if ($checked > 0 && $this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
$checked.' collections set to filecheck = 3(size calculated)'
- ),
- true
- );
- ColorCLI::doEcho(ColorCLI::primary(now()->diffInSeconds($startTime).' seconds'), true);
+ );
+ ColorCLI::primary(now()->diffInSeconds($startTime).' seconds');
}
}
@@ -383,12 +375,9 @@ class ProcessReleases
$this->initiateTableNames($groupID);
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::header(
+ ColorCLI::header(
'Process Releases -> Delete collections smaller/larger than minimum size/file count from group/site setting.'
- ),
- true
- );
+ );
}
$groupID === '' ? $groupIDs = Group::getActiveIDs() : $groupIDs = [['id' => $groupID]];
@@ -494,16 +483,13 @@ class ProcessReleases
}
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).' collections: '.PHP_EOL.
$minSizeDeleted.' smaller than, '.
$maxSizeDeleted.' bigger than, '.
$minFilesDeleted.' with less files than site/group settings in: '.
now()->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
}
@@ -542,7 +528,7 @@ class ProcessReleases
$returnCount = $duplicate = 0;
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create releases from complete collections.'), true);
+ ColorCLI::header('Process Releases -> Create releases from complete collections.');
}
$collections = DB::select(
@@ -562,7 +548,7 @@ class ProcessReleases
);
if ($this->echoCLI && \count($collections) > 0) {
- echo ColorCLI::primary(\count($collections).' Collections ready to be converted to releases.');
+ ColorCLI::primary(\count($collections).' Collections ready to be converted to releases.');
}
foreach ($collections as $collection) {
@@ -711,17 +697,14 @@ class ProcessReleases
}
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
PHP_EOL.
number_format($returnCount).
' Releases added and '.
number_format($duplicate).
' duplicate collections deleted in '.
now()->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
return ['added' => $returnCount, 'dupes' => $duplicate];
@@ -741,7 +724,7 @@ class ProcessReleases
$this->formFromNamesQuery();
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create the NZB, delete collections/binaries/parts.'), true);
+ ColorCLI::header('Process Releases -> Create the NZB, delete collections/binaries/parts.');
}
$releases = DB::select(
@@ -769,7 +752,7 @@ class ProcessReleases
if ($this->nzb->writeNzbForReleaseId($release->id, $release->guid, $release->name, $release->title) === true) {
$nzbCount++;
if ($this->echoCLI) {
- echo ColorCLI::primaryOver("Creating NZBs and deleting Collections:\t".$nzbCount.'/'.$total."\r");
+ ColorCLI::primaryOver("Creating NZBs and deleting Collections:\t".$nzbCount.'/'.$total."\r");
}
}
}
@@ -778,14 +761,11 @@ class ProcessReleases
$totalTime = now()->diffInSeconds($startTime);
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
number_format($nzbCount).' NZBs created/Collections deleted in '.
$totalTime.' seconds.'.PHP_EOL.
'Total time: '.ColorCLI::primary($totalTime.' seconds')
- ),
- true
- );
+ );
}
return $nzbCount;
@@ -804,7 +784,7 @@ class ProcessReleases
{
$startTime = now();
if ($this->echoCLI) {
- echo ColorCLI::header('Process Releases -> Categorize releases.');
+ ColorCLI::header('Process Releases -> Categorize releases.');
}
switch ((int) $categorize) {
case 2:
@@ -824,7 +804,7 @@ class ProcessReleases
);
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::primary(now()->diffInSeconds($startTime).' seconds'), true);
+ ColorCLI::primary(now()->diffInSeconds($startTime).' seconds');
}
}
@@ -842,13 +822,10 @@ class ProcessReleases
if ((int) $postProcess === 1) {
(new PostProcess(['Echo' => $this->echoCLI]))->processAll($nntp);
} elseif ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::info(
+ ColorCLI::info(
"\nPost-processing is not running inside the Process Releases class.\n".
'If you are using tmux or screen they might have their own scripts running Post-processing.'
- ),
- true
- );
+ );
}
}
@@ -897,7 +874,7 @@ class ProcessReleases
$firstQuery = $fourthQuery = now();
if ($this->echoCLI) {
- echo ColorCLI::primary(
+ ColorCLI::primary(
'Finished deleting '.$deleted.' old collections/binaries/parts in '.
$firstQuery->diffInSeconds($startTime).' seconds.'.PHP_EOL
);
@@ -938,7 +915,7 @@ class ProcessReleases
$secondQuery = now();
if ($this->echoCLI) {
- echo ColorCLI::primary(
+ ColorCLI::primary(
'Finished deleting '.$deleted.' orphaned collections in '.
$secondQuery->diffInSeconds($firstQuery).' seconds.'.PHP_EOL
);
@@ -947,7 +924,7 @@ class ProcessReleases
// orphaned binaries - binaries with no parts or binaries with no collection
// Don't delete currently inserting binaries by checking the max id.
if ($this->echoCLI) {
- echo ColorCLI::primary('Deleting orphaned binaries/parts with no collection.');
+ ColorCLI::primary('Deleting orphaned binaries/parts with no collection.');
}
$deleted = 0;
@@ -975,7 +952,7 @@ class ProcessReleases
$thirdQuery = now();
if ($this->echoCLI) {
- echo ColorCLI::primary(
+ ColorCLI::primary(
'Finished deleting '.$deleted.' binaries with no collections or parts in '.
$thirdQuery->diffInSeconds($secondQuery).' seconds.'
);
@@ -984,7 +961,7 @@ class ProcessReleases
// orphaned parts - parts with no binary
// Don't delete currently inserting parts by checking the max id.
if ($this->echoCLI) {
- echo ColorCLI::primary('Deleting orphaned parts with no binaries.');
+ ColorCLI::primary('Deleting orphaned parts with no binaries.');
}
$deleted = 0;
$deleteQuery = DB::transaction(function () {
@@ -1011,7 +988,7 @@ class ProcessReleases
$fourthQuery = now();
if ($this->echoCLI) {
- echo ColorCLI::primary(
+ ColorCLI::primary(
'Finished deleting '.$deleted.' parts with no binaries in '.
$fourthQuery->diffInSeconds($thirdQuery).' seconds.'.PHP_EOL
);
@@ -1019,7 +996,7 @@ class ProcessReleases
} // done cleaning up Binaries/Parts orphans
if ($this->echoCLI) {
- echo ColorCLI::primary(
+ ColorCLI::primary(
'Deleting collections that were missed after NZB creation.'
);
}
@@ -1055,17 +1032,14 @@ class ProcessReleases
$deletedCount += $deleted;
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Finished deleting '.$deleted.' collections missed after NZB creation in '.
now()->diffInSeconds($fourthQuery).' seconds.'.PHP_EOL.
'Removed '.
number_format($deletedCount).
' parts/binaries/collection rows in '.
$fourthQuery->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
}
@@ -1084,7 +1058,7 @@ class ProcessReleases
$minSizeDeleted = $maxSizeDeleted = $minFilesDeleted = 0;
if ($this->echoCLI) {
- echo ColorCLI::header('Process Releases -> Delete releases smaller/larger than minimum size/file count from group/site setting.');
+ ColorCLI::header('Process Releases -> Delete releases smaller/larger than minimum size/file count from group/site setting.');
}
$groupID === '' ? $groupIDs = Group::getActiveIDs() : $groupIDs = [['id' => $groupID]];
@@ -1153,16 +1127,13 @@ class ProcessReleases
}
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).
' releases: '.PHP_EOL.
$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.
' with less files than site/groups setting in: '.
now()->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
}
@@ -1182,7 +1153,7 @@ class ProcessReleases
// Delete old releases and finished collections.
if ($this->echoCLI) {
- ColorCLI::doEcho(ColorCLI::header('Process Releases -> Delete old releases and passworded releases.'), true);
+ ColorCLI::header('Process Releases -> Delete old releases and passworded releases.');
}
// Releases past retention.
@@ -1360,8 +1331,7 @@ class ProcessReleases
}
if ($this->echoCLI) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Removed releases: '.
number_format($retentionDeleted).
' past retention, '.
@@ -1384,9 +1354,7 @@ class ProcessReleases
? ', '.number_format($completionDeleted).' under '.$this->completion.'% completion.'
: '.'
)
- ),
- true
- );
+ );
$totalDeleted = (
$retentionDeleted + $passwordDeleted + $duplicateDeleted + $disabledCategoryDeleted +
@@ -1394,13 +1362,10 @@ class ProcessReleases
$categoryMinSizeDeleted
);
if ($totalDeleted > 0) {
- ColorCLI::doEcho(
- ColorCLI::primary(
+ ColorCLI::primary(
'Removed '.number_format($totalDeleted).' releases in '.
now()->diffInSeconds($startTime).' seconds'
- ),
- true
- );
+ );
}
}
}
@@ -1689,10 +1654,7 @@ class ProcessReleases
}, 3);
if ($this->echoCLI && $obj > 0) {
- ColorCLI::doEcho(
- ColorCLI::primary('Deleted '.$obj.' broken/stuck collections.'),
- true
- );
+ ColorCLI::primary('Deleted '.$obj.' broken/stuck collections.');
}
}
}
diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php
index 62ed5aa4a..79c47bc99 100755
--- a/Blacklight/processing/post/AniDB.php
+++ b/Blacklight/processing/post/AniDB.php
@@ -106,7 +106,7 @@ class AniDB
}
}
} else {
- ColorCLI::doEcho(ColorCLI::info('No anidb releases to process.'), true);
+ ColorCLI::info('No anidb releases to process.');
}
}
@@ -224,7 +224,7 @@ class AniDB
$cleanArr = $this->extractTitleEpisode($release->searchname);
if (\is_array($cleanArr) && isset($cleanArr['title']) && is_numeric($cleanArr['epno'])) {
- echo ColorCLI::header(PHP_EOL.'Looking Up: ').
+ ColorCLI::header(PHP_EOL.'Looking Up: ').
ColorCLI::primary(' Title: '.$cleanArr['title'].PHP_EOL.
' Episode: '.$cleanArr['epno']);
@@ -254,16 +254,15 @@ class AniDB
$this->updateRelease($anidbId->anidbid, $release->id);
- ColorCLI::doEcho(
- ColorCLI::headerOver('Matched '.$type.' AniDB ID: ').
+
+ ColorCLI::headerOver('Matched '.$type.' AniDB ID: ').
ColorCLI::primary($anidbId->anidbid).
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($anidbId->title).
ColorCLI::alternateOver(' Episode #: ').
ColorCLI::primary($cleanArr['epno']).
ColorCLI::alternateOver(' Episode Title: ').
- ColorCLI::primary($updatedAni['episode_title']), true
- );
+ ColorCLI::primary($updatedAni['episode_title']);
$matched = true;
} else {
diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php
index f4f55dc49..42db57d33 100755
--- a/Blacklight/processing/post/ProcessAdditional.php
+++ b/Blacklight/processing/post/ProcessAdditional.php
@@ -686,8 +686,7 @@ class ProcessAdditional
$this->_echo(
PHP_EOL.'['.$this->_release->id.']['.
human_filesize($this->_release->size, 1).']',
- 'primaryOver',
- false
+ 'primaryOver'
);
cli_set_process_title($this->_showCLIReleaseID.$this->_release->id);
@@ -979,7 +978,7 @@ class ProcessAdditional
}
if ($this->_releaseHasPassword === true) {
- $this->_echo('Skipping processing of rar '.$nzbFile['title'].' it has a password.', 'primaryOver', false);
+ $this->_echo('Skipping processing of rar '.$nzbFile['title'].' it has a password.', 'primaryOver');
break;
}
@@ -1023,7 +1022,7 @@ class ProcessAdditional
// Echo we downloaded compressed file.
if ($this->_echoCLI) {
- $this->_echo('(cB)', 'primaryOver', false);
+ $this->_echo('(cB)', 'primaryOver');
}
$downloaded++;
@@ -1037,7 +1036,7 @@ class ProcessAdditional
} else {
$failed++;
if ($this->_echoCLI) {
- $this->_echo('f('.$failed.')', 'warningOver', false);
+ $this->_echo('f('.$failed.')', 'warningOver');
}
}
}
@@ -1056,7 +1055,7 @@ class ProcessAdditional
$this->_compressedFilesChecked++;
// Give the data to archive info so it can check if it's a rar.
if ($this->_archiveInfo->setData($compressedData, true) === false) {
- $this->_debug('Data is probably not RAR or ZIP.'.PHP_EOL);
+ $this->_debug('Data is probably not RAR or ZIP.');
return false;
}
@@ -1083,7 +1082,7 @@ class ProcessAdditional
switch ($dataSummary['main_type']) {
case ArchiveInfo::TYPE_RAR:
if ($this->_echoCLI) {
- $this->_echo('r', 'primaryOver', false);
+ $this->_echo('r', 'primaryOver');
}
if ($this->_extractUsingRarInfo === false && $this->_unrarPath !== false) {
@@ -1099,7 +1098,7 @@ class ProcessAdditional
break;
case ArchiveInfo::TYPE_ZIP:
if ($this->_echoCLI) {
- $this->_echo('z', 'primaryOver', false);
+ $this->_echo('z', 'primaryOver');
}
if ($this->_extractUsingRarInfo === false && $this->_7zipPath !== false) {
@@ -1210,14 +1209,14 @@ class ProcessAdditional
$this->_addedFileInfo++;
if ($this->_echoCLI) {
- $this->_echo('^', 'primaryOver', false);
+ $this->_echo('^', 'primaryOver');
}
// Check for "codec spam"
if (preg_match('/alt\.binaries\.movies($|\.divx$)/', $this->_releaseGroupName) &&
preg_match('/[\/\\\\]Codec[\/\\\\]Setup\.exe$/i', $file['name'])
) {
- $this->_debug('Codec spam found, setting release to potentially passworded.'.PHP_EOL);
+ $this->_debug('Codec spam found, setting release to potentially passworded.');
$this->_releaseHasPassword = true;
$this->_passwordStatus[] = Releases::PASSWD_POTENTIAL;
} //Run a PreDB filename check on insert to try and match the release
@@ -1399,7 +1398,7 @@ class ProcessAdditional
if ($sampleBinary !== false) {
if ($this->_echoCLI) {
- $this->_echo('(sB)', 'primaryOver', false);
+ $this->_echo('(sB)', 'primaryOver');
}
// Check if it's more than 40 bytes.
@@ -1419,7 +1418,7 @@ class ProcessAdditional
}
}
} elseif ($this->_echoCLI) {
- $this->_echo('f', 'warningOver', false);
+ $this->_echo('f', 'warningOver');
}
}
}
@@ -1446,7 +1445,7 @@ class ProcessAdditional
if ($mediaBinary !== false) {
if ($this->_echoCLI) {
- $this->_echo('(mB)', 'primaryOver', false);
+ $this->_echo('(mB)', 'primaryOver');
}
// If it's more than 40 bytes...
@@ -1471,7 +1470,7 @@ class ProcessAdditional
}
}
} elseif ($this->_echoCLI) {
- $this->_echo('f', 'warningOver', false);
+ $this->_echo('f', 'warningOver');
}
}
}
@@ -1496,7 +1495,7 @@ class ProcessAdditional
if ($audioBinary !== false) {
if ($this->_echoCLI) {
- $this->_echo('(aB)', 'primaryOver', false);
+ $this->_echo('(aB)', 'primaryOver');
}
$fileLocation = $this->tmpPath.'audio.'.$this->_AudioInfoExtension;
@@ -1506,7 +1505,7 @@ class ProcessAdditional
// Try to get media info / sample of the audio file.
$this->_getAudioInfo($fileLocation, $this->_AudioInfoExtension);
} elseif ($this->_echoCLI) {
- $this->_echo('f', 'warningOver', false);
+ $this->_echo('f', 'warningOver');
}
}
}
@@ -1531,7 +1530,7 @@ class ProcessAdditional
if ($jpgBinary !== false) {
if ($this->_echoCLI) {
- $this->_echo('(jB)', 'primaryOver', false);
+ $this->_echo('(jB)', 'primaryOver');
}
// Try to create a file with it.
@@ -1553,13 +1552,13 @@ class ProcessAdditional
Release::query()->where('id', $this->_release->id)->update(['jpgstatus' => 1]);
if ($this->_echoCLI) {
- $this->_echo('j', 'primaryOver', false);
+ $this->_echo('j', 'primaryOver');
}
}
@unlink($this->tmpPath.'samplepicture.jpg');
} elseif ($this->_echoCLI) {
- $this->_echo('f', 'warningOver', false);
+ $this->_echo('f', 'warningOver');
}
}
}
@@ -1655,7 +1654,7 @@ class ProcessAdditional
new \RecursiveDirectoryIterator($path)
);
} catch (\Throwable $e) {
- $this->_debug('ERROR: Could not open temp dir: '.$e->getMessage().PHP_EOL);
+ $this->_debug('ERROR: Could not open temp dir: '.$e->getMessage());
return false;
}
@@ -1778,7 +1777,7 @@ class ProcessAdditional
$retVal = true;
$this->_foundAudioInfo = true;
if ($this->_echoCLI) {
- $this->_echo('a', 'primaryOver', false);
+ $this->_echo('a', 'primaryOver');
}
break;
}
@@ -1828,7 +1827,7 @@ class ProcessAdditional
$audVal = $this->_foundAudioSample = true;
if ($this->_echoCLI) {
- $this->_echo('A', 'primaryOver', false);
+ $this->_echo('A', 'primaryOver');
}
}
}
@@ -1932,7 +1931,7 @@ class ProcessAdditional
// Check if it saved.
if ($saved === 1) {
if ($this->_echoCLI) {
- $this->_echo('s', 'primaryOver', false);
+ $this->_echo('s', 'primaryOver');
}
return true;
@@ -2043,7 +2042,7 @@ class ProcessAdditional
// Update query to say we got the video.
Release::query()->where('guid', $this->_release->guid)->update(['videostatus' => 1]);
if ($this->_echoCLI) {
- $this->_echo('v', 'primaryOver', false);
+ $this->_echo('v', 'primaryOver');
}
return true;
@@ -2083,7 +2082,7 @@ class ProcessAdditional
$this->_releaseExtra->addFromXml($this->_release->id, $xmlArray);
if ($this->_echoCLI) {
- $this->_echo('m', 'primaryOver', false);
+ $this->_echo('m', 'primaryOver');
}
return true;
@@ -2307,14 +2306,13 @@ class ProcessAdditional
*
* @param string $string String to echo.
* @param string $type Method type.
- * @param bool $newLine Print a new line at the end of the string.
*
* @void
*/
- protected function _echo($string, $type, $newLine = true): void
+ protected function _echo($string, $type): void
{
if ($this->_echoCLI) {
- ColorCLI::doEcho(ColorCLI::$type($string), $newLine);
+ ColorCLI::$type($string);
}
}
@@ -2322,12 +2320,11 @@ class ProcessAdditional
* Echo a string to CLI. For debugging.
*
* @param string $string
- * @param bool $newline
*
* @void
*/
- protected function _debug($string, $newline = true): void
+ protected function _debug($string): void
{
- $this->_echo('DEBUG: '.$string, 'debug', $newline);
+ $this->_echo('DEBUG: '.$string, 'debug');
}
}
diff --git a/Blacklight/processing/tv/TMDB.php b/Blacklight/processing/tv/TMDB.php
index 88eb332de..e31b939a0 100755
--- a/Blacklight/processing/tv/TMDB.php
+++ b/Blacklight/processing/tv/TMDB.php
@@ -99,7 +99,7 @@ class TMDB extends TV
$lookupSetting = true;
if ($this->echooutput && $tvcount > 0) {
- echo ColorCLI::header('Processing TMDB lookup for '.number_format($tvcount).' release(s).');
+ ColorCLI::header('Processing TMDB lookup for '.number_format($tvcount).' release(s).');
}
if ($res instanceof \Traversable) {
@@ -115,7 +115,7 @@ class TMDB extends TV
if (\is_array($release) && $release['name'] !== '') {
if (\in_array($release['cleanname'], $this->titleCache, false)) {
if ($this->echooutput) {
- echo ColorCLI::headerOver('Title: ').
+ ColorCLI::headerOver('Title: ').
ColorCLI::warningOver($release['cleanname']).
ColorCLI::header(' already failed lookup for this site. Skipping.');
}
@@ -134,7 +134,7 @@ class TMDB extends TV
// If lookups are allowed lets try to get it.
if ($videoId === false && $lookupSetting) {
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Checking TMDB for previously failed title: ').
+ ColorCLI::primaryOver('Checking TMDB for previously failed title: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('.');
}
@@ -157,7 +157,7 @@ class TMDB extends TV
}
} else {
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Found local TMDB match for: ').
+ ColorCLI::primaryOver('Found local TMDB match for: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('. Attempting episode lookup!');
}
@@ -174,7 +174,7 @@ class TMDB extends TV
if ($episodeNo === 'all') {
// Set the video ID and leave episode 0
$this->setVideoIdFound($videoId, $row['id'], 0);
- echo ColorCLI::primary('Found TMDB Match for Full Season!');
+ ColorCLI::primary('Found TMDB Match for Full Season!');
continue;
}
@@ -204,7 +204,7 @@ class TMDB extends TV
// Mark the releases video and episode IDs
$this->setVideoIdFound($videoId, $row['id'], $episode);
if ($this->echooutput) {
- echo ColorCLI::primary('Found TMDB Match!');
+ ColorCLI::primary('Found TMDB Match!');
}
continue;
}
diff --git a/Blacklight/processing/tv/TVDB.php b/Blacklight/processing/tv/TVDB.php
index 862f807f7..743f9b9d3 100755
--- a/Blacklight/processing/tv/TVDB.php
+++ b/Blacklight/processing/tv/TVDB.php
@@ -60,7 +60,7 @@ class TVDB extends TV
try {
$this->token = $this->client->authentication()->login(self::TVDB_API_KEY);
} catch (UnauthorizedException $error) {
- ColorCLI::doEcho(ColorCLI::warning('Could not reach TVDB API. Running in local mode only!'), true);
+ ColorCLI::warning('Could not reach TVDB API. Running in local mode only!');
$this->local = true;
}
@@ -85,7 +85,7 @@ class TVDB extends TV
$tvCount = \count($res);
if ($this->echooutput && $tvCount > 0) {
- echo ColorCLI::header('Processing TVDB lookup for '.number_format($tvCount).' release(s).');
+ ColorCLI::header('Processing TVDB lookup for '.number_format($tvCount).' release(s).');
}
$this->titleCache = [];
@@ -97,7 +97,7 @@ class TVDB extends TV
if (\is_array($release) && $release['name'] !== '') {
if (\in_array($release['cleanname'], $this->titleCache, false)) {
if ($this->echooutput) {
- echo ColorCLI::headerOver('Title: ').
+ ColorCLI::headerOver('Title: ').
ColorCLI::warningOver($release['cleanname']).
ColorCLI::header(' already failed lookup for this site. Skipping.');
}
@@ -122,7 +122,7 @@ class TVDB extends TV
// If it doesnt exist locally and lookups are allowed lets try to get it.
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Video ID for ').
+ ColorCLI::primaryOver('Video ID for ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary(' not found in local db, checking web.');
}
@@ -143,7 +143,7 @@ class TVDB extends TV
$tvDbId = (int) $tvdbShow['tvdb'];
}
} elseif ($this->echooutput && $tvDbId !== false) {
- echo ColorCLI::primaryOver('Video ID for ').
+ ColorCLI::primaryOver('Video ID for ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary(' found in local db, attempting episode match.');
}
@@ -168,7 +168,7 @@ class TVDB extends TV
if ($episodeNo === 'all') {
// Set the video ID and leave episode 0
$this->setVideoIdFound($videoId, $row['id'], 0);
- echo ColorCLI::primary('Found TVDB Match for Full Season!');
+ ColorCLI::primary('Found TVDB Match for Full Season!');
continue;
}
@@ -198,7 +198,7 @@ class TVDB extends TV
// Mark the releases video and episode IDs
$this->setVideoIdFound($videoId, $row['id'], $episode);
if ($this->echooutput) {
- echo ColorCLI::primary('Found TVDB Match!');
+ ColorCLI::primary('Found TVDB Match!');
}
} else {
//Processing failed, set the episode ID to the next processing group
@@ -248,7 +248,7 @@ class TVDB extends TV
$response = $this->client->search()->searchByName($cleanName);
} catch (ResourceNotFoundException $e) {
$response = false;
- ColorCLI::doEcho(ColorCLI::notice('Show not found on TVDB'), true);
+ ColorCLI::notice('Show not found on TVDB');
}
if ($response === false && $country !== '') {
@@ -256,7 +256,7 @@ class TVDB extends TV
$response = $this->client->search()->searchByName(rtrim(str_replace($country, '', $cleanName)));
} catch (ResourceNotFoundException $e) {
$response = false;
- ColorCLI::doEcho(ColorCLI::notice('Show not found on TVDB'), true);
+ ColorCLI::notice('Show not found on TVDB');
}
}
@@ -393,13 +393,13 @@ class TVDB extends TV
try {
$poster = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'poster']);
} catch (ResourceNotFoundException $e) {
- ColorCLI::doEcho(ColorCLI::notice('Poster image not found on TVDB'), true);
+ ColorCLI::notice('Poster image not found on TVDB');
}
try {
$fanart = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'fanart']);
} catch (ResourceNotFoundException $e) {
- ColorCLI::doEcho(ColorCLI::notice('Fanart image not found on TVDB'), true);
+ ColorCLI::notice('Fanart image not found on TVDB');
}
$imdbid = $this->client->series()->getById($show->id);
diff --git a/Blacklight/processing/tv/TVMaze.php b/Blacklight/processing/tv/TVMaze.php
index a01c58c2c..38ab42045 100755
--- a/Blacklight/processing/tv/TVMaze.php
+++ b/Blacklight/processing/tv/TVMaze.php
@@ -69,7 +69,7 @@ class TVMaze extends TV
$tvCount = \count($res);
if ($this->echooutput && $tvCount > 0) {
- echo ColorCLI::header('Processing TVMaze lookup for '.number_format($tvCount).' release(s).');
+ ColorCLI::header('Processing TVMaze lookup for '.number_format($tvCount).' release(s).');
}
if ($res instanceof \Traversable) {
@@ -84,7 +84,7 @@ class TVMaze extends TV
if (\is_array($release) && $release['name'] !== '') {
if (\in_array($release['cleanname'], $this->titleCache, false)) {
if ($this->echooutput) {
- echo ColorCLI::headerOver('Title: ').
+ ColorCLI::headerOver('Title: ').
ColorCLI::warningOver($release['cleanname']).
ColorCLI::header(' already failed lookup for this site. Skipping.');
}
@@ -102,7 +102,7 @@ class TVMaze extends TV
if ($videoId === false && $lookupSetting) {
// If lookups are allowed lets try to get it.
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Checking TVMaze for previously failed title: ').
+ ColorCLI::primaryOver('Checking TVMaze for previously failed title: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('.');
}
@@ -128,7 +128,7 @@ class TVMaze extends TV
}
} else {
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Found local TVMaze match for: ').
+ ColorCLI::primaryOver('Found local TVMaze match for: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('. Attempting episode lookup!');
}
@@ -145,7 +145,7 @@ class TVMaze extends TV
if ($episodeNo === 'all') {
// Set the video ID and leave episode 0
$this->setVideoIdFound($videoId, $row['id'], 0);
- echo ColorCLI::primary('Found TVMaze Match for Full Season!');
+ ColorCLI::primary('Found TVMaze Match for Full Season!');
continue;
}
@@ -175,7 +175,7 @@ class TVMaze extends TV
// Mark the releases video and episode IDs
$this->setVideoIdFound($videoId, $row['id'], $episode);
if ($this->echooutput) {
- echo ColorCLI::primary('Found TVMaze Match!');
+ ColorCLI::primary('Found TVMaze Match!');
}
continue;
}
diff --git a/Blacklight/processing/tv/TraktTv.php b/Blacklight/processing/tv/TraktTv.php
index 3bbf4e059..bff543cb3 100755
--- a/Blacklight/processing/tv/TraktTv.php
+++ b/Blacklight/processing/tv/TraktTv.php
@@ -83,7 +83,7 @@ class TraktTv extends TV
$tvcount = \count($res);
if ($this->echooutput && $tvcount > 1) {
- echo ColorCLI::header('Processing TRAKT lookup for '.number_format($tvcount).' release(s).');
+ ColorCLI::header('Processing TRAKT lookup for '.number_format($tvcount).' release(s).');
}
if ($res instanceof \Traversable) {
@@ -96,7 +96,7 @@ class TraktTv extends TV
if (\is_array($release) && $release['name'] !== '') {
if (\in_array($release['cleanname'], $this->titleCache, false)) {
if ($this->echooutput) {
- echo ColorCLI::headerOver('Title: ').
+ ColorCLI::headerOver('Title: ').
ColorCLI::warningOver($release['cleanname']).
ColorCLI::header(' already failed lookup for this site. Skipping.');
}
@@ -118,7 +118,7 @@ class TraktTv extends TV
// If it doesn't exist locally and lookups are allowed lets try to get it.
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Checking Trakt for previously failed title: ').
+ ColorCLI::primaryOver('Checking Trakt for previously failed title: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('.');
}
@@ -132,7 +132,7 @@ class TraktTv extends TV
}
} else {
if ($this->echooutput) {
- echo ColorCLI::primaryOver('Found local TMDB match for: ').
+ ColorCLI::primaryOver('Found local TMDB match for: ').
ColorCLI::headerOver($release['cleanname']).
ColorCLI::primary('. Attempting episode lookup!');
}
@@ -150,7 +150,7 @@ class TraktTv extends TV
if ($episodeNo === 'all') {
// Set the video ID and leave episode 0
$this->setVideoIdFound($videoId, $row['id'], 0);
- echo ColorCLI::primary('Found TRAKT Match for Full Season!');
+ ColorCLI::primary('Found TRAKT Match for Full Season!');
continue;
}
@@ -174,7 +174,7 @@ class TraktTv extends TV
// Mark the releases video and episode IDs
$this->setVideoIdFound($videoId, $row['id'], $episode);
if ($this->echooutput) {
- echo ColorCLI::primary('Found TRAKT Match!');
+ ColorCLI::primary('Found TRAKT Match!');
}
continue;
}
diff --git a/Blacklight/utility/Utility.php b/Blacklight/utility/Utility.php
index 149c76bb6..7ff15f61a 100755
--- a/Blacklight/utility/Utility.php
+++ b/Blacklight/utility/Utility.php
@@ -215,7 +215,7 @@ class Utility
$message = "\nYour database is not up to date. Reported patch levels\n Db: $patch\nfile: $ver\nPlease update.\n php ".
NN_ROOT."./tmux nntmux:db\n";
if (self::isCLI()) {
- echo ColorCLI::error($message);
+ ColorCLI::error($message);
}
throw new \RuntimeException($message);
}
diff --git a/Blacklight/utility/Versions.php b/Blacklight/utility/Versions.php
index 496af4401..1b1e9cc36 100755
--- a/Blacklight/utility/Versions.php
+++ b/Blacklight/utility/Versions.php
@@ -126,7 +126,7 @@ class Versions
$count++;
}
if ($count !== $this->_vers->git->commit) {
- echo ColorCLI::primary("Updating commit number to {$count}");
+ ColorCLI::primary("Updating commit number to {$count}");
$this->_vers->git->commit = $count;
$this->_changes |= self::UPDATED_GIT_COMMIT;
}
@@ -165,17 +165,17 @@ class Versions
// Check if version file's entry is the same as current branch's tag
if (version_compare($this->_vers->git->tag, $latest, '!=')) {
if ($update) {
- echo ColorCLI::primaryOver('Updating tag version to ').ColorCLI::headerOver($latest);
+ ColorCLI::primaryOver('Updating tag version to ').ColorCLI::headerOver($latest);
$this->_vers->git->tag = $ver;
$this->_changes |= self::UPDATED_GIT_TAG;
} else {
- echo ColorCLI::primaryOver('Leaving tag version at ').
+ ColorCLI::primaryOver('Leaving tag version at ').
ColorCLI::headerOver($this->_vers->git->tag);
}
return $this->_vers->git->tag;
} else {
- echo ColorCLI::primaryOver('Tag version is ').ColorCLI::header($latest);
+ ColorCLI::primaryOver('Tag version is ').ColorCLI::header($latest);
}
return false;
@@ -194,7 +194,7 @@ class Versions
if ($this->_vers->sql->db->__toString() !== $this->_vers->sql->file->__toString()) {
if ($update) {
- echo ColorCLI::primaryOver('Updating Db revision to '.$this->_vers->sql->file);
+ ColorCLI::primaryOver('Updating Db revision to '.$this->_vers->sql->file);
$this->_vers->sql->db = $this->_vers->sql->file->__toString();
$this->_changes |= self::UPDATED_SQL_DB_PATCH;
}
@@ -228,7 +228,7 @@ class Versions
if ($update) {
if ($last !== false && $this->_vers->sql->file->__toString() !== $last) {
- echo ColorCLI::primary('Updating latest patch file to '.$last);
+ ColorCLI::primary('Updating latest patch file to '.$last);
$this->_vers->sql->file = $last;
$this->_changes |= self::UPDATED_SQL_FILE_LAST;
}
diff --git a/Changelog b/Changelog
index 6400ef0e7..88d2123ec 100755
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
2018-10-19 DariusIII
+ * Chg: Use league/climate in ColorCLI class
* Chg: Check for empty filename before processing filename matching
* Chg: Increase matching percentage for matchPreDbFiles function
2018-10-18 DariusIII
diff --git a/app/Console/Commands/TmuxUIStart.php b/app/Console/Commands/TmuxUIStart.php
index bcac1ea1f..67afe2a39 100644
--- a/app/Console/Commands/TmuxUIStart.php
+++ b/app/Console/Commands/TmuxUIStart.php
@@ -42,7 +42,7 @@ class TmuxUIStart extends Command
// Kill the placeholder
exec('tmux kill-session -t placeholder');
if ($session === null) {
- ColorCLI::doEcho(ColorCLI::info('Starting the tmux server and monitor script.'), true);
+ ColorCLI::info('Starting the tmux server and monitor script.');
passthru('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/update/tmux/run.php');
}
}
diff --git a/app/Extensions/helper/helpers.php b/app/Extensions/helper/helpers.php
index 2cd6633a1..bcde8b807 100644
--- a/app/Extensions/helper/helpers.php
+++ b/app/Extensions/helper/helpers.php
@@ -182,18 +182,6 @@ if (! function_exists('makeFieldLinks')) {
}
}
- if (! function_exists('color')) {
- /**
- * @param string $string
- *
- * @return \Colors\Color
- */
- function color($string = ''): Color
- {
- return new Color($string);
- }
- }
-
if (! function_exists('human_filesize')) {
/**
diff --git a/app/Models/Group.php b/app/Models/Group.php
index 235631392..255f8a2e6 100644
--- a/app/Models/Group.php
+++ b/app/Models/Group.php
@@ -589,10 +589,6 @@ class Group extends Model
public static function disableIfNotExist($id): void
{
self::updateGroupStatus($id, 'active');
- ColorCLI::doEcho(
- ColorCLI::error(
- 'Group does not exist on server, disabling'
- ), true
- );
+ ColorCLI::error('Group does not exist on server, disabling');
}
}
diff --git a/app/Models/Predb.php b/app/Models/Predb.php
index c40fca8cc..4c95da098 100644
--- a/app/Models/Predb.php
+++ b/app/Models/Predb.php
@@ -98,7 +98,7 @@ class Predb extends Model
$updated = 0;
if (config('nntmux.echocli')) {
- echo ColorCLI::header('Querying DB for release search names not matched with PreDB titles.');
+ ColorCLI::header('Querying DB for release search names not matched with PreDB titles.');
}
$query = self::query()
@@ -113,7 +113,7 @@ class Predb extends Model
if ($res !== null) {
$total = \count($res);
- echo ColorCLI::primary(number_format($total).' releases to match.');
+ ColorCLI::primary(number_format($total).' releases to match.');
foreach ($res as $row) {
Release::query()->where('id', $row['releases_id'])->update(['predb_id' => $row['predb_id']]);
@@ -129,7 +129,7 @@ class Predb extends Model
}
if (config('nntmux.echocli')) {
- echo ColorCLI::header(
+ ColorCLI::header(
'Matched '.number_format(($updated > 0) ? $updated : 0).' PreDB titles to release search names.'
);
}
diff --git a/cli/data/populate_anidb.php b/cli/data/populate_anidb.php
index 8b92313af..1907cc8bb 100755
--- a/cli/data/populate_anidb.php
+++ b/cli/data/populate_anidb.php
@@ -18,14 +18,12 @@ if ($argc > 1 && $argv[1] === 'true' && isset($argv[2])) {
}
}
} else {
- ColorCLI::doEcho(
- PHP_EOL.ColorCLI::error(
+
+ ColorCLI::error(
'To execute this script you must provide a boolean argument.'.PHP_EOL.
'Argument1: true|false to run this script or not'.PHP_EOL.
'Argument2: full|info for what type of data to populate.'.PHP_EOL.
'Argument3 (optional) anidbid to fetch info for'.PHP_EOL.
'WARNING: Argument "info" without third argument will get you banned from AniDB almost instantly'
- ),
- true
);
}
diff --git a/cli/data/predb_import_daily_batch.php b/cli/data/predb_import_daily_batch.php
index 1c52db9d5..fb1509d0d 100755
--- a/cli/data/predb_import_daily_batch.php
+++ b/cli/data/predb_import_daily_batch.php
@@ -145,7 +145,7 @@ foreach ($data as $dir => $files) {
$verbose = $argv[3] === true;
if ($verbose) {
- ColorCLI::doEcho(ColorCLI::info('Clearing import table'), true);
+ ColorCLI::info('Clearing import table');
}
// Truncate to clear any old data
@@ -163,7 +163,7 @@ foreach ($data as $dir => $files) {
// Remove any titles where length <=8
if ($verbose === true) {
- ColorCLI::doEcho(ColorCLI::info('Deleting any records where title <=8 from Temporary Table'), true);
+ ColorCLI::info('Deleting any records where title <=8 from Temporary Table');
}
$predb->executeDeleteShort();
@@ -173,7 +173,7 @@ foreach ($data as $dir => $files) {
// Fill the groups_id
$predb->executeUpdateGroupID();
- ColorCLI::doEcho(ColorCLI::info('Inserting records from temporary table into predb table'), true);
+ ColorCLI::info('Inserting records from temporary table into predb table');
$predb->executeInsert();
// Delete the dump.
diff --git a/composer.json b/composer.json
index e69ca74e3..9690c2be9 100755
--- a/composer.json
+++ b/composer.json
@@ -146,11 +146,11 @@
"james-heinrich/getid3": "1.9.*",
"joshpinkney/tv-maze-php-api": "dev-master",
"jrean/laravel-user-verification": "^7.0",
- "kevinlebrun/colors.php": "^1.0",
"laravel/framework": "5.7.*",
"laravel/scout": "^5.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.6",
+ "league/climate": "^3.4",
"mayconbordin/l5-fixtures": "dev-master",
"messerli90/igdb": "^1.0",
"monolog/monolog": "^1.22",
diff --git a/composer.lock b/composer.lock
index 97dc50542..e911c8d25 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "57080088606a96b9762d3a7a7498116c",
+ "content-hash": "b654a0021e4b09d9f556cda27ede76b8",
"packages": [
{
"name": "aharen/omdbapi",
@@ -3694,57 +3694,6 @@
],
"time": "2018-09-13T10:21:07+00:00"
},
- {
- "name": "kevinlebrun/colors.php",
- "version": "1.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/kevinlebrun/colors.php.git",
- "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/kevinlebrun/colors.php/zipball/cdda5eee41314b87cd5a8bb91b1ffc7c0210e673",
- "reference": "cdda5eee41314b87cd5a8bb91b1ffc7c0210e673",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "3.7.*",
- "satooshi/php-coveralls": "1.0.*",
- "squizlabs/php_codesniffer": "1.*"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Colors": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Kevin Le Brun",
- "email": "lebrun.k@gmail.com",
- "homepage": "http://kevinlebrun.fr",
- "role": "developer"
- }
- ],
- "description": "Colors for PHP CLI scripts",
- "homepage": "https://github.com/kevinlebrun/colors.php",
- "keywords": [
- "cli",
- "color",
- "colors",
- "console",
- "shell"
- ],
- "time": "2018-05-30T08:34:23+00:00"
- },
{
"name": "kevinrob/guzzle-cache-middleware",
"version": "v2.1.1",
@@ -4158,6 +4107,67 @@
"homepage": "https://laravelcollective.com",
"time": "2018-09-05T18:32:53+00:00"
},
+ {
+ "name": "league/climate",
+ "version": "3.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/thephpleague/climate.git",
+ "reference": "d657a19837c1f79a891381fb128b755aa3386381"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/thephpleague/climate/zipball/d657a19837c1f79a891381fb128b755aa3386381",
+ "reference": "d657a19837c1f79a891381fb128b755aa3386381",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6|^7.0",
+ "psr/log": "^1.0",
+ "seld/cli-prompt": "^1.0"
+ },
+ "require-dev": {
+ "mikey179/vfsstream": "^1.4",
+ "mockery/mockery": "^1.0",
+ "phpunit/phpunit": "^5.7.16"
+ },
+ "suggest": {
+ "ext-mbstring": "If ext-mbstring is not available you MUST install symfony/polyfill-mbstring"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "League\\CLImate\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Craig Duncan",
+ "email": "git@duncanc.co.uk",
+ "homepage": "https://github.com/duncan3dc",
+ "role": "Developer"
+ },
+ {
+ "name": "Joe Tannenbaum",
+ "email": "hey@joe.codes",
+ "homepage": "http://joe.codes/",
+ "role": "Developer"
+ }
+ ],
+ "description": "PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.",
+ "keywords": [
+ "cli",
+ "colors",
+ "command",
+ "php",
+ "terminal"
+ ],
+ "time": "2018-04-29T16:43:54+00:00"
+ },
{
"name": "league/csv",
"version": "8.0.0",
@@ -5995,6 +6005,54 @@
],
"time": "2017-11-06T19:17:52+00:00"
},
+ {
+ "name": "seld/cli-prompt",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/cli-prompt.git",
+ "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+ "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Seld\\CliPrompt\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be"
+ }
+ ],
+ "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type",
+ "keywords": [
+ "cli",
+ "console",
+ "hidden",
+ "input",
+ "prompt"
+ ],
+ "time": "2017-03-18T11:32:45+00:00"
+ },
{
"name": "smarty/smarty",
"version": "v3.1.33",
diff --git a/misc/testing/DB/reset_postprocessing.php b/misc/testing/DB/reset_postprocessing.php
index 88fc9e8b3..cea3214b4 100755
--- a/misc/testing/DB/reset_postprocessing.php
+++ b/misc/testing/DB/reset_postprocessing.php
@@ -32,7 +32,7 @@ if (isset($argv[1]) && $argv[1] === 'all' && isset($argv[2]) && $argv[2] === 'tr
$pdo->exec('TRUNCATE TABLE anidb_info');
$pdo->exec('TRUNCATE TABLE anidb_episodes');
}
- echo ColorCLI::header('Resetting all postprocessing');
+ ColorCLI::header('Resetting all postprocessing');
$qry = $pdo->query('SELECT id FROM releases');
$affected = 0;
if ($qry instanceof \Traversable) {
@@ -59,10 +59,10 @@ if (isset($argv[1]) && ($argv[1] === 'consoles' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE consoleinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Console postprocessing');
+ ColorCLI::header('Resetting all Console postprocessing');
$where = ' WHERE consoleinfo_id IS NOT NULL';
} else {
- echo ColorCLI::header('Resetting all failed Console postprocessing');
+ ColorCLI::header('Resetting all failed Console postprocessing');
$where = ' WHERE consoleinfo_id IN (-2, 0) AND categories_id BETWEEN '.Category::GAME_ROOT.' AND '.Category::GAME_OTHER;
}
@@ -79,7 +79,7 @@ if (isset($argv[1]) && ($argv[1] === 'consoles' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Console Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' consoleinfoIDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' consoleinfoIDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'games' || $argv[1] === 'all')) {
$ran = true;
@@ -87,10 +87,10 @@ if (isset($argv[1]) && ($argv[1] === 'games' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE gamesinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Games postprocessing');
+ ColorCLI::header('Resetting all Games postprocessing');
$where = ' WHERE gamesinfo_id != 0';
} else {
- echo ColorCLI::header('Resetting all failed Games postprocessing');
+ ColorCLI::header('Resetting all failed Games postprocessing');
$where = ' WHERE gamesinfo_id IN (-2, 0) AND categories_id = 4050';
}
@@ -107,7 +107,7 @@ if (isset($argv[1]) && ($argv[1] === 'games' || $argv[1] === 'all')) {
$pdo->exec('UPDATE releases SET gamesinfo_id = 0 WHERE id = '.$releases['id']);
$consoletools->overWritePrimary('Resetting Games Releases: '.$consoletools->percentString(++$concount, $total));
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' gameinfo_IDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' gameinfo_IDs reset.');
}
}
if (isset($argv[1]) && ($argv[1] === 'movies' || $argv[1] === 'all')) {
@@ -116,10 +116,10 @@ if (isset($argv[1]) && ($argv[1] === 'movies' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE movieinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Movie postprocessing');
+ ColorCLI::header('Resetting all Movie postprocessing');
$where = ' WHERE imdbid IS NOT NULL';
} else {
- echo ColorCLI::header('Resetting all failed Movie postprocessing');
+ ColorCLI::header('Resetting all failed Movie postprocessing');
$where = ' WHERE imdbid IN (-2, 0) AND categories_id BETWEEN '.Category::MOVIE_ROOT.' AND '.Category::MOVIE_OTHER;
}
@@ -136,7 +136,7 @@ if (isset($argv[1]) && ($argv[1] === 'movies' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Movie Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' imdbIDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' imdbIDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'music' || $argv[1] === 'all')) {
$ran = true;
@@ -144,10 +144,10 @@ if (isset($argv[1]) && ($argv[1] === 'music' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE musicinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Music postprocessing');
+ ColorCLI::header('Resetting all Music postprocessing');
$where = ' WHERE musicinfo_id IS NOT NULL';
} else {
- echo ColorCLI::header('Resetting all failed Music postprocessing');
+ ColorCLI::header('Resetting all failed Music postprocessing');
$where = ' WHERE musicinfo_id IN (-2, 0) AND categories_id BETWEEN '.Category::MUSIC_ROOT.' AND '.Category::MUSIC_OTHER;
}
@@ -160,19 +160,19 @@ if (isset($argv[1]) && ($argv[1] === 'music' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Music Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' musicinfo_ids reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' musicinfo_ids reset.');
}
if (isset($argv[1]) && ($argv[1] === 'misc' || $argv[1] === 'all')) {
$ran = true;
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Additional postprocessing');
+ ColorCLI::header('Resetting all Additional postprocessing');
$where = ' WHERE (haspreview != -1 AND haspreview != 0) OR (passwordstatus != -1 AND passwordstatus != 0) OR jpgstatus != 0 OR videostatus != 0 OR audiostatus != 0';
} else {
- echo ColorCLI::header('Resetting all failed Additional postprocessing');
+ ColorCLI::header('Resetting all failed Additional postprocessing');
$where = ' WHERE haspreview < -1 OR haspreview = 0 OR passwordstatus < -1 OR passwordstatus = 0 OR jpgstatus < 0 OR videostatus < 0 OR audiostatus < 0';
}
- echo ColorCLI::primary('SELECT id FROM releases'.$where);
+ ColorCLI::primary('SELECT id FROM releases'.$where);
$qry = $pdo->query('SELECT id FROM releases'.$where);
if ($qry !== false) {
$total = $qry->rowCount();
@@ -186,7 +186,7 @@ if (isset($argv[1]) && ($argv[1] === 'misc' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' Releases reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' Releases reset.');
}
if (isset($argv[1]) && ($argv[1] === 'tv' || $argv[1] === 'all')) {
$ran = true;
@@ -196,10 +196,10 @@ if (isset($argv[1]) && ($argv[1] === 'tv' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE tv_episodes');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all TV postprocessing');
+ ColorCLI::header('Resetting all TV postprocessing');
$where = ' WHERE videos_id != 0 AND tv_episodes_id != 0 AND categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER;
} else {
- echo ColorCLI::header('Resetting all failed TV postprocessing');
+ ColorCLI::header('Resetting all failed TV postprocessing');
$where = ' WHERE tv_episodes_id < 0 AND categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER;
}
@@ -216,7 +216,7 @@ if (isset($argv[1]) && ($argv[1] === 'tv' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting TV Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' Video IDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' Video IDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'anime' || $argv[1] === 'all')) {
$ran = true;
@@ -225,10 +225,10 @@ if (isset($argv[1]) && ($argv[1] === 'anime' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE anidb_episodes');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Anime postprocessing');
+ ColorCLI::header('Resetting all Anime postprocessing');
$where = ' WHERE categories_id = 5070';
} else {
- echo ColorCLI::header('Resetting all failed Anime postprocessing');
+ ColorCLI::header('Resetting all failed Anime postprocessing');
$where = ' WHERE anidbid BETWEEN -2 AND -1 AND categories_id = '.Category::TV_ANIME;
}
@@ -245,7 +245,7 @@ if (isset($argv[1]) && ($argv[1] === 'anime' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Anime Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' anidbIDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' anidbIDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'books' || $argv[1] === 'all')) {
$ran = true;
@@ -253,10 +253,10 @@ if (isset($argv[1]) && ($argv[1] === 'books' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE bookinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all Book postprocessing');
+ ColorCLI::header('Resetting all Book postprocessing');
$where = ' WHERE bookinfo_id IS NOT NULL';
} else {
- echo ColorCLI::header('Resetting all failed Book postprocessing');
+ ColorCLI::header('Resetting all failed Book postprocessing');
$where = ' WHERE bookinfo_id IN (-2, 0) AND categories_id BETWEEN '.Category::BOOKS_ROOT.' AND '.Category::BOOKS_UNKNOWN;
}
@@ -269,7 +269,7 @@ if (isset($argv[1]) && ($argv[1] === 'books' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting Book Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' bookinfoIDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' bookinfoIDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'xxx' || $argv[1] === 'all')) {
$ran = true;
@@ -277,10 +277,10 @@ if (isset($argv[1]) && ($argv[1] === 'xxx' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE xxxinfo');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all XXX postprocessing');
+ ColorCLI::header('Resetting all XXX postprocessing');
$where = ' WHERE xxxinfo_id != 0';
} else {
- echo ColorCLI::header('Resetting all failed XXX postprocessing');
+ ColorCLI::header('Resetting all failed XXX postprocessing');
$where = ' WHERE xxxinfo_id IN (-2, 0) AND categories_id BETWEEN '.Category::XXX_ROOT.' AND '.Category::XXX_X264;
}
@@ -296,7 +296,7 @@ if (isset($argv[1]) && ($argv[1] === 'xxx' || $argv[1] === 'all')) {
));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' xxxinfo_IDs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' xxxinfo_IDs reset.');
}
if (isset($argv[1]) && ($argv[1] === 'nfos' || $argv[1] === 'all')) {
$ran = true;
@@ -304,10 +304,10 @@ if (isset($argv[1]) && ($argv[1] === 'nfos' || $argv[1] === 'all')) {
$pdo->exec('TRUNCATE TABLE release_nfos');
}
if (isset($argv[2]) && $argv[2] === 'true') {
- echo ColorCLI::header('Resetting all NFO postprocessing');
+ ColorCLI::header('Resetting all NFO postprocessing');
$where = ' WHERE nfostatus != -1';
} else {
- echo ColorCLI::header('Resetting all failed NFO postprocessing');
+ ColorCLI::header('Resetting all failed NFO postprocessing');
$where = ' WHERE nfostatus < -1';
}
@@ -320,7 +320,7 @@ if (isset($argv[1]) && ($argv[1] === 'nfos' || $argv[1] === 'all')) {
$consoletools->overWritePrimary('Resetting NFO Releases: '.$consoletools->percentString(++$concount, $total));
}
}
- echo ColorCLI::header(PHP_EOL.number_format($concount).' NFOs reset.');
+ ColorCLI::header(PHP_EOL.number_format($concount).' NFOs reset.');
}
if ($ran === false) {
diff --git a/misc/testing/Dev/clean_nzbs.php b/misc/testing/Dev/clean_nzbs.php
index 6708ebe80..a3ea9ea11 100644
--- a/misc/testing/Dev/clean_nzbs.php
+++ b/misc/testing/Dev/clean_nzbs.php
@@ -12,9 +12,10 @@ use Blacklight\utility\Utility;
$dir = NN_RES.'movednzbs/';
if (! isset($argv[1]) || ! in_array($argv[1], ['true', 'move'])) {
- exit(ColorCLI::error("\nThis script can remove all nzbs not found in the db and all releases with no nzbs found. It can also move invalid nzbs.\n\n"
+ ColorCLI::error("This script can remove all nzbs not found in the db and all releases with no nzbs found. It can also move invalid nzbs.\n\n"
."php $argv[0] true ...: For a dry run, to see how many would be moved.\n"
- ."php $argv[0] move ...: Move NZBs that are possibly bad or have no release. They are moved into this folder: $dir\n"));
+ ."php $argv[0] move ...: Move NZBs that are possibly bad or have no release. They are moved into this folder: $dir");
+ exit();
}
if (! is_dir($dir) && ! mkdir($dir) && ! is_dir($dir)) {
@@ -29,8 +30,8 @@ $timestart = date('r');
$checked = $moved = 0;
$couldbe = ($argv[1] === 'true') ? 'could be ' : '';
-echo ColorCLI::header('Getting List of nzbs to check against db.');
-echo ColorCLI::header("Checked / {$couldbe}moved\n");
+ColorCLI::header('Getting List of nzbs to check against db.');
+ColorCLI::header("Checked / {$couldbe}moved\n");
$dirItr = new \RecursiveDirectoryIterator(Settings::settingValue('..nzbpath'));
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
@@ -52,9 +53,9 @@ foreach ($itr as $filePath) {
}
}
-echo ColorCLI::header("\n".number_format($checked).' nzbs checked, '.number_format($moved).' nzbs '.$couldbe.'moved.');
-echo ColorCLI::header('Getting List of releases to check against nzbs.');
-echo ColorCLI::header("Checked / releases deleted\n");
+ColorCLI::header("\n".number_format($checked).' nzbs checked, '.number_format($moved).' nzbs '.$couldbe.'moved.');
+ColorCLI::header('Getting List of releases to check against nzbs.');
+ColorCLI::header("Checked / releases deleted\n");
$checked = $deleted = 0;
@@ -70,5 +71,5 @@ $res = DB::select('SELECT id, guid, nzbstatus FROM releases');
$checked++;
echo "$checked / $deleted\r";
}
-echo ColorCLI::header("\n".number_format($checked).' releases checked, '.number_format($deleted).' releases deleted.');
-echo ColorCLI::header("Script started at [$timestart], finished at [".date('r').']');
+ColorCLI::header("\n".number_format($checked).' releases checked, '.number_format($deleted).' releases deleted.');
+ColorCLI::header("Script started at [$timestart], finished at [".date('r').']');
diff --git a/misc/testing/PostProc/check_covers.php b/misc/testing/PostProc/check_covers.php
index c09308bc1..de48987e2 100644
--- a/misc/testing/PostProc/check_covers.php
+++ b/misc/testing/PostProc/check_covers.php
@@ -28,7 +28,7 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
if (isset($argv[2]) && is_numeric($argv[2])) {
$limit = $argv[2];
}
- ColorCLI::doEcho(ColorCLI::header('Scanning for releases missing covers'), true);
+ ColorCLI::header('Scanning for releases missing covers');
$res = DB::select('SELECT r.id, r.imdbid
FROM releases r
LEFT JOIN movieinfo m ON m.imdbid = r.imdbid
@@ -38,7 +38,7 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
$nzbpath = $path2cover.$row->imdbid.'-cover.jpg';
if (! file_exists($nzbpath)) {
$counterfixed++;
- ColorCLI::doEcho(ColorCLI::warning('Missing cover '.$nzbpath), true);
+ ColorCLI::warning('Missing cover '.$nzbpath);
if ($argv[1] === 'true') {
$cover = $movie->updateMovieInfo($row->imdbid);
if ($cover === false || ! file_exists($nzbpath)) {
@@ -51,12 +51,13 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
break;
}
}
- ColorCLI::doEcho(ColorCLI::header('Total releases missing covers that '.$couldbe.'their covers fixed = '.number_format($counterfixed)), true);
+ ColorCLI::header('Total releases missing covers that '.$couldbe.'their covers fixed = '.number_format($counterfixed));
} else {
- exit(ColorCLI::header("\nThis script checks if release covers actually exist on disk.\n\n"
+ ColorCLI::header("\nThis script checks if release covers actually exist on disk.\n\n"
."Releases without covers may be reset for post-processing, thus regenerating them and related meta data.\n\n"
."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n"
."Optional LIMIT parameter restricts number of releases to be reset.\n\n"
."php $argv[0] check [LIMIT] ...: Dry run, displays missing covers.\n"
- ."php $argv[0] true [LIMIT] ...: Re-process releases missing covers.\n"));
+ ."php $argv[0] true [LIMIT] ...: Re-process releases missing covers.\n");
+ exit();
}
diff --git a/misc/testing/PostProc/check_previews.php b/misc/testing/PostProc/check_previews.php
index 3f9d3c19e..05a5fd0db 100644
--- a/misc/testing/PostProc/check_previews.php
+++ b/misc/testing/PostProc/check_previews.php
@@ -35,14 +35,14 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
if (isset($argv[2]) && is_numeric($argv[2])) {
$limit = $argv[2];
}
- echo ColorCLI::header('Scanning for releases missing previews');
+ ColorCLI::header('Scanning for releases missing previews');
$res = $pdo->query('SELECT id, guid FROM releases where nzbstatus = 1 AND haspreview = 1');
if ($res instanceof \Traversable) {
foreach ($res as $row) {
$nzbpath = $path2preview.$row['guid'].'_thumb.jpg';
if (! file_exists($nzbpath)) {
$counterfixed++;
- echo ColorCLI::warning('Missing preview '.$nzbpath);
+ ColorCLI::warning('Missing preview '.$nzbpath);
if ($argv[1] === 'true') {
$pdo->exec(
sprintf('UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %s', $row['id'])
@@ -55,12 +55,13 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
}
}
}
- echo ColorCLI::header('Total releases missing previews that '.$couldbe.'reset for reprocessing= '.number_format($counterfixed));
+ ColorCLI::header('Total releases missing previews that '.$couldbe.'reset for reprocessing= '.number_format($counterfixed));
} else {
- exit(ColorCLI::header("\nThis script checks if release previews actually exist on disk.\n\n"
+ ColorCLI::header("\nThis script checks if release previews actually exist on disk.\n\n"
."Releases without previews may be reset for post-processing, thus regenerating them and related meta data.\n\n"
."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n"
."Optional LIMIT parameter restricts number of releases to be reset.\n\n"
."php $argv[0] check [LIMIT] ...: Dry run, displays missing previews.\n"
- ."php $argv[0] true [LIMIT] ...: Re-process releases missing previews.\n"));
+ ."php $argv[0] true [LIMIT] ...: Re-process releases missing previews.\n");
+ exit();
}
diff --git a/misc/testing/PostProc/getConsole.php b/misc/testing/PostProc/getConsole.php
index e764d81c2..ff9e93396 100644
--- a/misc/testing/PostProc/getConsole.php
+++ b/misc/testing/PostProc/getConsole.php
@@ -21,7 +21,7 @@ $res = $pdo->query(
)
);
if ($res instanceof \Traversable) {
- echo ColorCLI::header('Updating console info for '.number_format($res->rowCount()).' releases.');
+ ColorCLI::header('Updating console info for '.number_format($res->rowCount()).' releases.');
foreach ($res as $arr) {
$starttime = microtime(true);
@@ -29,14 +29,14 @@ if ($res instanceof \Traversable) {
if ($gameInfo !== false) {
$game = $console->updateConsoleInfo($gameInfo);
if ($game === false) {
- echo ColorCLI::primary($gameInfo['release'].' not found');
+ ColorCLI::primary($gameInfo['release'].' not found');
}
}
// amazon limits are 1 per 1 sec
$diff = floor((microtime(true) - $starttime) * 1000000);
if (1000000 - $diff > 0) {
- echo ColorCLI::alternate('Sleeping');
+ ColorCLI::alternate('Sleeping');
usleep(1000000 - $diff);
}
}
diff --git a/misc/testing/PostProc/getGameCovers.php b/misc/testing/PostProc/getGameCovers.php
index da4e4a8ea..e6a4e4662 100644
--- a/misc/testing/PostProc/getGameCovers.php
+++ b/misc/testing/PostProc/getGameCovers.php
@@ -15,16 +15,16 @@ $res = $pdo->query(
);
$total = $res->rowCount();
if ($total > 0) {
- echo ColorCLI::header('Updating game covers for '.number_format($total).' releases.');
+ ColorCLI::header('Updating game covers for '.number_format($total).' releases.');
foreach ($res as $arr) {
$starttime = microtime(true);
$gameInfo = $game->parseTitle($arr['title']);
if ($gameInfo !== false) {
- echo ColorCLI::primary('Looking up: '.$gameInfo['release']);
+ ColorCLI::primary('Looking up: '.$gameInfo['release']);
$gameData = $game->updateGamesInfo($gameInfo);
if ($gameData === false) {
- echo ColorCLI::primary($gameInfo['release'].' not found');
+ ColorCLI::primary($gameInfo['release'].' not found');
} else {
if (file_exists(NN_COVERS.'games'.DS.$gameData.'.jpg')) {
$pdo->exec(sprintf('UPDATE gamesinfo SET cover = 1 WHERE id = %d', $arr['id']));
@@ -35,7 +35,7 @@ if ($total > 0) {
// amazon limits are 1 per 1 sec
$diff = floor((microtime(true) - $starttime) * 1000000);
if (1000000 - $diff > 0) {
- echo ColorCLI::alternate('Sleeping');
+ ColorCLI::alternate('Sleeping');
usleep(1000000 - $diff);
}
}
diff --git a/misc/testing/PostProc/getImdb.php b/misc/testing/PostProc/getImdb.php
index 79157135c..3c03fb1d6 100644
--- a/misc/testing/PostProc/getImdb.php
+++ b/misc/testing/PostProc/getImdb.php
@@ -14,7 +14,7 @@ $movies = $pdo->query('SELECT imdbid FROM movieinfo WHERE tmdbid = 0 ORDER BY id
if ($movies instanceof \Traversable) {
$count = $movies->rowCount();
if ($count > 0) {
- echo ColorCLI::header('Updating movie info for '.number_format($count).' movies.');
+ ColorCLI::header('Updating movie info for '.number_format($count).' movies.');
foreach ($movies as $mov) {
$startTime = microtime(true);
@@ -28,6 +28,6 @@ if ($movies instanceof \Traversable) {
}
}
} else {
- echo ColorCLI::header('No movies to update');
+ ColorCLI::header('No movies to update');
}
}
diff --git a/misc/testing/PostProc/getMovieCovers.php b/misc/testing/PostProc/getMovieCovers.php
index 0a6f6fff8..4db693a6f 100644
--- a/misc/testing/PostProc/getMovieCovers.php
+++ b/misc/testing/PostProc/getMovieCovers.php
@@ -12,11 +12,11 @@ $movie = new Movie(['Echo' => true]);
$movies = MovieInfo::query()->where('cover', '=', 0)->orderBy('year')->orderByDesc('id')->get(['imdbid']);
$count = $movies->count();
if ($count > 0) {
- echo ColorCLI::primary('Updating '.number_format($count).' movie covers.');
+ ColorCLI::primary('Updating '.number_format($count).' movie covers.');
foreach ($movies as $mov) {
$startTime = microtime(true);
$mov = $movie->updateMovieInfo($mov['imdbid']);
}
} else {
- echo ColorCLI::header('No movie covers to update');
+ ColorCLI::header('No movie covers to update');
}
diff --git a/misc/testing/PostProc/getTraktData.php b/misc/testing/PostProc/getTraktData.php
index 7b5a0bc49..7162398c4 100644
--- a/misc/testing/PostProc/getTraktData.php
+++ b/misc/testing/PostProc/getTraktData.php
@@ -13,20 +13,20 @@ $movie = new Movie(['Echo' => true]);
$movies = MovieInfo::query()->where('imdbid', '<>', 0)->where('traktid', '=', 0)->get(['imdbid']);
$count = $movies->count();
if ($count > 0) {
- echo ColorCLI::primary('Updating '.number_format($count).' movies for TraktTV id.');
+ ColorCLI::primary('Updating '.number_format($count).' movies for TraktTV id.');
foreach ($movies as $mov) {
$traktTv = new TraktTv(['Settings' => null]);
$traktmovie = $traktTv->client->movieSummary('tt'.str_pad($mov['imdbid'], 7, '0', STR_PAD_LEFT), 'full');
if ($traktmovie !== false) {
- ColorCLI::doEcho(ColorCLI::info('Updating IMDb id: tt'.str_pad($mov['imdbid'], 7, '0', STR_PAD_LEFT)), true);
+ ColorCLI::info('Updating IMDb id: tt'.str_pad($mov['imdbid'], 7, '0', STR_PAD_LEFT));
$trakt = $movie->parseTraktTv($traktmovie);
if ($trakt === true) {
- ColorCLI::doEcho(ColorCLI::info('Added traktid: '.$traktmovie['ids']['trakt']), true);
+ ColorCLI::info('Added traktid: '.$traktmovie['ids']['trakt']);
} else {
- ColorCLI::doEcho(ColorCLI::info('No traktid found.'), true);
+ ColorCLI::info('No traktid found.');
}
}
}
} else {
- echo ColorCLI::header('No movies to update');
+ ColorCLI::header('No movies to update');
}
diff --git a/misc/testing/PostProc/getXXXSamples.php b/misc/testing/PostProc/getXXXSamples.php
index 07b008674..5219ab3d9 100644
--- a/misc/testing/PostProc/getXXXSamples.php
+++ b/misc/testing/PostProc/getXXXSamples.php
@@ -18,7 +18,7 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
$limit = $argv[2];
}
- echo ColorCLI::header('Scanning for XXX UHD/HD/SD releases missing sample images');
+ ColorCLI::header('Scanning for XXX UHD/HD/SD releases missing sample images');
$res = $pdo->query(sprintf('SELECT r.id, r.guid AS guid, r.searchname AS searchname
FROM releases r
WHERE r.nzbstatus = 1 AND r.jpgstatus = 0 AND r.categories_id IN (%s, %s, %s) ORDER BY r.adddate DESC', Category::XXX_CLIPHD, Category::XXX_CLIPSD, Category::XXX_UHD));
@@ -35,10 +35,10 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
}
$sample = $releaseImage->saveImage($row['guid'].'_thumb', $imgpath, $releaseImage->jpgSavePath, 650, 650);
if ($sample !== 0) {
- echo ColorCLI::info('Downloaded sample for '.$row['searchname']);
+ ColorCLI::info('Downloaded sample for '.$row['searchname']);
$pdo->exec(sprintf('UPDATE releases SET jpgstatus = 1 WHERE id = %d', $row['id']));
} else {
- echo ColorCLI::notice('Sample download failed!');
+ ColorCLI::notice('Sample download failed!');
$pdo->exec(sprintf('UPDATE releases SET jpgstatus = -2 WHERE id = %d', $row['id']));
}
}
@@ -48,9 +48,10 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) {
break;
}
}
- echo ColorCLI::header('Total releases missing samples that '.$couldbe.'their samples updated = '.number_format($counterfixed));
+ ColorCLI::header('Total releases missing samples that '.$couldbe.'their samples updated = '.number_format($counterfixed));
} else {
- exit(ColorCLI::header("\nThis script checks if XXX release samples actually exist on disk.\n\n"
+ ColorCLI::header("\nThis script checks if XXX release samples actually exist on disk.\n\n"
."php $argv[0] check ...: Dry run, displays missing samples.\n"
- ."php $argv[0] true ...: Update XXX releases missing samples.\n"));
+ ."php $argv[0] true ...: Update XXX releases missing samples.\n");
+ exit();
}
diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php
index e12cc1be0..6d57d433a 100644
--- a/misc/testing/PostProc/updateBookImages.php
+++ b/misc/testing/PostProc/updateBookImages.php
@@ -8,7 +8,8 @@ require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/book and compare to db->bookinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/book and compare to db->bookinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$path2covers = NN_COVERS.'book'.DS;
@@ -16,8 +17,8 @@ $path2covers = NN_COVERS.'book'.DS;
$dirItr = new \RecursiveDirectoryIterator($path2covers);
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
- if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) {
- preg_match('/(\d+)\.jpg/', basename($filePath), $match);
+ if (is_file($filePath) && preg_match('/\d+\.jpg$/', $filePath)) {
+ preg_match('/(\d+)\.jpg$/', basename($filePath), $match);
if (isset($match[1])) {
$run = BookInfo::query()->where('cover', '=', 0)->where('id', $match[1])->update(['cover' => 1]);
if ($run >= 1) {
@@ -25,7 +26,7 @@ foreach ($itr as $filePath) {
} else {
$run = BookInfo::query()->where('id', $match[1])->select(['id'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -36,9 +37,9 @@ $qry = BookInfo::query()->where('cover', '=', 1)->select(['id'])->get();
foreach ($qry as $rows) {
if (! is_file($path2covers.$rows['id'].'.jpg')) {
BookInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
$deleted++;
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($deleted.' books unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($deleted.' books unset.');
diff --git a/misc/testing/PostProc/updateConsoleImages.php b/misc/testing/PostProc/updateConsoleImages.php
index 3cda33498..7e925b1ff 100644
--- a/misc/testing/PostProc/updateConsoleImages.php
+++ b/misc/testing/PostProc/updateConsoleImages.php
@@ -8,7 +8,8 @@ use App\Models\ConsoleInfo;
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/console and compare to db->consoleinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/console and compare to db->consoleinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$path2covers = NN_COVERS.'console'.DS;
@@ -16,8 +17,8 @@ $path2covers = NN_COVERS.'console'.DS;
$dirItr = new \RecursiveDirectoryIterator($path2covers);
$itr = new \RecursiveIteratorIterator($dirItr, \RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($itr as $filePath) {
- if (is_file($filePath) && preg_match('/\d+\.jpg/', $filePath)) {
- preg_match('/(\d+)\.jpg/', basename($filePath), $match);
+ if (is_file($filePath) && preg_match('/\d+\.jpg$/', $filePath)) {
+ preg_match('/(\d+)\.jpg$/', basename($filePath), $match);
if (isset($match[1])) {
$run = ConsoleInfo::query()->where(
[
@@ -30,7 +31,7 @@ foreach ($itr as $filePath) {
} else {
$run = ConsoleInfo::query()->where('id', $match[1])->value('id');
if ($run === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -47,10 +48,10 @@ if ($qry instanceof \Traversable) {
['id' => $rows['id']],
]
)->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
$deleted++;
}
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($deleted.' consoles unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($deleted.' consoles unset.');
diff --git a/misc/testing/PostProc/updateGamesImages.php b/misc/testing/PostProc/updateGamesImages.php
index fb22ed5ac..6844554c9 100644
--- a/misc/testing/PostProc/updateGamesImages.php
+++ b/misc/testing/PostProc/updateGamesImages.php
@@ -11,7 +11,8 @@ use Illuminate\Support\Facades\DB;
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/games and compare to db->gamesinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/games and compare to db->gamesinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$pdo = DB::connection()->getPdo();
@@ -37,7 +38,7 @@ foreach ($itr as $filePath) {
} else {
$run = GamesInfo::query()->where('id', $match[1])->select(['id'])->get();
if ($run !== null && $run === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -50,10 +51,10 @@ if ($qry instanceof \Traversable) {
foreach ($qry as $rows) {
if (! is_file($path2covers.$rows['id'].'.jpg')) {
GamesInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
$deleted++;
}
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($deleted.' games unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($deleted.' games unset.');
diff --git a/misc/testing/PostProc/updateMovieImages.php b/misc/testing/PostProc/updateMovieImages.php
index 65116ecbf..41aa9e335 100644
--- a/misc/testing/PostProc/updateMovieImages.php
+++ b/misc/testing/PostProc/updateMovieImages.php
@@ -10,7 +10,8 @@ use Blacklight\utility\Utility;
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/movies and compare to db->movieinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/movies and compare to db->movieinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$row = Settings::settingValue('site.main.coverspath');
@@ -33,7 +34,7 @@ foreach ($itr as $filePath) {
} else {
$run = MovieInfo::query()->where('imdbid', '=', $match[1])->select(['imdbid'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -47,7 +48,7 @@ foreach ($itr as $filePath) {
} else {
$run = MovieInfo::query()->where('imdbid', $match1[1])->select(['imdbid'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -58,7 +59,7 @@ $qry = MovieInfo::query()->where('cover', '=', 1)->select(['imdbid'])->get();
foreach ($qry as $rows) {
if (! is_file($path2covers.$rows['imdbid'].'-cover.jpg')) {
MovieInfo::query()->where('cover', '=', 1)->where('imdbid', $rows['imdbid'])->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['imdbid'].'-cover.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['imdbid'].'-cover.jpg does not exist.');
$deleted++;
}
}
@@ -66,10 +67,10 @@ $qry = MovieInfo::query()->where('cover', '=', 1)->select(['imdbid'])->get();
foreach ($qry1 as $rows) {
if (! is_file($path2covers.$rows['imdbid'].'-backdrop.jpg')) {
MovieInfo::query()->where('backdrop', '=', 1)->where('imdbid', $rows['imdbid'])->update(['backdrop' => 0]);
- echo ColorCLI::info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.');
$deleted++;
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($updated.' backdrops set.');
-echo ColorCLI::header($deleted.' movies unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($updated.' backdrops set.');
+ColorCLI::header($deleted.' movies unset.');
diff --git a/misc/testing/PostProc/updateMusicImages.php b/misc/testing/PostProc/updateMusicImages.php
index 5f586e99f..41492c2ad 100644
--- a/misc/testing/PostProc/updateMusicImages.php
+++ b/misc/testing/PostProc/updateMusicImages.php
@@ -8,7 +8,8 @@ use App\Models\MusicInfo;
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/music and compare to db->musicinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/music and compare to db->musicinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$path2covers = NN_COVERS.'music'.DS;
@@ -25,7 +26,7 @@ foreach ($itr as $filePath) {
} else {
$run = MusicInfo::query()->where('id', $match[1])->select(['id'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -36,9 +37,9 @@ $qry = MusicInfo::query()->where('cover', '=', 1)->select(['id'])->get();
foreach ($qry as $rows) {
if (! is_file($path2covers.$rows['id'].'.jpg')) {
MusicInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'.jpg does not exist.');
$deleted++;
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($deleted.' music unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($deleted.' music unset.');
diff --git a/misc/testing/PostProc/updateXXXImages.php b/misc/testing/PostProc/updateXXXImages.php
index 20b03f2bf..47ce5b80e 100644
--- a/misc/testing/PostProc/updateXXXImages.php
+++ b/misc/testing/PostProc/updateXXXImages.php
@@ -8,7 +8,8 @@ use Blacklight\ColorCLI;
$covers = $updated = $deleted = 0;
if ($argc === 1 || $argv[1] !== 'true') {
- exit(ColorCLI::error("\nThis script will check all images in covers/xxx and compare to db->xxxinfo.\nTo run:\nphp $argv[0] true\n"));
+ ColorCLI::error("\nThis script will check all images in covers/xxx and compare to db->xxxinfo.\nTo run:\nphp $argv[0] true\n");
+ exit();
}
$path2covers = NN_COVERS.'xxx'.DS;
@@ -25,7 +26,7 @@ foreach ($itr as $filePath) {
} else {
$run = XxxInfo::query()->where('id', $match[1])->select(['id'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -39,7 +40,7 @@ foreach ($itr as $filePath) {
} else {
$run = XxxInfo::query()->where('id', $match1[1])->select(['id'])->get();
if ($run->count() === 0) {
- echo ColorCLI::info($filePath.' not found in db.');
+ ColorCLI::info($filePath.' not found in db.');
}
}
}
@@ -50,7 +51,7 @@ $qry = XxxInfo::query()->where('cover', '=', 1)->select(['id'])->get();
foreach ($qry as $rows) {
if (! is_file($path2covers.$rows['id'].'-cover.jpg')) {
XxxInfo::query()->where(['cover' => 1, 'id' => $rows['id']])->update(['cover' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'-cover.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'-cover.jpg does not exist.');
$deleted++;
}
}
@@ -58,10 +59,10 @@ $qry = XxxInfo::query()->where('backdrop', '=', 1)->select(['id'])->get();
foreach ($qry1 as $rows) {
if (! is_file($path2covers.$rows['id'].'-backdrop.jpg')) {
XxxInfo::query()->where(['backdrop' => 1, 'id' => $rows['id']])->update(['backdrop' => 0]);
- echo ColorCLI::info($path2covers.$rows['id'].'-backdrop.jpg does not exist.');
+ ColorCLI::info($path2covers.$rows['id'].'-backdrop.jpg does not exist.');
$deleted++;
}
}
-echo ColorCLI::header($covers.' covers set.');
-echo ColorCLI::header($updated.' backdrops set.');
-echo ColorCLI::header($deleted.' movies unset.');
+ColorCLI::header($covers.' covers set.');
+ColorCLI::header($updated.' backdrops set.');
+ColorCLI::header($deleted.' movies unset.');
diff --git a/misc/testing/Releases/fixReleaseNames.php b/misc/testing/Releases/fixReleaseNames.php
index ad9b1d848..1c5cde6c8 100755
--- a/misc/testing/Releases/fixReleaseNames.php
+++ b/misc/testing/Releases/fixReleaseNames.php
@@ -32,7 +32,7 @@ if (isset($argv[1], $argv[2], $argv[3], $argv[4])) {
if ($argv[1] === 7 || $argv[1] === 8) {
$nntp = new NNTP();
if ((Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) {
- echo ColorCLI::error('Unable to connect to usenet.'.PHP_EOL);
+ ColorCLI::error('Unable to connect to usenet.'.PHP_EOL);
return;
}
@@ -94,11 +94,12 @@ if (isset($argv[1], $argv[2], $argv[3], $argv[4])) {
$namefixer->fixNamesWithMediaMovieName(2, $update, $other, $setStatus, $show);
break;
default:
- exit(ColorCLI::error(PHP_EOL.'ERROR: Wrong argument, type php $argv[0] to see a list of valid arguments.'.PHP_EOL));
+ ColorCLI::error(PHP_EOL.'ERROR: Wrong argument, type php $argv[0] to see a list of valid arguments.');
+ exit();
break;
}
} else {
- exit(ColorCLI::error(PHP_EOL.'You must supply 4 arguments.'.PHP_EOL
+ ColorCLI::error(PHP_EOL.'You must supply 4 arguments.'.PHP_EOL
.'The 2nd argument, false, will display the results, but not change the name, type true to have the names changed.'.PHP_EOL
.'The 3rd argument, other, will only do against other categories, to do against all categories use all, or predb_id to process all not matched to predb.'.PHP_EOL
.'The 4th argument, yes, will set the release as checked, so the next time you run it will not be processed, to not set as checked type no.'.PHP_EOL
@@ -120,5 +121,6 @@ if (isset($argv[1], $argv[2], $argv[3], $argv[4])) {
.'php '.$argv[0].' 15 false other no ...: Fix release names in misc categories using PAR2 hash_16K block in the past 6 hours.'.PHP_EOL
.'php '.$argv[0].' 16 false other no ...: Fix release names in misc categories using PAR2 hash_16K block.'.PHP_EOL
.'php '.$argv[0].' 17 false other no ...: Fix release names in misc categories using Mediainfo in the past 6 hours.'.PHP_EOL
- .'php '.$argv[0].' 18 false other no ...: Fix release names in misc categories using Mediainfo.'.PHP_EOL));
+ .'php '.$argv[0].' 18 false other no ...: Fix release names in misc categories using Mediainfo.'.PHP_EOL);
+ exit();
}
diff --git a/misc/testing/Releases/recategorize.php b/misc/testing/Releases/recategorize.php
index e9680f72f..20a6e383e 100644
--- a/misc/testing/Releases/recategorize.php
+++ b/misc/testing/Releases/recategorize.php
@@ -9,7 +9,7 @@ use Blacklight\ConsoleTools;
use Illuminate\Support\Facades\DB;
if (! (isset($argv[1]) && ($argv[1] === 'all' || $argv[1] === 'misc' || preg_match('/\([\d, ]+\)/', $argv[1]) || is_numeric($argv[1])))) {
- exit(ColorCLI::error(
+ ColorCLI::error(
"\nThis script will attempt to re-categorize releases and is useful if changes have been made to Category.php.\n"
."No updates will be done unless the category changes\n"
."An optional last argument, test, will display the number of category changes that would be made\n"
@@ -18,7 +18,8 @@ if (! (isset($argv[1]) && ($argv[1] === 'all' || $argv[1] === 'misc' || preg_mat
."php $argv[0] misc ...: To process all releases in misc categories.\n"
."php $argv[0] 155 ...: To process all releases in groupid 155.\n"
."php $argv[0] '(155, 140)' ...: To process all releases in groupids 155 and 140.\n"
- ));
+ );
+ exit();
}
reCategorize($argv);
@@ -40,11 +41,11 @@ function reCategorize($argv)
}
if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\([\d, ]+\)/', $argv[1]))) {
- echo ColorCLI::header('Categorizing all releases in '.$argv[1].' using searchname. This can take a while, be patient.');
+ ColorCLI::header('Categorizing all releases in '.$argv[1].' using searchname. This can take a while, be patient.');
} elseif (isset($argv[1]) && $argv[1] === 'misc') {
- echo ColorCLI::header('Categorizing all releases in misc categories using searchname. This can take a while, be patient.');
+ ColorCLI::header('Categorizing all releases in misc categories using searchname. This can take a while, be patient.');
} else {
- echo ColorCLI::header('Categorizing all releases using searchname. This can take a while, be patient.');
+ ColorCLI::header('Categorizing all releases using searchname. This can take a while, be patient.');
}
$timestart = now();
if (isset($argv[1]) && (is_numeric($argv[1]) || $argv[1] === 'misc')) {
@@ -54,9 +55,9 @@ function reCategorize($argv)
}
$time = now()->diffInSeconds($timestart);
if ($update === true) {
- echo ColorCLI::header('Finished re-categorizing '.number_format($chgcount).' releases in '.$time.' , using the searchname.'.PHP_EOL);
+ ColorCLI::header('Finished re-categorizing '.number_format($chgcount).' releases in '.$time.' , using the searchname.'.PHP_EOL);
} else {
- echo ColorCLI::header('Finished re-categorizing in '.$time.' seconds , using the searchname.'.PHP_EOL
+ ColorCLI::header('Finished re-categorizing in '.$time.' seconds , using the searchname.'.PHP_EOL
.'This would have changed '.number_format($chgcount).' releases but no updates were done.'.PHP_EOL);
}
}
@@ -68,7 +69,7 @@ function categorizeRelease($where, $update = true, $echooutput = false)
$cat = new Categorize();
$consoletools = new ConsoleTools();
$relcount = $chgcount = 0;
- echo ColorCLI::primary('SELECT id, searchname, fromname, groups_id, categories_id FROM releases '.$where);
+ ColorCLI::primary('SELECT id, searchname, fromname, groups_id, categories_id FROM releases '.$where);
$resrel = DB::select('SELECT id, searchname, fromname, groups_id, categories_id FROM releases '.$where);
$total = \count($resrel);
if ($total > 0) {
diff --git a/misc/testing/Tests/test_fanarttv_API.php b/misc/testing/Tests/test_fanarttv_API.php
index 1fae7d336..f9ff3be8e 100644
--- a/misc/testing/Tests/test_fanarttv_API.php
+++ b/misc/testing/Tests/test_fanarttv_API.php
@@ -17,8 +17,10 @@ if (! empty($argv[1])) {
if ($moviefanart) {
dump($moviefanart);
} else {
- exit(ColorCLI::error('Error retrieving Fanart.TV data.'));
+ ColorCLI::error('Error retrieving Fanart.TV data.');
+ exit();
}
} else {
- exit(ColorCLI::error('Invalid arguments. This script requires a number or string (TMDB or IMDb ID.'));
+ ColorCLI::error('Invalid arguments. This script requires a number or string (TMDB or IMDb ID.');
+ exit();
}
diff --git a/misc/testing/Tests/test_omdb_API.php b/misc/testing/Tests/test_omdb_API.php
index e079daaa9..967b78484 100644
--- a/misc/testing/Tests/test_omdb_API.php
+++ b/misc/testing/Tests/test_omdb_API.php
@@ -15,17 +15,19 @@ if (! empty($argv[1]) && ! empty($argv[2]) && ($argv[2] !== 'series' || $argv[2]
// Search for a show
$search = $omdb->search((string) $argv[1], (string) $argv[2]);
if (is_object($search) && $search->data->Response !== 'False') {
- print_r($search->data->Search[0]->Title.PHP_EOL);
+ dump($search->data->Search[0]->Title.PHP_EOL);
}
// Use the first show found (highest match) and get the requested season/episode from $argv
if (is_object($search) && $search->data->Response !== 'False') {
$search = $omdb->fetch('i', $search->data->Search[0]->imdbID);
- print_r($search);
+ dump($search);
} else {
- exit(ColorCLI::error('Error retrieving OMDb API data.'));
+ ColorCLI::error('Error retrieving OMDb API data.');
+ exit();
}
} else {
- exit(ColorCLI::error('Invalid arguments. This script requires a text string (show name), and a second argument, movie or series.'));
+ ColorCLI::error('Invalid arguments. This script requires a text string (show name), and a second argument, movie or series.');
+ exit();
}
diff --git a/misc/testing/resend_activation_email.php b/misc/testing/resend_activation_email.php
index c6a756960..cb0685294 100644
--- a/misc/testing/resend_activation_email.php
+++ b/misc/testing/resend_activation_email.php
@@ -12,7 +12,7 @@ if (isset($argv[1]) && is_numeric($argv[1])) {
UserVerification::send($user, 'User email verification required');
- ColorCLI::doEcho(ColorCLI::notice('Email has been sent'));
+ ColorCLI::notice('Email has been sent');
} else {
- ColorCLI::doEcho(ColorCLI::info('You need to provide user id as argument'));
+ ColorCLI::info('You need to provide user id as argument');
}
diff --git a/misc/update/tmux/bin/groupfixrelnames.php b/misc/update/tmux/bin/groupfixrelnames.php
index 282176a5c..15971c96c 100644
--- a/misc/update/tmux/bin/groupfixrelnames.php
+++ b/misc/update/tmux/bin/groupfixrelnames.php
@@ -16,7 +16,8 @@ use Illuminate\Support\Facades\DB;
use Blacklight\processing\PostProcess;
if (! isset($argv[1])) {
- exit(ColorCLI::error('This script is not intended to be run manually, it is called from Multiprocessing.'));
+ ColorCLI::error('This script is not intended to be run manually, it is called from Multiprocessing.');
+ exit();
}
$nameFixer = new NameFixer();
[$type, $guidChar, $maxPerRun, $thread] = explode(' ', $argv[1]);
@@ -101,12 +102,12 @@ switch (true) {
echo PHP_EOL.ColorCLI::primaryOver("[{$release['releases_id']}]");
if ((int) $release['ishashed'] === 1 && (int) $release['dehashstatus'] >= -6 && (int) $release['dehashstatus'] <= 0) {
- echo ColorCLI::primaryOver('m');
+ ColorCLI::primaryOver('m');
if (preg_match('/[a-fA-F0-9]{32,40}/i', $release['name'], $matches)) {
$nameFixer->matchPredbHash($matches[0], $release, true, 1, true, 1);
}
if ($nameFixer->matched === false && ! empty($release['filehash']) && preg_match('/[a-fA-F0-9]{32,40}/i', $release['filehash'], $matches)) {
- echo ColorCLI::primaryOver('h');
+ ColorCLI::primaryOver('h');
$nameFixer->matchPredbHash($matches[0], $release, true, 1, true, 1);
}
}
@@ -117,7 +118,7 @@ switch (true) {
$nameFixer->reset();
if ((int) $release['proc_uid'] === NameFixer::PROC_UID_NONE && (! empty($release['uid']) || ! empty($release['mediainfo']))) {
- echo ColorCLI::primaryOver('U');
+ ColorCLI::primaryOver('U');
$nameFixer->mediaMovieNameCheck($release, true, 'Mediainfo, ', 1, 1);
$nameFixer->uidCheck($release, true, 'UID, ', 1, 1);
}
@@ -130,7 +131,7 @@ switch (true) {
$nameFixer->reset();
if ((int) $release['proc_srr'] === NameFixer::PROC_SRR_NONE) {
- echo ColorCLI::primaryOver('sr');
+ ColorCLI::primaryOver('sr');
$nameFixer->srrNameCheck($release, true, 'SRR, ', 1, 1);
}
// Not all gate requirements in query always set column status as PP Add check is in query
@@ -142,7 +143,7 @@ switch (true) {
$nameFixer->reset();
if ((int) $release['proc_hash16k'] === NameFixer::PROC_HASH16K_NONE && ! empty($release['hash'])) {
- echo ColorCLI::primaryOver('H');
+ ColorCLI::primaryOver('H');
$nameFixer->hashCheck($release, true, 'PAR2 hash, ', 1, 1);
}
// Not all gate requirements in query always set column status as PP Add check is in query
@@ -155,7 +156,7 @@ switch (true) {
if ((int) $release['nfostatus'] === Nfo::NFO_FOUND && (int) $release['proc_nfo'] === NameFixer::PROC_NFO_NONE) {
if (! empty($release['textstring']) && ! preg_match('/^=newz\[NZB\]=\w+/', $release['textstring'])) {
- echo ColorCLI::primaryOver('n');
+ ColorCLI::primaryOver('n');
$nameFixer->done = $nameFixer->matched = false;
$nameFixer->checkName($release, true, 'NFO, ', 1, 1);
}
@@ -168,14 +169,14 @@ switch (true) {
$nameFixer->reset();
if ((int) $release['fileid'] > 0 && (int) $release['proc_files'] === NameFixer::PROC_FILES_NONE) {
- echo ColorCLI::primaryOver('F');
+ ColorCLI::primaryOver('F');
$nameFixer->done = $nameFixer->matched = false;
$fileNames = explode('|', $release['filestring']);
if (is_array($fileNames)) {
$releaseFile = $release;
foreach ($fileNames as $fileName) {
if ($nameFixer->matched === false) {
- echo ColorCLI::primaryOver('f');
+ ColorCLI::primaryOver('f');
$releaseFile['textstring'] = $fileName;
$nameFixer->checkName($releaseFile, true, 'Filenames, ', 1, 1);
}
@@ -191,7 +192,7 @@ switch (true) {
$nameFixer->reset();
if ((int) $release['proc_par2'] === NameFixer::PROC_PAR2_NONE) {
- echo ColorCLI::primaryOver('p');
+ ColorCLI::primaryOver('p');
if (! isset($nzbcontents)) {
$nntp = new NNTP();
if (((int) Settings::settingValue('..alternate_nntp') === 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) {
diff --git a/misc/update/tmux/bin/update_groups.php b/misc/update/tmux/bin/update_groups.php
index de68ef0ce..915417aa8 100644
--- a/misc/update/tmux/bin/update_groups.php
+++ b/misc/update/tmux/bin/update_groups.php
@@ -15,16 +15,18 @@ $consoleTools = new ConsoleTools();
// Create the connection here and pass
$nntp = new NNTP();
if ($nntp->doConnect() !== true) {
- exit(ColorCLI::error('Unable to connect to usenet.'));
+ ColorCLI::error('Unable to connect to usenet.');
+ exit();
}
-ColorCLI::doEcho(ColorCLI::header('Getting first/last for all your active groups.'));
+ColorCLI::header('Getting first/last for all your active groups.');
$data = $nntp->getGroups();
if ($nntp->isError($data)) {
- exit(ColorCLI::error('Failed to getGroups() from nntp server.'));
+ ColorCLI::error('Failed to getGroups() from nntp server.');
+ exit();
}
-ColorCLI::doEcho(ColorCLI::header('Inserting new values into short_groups table.'));
+ColorCLI::header('Inserting new values into short_groups table.');
DB::unprepared('TRUNCATE TABLE short_groups');
DB::commit();
@@ -40,8 +42,8 @@ foreach ($data as $newgroup) {
'last_record' => $newgroup['last'],
'updated' => now(),
]);
- ColorCLI::doEcho(ColorCLI::primary('Updated '.$newgroup['group']));
+ ColorCLI::primary('Updated '.$newgroup['group']);
}
}
-ColorCLI::doEcho(ColorCLI::header('Running time: '.now()->diffInSeconds($start).' seconds'), true);
+ColorCLI::header('Running time: '.now()->diffInSeconds($start).' seconds');
diff --git a/misc/update/tmux/monitor.php b/misc/update/tmux/monitor.php
index ee6e9a651..97c4f9111 100644
--- a/misc/update/tmux/monitor.php
+++ b/misc/update/tmux/monitor.php
@@ -120,7 +120,7 @@ while ($runVar['counts']['iterations'] > 0) {
$runVar['counts']['now']['total_work'] = 0;
$runVar['modsettings']['fix_crap'] = explode(', ', $runVar['settings']['fix_crap']);
- echo ColorCLI::info("\nThe numbers(queries) above are currently being refreshed. \nNo pane(script) can be (re)started until these have completed.\n");
+ ColorCLI::info("\nThe numbers(queries) above are currently being refreshed. \nNo pane(script) can be (re)started until these have completed.\n");
$timer02 = time();
try {
@@ -417,7 +417,7 @@ while ($runVar['counts']['iterations'] > 0) {
function errorOnSQL()
{
- echo ColorCLI::error(PHP_EOL.'Monitor encountered severe errors retrieving process data from MySQL. Please diagnose and try running again.'.PHP_EOL);
+ ColorCLI::error(PHP_EOL.'Monitor encountered severe errors retrieving process data from MySQL. Please diagnose and try running again.'.PHP_EOL);
}
/**
diff --git a/misc/update/tmux/run.php b/misc/update/tmux/run.php
index d944757b0..f58849c61 100644
--- a/misc/update/tmux/run.php
+++ b/misc/update/tmux/run.php
@@ -31,11 +31,12 @@ $session = shell_exec("tmux list-session | grep $tmux_session");
// Kill the placeholder
exec('tmux kill-session -t placeholder');
if ($session !== null) {
- exit(ColorCLI::error("tmux session: '".$tmux_session."' is already running, aborting.\n"));
+ ColorCLI::error("tmux session: '".$tmux_session."' is already running, aborting.");
+ exit();
}
//reset collections dateadded to now if dateadded > delay time check
-ColorCLI::doEcho(ColorCLI::header('Resetting expired collections dateadded to now. This could take a minute or two. Really.'), true);
+ColorCLI::header('Resetting expired collections dateadded to now. This could take a minute or two. Really.');
$sql = 'SHOW table status';
$tables = DB::select($sql);
@@ -55,7 +56,7 @@ foreach ($tables as $row) {
}
}
}
-ColorCLI::doEcho(ColorCLI::primary(number_format($ran).' collections reset.'), true);
+ColorCLI::primary(number_format($ran).' collections reset.');
sleep(2);
function writelog($pane)
@@ -74,14 +75,15 @@ function command_exist($cmd)
{
$returnVal = exec("which $cmd 2>/dev/null");
- return empty($returnVal) ? false : true;
+ return ! empty($returnVal);
}
//check for apps
$apps = ['time', 'tmux', 'nice', 'tee'];
foreach ($apps as &$value) {
if (! command_exist($value)) {
- exit(ColorCLI::error('Tmux scripts require '.$value.' but its not installed. Aborting.'.PHP_EOL));
+ ColorCLI::error('Tmux scripts require '.$value.' but its not installed. Aborting.');
+ exit();
}
}
diff --git a/misc/update/update_binaries.php b/misc/update/update_binaries.php
index b912f8024..8596b5389 100644
--- a/misc/update/update_binaries.php
+++ b/misc/update/update_binaries.php
@@ -13,13 +13,14 @@ $maxHeaders = (int) Settings::settingValue('..max_headers_iteration') ?: 1000000
// Create the connection here and pass
$nntp = new NNTP();
if ($nntp->doConnect() !== true) {
- exit(ColorCLI::error('Unable to connect to usenet.'));
+ ColorCLI::error('Unable to connect to usenet.');
+ exit();
}
$binaries = new Binaries(['NNTP' => $nntp]);
if (isset($argv[1]) && ! is_numeric($argv[1])) {
$groupName = $argv[1];
- echo ColorCLI::header("Updating group: $groupName");
+ ColorCLI::header("Updating group: $groupName");
$group = Group::getByName($groupName);
if (is_array($group)) {