Skip to content

Commit

Permalink
Merge branch 'dev' into 0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 4, 2018
2 parents faffe2b + 6f6e130 commit 83aa12f
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 168 deletions.
4 changes: 4 additions & 0 deletions Blacklight/Binaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function __construct(array $options = [])
*
* @return void
* @throws \Exception
* @throws \Throwable
*/
public function updateAllGroups($maxHeaders = 100000): void
{
Expand Down Expand Up @@ -329,6 +330,7 @@ public function logIndexerStart(): void
*
* @return void
* @throws \Exception
* @throws \Throwable
*/
public function updateGroup($groupMySQL, $maxHeaders = 0): void
{
Expand Down Expand Up @@ -575,6 +577,7 @@ public function updateGroup($groupMySQL, $maxHeaders = 0): void
*
* @return array Empty on failure.
* @throws \Exception
* @throws \Throwable
*/
public function scan($groupMySQL, $first, $last, $type = 'update', $missingParts = null): array
{
Expand Down Expand Up @@ -1084,6 +1087,7 @@ protected function outputHeaderDuration(): void
* @param array $headers Array of headers containing sub-arrays with parts.
*
* @return array Array of article numbers to add to part repair.
* @throws \Exception
*/
protected function _rollbackAddToPartRepair(array $headers): array
{
Expand Down
18 changes: 9 additions & 9 deletions Blacklight/ReleaseExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,15 @@ private function addAudio($releaseID, $audioID, $audioFormat, $audioMode, $audio
AudioData::query()->insert([
'releases_id' => $releaseID,
'audioid' => $audioID,
'audioformat' => $audioFormat,
'audiomode' => ! empty($audioMode) ? $audioMode : '',
'audiobitratemode' => ! empty($audioBitRateMode) ? $audioBitRateMode : '',
'audiobitrate' => $audioBitRate,
'audiochannels' => $audioChannels,
'audiosamplerate' => ! empty($audioSampleRate) ? $audioSampleRate : '',
'audiolibrary' => ! empty($audioLibrary) ? $audioLibrary : '',
'audiolanguage' => ! empty($audioLanguage) ? $audioLanguage : '',
'audiotitle' => ! empty($audioTitle) ? $audioTitle : '',
'audioformat' => \is_array($audioFormat) ? implode($audioFormat) : $audioFormat,
'audiomode' => \is_array($audioMode) ? implode($audioMode) : $audioMode,
'audiobitratemode' => \is_array($audioBitRateMode) ? implode($audioBitRateMode) : $audioBitRateMode,
'audiobitrate' => \is_array($audioBitRate) ? implode($audioBitRate) : $audioBitRate,
'audiochannels' => \is_array($audioChannels) ? implode($audioChannels) : $audioChannels,
'audiosamplerate' => \is_array($audioSampleRate) ? implode($audioSampleRate) : $audioSampleRate,
'audiolibrary' => \is_array($audioLibrary) ? implode($audioLibrary) : $audioLibrary,
'audiolanguage' => \is_array($audioLanguage) ? implode($audioLanguage) : $audioLanguage,
'audiotitle' => \is_array($audioTitle) ? implode($audioTitle) : $audioTitle,
]);
}
}
Expand Down
27 changes: 14 additions & 13 deletions Blacklight/ReleaseRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
*/
class ReleaseRemover
{
/**
* @const New line.
*/
private const N = PHP_EOL;

/**
* @var string
*/
Expand Down Expand Up @@ -150,7 +145,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 +487,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 +852,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 +1008,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 +1036,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 +1069,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 +1240,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 +1304,11 @@ protected function returnError()
return false;
}

/**
* @param string $dbRegex
*
* @return bool|mixed|string
*/
protected function extractSrchFromRegx($dbRegex = '')
{
$regexMatch = '';
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/TmuxRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ protected function _runSharing($pane, &$runVar): void
{
$sharing = (array) array_first(DB::select('SELECT enabled, posting, fetching FROM sharing'));

if ((int) $sharing['enabled'] === 1 && (int) $runVar['settings']['run_sharing'] === 1 && ((int) $sharing['posting'] === 1 || (int) $sharing['fetching'] === 1) && shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:${pane} | grep ^0 | grep -c dead") == 1) {
if (! empty($sharing) && (int) $sharing['enabled'] === 1 && (int) $runVar['settings']['run_sharing'] === 1 && ((int) $sharing['posting'] === 1 || (int) $sharing['fetching'] === 1) && shell_exec("tmux list-panes -t{$runVar['constants']['tmux_session']}:${pane} | grep ^0 | grep -c dead") == 1) {
shell_exec(
"tmux respawnp -t{$runVar['constants']['tmux_session']}:${pane}.0 ' \
{$runVar['commands']['_php']} {$runVar['paths']['misc']}/update/multiprocessing/postprocess.php sha; \
Expand Down
12 changes: 12 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
2018-09-04 DariusIII
* Fix: Add check for empty sharing table when running tmux
2018-09-03 DariusIII
* Fix: Fix monitor counts and percentages displayed in main monitor pane
* 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
2018-09-02 DariusIII
* Chg: Update symfony components, laravel/framework to their latest versions
2018-08-27 DariusIII
* Chg: Update font-awesome and laravel/framework to latest versions
* Fix: Fix failed releases returned responses
* Chg: Update yab/laravel-scout-mysql-driver to version 2.0.5
* Fix: Fix array to string conversion in ReleaseExtra addAudio function
* Fix: Fix display of movie covers on release details page
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/FailedReleasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function show(Request $request)
return response('Error!', 404)->withHeaders(['X-DNZB-RCode' => 404, 'X-DNZB-RText' => 'No NZB found for alternate match.']);
}

return response('Success', 200)->header('Location:'.$this->serverurl.'getnzb?id='.$alt['guid'].'&i='.$uid.'&r='.$rssToken);
return response('Success', 200)->withHeaders(['Location' => $this->serverurl.'getnzb?id='.$alt['guid'].'&i='.$uid.'&r='.$rssToken]);
}
}
}
22 changes: 16 additions & 6 deletions app/Models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,25 @@ public function getCBPTableNames($groupID): array
return self::$cbppTableNames[$groupKey];
}

if (config('nntmux.echocli') && $this->allasmgr === false && self::createNewTPGTables($groupID) === false) {
if ($this->allasmgr === false && config('nntmux.echocli') && self::createNewTPGTables($groupID) === false) {
exit('There is a problem creating new TPG tables for this group ID: '.$groupID.PHP_EOL);
}

$tables = [];
$tables['cname'] = 'collections_'.$groupID;
$tables['bname'] = 'binaries_'.$groupID;
$tables['pname'] = 'parts_'.$groupID;
$tables['prname'] = 'missed_parts_'.$groupID;
if ($this->allasmgr === false) {
$tables = [
'cname' => 'collections_'.$groupID,
'bname' => 'binaries_'.$groupID,
'pname' => 'parts_'.$groupID,
'prname' => 'missed_parts_'.$groupID,
];
} else {
$tables = [
'cname' => 'multigroup_collections',
'bname' => 'multigroup_binaries',
'pname' => 'multigroup_parts',
'prname' => 'multigroup_missed_parts',
];
}

// Buffer.
self::$cbppTableNames[$groupKey] = $tables;
Expand Down
Loading

0 comments on commit 83aa12f

Please sign in to comment.