Skip to content

Commit

Permalink
Update ReleaseRemover class
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 3, 2018
1 parent 52fa047 commit cf4f6a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Blacklight/ReleaseRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
*/
class ReleaseRemover
{
/**
* @const New line.
*/
private const N = PHP_EOL;

/**
* @var string
Expand Down Expand Up @@ -150,7 +146,7 @@ public function __construct(array $options = [])
* Remove releases using user criteria.
*
* @param array $arguments Array of criteria used to delete unwanted releases.
* Criteria muse look like this : columnName=modifier="content"
* Criteria must look like this : columnName=modifier="content"
* columnName is a column name from the releases table.
* modifiers are : equals,like,bigger,smaller
* content is what to change the column content to
Expand Down Expand Up @@ -492,7 +488,7 @@ protected function removePasswordURL()
'SELECT r.guid, r.searchname, r.id
FROM releases r
STRAIGHT_JOIN release_files rf ON r.id = rf.releases_id
WHERE rf.name LIKE %s ',
WHERE rf.name LIKE %s %s',
$this->pdo->quote('%password.url%'),
$this->crapTime
);
Expand Down Expand Up @@ -857,8 +853,7 @@ protected function removeBlacklistFiles(): bool
if (\count($allRegex) > 0) {
foreach ($allRegex as $regex) {
$regexSQL = sprintf(
'STRAIGHT_JOIN release_files rf ON r.id = rf.releases_id
WHERE rf.name REGEXP %s ',
'STRAIGHT_JOIN release_files rf ON r.id = rf.releases_id WHERE rf.name REGEXP %s',
$this->pdo->quote($regex->regex)
);

Expand Down Expand Up @@ -1014,8 +1009,10 @@ protected function removeCodecPoster()

/**
* Delete releases from the database.
*
* @return true
*/
protected function deleteReleases()
protected function deleteReleases(): bool
{
$deletedCount = 0;
foreach ($this->result as $release) {
Expand All @@ -1040,7 +1037,7 @@ protected function deleteReleases()
*
* @return bool False on failure, true on success after setting a count of found releases.
*/
protected function checkSelectQuery()
protected function checkSelectQuery(): bool
{
// Run the query, check if it picked up anything.
$result = DB::select($this->cleanSpaces($this->query));
Expand Down Expand Up @@ -1073,7 +1070,7 @@ protected function formatCriteriaQuery($argument)
return '';
}

$this->error = 'Invalid argument supplied: '.$argument.self::N;
$this->error = 'Invalid argument supplied: '.$argument.PHP_EOL;
$args = explode('=', $argument);
if (\count($args) === 3) {
$args[0] = $this->cleanSpaces($args[0]);
Expand Down Expand Up @@ -1244,7 +1241,7 @@ protected function checkUserResponse()
// Print the query to the user, ask them if they want to continue using it.
echo 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:'.
self::N.$this->query.';'.self::N.
PHP_EOL.$this->query.';'.PHP_EOL.
'If you are satisfied, type yes and press enter. Anything else will exit.'
);

Expand Down Expand Up @@ -1308,6 +1305,11 @@ protected function returnError()
return false;
}

/**
* @param string $dbRegex
*
* @return bool|mixed|string
*/
protected function extractSrchFromRegx($dbRegex = '')
{
$regexMatch = '';
Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-09-03 DariusIII
* Chg: Update ReleaseRemover class
* Chg: Check for array before inserting audio data from mediainfo
* Chg: Add checks before inserting audio data from mediainfo
* Chg: Update handling of allAsMgr tables
Expand Down

0 comments on commit cf4f6a3

Please sign in to comment.