Skip to content

Commit

Permalink
Update time handling in ReleaseRemover and NameFixer classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 12, 2018
1 parent ab39a71 commit eaea6e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Blacklight/NameFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ public function getPreFileNames(array $args = []): void
ColorCLI::doEcho(ColorCLI::primary('Matching predb filename to cleaned release_files.name.'), true);

$counter = $counted = 0;
$timestart = time();
$timestart = now();

$query = DB::select(
sprintf(
Expand Down Expand Up @@ -1184,7 +1184,7 @@ public function getPreFileNames(array $args = []): void
$this->consoletools->overWritePrimary('Renamed Releases: ['.number_format($counted).'] '.$this->consoletools->percentString(++$counter, $total));
}
}
echo ColorCLI::header($n.'Renamed '.number_format($counted).' releases in '.$this->consoletools->convertTime(time() - $timestart).'.');
echo ColorCLI::header($n.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.');
} else {
ColorCLI::doEcho(ColorCLI::info($n.'Nothing to do.'), true);
}
Expand Down
19 changes: 6 additions & 13 deletions Blacklight/ReleaseRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,6 @@ class ReleaseRemover
*/
protected $result;

/**
* Time we started.
*
* @var int
*/
protected $timeStart;

/**
* @var \Blacklight\NZB
*/
Expand Down Expand Up @@ -157,7 +150,7 @@ public function removeByCriteria($arguments)
$this->delete = true;
$this->ignoreUserCheck = false;
// Time we started.
$this->timeStart = now();
$timeStart = now();

// Start forming the query.
$this->query = 'SELECT id, guid, searchname FROM releases WHERE 1=1';
Expand Down Expand Up @@ -191,7 +184,7 @@ public function removeByCriteria($arguments)

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($this->timeStart).' seconds');
echo ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
}

return $this->browser
Expand All @@ -200,7 +193,7 @@ public function removeByCriteria($arguments)
($this->delete ? 'Deleted ' : 'Would have deleted ').
$this->deletedCount.
' release(s) in '.
now()->diffInSeconds($this->timeStart).' seconds'
now()->diffInSeconds($timeStart).' seconds'
:
true;
}
Expand All @@ -218,7 +211,7 @@ public function removeByCriteria($arguments)
*/
public function removeCrap($delete, $time, $type = '', $blacklistID = '')
{
$this->timeStart = now();
$timeStart = now();
$this->delete = $delete;
$this->blacklistID = '';

Expand Down Expand Up @@ -320,7 +313,7 @@ public function removeCrap($delete, $time, $type = '', $blacklistID = '')

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($this->timeStart).' seconds');
echo ColorCLI::header(now()->diffInSeconds($timeStart).' seconds');
}

return $this->browser
Expand All @@ -329,7 +322,7 @@ public function removeCrap($delete, $time, $type = '', $blacklistID = '')
($this->delete ? 'Deleted ' : 'Would have deleted ').
$this->deletedCount.
' release(s) in '.
now()->diffInSeconds($this->timeStart).' seconds'
now()->diffInSeconds($timeStart).' seconds'
:
true;
}
Expand Down

0 comments on commit eaea6e3

Please sign in to comment.