diff --git a/Blacklight/Backfill.php b/Blacklight/Backfill.php index 9723c98c2..cebe700c1 100755 --- a/Blacklight/Backfill.php +++ b/Blacklight/Backfill.php @@ -55,9 +55,9 @@ class Backfill $this->colorCli = new ColorCLI; $this->_compressedHeaders = config('nntmux_nntp.compressed_headers'); - $this->_safeBackFillDate = Settings::settingValue('..safebackfilldate') !== '' ? (string) Settings::settingValue('safebackfilldate') : '2012-08-14'; - $this->_safePartRepair = (int) Settings::settingValue('..safepartrepair') === 1 ? 'update' : 'backfill'; - $this->_disableBackfillGroup = (int) Settings::settingValue('..disablebackfillgroup') === 1; + $this->_safeBackFillDate = Settings::settingValue('safebackfilldate') !== '' ? (string) Settings::settingValue('safebackfilldate') : '2012-08-14'; + $this->_safePartRepair = (int) Settings::settingValue('safepartrepair') === 1 ? 'update' : 'backfill'; + $this->_disableBackfillGroup = (int) Settings::settingValue('disablebackfillgroup') === 1; } /** diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php index 43263d569..19ae3a7fe 100644 --- a/Blacklight/Binaries.php +++ b/Blacklight/Binaries.php @@ -180,15 +180,15 @@ class Binaries $this->_nntp = new NNTP; $this->_collectionsCleaning = new CollectionsCleaning; - $this->messageBuffer = Settings::settingValue('..maxmssgs') !== '' ? - (int) Settings::settingValue('..maxmssgs') : 20000; + $this->messageBuffer = Settings::settingValue('maxmssgs') !== '' ? + (int) Settings::settingValue('maxmssgs') : 20000; $this->_compressedHeaders = config('nntmux_nntp.compressed_headers'); - $this->_partRepair = (int) Settings::settingValue('..partrepair') === 1; - $this->_newGroupScanByDays = (int) Settings::settingValue('..newgroupscanmethod') === 1; - $this->_newGroupMessagesToScan = Settings::settingValue('..newgroupmsgstoscan') !== '' ? (int) Settings::settingValue('..newgroupmsgstoscan') : 50000; - $this->_newGroupDaysToScan = Settings::settingValue('..newgroupdaystoscan') !== '' ? (int) Settings::settingValue('..newgroupdaystoscan') : 3; - $this->_partRepairLimit = Settings::settingValue('..maxpartrepair') !== '' ? (int) Settings::settingValue('..maxpartrepair') : 15000; - $this->_partRepairMaxTries = (Settings::settingValue('..partrepairmaxtries') !== '' ? (int) Settings::settingValue('..partrepairmaxtries') : 3); + $this->_partRepair = (int) Settings::settingValue('partrepair') === 1; + $this->_newGroupScanByDays = (int) Settings::settingValue('newgroupscanmethod') === 1; + $this->_newGroupMessagesToScan = Settings::settingValue('newgroupmsgstoscan') !== '' ? (int) Settings::settingValue('newgroupmsgstoscan') : 50000; + $this->_newGroupDaysToScan = Settings::settingValue('newgroupdaystoscan') !== '' ? (int) Settings::settingValue('newgroupdaystoscan') : 3; + $this->_partRepairLimit = Settings::settingValue('maxpartrepair') !== '' ? (int) Settings::settingValue('maxpartrepair') : 15000; + $this->_partRepairMaxTries = (Settings::settingValue('partrepairmaxtries') !== '' ? (int) Settings::settingValue('partrepairmaxtries') : 3); $this->blackList = $this->whiteList = []; } diff --git a/Blacklight/Books.php b/Blacklight/Books.php index 127968e11..88fc5c310 100755 --- a/Blacklight/Books.php +++ b/Blacklight/Books.php @@ -63,15 +63,15 @@ class Books $this->colorCli = new ColorCLI; - $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); - $this->privkey = Settings::settingValue('APIs..amazonprivkey'); - $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); - $this->bookqty = Settings::settingValue('..maxbooksprocessed') !== '' ? (int) Settings::settingValue('..maxbooksprocessed') : 300; - $this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000; + $this->pubkey = Settings::settingValue('amazonpubkey'); + $this->privkey = Settings::settingValue('amazonprivkey'); + $this->asstag = Settings::settingValue('amazonassociatetag'); + $this->bookqty = Settings::settingValue('maxbooksprocessed') !== '' ? (int) Settings::settingValue('maxbooksprocessed') : 300; + $this->sleeptime = Settings::settingValue('amazonsleep') !== '' ? (int) Settings::settingValue('amazonsleep') : 1000; $this->imgSavePath = storage_path('covers/book/'); $this->bookreqids = Category::BOOKS_EBOOK; - $this->renamed = (int) Settings::settingValue('..lookupbooks') === 2 ? 'AND isrenamed = 1' : ''; + $this->renamed = (int) Settings::settingValue('lookupbooks') === 2 ? 'AND isrenamed = 1' : ''; $this->failCache = []; } diff --git a/Blacklight/Categorize.php b/Blacklight/Categorize.php index 4bca4a969..8ea2627ea 100755 --- a/Blacklight/Categorize.php +++ b/Blacklight/Categorize.php @@ -47,8 +47,8 @@ class Categorize */ public function __construct() { - $this->categorizeForeign = (bool) Settings::settingValue('indexer.categorise.categorizeforeign'); - $this->catWebDL = (bool) Settings::settingValue('indexer.categorise.catwebdl'); + $this->categorizeForeign = (bool) Settings::settingValue('categorizeforeign'); + $this->catWebDL = (bool) Settings::settingValue('catwebdl'); } /** diff --git a/Blacklight/Console.php b/Blacklight/Console.php index a57f5958c..9eaa809c3 100755 --- a/Blacklight/Console.php +++ b/Blacklight/Console.php @@ -90,13 +90,13 @@ class Console $this->colorCli = new ColorCLI; - $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); - $this->privkey = Settings::settingValue('APIs..amazonprivkey'); - $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); - $this->gameqty = (Settings::settingValue('..maxgamesprocessed') !== '') ? (int) Settings::settingValue('..maxgamesprocessed') : 150; - $this->sleeptime = (Settings::settingValue('..amazonsleep') !== '') ? (int) Settings::settingValue('..amazonsleep') : 1000; - $this->imgSavePath = storage_path('covers/console/'); - $this->renamed = (int) Settings::settingValue('..lookupgames') === 2; + $this->pubkey = Settings::settingValue('amazonpubkey'); + $this->privkey = Settings::settingValue('amazonprivkey'); + $this->asstag = Settings::settingValue('amazonassociatetag'); + $this->gameqty = (Settings::settingValue('maxgamesprocessed') !== '') ? (int) Settings::settingValue('maxgamesprocessed') : 150; + $this->sleeptime = (Settings::settingValue('amazonsleep') !== '') ? (int) Settings::settingValue('amazonsleep') : 1000; + $this->imgSavePath = config('nntmux_settings.covers_path').'/console/'; + $this->renamed = (int) Settings::settingValue('lookupgames') === 2; $this->failCache = []; } diff --git a/Blacklight/Games.php b/Blacklight/Games.php index aeaf77b20..073ee7a8f 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -85,9 +85,9 @@ class Games $this->colorCli = new ColorCLI; $this->publicKey = config('nntmux_api.giantbomb_api_key'); - $this->gameQty = Settings::settingValue('..maxgamesprocessed') !== '' ? (int) Settings::settingValue('..maxgamesprocessed') : 150; - $this->imgSavePath = storage_path('covers/games/'); - $this->renamed = (int) Settings::settingValue('..lookupgames') === 2 ? 'AND isrenamed = 1' : ''; + $this->gameQty = Settings::settingValue('maxgamesprocessed') !== '' ? (int) Settings::settingValue('maxgamesprocessed') : 150; + $this->imgSavePath = config('nntmux_settings.covers_path').'/games/'; + $this->renamed = (int) Settings::settingValue('lookupgames') === 2 ? 'AND isrenamed = 1' : ''; $this->matchPercentage = 60; $this->maxHitRequest = false; $this->catWhere = 'AND categories_id = '.Category::PC_GAMES.' '; @@ -678,7 +678,7 @@ class Games ->where('nzbstatus', '=', 1) ->where('gamesinfo_id', '=', 0) ->where('categories_id', '=', Category::PC_GAMES); - if ((int) Settings::settingValue('..lookupgames') === 2) { + if ((int) Settings::settingValue('lookupgames') === 2) { $query->where('isrenamed', '=', 1); } $query->select(['searchname', 'id']) diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 987253aa3..1c43209f8 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -132,7 +132,7 @@ class Movie $this->omdbApi = new OMDbAPI($this->omdbapikey); } - $this->lookuplanguage = Settings::settingValue('indexer.categorise.imdblanguage') !== '' ? (string) Settings::settingValue('indexer.categorise.imdblanguage') : 'en'; + $this->lookuplanguage = Settings::settingValue('imdblanguage') !== '' ? (string) Settings::settingValue('imdblanguage') : 'en'; $this->config = new Config; $this->config->language = $this->lookuplanguage; $this->config->throwHttpExceptions = false; @@ -142,8 +142,8 @@ class Movie } $this->config->cachedir = $cacheDir; - $this->imdburl = (int) Settings::settingValue('indexer.categorise.imdburl') !== 0; - $this->movieqty = Settings::settingValue('..maximdbprocessed') !== '' ? (int) Settings::settingValue('..maximdbprocessed') : 100; + $this->imdburl = (int) Settings::settingValue('imdburl') !== 0; + $this->movieqty = Settings::settingValue('maximdbprocessed') !== '' ? (int) Settings::settingValue('maximdbprocessed') : 100; $this->showPasswords = (new Releases)->showPasswords(); $this->echooutput = config('nntmux.echocli'); diff --git a/Blacklight/Music.php b/Blacklight/Music.php index 7bec6da5d..bc85ad641 100755 --- a/Blacklight/Music.php +++ b/Blacklight/Music.php @@ -80,13 +80,13 @@ class Music $this->colorCli = new ColorCLI; - $this->pubkey = Settings::settingValue('APIs..amazonpubkey'); - $this->privkey = Settings::settingValue('APIs..amazonprivkey'); - $this->asstag = Settings::settingValue('APIs..amazonassociatetag'); - $this->musicqty = Settings::settingValue('..maxmusicprocessed') !== '' ? (int) Settings::settingValue('..maxmusicprocessed') : 150; - $this->sleeptime = Settings::settingValue('..amazonsleep') !== '' ? (int) Settings::settingValue('..amazonsleep') : 1000; - $this->imgSavePath = storage_path('covers/music/'); - $this->renamed = (int) Settings::settingValue('..lookupmusic') === 2 ? 'AND isrenamed = 1' : ''; + $this->pubkey = Settings::settingValue('amazonpubkey'); + $this->privkey = Settings::settingValue('amazonprivkey'); + $this->asstag = Settings::settingValue('amazonassociatetag'); + $this->musicqty = Settings::settingValue('maxmusicprocessed') !== '' ? (int) Settings::settingValue('maxmusicprocessed') : 150; + $this->sleeptime = Settings::settingValue('amazonsleep') !== '' ? (int) Settings::settingValue('amazonsleep') : 1000; + $this->imgSavePath = config('nntmux_settings.covers_path').'/music/'; + $this->renamed = (int) Settings::settingValue('lookupmusic') === 2 ? 'AND isrenamed = 1' : ''; $this->failCache = []; } diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php index 21bedbd74..66186cf47 100755 --- a/Blacklight/NNTP.php +++ b/Blacklight/NNTP.php @@ -112,7 +112,7 @@ class NNTP extends \Net_NNTP_Client $this->_echo = config('nntmux.echocli'); $this->_tmux = new Tmux; - $this->_nntpRetries = Settings::settingValue('..nntpretries') !== '' ? (int) Settings::settingValue('..nntpretries') : 0 + 1; + $this->_nntpRetries = Settings::settingValue('nntpretries') !== '' ? (int) Settings::settingValue('nntpretries') : 0 + 1; $this->colorCli = new ColorCLI; $this->_currentPort = config('nntmux_nntp.port'); $this->_currentServer = config('nntmux_nntp.server'); diff --git a/Blacklight/NZB.php b/Blacklight/NZB.php index 4eb98dc83..19585e67d 100755 --- a/Blacklight/NZB.php +++ b/Blacklight/NZB.php @@ -63,7 +63,7 @@ class NZB */ public function __construct() { - $nzbSplitLevel = (int) Settings::settingValue('..nzbsplitlevel'); + $nzbSplitLevel = (int) Settings::settingValue('nzbsplitlevel'); $this->nzbSplitLevel = $nzbSplitLevel ?? 1; $this->siteNzbPath = config('nntmux_settings.path_to_nzbs'); if (! Str::endsWith($this->siteNzbPath, '/')) { diff --git a/Blacklight/NZBContents.php b/Blacklight/NZBContents.php index c07f12582..0d3638815 100755 --- a/Blacklight/NZBContents.php +++ b/Blacklight/NZBContents.php @@ -40,7 +40,7 @@ class NZBContents $this->nfo = new Nfo; $this->pp = new PostProcess; $this->nzb = new NZB; - $this->lookuppar2 = (int) Settings::settingValue('..lookuppar2') === 1; + $this->lookuppar2 = (int) Settings::settingValue('lookuppar2') === 1; $this->alternateNNTP = config('nntmux_nntp.use_alternate_nntp_server'); } diff --git a/Blacklight/NZBImport.php b/Blacklight/NZBImport.php index fefed92c2..054c30de6 100755 --- a/Blacklight/NZBImport.php +++ b/Blacklight/NZBImport.php @@ -70,7 +70,7 @@ class NZBImport $this->nzb = new NZB; $this->releaseCleaner = new ReleaseCleaning; $this->colorCli = new ColorCLI; - $this->crossPostt = Settings::settingValue('..crossposttime') !== '' ? Settings::settingValue('..crossposttime') : 2; + $this->crossPostt = Settings::settingValue('crossposttime') !== '' ? Settings::settingValue('crossposttime') : 2; // Set properties from options $this->browser = isset($options['Browser']) ? $options['Browser'] : ''; diff --git a/Blacklight/Nfo.php b/Blacklight/Nfo.php index a343f7bf2..85b7e9c9a 100755 --- a/Blacklight/Nfo.php +++ b/Blacklight/Nfo.php @@ -67,11 +67,11 @@ class Nfo public function __construct() { $this->echo = config('nntmux.echocli'); - $this->nzbs = Settings::settingValue('..maxnfoprocessed') !== '' ? (int) Settings::settingValue('..maxnfoprocessed') : 100; - $this->maxRetries = (int) Settings::settingValue('..maxnforetries') >= 0 ? -((int) Settings::settingValue('..maxnforetries') + 1) : self::NFO_UNPROC; + $this->nzbs = Settings::settingValue('maxnfoprocessed') !== '' ? (int) Settings::settingValue('maxnfoprocessed') : 100; + $this->maxRetries = (int) Settings::settingValue('maxnforetries') >= 0 ? -((int) Settings::settingValue('maxnforetries') + 1) : self::NFO_UNPROC; $this->maxRetries = $this->maxRetries < -8 ? -8 : $this->maxRetries; - $this->maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo'); - $this->minSize = (int) Settings::settingValue('..minsizetoprocessnfo'); + $this->maxSize = (int) Settings::settingValue('maxsizetoprocessnfo'); + $this->minSize = (int) Settings::settingValue('minsizetoprocessnfo'); $this->colorCli = new ColorCLI; $this->tmpPath = config('nntmux.tmp_unrar_path'); @@ -388,9 +388,9 @@ class Nfo */ public static function NfoQueryString(): string { - $maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo'); - $minSize = (int) Settings::settingValue('..minsizetoprocessnfo'); - $dummy = (int) Settings::settingValue('..maxnforetries'); + $maxSize = (int) Settings::settingValue('maxsizetoprocessnfo'); + $minSize = (int) Settings::settingValue('minsizetoprocessnfo'); + $dummy = (int) Settings::settingValue('maxnforetries'); $maxRetries = ($dummy >= 0 ? -($dummy + 1) : self::NFO_UNPROC); return sprintf( diff --git a/Blacklight/PopulateAniDB.php b/Blacklight/PopulateAniDB.php index 068416cb5..5f94f2a8f 100644 --- a/Blacklight/PopulateAniDB.php +++ b/Blacklight/PopulateAniDB.php @@ -54,10 +54,10 @@ class PopulateAniDB $this->echooutput = config('nntmux.echocli'); $this->colorCli = new ColorCLI; - $anidbupdint = Settings::settingValue('APIs.AniDB.max_update_frequency'); - $lastupdated = Settings::settingValue('APIs.AniDB.last_full_update'); + $anidbupdint = Settings::settingValue('max_update_frequency'); + $lastupdated = Settings::settingValue('last_full_update'); - $this->imgSavePath = storage_path('covers/anime/'); + $this->imgSavePath = config('nntmux_settings.covers_path').'/anime/'; $this->apiKey = config('nntmux_api.anidb_api_key'); $this->updateInterval = $anidbupdint ?? '7'; @@ -90,7 +90,7 @@ class PopulateAniDB */ private function getAniDbAPI($aniDbId) { - $timestamp = Settings::settingValue('APIs.AniDB.banned') + 90000; + $timestamp = Settings::settingValue('banned') + 90000; if ($timestamp > time()) { echo 'Banned from AniDB lookups until '.date('Y-m-d H:i:s', $timestamp).PHP_EOL; diff --git a/Blacklight/Releases.php b/Blacklight/Releases.php index 8b4176f5d..ab4084037 100644 --- a/Blacklight/Releases.php +++ b/Blacklight/Releases.php @@ -135,7 +135,7 @@ class Releases extends Release public function showPasswords(): string { - $show = (int) Settings::settingValue('..showpasswordedrelease'); + $show = (int) Settings::settingValue('showpasswordedrelease'); $setting = $show ?? 0; return match ($setting) { diff --git a/Blacklight/Tmux.php b/Blacklight/Tmux.php index 37de4c7ac..86a55d3a5 100755 --- a/Blacklight/Tmux.php +++ b/Blacklight/Tmux.php @@ -124,7 +124,7 @@ class Tmux public function getMonitorSettings(): string { - $settstr = 'SELECT value FROM settings WHERE setting ='; + $settstr = 'SELECT value FROM settings WHERE name ='; $sql = sprintf( "SELECT @@ -132,17 +132,13 @@ class Tmux (%1\$s 'binaries') AS binaries_run, (%1\$s 'backfill') AS backfill, (%1\$s 'backfill_qty') AS backfill_qty, - (%1\$s 'import') AS import, (%1\$s 'nzbs') AS nzbs, (%1\$s 'post') AS post, (%1\$s 'releases') AS releases_run, - (%1\$s 'releases_threaded') AS releases_threaded, (%1\$s 'fix_names') AS fix_names, (%1\$s 'seq_timer') AS seq_timer, (%1\$s 'bins_timer') AS bins_timer, (%1\$s 'back_timer') AS back_timer, - (%1\$s 'import_count') AS import_count, - (%1\$s 'import_timer') AS import_timer, (%1\$s 'rel_timer') AS rel_timer, (%1\$s 'fix_timer') AS fix_timer, (%1\$s 'post_timer') AS post_timer, @@ -152,7 +148,6 @@ class Tmux (%1\$s 'fix_crap') AS fix_crap, (%1\$s 'fix_crap_opt') AS fix_crap_opt, (%1\$s 'tv_timer') AS tv_timer, - (%1\$s 'update_tv') AS update_tv, (%1\$s 'post_kill_timer') AS post_kill_timer, (%1\$s 'monitor_path') AS monitor_path, (%1\$s 'monitor_path_a') AS monitor_path_a, @@ -170,8 +165,6 @@ class Tmux (%1\$s 'colors_exc') AS colors_exc, (%1\$s 'showquery') AS show_query, (%1\$s 'running') AS is_running, - (%1\$s 'run_sharing') AS run_sharing, - (%1\$s 'sharing_timer') AS sharing_timer, (%1\$s 'lookupbooks') AS processbooks, (%1\$s 'lookupmusic') AS processmusic, (%1\$s 'lookupgames') AS processgames, @@ -182,8 +175,6 @@ class Tmux (%1\$s 'lookupnfo') AS processnfo, (%1\$s 'lookuppar2') AS processpar2, (%1\$s 'nzbthreads') AS nzbthreads, - (%1\$s 'tmpunrarpath') AS tmpunrar, - (%1\$s 'compressedheaders') AS compressed, (%1\$s 'maxsizetopostprocess') AS maxsize_pp, (%1\$s 'minsizetopostprocess') AS minsize_pp", $settstr @@ -223,7 +214,7 @@ class Tmux { $path = storage_path('logs'); $getDate = now()->format('Y_m_d'); - $logs = Settings::settingValue('site.tmux.write_logs') ?? 0; + $logs = Settings::settingValue('write_logs') ?? 0; if ($logs === 1) { return "2>&1 | tee -a $path/$pane-$getDate.log"; } @@ -260,7 +251,7 @@ class Tmux */ public function rand_bool($loop, int $chance = 60): bool { - $usecache = Settings::settingValue('site.tmux.usecache') ?? 0; + $usecache = Settings::settingValue('usecache') ?? 0; if ($loop === 1 || $usecache === 0) { return false; } @@ -393,7 +384,7 @@ class Tmux */ public function isRunning(): bool { - $running = Settings::query()->where(['section' => 'site', 'subsection' => 'tmux', 'setting' => 'running'])->first(['value']); + $running = Settings::query()->where(['name' => 'running'])->first(['value']); if ($running === null) { throw new \RuntimeException('Tmux\\\'s running flag was not found in the database.'.PHP_EOL.'Please check the tables are correctly setup.'.PHP_EOL); } @@ -407,8 +398,8 @@ class Tmux public function stopIfRunning(): bool { if ($this->isRunning()) { - Settings::query()->where(['section' => 'site', 'subsection' => 'tmux', 'setting' => 'running'])->update(['value' => 0]); - $sleep = Settings::settingValue('site.tmux.monitor_delay'); + Settings::query()->where(['name' => 'running'])->update(['value' => 0]); + $sleep = Settings::settingValue('monitor_delay'); $this->colorCli->header('Stopping tmux scripts and waiting '.$sleep.' seconds for all panes to shutdown'); sleep($sleep); diff --git a/Blacklight/TmuxRun.php b/Blacklight/TmuxRun.php index 6fa0d6c92..fe3442c6a 100755 --- a/Blacklight/TmuxRun.php +++ b/Blacklight/TmuxRun.php @@ -27,8 +27,7 @@ class TmuxRun extends Tmux public function __construct() { parent::__construct(); - $dateFormat = Settings::settingValue('shell.date.format'); - $this->_dateFormat = $dateFormat ?? '%Y-%m-%d %T'; + $this->_dateFormat = '%Y-%m-%d %T'; } /** diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php index d58c2f278..6ba6c5a2e 100755 --- a/Blacklight/XXX.php +++ b/Blacklight/XXX.php @@ -49,7 +49,7 @@ class XXX $this->releaseImage = new ReleaseImage; $this->colorCli = new ColorCLI; - $this->movieQty = Settings::settingValue('..maxxxxprocessed') !== '' ? (int) Settings::settingValue('..maxxxxprocessed') : 100; + $this->movieQty = Settings::settingValue('maxxxxprocessed') ?? 100; $this->showPasswords = (new Releases)->showPasswords(); $this->echoOutput = config('nntmux.echocli'); $this->imgSavePath = storage_path('covers/xxx/'); diff --git a/Blacklight/libraries/Forking.php b/Blacklight/libraries/Forking.php index 1d5dd2432..4146d609f 100755 --- a/Blacklight/libraries/Forking.php +++ b/Blacklight/libraries/Forking.php @@ -96,9 +96,9 @@ class Forking $this->dnr_path = PHP_BINARY.' misc/update/multiprocessing/.do_not_run/switch.php "php '; - $this->maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo'); - $this->minSize = (int) Settings::settingValue('..minsizetoprocessnfo'); - $this->maxRetries = (int) Settings::settingValue('..maxnforetries') >= 0 ? -((int) Settings::settingValue('..maxnforetries') + 1) : Nfo::NFO_UNPROC; + $this->maxSize = (int) Settings::settingValue('maxsizetoprocessnfo'); + $this->minSize = (int) Settings::settingValue('minsizetoprocessnfo'); + $this->maxRetries = (int) Settings::settingValue('maxnforetries') >= 0 ? -((int) Settings::settingValue('maxnforetries') + 1) : Nfo::NFO_UNPROC; $this->maxRetries = max($this->maxRetries, -8); } @@ -285,11 +285,11 @@ class Forking private function safeBackfill(): void { - $backfill_qty = (int) Settings::settingValue('site.tmux.backfill_qty'); - $backfill_order = (int) Settings::settingValue('site.tmux.backfill_order'); - $backfill_days = (int) Settings::settingValue('site.tmux.backfill_days'); - $maxMessages = (int) Settings::settingValue('..maxmssgs'); - $threads = (int) Settings::settingValue('..backfillthreads'); + $backfill_qty = (int) Settings::settingValue('backfill_qty'); + $backfill_order = (int) Settings::settingValue('backfill_order'); + $backfill_days = (int) Settings::settingValue('backfill_days'); + $maxMessages = (int) Settings::settingValue('maxmssgs'); + $threads = (int) Settings::settingValue('backfillthreads'); $orderby = 'ORDER BY a.last_record ASC'; switch ($backfill_order) { @@ -318,7 +318,7 @@ class Forking if ($backfill_days === 1) { $backfilldays = 'g.backfill_target'; } elseif ($backfill_days === 2) { - $backfilldays = now()->diffInDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('..safebackfilldate')), true); + $backfilldays = now()->diffInDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('safebackfilldate')), true); } $data = DB::select( @@ -395,7 +395,7 @@ class Forking ) ); - $this->maxProcesses = (int) Settings::settingValue('..binarythreads'); + $this->maxProcesses = (int) Settings::settingValue('binarythreads'); $pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time')); @@ -424,9 +424,9 @@ class Forking */ private function safeBinaries(): void { - $maxHeaders = (int) Settings::settingValue('..max_headers_iteration') ?: 1000000; - $maxMessages = (int) Settings::settingValue('..maxmssgs'); - $this->maxProcesses = (int) Settings::settingValue('..binarythreads'); + $maxHeaders = (int) Settings::settingValue('max_headers_iteration') ?: 1000000; + $maxMessages = (int) Settings::settingValue('maxmssgs'); + $this->maxProcesses = (int) Settings::settingValue('binarythreads'); $this->work = DB::select( ' @@ -494,8 +494,8 @@ class Forking private function fixRelNames(): void { - $this->maxProcesses = (int) Settings::settingValue('..fixnamethreads'); - $maxPerRun = (int) Settings::settingValue('..fixnamesperrun'); + $this->maxProcesses = (int) Settings::settingValue('fixnamethreads'); + $maxPerRun = (int) Settings::settingValue('fixnamesperrun'); if ($this->maxProcesses > 16) { $this->maxProcesses = 16; @@ -564,7 +564,7 @@ class Forking private function releases(): void { $work = DB::select('SELECT id, name FROM usenet_groups WHERE (active = 1 OR backfill = 1)'); - $this->maxProcesses = (int) Settings::settingValue('..releasethreads'); + $this->maxProcesses = (int) Settings::settingValue('releasethreads'); $uGroups = []; foreach ($work as $group) { @@ -655,9 +655,9 @@ class Forking */ private function postProcessAdd(): void { - $ppAddMinSize = Settings::settingValue('..minsizetopostprocess') !== '' ? (int) Settings::settingValue('..minsizetopostprocess') : 1; + $ppAddMinSize = Settings::settingValue('minsizetopostprocess') !== '' ? (int) Settings::settingValue('minsizetopostprocess') : 1; $ppAddMinSize = ($ppAddMinSize > 0 ? ('AND r.size > '.($ppAddMinSize * 1048576)) : ''); - $ppAddMaxSize = (Settings::settingValue('..maxsizetopostprocess') !== '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100; + $ppAddMaxSize = (Settings::settingValue('maxsizetopostprocess') !== '') ? (int) Settings::settingValue('maxsizetopostprocess') : 100; $ppAddMaxSize = ($ppAddMaxSize > 0 ? ('AND r.size < '.($ppAddMaxSize * 1073741824)) : ''); $this->maxProcesses = 1; $ppQueue = DB::select( @@ -681,7 +681,7 @@ class Forking if (\count($ppQueue) > 0) { $this->processAdditional = true; $this->work = $ppQueue; - $this->maxProcesses = (int) Settings::settingValue('..postthreads'); + $this->maxProcesses = (int) Settings::settingValue('postthreads'); } $this->postProcess($this->work, $this->maxProcesses); @@ -697,7 +697,7 @@ class Forking */ private function checkProcessNfo(): bool { - if ((int) Settings::settingValue('..lookupnfo') === 1) { + if ((int) Settings::settingValue('lookupnfo') === 1) { $this->nfoQueryString = Nfo::NfoQueryString(); return DB::select(sprintf('SELECT r.id FROM releases r WHERE 1=1 %s LIMIT 1', $this->nfoQueryString)) > 0; @@ -725,7 +725,7 @@ class Forking $this->nfoQueryString ) ); - $this->maxProcesses = (int) Settings::settingValue('..nfothreads'); + $this->maxProcesses = (int) Settings::settingValue('nfothreads'); } $this->postProcess($this->work, $this->maxProcesses); @@ -736,7 +736,7 @@ class Forking */ private function checkProcessMovies(): bool { - if (Settings::settingValue('..lookupimdb') > 0) { + if (Settings::settingValue('lookupimdb') > 0) { return DB::select(sprintf(' SELECT id FROM releases @@ -744,7 +744,7 @@ class Forking AND nzbstatus = %d AND imdbid IS NULL %s %s - LIMIT 1', NZB::NZB_ADDED, ((int) Settings::settingValue('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), ($this->ppRenamedOnly ? 'AND isrenamed = 1' : ''))) > 0; + LIMIT 1', NZB::NZB_ADDED, ((int) Settings::settingValue('lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), ($this->ppRenamedOnly ? 'AND isrenamed = 1' : ''))) > 0; } return false; @@ -771,11 +771,11 @@ class Forking LIMIT 16', ($this->ppRenamedOnly ? 2 : 1), NZB::NZB_ADDED, - ((int) Settings::settingValue('..lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), + ((int) Settings::settingValue('lookupimdb') === 2 ? 'AND isrenamed = 1' : ''), ($this->ppRenamedOnly ? 'AND isrenamed = 1' : '') ) ); - $this->maxProcesses = (int) Settings::settingValue('..postthreadsnon'); + $this->maxProcesses = (int) Settings::settingValue('postthreadsnon'); } $this->postProcess($this->work, $this->maxProcesses); @@ -789,7 +789,7 @@ class Forking */ private function checkProcessTV(): bool { - if ((int) Settings::settingValue('..lookuptvrage') > 0) { + if ((int) Settings::settingValue('lookuptvrage') > 0) { return DB::select(sprintf(' SELECT id FROM releases @@ -798,7 +798,7 @@ class Forking AND size > 1048576 AND tv_episodes_id BETWEEN -2 AND 0 %s %s - ', NZB::NZB_ADDED, (int) Settings::settingValue('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', $this->ppRenamedOnly ? 'AND isrenamed = 1' : '')) > 0; + ', NZB::NZB_ADDED, (int) Settings::settingValue('lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', $this->ppRenamedOnly ? 'AND isrenamed = 1' : '')) > 0; } return false; @@ -826,11 +826,11 @@ class Forking LIMIT 16', ($this->ppRenamedOnly ? 2 : 1), NZB::NZB_ADDED, - (int) Settings::settingValue('..lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', + (int) Settings::settingValue('lookuptvrage') === 2 ? 'AND isrenamed = 1' : '', ($this->ppRenamedOnly ? 'AND isrenamed = 1' : '') ) ); - $this->maxProcesses = (int) Settings::settingValue('..postthreadsnon'); + $this->maxProcesses = (int) Settings::settingValue('postthreadsnon'); } $this->postProcess($this->work, $this->maxProcesses); @@ -862,7 +862,7 @@ class Forking { $this->work = DB::select('SELECT id , name FROM usenet_groups WHERE (active = 1 OR backfill = 1)'); - $maxProcess = (int) Settings::settingValue('..releasethreads'); + $maxProcess = (int) Settings::settingValue('releasethreads'); $pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time')); $this->processWork(); diff --git a/Blacklight/processing/PostProcess.php b/Blacklight/processing/PostProcess.php index d70ba4235..b6fea1998 100755 --- a/Blacklight/processing/PostProcess.php +++ b/Blacklight/processing/PostProcess.php @@ -91,7 +91,7 @@ class PostProcess */ public function processAnime(): void { - if ((int) Settings::settingValue('..lookupanidb') !== 0) { + if ((int) Settings::settingValue('lookupanidb') !== 0) { (new AniDB(['Echo' => $this->echooutput]))->processAnimeReleases(); } } @@ -104,7 +104,7 @@ class PostProcess */ public function processBooks(): void { - if ((int) Settings::settingValue('..lookupbooks') !== 0) { + if ((int) Settings::settingValue('lookupbooks') !== 0) { (new Books(['Echo' => $this->echooutput]))->processBookReleases(); } } @@ -114,7 +114,7 @@ class PostProcess */ public function processConsoles(): void { - if ((int) Settings::settingValue('..lookupgames') !== 0) { + if ((int) Settings::settingValue('lookupgames') !== 0) { (new Console(['Echo' => $this->echooutput]))->processConsoleReleases(); } } @@ -124,7 +124,7 @@ class PostProcess */ public function processGames(): void { - if ((int) Settings::settingValue('..lookupgames') !== 0) { + if ((int) Settings::settingValue('lookupgames') !== 0) { (new Games(['Echo' => $this->echooutput]))->processGamesReleases(); } } @@ -141,7 +141,7 @@ class PostProcess */ public function processMovies(string $groupID = '', string $guidChar = '', int|string|null $processMovies = ''): void { - $processMovies = (is_numeric($processMovies) ? $processMovies : Settings::settingValue('..lookupimdb')); + $processMovies = (is_numeric($processMovies) ? $processMovies : Settings::settingValue('lookupimdb')); if ($processMovies > 0) { (new Movie(['Echo' => $this->echooutput]))->processMovieReleases($groupID, $guidChar, $processMovies); } @@ -152,7 +152,7 @@ class PostProcess */ public function processMusic(): void { - if ((int) Settings::settingValue('..lookupmusic') !== 0) { + if ((int) Settings::settingValue('lookupmusic') !== 0) { (new Music(['Echo' => $this->echooutput]))->processMusicReleases(); } } @@ -167,8 +167,8 @@ class PostProcess */ public function processNfos(NNTP $nntp, string $groupID = '', string $guidChar = ''): void { - if ((int) Settings::settingValue('..lookupnfo') === 1) { - $this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int) Settings::settingValue('..lookupimdb'), (int) Settings::settingValue('..lookuptvrage')); + if ((int) Settings::settingValue('lookupnfo') === 1) { + $this->Nfo->processNfoFiles($nntp, $groupID, $guidChar, (int) Settings::settingValue('lookupimdb'), (int) Settings::settingValue('lookuptvrage')); } } @@ -184,7 +184,7 @@ class PostProcess */ public function processTv(string $groupID = '', string $guidChar = '', int|string|null $processTV = ''): void { - $processTV = (is_numeric($processTV) ? $processTV : Settings::settingValue('..lookuptvrage')); + $processTV = (is_numeric($processTV) ? $processTV : Settings::settingValue('lookuptvrage')); if ($processTV > 0) { (new TVDB(['Echo' => $this->echooutput]))->processSite($groupID, $guidChar, $processTV); (new TVMaze(['Echo' => $this->echooutput]))->processSite($groupID, $guidChar, $processTV); @@ -200,7 +200,7 @@ class PostProcess */ public function processXXX(): void { - if ((int) Settings::settingValue('..lookupxxx') === 1) { + if ((int) Settings::settingValue('lookupxxx') === 1) { (new XXX(['Echo' => $this->echooutput]))->processXXXReleases(); } } diff --git a/Blacklight/processing/ProcessReleases.php b/Blacklight/processing/ProcessReleases.php index 382f475e6..49f6c0aad 100755 --- a/Blacklight/processing/ProcessReleases.php +++ b/Blacklight/processing/ProcessReleases.php @@ -82,19 +82,19 @@ class ProcessReleases $this->releases = new Releases; $this->releaseImage = new ReleaseImage; - $dummy = Settings::settingValue('..delaytime'); + $dummy = Settings::settingValue('delaytime'); $this->collectionDelayTime = ($dummy !== '' ? (int) $dummy : 2); - $dummy = Settings::settingValue('..crossposttime'); + $dummy = Settings::settingValue('crossposttime'); $this->crossPostTime = ($dummy !== '' ? (int) $dummy : 2); - $dummy = Settings::settingValue('..maxnzbsprocessed'); + $dummy = Settings::settingValue('maxnzbsprocessed'); $this->releaseCreationLimit = ($dummy !== '' ? (int) $dummy : 1000); - $dummy = Settings::settingValue('..completionpercent'); + $dummy = Settings::settingValue('completionpercent'); $this->completion = ($dummy !== '' ? (int) $dummy : 0); if ($this->completion > 100) { $this->completion = 100; $this->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'); + $this->collectionTimeout = (int) Settings::settingValue('collection_timeout'); } /** @@ -120,9 +120,9 @@ class ProcessReleases $this->colorCLI->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')'); } - if (! file_exists(Settings::settingValue('..nzbpath'))) { + if (! file_exists(config('nntmux_settings.path_to_nzbs'))) { if ($this->echoCLI) { - $this->colorCLI->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath')); + $this->colorCLI->error('Bad or missing nzb directory - '.config('nntmux_settings.path_to_nzbs')); } return 0; @@ -303,9 +303,9 @@ class ProcessReleases $minSizeDeleted = $maxSizeDeleted = $minFilesDeleted = 0; - $maxSizeSetting = Settings::settingValue('.release.maxsizetoformrelease'); - $minSizeSetting = Settings::settingValue('.release.minsizetoformrelease'); - $minFilesSetting = Settings::settingValue('.release.minfilestoformrelease'); + $maxSizeSetting = Settings::settingValue('maxsizetoformrelease'); + $minSizeSetting = Settings::settingValue('minsizetoformrelease'); + $minFilesSetting = Settings::settingValue('minfilestoformrelease'); foreach ($groupIDs as $grpID) { $groupMinSizeSetting = $groupMinFilesSetting = 0; @@ -665,14 +665,14 @@ class ProcessReleases echo $this->colorCLI->header('Process Releases -> Delete finished collections.'.PHP_EOL). $this->colorCLI->primary(sprintf( 'Deleting collections/binaries/parts older than %d hours.', - Settings::settingValue('..partretentionhours') + Settings::settingValue('partretentionhours') ), true); } DB::transaction(function () use ($deletedCount, $startTime) { $deleted = 0; $deleteQuery = Collection::query() - ->where('dateadded', '<', now()->subHours(Settings::settingValue('..partretentionhours'))) + ->where('dateadded', '<', now()->subHours(Settings::settingValue('partretentionhours'))) ->delete(); if ($deleteQuery > 0) { $deleted = $deleteQuery; @@ -757,9 +757,9 @@ class ProcessReleases $groupIDs = $groupID === '' ? UsenetGroup::getActiveIDs() : [['id' => $groupID]]; - $maxSizeSetting = Settings::settingValue('.release.maxsizetoformrelease'); - $minSizeSetting = Settings::settingValue('.release.minsizetoformrelease'); - $minFilesSetting = Settings::settingValue('.release.minfilestoformrelease'); + $maxSizeSetting = Settings::settingValue('maxsizetoformrelease'); + $minSizeSetting = Settings::settingValue('minsizetoformrelease'); + $minFilesSetting = Settings::settingValue('minfilestoformrelease'); foreach ($groupIDs as $grpID) { $releases = Release::query()->where('releases.groups_id', $grpID['id'])->whereRaw('greatest(IFNULL(usenet_groups.minsizetoformrelease, 0), ?) > 0 AND releases.size < greatest(IFNULL(usenet_groups.minsizetoformrelease, 0), ?)', [$minSizeSetting, $minSizeSetting])->join('usenet_groups', 'usenet_groups.id', '=', 'releases.groups_id')->select(['releases.id', 'releases.guid'])->get(); @@ -819,8 +819,8 @@ class ProcessReleases } // Releases past retention. - if ((int) Settings::settingValue('..releaseretentiondays') !== 0) { - $releases = Release::query()->where('postdate', '<', now()->subDays((int) Settings::settingValue('..releaseretentiondays')))->select(['id', 'guid'])->get(); + if ((int) Settings::settingValue('releaseretentiondays') !== 0) { + $releases = Release::query()->where('postdate', '<', now()->subDays((int) Settings::settingValue('releaseretentiondays')))->select(['id', 'guid'])->get(); foreach ($releases as $release) { $this->releases->deleteSingle(['g' => $release->guid, 'i' => $release->id], $this->nzb, $this->releaseImage); $retentionDeleted++; @@ -828,7 +828,7 @@ class ProcessReleases } // Passworded releases. - if ((int) Settings::settingValue('..deletepasswordedrelease') === 1) { + if ((int) Settings::settingValue('deletepasswordedrelease') === 1) { $releases = Release::query() ->select(['id', 'guid']) ->where('passwordstatus', '=', Releases::PASSWD_RAR) @@ -904,8 +904,8 @@ class ProcessReleases } // Misc other. - if (Settings::settingValue('..miscotherretentionhours') > 0) { - $releases = Release::query()->where('categories_id', Category::OTHER_MISC)->where('adddate', '<=', now()->subHours((int) Settings::settingValue('..miscotherretentionhours')))->select(['id', 'guid'])->get(); + if (Settings::settingValue('miscotherretentionhours') > 0) { + $releases = Release::query()->where('categories_id', Category::OTHER_MISC)->where('adddate', '<=', now()->subHours((int) Settings::settingValue('miscotherretentionhours')))->select(['id', 'guid'])->get(); foreach ($releases as $release) { $this->releases->deleteSingle(['g' => $release->guid, 'i' => $release->id], $this->nzb, $this->releaseImage); $miscRetentionDeleted++; @@ -913,8 +913,8 @@ class ProcessReleases } // Misc hashed. - if ((int) Settings::settingValue('..mischashedretentionhours') > 0) { - $releases = Release::query()->where('categories_id', Category::OTHER_HASHED)->where('adddate', '<=', now()->subHours((int) Settings::settingValue('..mischashedretentionhours')))->select(['id', 'guid'])->get(); + if ((int) Settings::settingValue('mischashedretentionhours') > 0) { + $releases = Release::query()->where('categories_id', Category::OTHER_HASHED)->where('adddate', '<=', now()->subHours((int) Settings::settingValue('mischashedretentionhours')))->select(['id', 'guid'])->get(); foreach ($releases as $release) { $this->releases->deleteSingle(['g' => $release->guid, 'i' => $release->id], $this->nzb, $this->releaseImage); $miscHashedDeleted++; @@ -1184,7 +1184,7 @@ class ProcessReleases */ private function processStuckCollections(int $groupID): void { - $lastRun = Settings::settingValue('indexer.processing.last_run_time'); + $lastRun = Settings::settingValue('last_run_time'); DB::transaction(function () use ($groupID, $lastRun) { $objQuery = Collection::query() diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php index 3952cf036..c2b33cdaa 100755 --- a/Blacklight/processing/post/AniDB.php +++ b/Blacklight/processing/post/AniDB.php @@ -46,7 +46,7 @@ class AniDB $this->padb = new PaDb; $this->colorCli = new ColorCLI; - $quantity = (int) Settings::settingValue('..maxanidbprocessed'); + $quantity = (int) Settings::settingValue('maxanidbprocessed'); $this->aniqty = $quantity ?? 100; $this->status = null; diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 53fb74b65..48eaa0bce 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -271,15 +271,15 @@ class ProcessAdditional $this->_nfo = new Nfo; $this->manticore = new ManticoreSearch; $this->elasticsearch = new ElasticSearchSiteSearch; - $this->ffmpeg = FFMpeg::create(['timeout' => Settings::settingValue('..timeoutseconds')]); + $this->ffmpeg = FFMpeg::create(['timeout' => Settings::settingValue('timeoutseconds')]); $this->ffprobe = FFProbe::create(); $this->mediaInfo = new MediaInfo; $this->mediaInfo->setConfig('use_oldxml_mediainfo_output_format', true); - $this->mediaInfo->setConfig('command', Settings::settingValue('apps..mediainfopath')); + $this->mediaInfo->setConfig('command', config('nntmux_settings.mediainfo_path')); - $this->_innerFileBlacklist = Settings::settingValue('indexer.ppa.innerfileblacklist') === '' ? false : Settings::settingValue('indexer.ppa.innerfileblacklist'); - $this->_maxNestedLevels = (int) Settings::settingValue('..maxnestedlevels') === 0 ? 3 : (int) Settings::settingValue('..maxnestedlevels'); - $this->_extractUsingRarInfo = (int) Settings::settingValue('..extractusingrarinfo') !== 0; + $this->_innerFileBlacklist = Settings::settingValue('innerfileblacklist') === '' ? false : Settings::settingValue('innerfileblacklist'); + $this->_maxNestedLevels = (int) Settings::settingValue('maxnestedlevels') === 0 ? 3 : (int) Settings::settingValue('maxnestedlevels'); + $this->_extractUsingRarInfo = (int) Settings::settingValue('extractusingrarinfo') !== 0; $this->_fetchLastFiles = (int) Settings::settingValue('archive.fetch.end') !== 0; $this->_unrarPath = false; @@ -291,11 +291,11 @@ class ProcessAdditional $this->_archiveInfo->setExternalClients($clients); $this->_killString = '"'; - if (config('nntmux_settings.timeout_path') && (int) Settings::settingValue('..timeoutseconds') > 0) { + if (config('nntmux_settings.timeout_path') && (int) Settings::settingValue('timeoutseconds') > 0) { $this->_killString = ( '"'.config('nntmux_settings.timeout_path'). '" --foreground --signal=KILL '. - Settings::settingValue('..timeoutseconds').' "' + Settings::settingValue('timeoutseconds').' "' ); } @@ -303,43 +303,43 @@ class ProcessAdditional // Maximum amount of releases to fetch per run. $this->_queryLimit = - (Settings::settingValue('..maxaddprocessed') !== '') ? (int) Settings::settingValue('..maxaddprocessed') : 25; + (Settings::settingValue('maxaddprocessed') !== '') ? (int) Settings::settingValue('maxaddprocessed') : 25; // Maximum message ID's to download per file type in the NZB (video, jpg, etc). $this->_segmentsToDownload = - (Settings::settingValue('..segmentstodownload') !== '') ? (int) Settings::settingValue('..segmentstodownload') : 2; + (Settings::settingValue('segmentstodownload') !== '') ? (int) Settings::settingValue('segmentstodownload') : 2; // Maximum message ID's to download for a RAR file. $this->_maximumRarSegments = - (Settings::settingValue('..maxpartsprocessed') !== '') ? (int) Settings::settingValue('..maxpartsprocessed') : 3; + (Settings::settingValue('maxpartsprocessed') !== '') ? (int) Settings::settingValue('maxpartsprocessed') : 3; // Maximum RAR files to check for a password before stopping. $this->_maximumRarPasswordChecks = - (Settings::settingValue('..passchkattempts') !== '') ? (int) Settings::settingValue('..passchkattempts') : 1; + (Settings::settingValue('passchkattempts') !== '') ? (int) Settings::settingValue('passchkattempts') : 1; $this->_maximumRarPasswordChecks = (max($this->_maximumRarPasswordChecks, 1)); // Maximum size of releases in GB. - $this->_maxSize = (Settings::settingValue('..maxsizetopostprocess') !== '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100; + $this->_maxSize = (Settings::settingValue('maxsizetopostprocess') !== '') ? (int) Settings::settingValue('maxsizetopostprocess') : 100; // Minimum size of releases in MB. - $this->_minSize = (Settings::settingValue('..minsizetopostprocess') !== '') ? (int) Settings::settingValue('..minsizetopostprocess') : 100; + $this->_minSize = (Settings::settingValue('minsizetopostprocess') !== '') ? (int) Settings::settingValue('minsizetopostprocess') : 100; // Use the alternate NNTP provider for downloading Message-ID's ? $this->_alternateNNTP = config('nntmux_nntp.use_alternate_nntp_server'); - $this->_ffMPEGDuration = Settings::settingValue('..ffmpeg_duration') !== '' ? (int) Settings::settingValue('..ffmpeg_duration') : 5; + $this->_ffMPEGDuration = Settings::settingValue('ffmpeg_duration') !== '' ? (int) Settings::settingValue('ffmpeg_duration') : 5; $this->_addPAR2Files = config('nntmux:settings.add_par2'); if (! config('nntmux_settings.ffmpeg_path')) { $this->_processAudioSample = $this->_processThumbnails = $this->_processVideo = false; } else { - $this->_processAudioSample = (int) Settings::settingValue('..saveaudiopreview') !== 0; - $this->_processThumbnails = (int) Settings::settingValue('..processthumbnails') !== 0; - $this->_processVideo = (int) Settings::settingValue('..processvideos') !== 0; + $this->_processAudioSample = (int) Settings::settingValue('saveaudiopreview') !== 0; + $this->_processThumbnails = (int) Settings::settingValue('processthumbnails') !== 0; + $this->_processVideo = (int) Settings::settingValue('processvideos') !== 0; } - $this->_processJPGSample = (int) Settings::settingValue('..processjpg') !== 0; + $this->_processJPGSample = (int) Settings::settingValue('processjpg') !== 0; $this->_processMediaInfo = config('nntmux_settings.mediainfo_path'); $this->_processAudioInfo = $this->_processMediaInfo; $this->_processPasswords = config('nntmux_settings.check_passworded_rars') === true && ! empty(config('nntmux_settings.unrar_path')); diff --git a/Blacklight/processing/tv/TV.php b/Blacklight/processing/tv/TV.php index fe79edd07..cbabda36b 100755 --- a/Blacklight/processing/tv/TV.php +++ b/Blacklight/processing/tv/TV.php @@ -80,7 +80,7 @@ abstract class TV extends Videos parent::__construct(); $this->colorCli = new ColorCLI; $this->catWhere = 'categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER.' AND categories_id != '.Category::TV_ANIME; - $this->tvqty = Settings::settingValue('..maxrageprocessed') !== '' ? (int) Settings::settingValue('..maxrageprocessed') : 75; + $this->tvqty = Settings::settingValue('maxrageprocessed') !== '' ? (int) Settings::settingValue('maxrageprocessed') : 75; $this->imgSavePath = storage_path('covers/tvshows/'); $this->siteColumns = ['tvdb', 'trakt', 'tvrage', 'tvmaze', 'imdb', 'tmdb']; } diff --git a/app/Console/Commands/TmuxUIStart.php b/app/Console/Commands/TmuxUIStart.php index c5cbf2698..7154cedcb 100644 --- a/app/Console/Commands/TmuxUIStart.php +++ b/app/Console/Commands/TmuxUIStart.php @@ -29,7 +29,7 @@ class TmuxUIStart extends Command public function handle(): void { $tmux = new Tmux; - $tmux_session = Settings::settingValue('site.tmux.tmux_session') ?? 0; + $tmux_session = Settings::settingValue('tmux_session') ?? 0; // Set running value to on. $tmux->startRunning(); diff --git a/app/Console/Commands/TmuxUIStop.php b/app/Console/Commands/TmuxUIStop.php index 3109bf329..a65b4fc75 100644 --- a/app/Console/Commands/TmuxUIStop.php +++ b/app/Console/Commands/TmuxUIStop.php @@ -31,7 +31,7 @@ class TmuxUIStop extends Command $tmux = new Tmux; $tmux->stopIfRunning(); if ($this->option('kill') === true) { - $sessionName = Settings::settingValue('site.tmux.tmux_session'); + $sessionName = Settings::settingValue('tmux_session'); $tmuxSession = Process::run('tmux kill-session -t '.$sessionName); $this->info('Killing active tmux session: '.$sessionName); if ($tmuxSession->successful()) { diff --git a/app/Http/Controllers/Admin/AdminSiteController.php b/app/Http/Controllers/Admin/AdminSiteController.php index 70a1c0d9a..78074b824 100644 --- a/app/Http/Controllers/Admin/AdminSiteController.php +++ b/app/Http/Controllers/Admin/AdminSiteController.php @@ -156,7 +156,7 @@ class AdminSiteController extends BasePageController $this->smarty->assign('book_reqids_names', $book_reqids_names); // convert from a list to an array as we need to use an array, but teh Settings table only saves strings - $books_selected = explode(',', Settings::settingValue('..book_reqids')); + $books_selected = explode(',', Settings::settingValue('book_reqids')); // convert from a string array to an int array $books_selected = array_map(function ($value) { diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index a13ee90e8..3834b3aba 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -369,9 +369,9 @@ class ApiController extends BasePageController return [ 'server' => [ 'title' => config('app.name'), - 'strapline' => Settings::settingValue('site.main.strapline'), + 'strapline' => Settings::settingValue('strapline'), 'email' => config('mail.from.address'), - 'meta' => Settings::settingValue('site.main.metakeywords'), + 'meta' => Settings::settingValue('metakeywords'), 'url' => $serverroot, 'image' => $serverroot.'/assets/images/tmux_logo.png', ], @@ -381,7 +381,7 @@ class ApiController extends BasePageController ], 'registration' => [ 'available' => 'yes', - 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', + 'open' => (int) Settings::settingValue('registerstatus') === 0 ? 'yes' : 'no', ], 'searching' => [ 'search' => ['available' => 'yes', 'supportedParams' => 'q'], @@ -423,7 +423,7 @@ class ApiController extends BasePageController if ($request->has('cat')) { $categoryIDs = urldecode($request->input('cat')); // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility. - if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { + if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) { $categoryIDs .= (','.Category::TV_WEBDL); } $categoryID = explode(',', $categoryIDs); diff --git a/app/Http/Controllers/Api/ApiV2Controller.php b/app/Http/Controllers/Api/ApiV2Controller.php index 812a90c96..64fdc31f4 100644 --- a/app/Http/Controllers/Api/ApiV2Controller.php +++ b/app/Http/Controllers/Api/ApiV2Controller.php @@ -35,7 +35,7 @@ class ApiV2Controller extends BasePageController $capabilities = [ 'server' => [ 'title' => config('app.name'), - 'strapline' => Settings::settingValue('site.main.strapline'), + 'strapline' => Settings::settingValue('strapline'), 'email' => config('mail.from.address'), 'url' => url('/'), ], @@ -45,7 +45,7 @@ class ApiV2Controller extends BasePageController ], 'registration' => [ 'available' => 'no', - 'open' => (int) Settings::settingValue('..registerstatus') === 0 ? 'yes' : 'no', + 'open' => (int) Settings::settingValue('registerstatus') === 0 ? 'yes' : 'no', ], 'searching' => [ 'search' => ['available' => 'yes', 'supportedParams' => 'id'], diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index cdcc96462..ba1119e77 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -151,7 +151,7 @@ class RegisterController extends Controller return $this->showRegistrationForm($request, $error); } - if (Invite::isAllowed($inviteCode, $email) || Settings::settingValue('..registerstatus') !== Settings::REGISTER_STATUS_INVITE) { + if (Invite::isAllowed($inviteCode, $email) || Settings::settingValue('registerstatus') !== Settings::REGISTER_STATUS_INVITE) { $user = $this->create( [ 'username' => $userName, @@ -201,7 +201,7 @@ class RegisterController extends Controller $this->inviteCodeQuery = '&invitecode='.$inviteCode; } - if ((int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { + if ((int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { if (! empty($inviteCode)) { if (Invite::isValid($inviteCode)) { $error = ''; @@ -214,7 +214,7 @@ class RegisterController extends Controller $error = 'Registrations are currently invite only.'; $showRegister = 0; } - } elseif ((int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_CLOSED) { + } elseif ((int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_CLOSED) { $error = 'Registrations are currently closed.'; $showRegister = 0; } elseif ($request->has('invitecode')) { diff --git a/app/Http/Controllers/DetailsController.php b/app/Http/Controllers/DetailsController.php index 52cd67d25..1b75eb50d 100644 --- a/app/Http/Controllers/DetailsController.php +++ b/app/Http/Controllers/DetailsController.php @@ -76,10 +76,10 @@ class DetailsController extends BasePageController $mov['actors'] = makeFieldLinks($mov, 'actors', 'movies'); $mov['genre'] = makeFieldLinks($mov, 'genre', 'movies'); $mov['director'] = makeFieldLinks($mov, 'director', 'movies'); - if (Settings::settingValue('site.trailers.trailers_display')) { + if (Settings::settingValue('trailers_display')) { $trailer = empty($mov['trailer']) || $mov['trailer'] === '' ? $movie->getTrailer($data['imdbid']) : $mov['trailer']; if ($trailer) { - $mov['trailer'] = sprintf('', Settings::settingValue('site.trailers.trailers_size_x'), Settings::settingValue('site.trailers.trailers_size_y'), $trailer); + $mov['trailer'] = sprintf('', Settings::settingValue('trailers_size_x'), Settings::settingValue('trailers_size_y'), $trailer); } } } diff --git a/app/Http/Controllers/MyMoviesController.php b/app/Http/Controllers/MyMoviesController.php index 208d8db04..36eeda3fe 100644 --- a/app/Http/Controllers/MyMoviesController.php +++ b/app/Http/Controllers/MyMoviesController.php @@ -70,7 +70,7 @@ class MyMoviesController extends BasePageController $categories = []; foreach ($tmpcats as $c) { // If MOVIE WEB-DL categorization is disabled, don't include it as an option - if ((int) $c['id'] === Category::MOVIE_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { + if ((int) $c['id'] === Category::MOVIE_WEBDL && (int) Settings::settingValue('catwebdl') === 0) { continue; } $categories[$c['id']] = $c['title']; diff --git a/app/Http/Controllers/MyShowsController.php b/app/Http/Controllers/MyShowsController.php index bdc0e58ea..e6c99ec1c 100644 --- a/app/Http/Controllers/MyShowsController.php +++ b/app/Http/Controllers/MyShowsController.php @@ -69,7 +69,7 @@ class MyShowsController extends BasePageController $categories = []; foreach ($tmpcats as $c) { // If TV WEB-DL categorization is disabled, don't include it as an option - if ((int) $c['id'] === Category::TV_WEBDL && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) { + if ((int) $c['id'] === Category::TV_WEBDL && (int) Settings::settingValue('catwebdl') === 0) { continue; } $categories[$c['id']] = $c['title']; diff --git a/app/Models/Release.php b/app/Models/Release.php index 8774580de..cf8e3855e 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -309,7 +309,7 @@ class Release extends Model */ public static function updateGrab(string $guid): void { - $updateGrabs = ((int) Settings::settingValue('..grabstatus') !== 0); + $updateGrabs = ((int) Settings::settingValue('grabstatus') !== 0); if ($updateGrabs) { self::whereGuid($guid)->increment('grabs'); } diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 9aa2bc931..c00247b79 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -157,21 +157,14 @@ class Settings extends Model return $tree; } - /** - * @return mixed - */ - public static function settingValue($setting) + + public static function settingValue($setting): mixed { - preg_match('/(\w+)?\.(\w+)?\.(\w+)/i', $setting, $hit); - $result = self::query()->where( + return self::query()->where( [ - 'section' => $hit[1] ?? '', - 'subsection' => $hit[2] ?? '', - 'name' => $hit[3] ?? '', + 'name' => $setting, ] )->value('value'); - - return $result; } public static function settingsUpdate(array $data = []): void diff --git a/app/Models/User.php b/app/Models/User.php index 03b94f1bc..f323ff526 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -555,7 +555,7 @@ class User extends Authenticatable // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up. $invitedBy = 0; - if (! $forceInviteMode && (int) Settings::settingValue('..registerstatus') === Settings::REGISTER_STATUS_INVITE) { + if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) { if ($inviteCode === '') { return self::ERR_SIGNUP_BADINVITECODE; } diff --git a/misc/update/multiprocessing/.do_not_run/switch.php b/misc/update/multiprocessing/.do_not_run/switch.php index 7555ee8b5..acf37c86e 100644 --- a/misc/update/multiprocessing/.do_not_run/switch.php +++ b/misc/update/multiprocessing/.do_not_run/switch.php @@ -29,7 +29,7 @@ switch ($options[1]) { // $options[3] => (int) backfill type from tmux settings. 1 = Backfill interval , 2 = Bakfill all case 'backfill': if (in_array((int) $options[3], [1, 2], false)) { - $value = (int) Settings::settingValue('site.tmux.backfill_qty'); + $value = (int) Settings::settingValue('backfill_qty'); if ($value !== null) { try { $nntp = nntp(); @@ -109,7 +109,7 @@ switch ($options[1]) { } try { $binaries = new Binaries(['NNTP' => $nntp, 'Groups' => null]); - $return = $binaries->scan($groupMySQL, $options[4], $options[5], ((int) Settings::settingValue('..safepartrepair') === 1 ? 'update' : 'backfill')); + $return = $binaries->scan($groupMySQL, $options[4], $options[5], ((int) Settings::settingValue('safepartrepair') === 1 ? 'update' : 'backfill')); } catch (Throwable $e) { Log::error($e->getTraceAsString()); echo $e->getMessage(); @@ -309,7 +309,7 @@ switch ($options[1]) { echo $e->getMessage(); } try { - (new Nfo())->processNfoFiles($nntp, $options[2], '', (int) Settings::settingValue('..lookupimdb'), (int) Settings::settingValue('..lookuptvrage')); + (new Nfo())->processNfoFiles($nntp, $options[2], '', (int) Settings::settingValue('lookupimdb'), (int) Settings::settingValue('lookuptvrage')); } catch (Throwable $e) { echo $e->getMessage(); } @@ -331,7 +331,7 @@ switch ($options[1]) { if ($options[1] === 'pp_nfo') { try { - (new Nfo())->processNfoFiles($nntp, '', $options[2], (int) Settings::settingValue('..lookupimdb'), (int) Settings::settingValue('..lookuptvrage')); + (new Nfo())->processNfoFiles($nntp, '', $options[2], (int) Settings::settingValue('lookupimdb'), (int) Settings::settingValue('lookuptvrage')); } catch (Throwable $e) { echo $e->getMessage(); } @@ -386,7 +386,7 @@ switch ($options[1]) { */ function processReleases(ProcessReleases $releases, $groupID): void { - $releaseCreationLimit = (Settings::settingValue('..maxnzbsprocessed') !== '' ? (int) Settings::settingValue('..maxnzbsprocessed') : 1000); + $releaseCreationLimit = (Settings::settingValue('maxnzbsprocessed') !== '' ? (int) Settings::settingValue('maxnzbsprocessed') : 1000); $releases->processIncompleteCollections($groupID); $releases->processCollectionSizes($groupID); $releases->deleteUnwantedCollections($groupID); diff --git a/misc/update/tmux/monitor.php b/misc/update/tmux/monitor.php index a7ca71ce2..360f6c38c 100644 --- a/misc/update/tmux/monitor.php +++ b/misc/update/tmux/monitor.php @@ -32,7 +32,7 @@ $runVar['paths']['scraper'] = base_path().'/misc/IRCScraper/scrape.php'; $db_name = config('nntmux.db_name'); -$tmux_niceness = Settings::settingValue('site.tmux.niceness') ?? 2; +$tmux_niceness = Settings::settingValue('niceness') ?? 2; $runVar['constants'] = (array) Arr::first(DB::select($tRun->getConstantSettings())); @@ -388,7 +388,7 @@ while ($runVar['counts']['iterations'] > 0) { } } - $exit = Settings::settingValue('tmux.running.exit'); + $exit = Settings::settingValue('exit'); if ((int) $exit === 0) { $runVar['counts']['iterations']++; sleep(10); diff --git a/misc/update/tmux/run.php b/misc/update/tmux/run.php index 87584af0e..49e3a50ea 100644 --- a/misc/update/tmux/run.php +++ b/misc/update/tmux/run.php @@ -9,10 +9,9 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Process; $tmuxPath = base_path().'/misc/update/tmux/'; -$import = Settings::settingValue('site.tmux.import') ?? 0; -$tmux_session = Settings::settingValue('site.tmux.tmux_session') ?? 0; -$seq = Settings::settingValue('site.tmux.sequential') ?? 0; -$delaytime = Settings::settingValue('..delaytime'); +$tmux_session = Settings::settingValue('tmux_session') ?? 0; +$seq = Settings::settingValue('sequential') ?? 0; +$delaytime = Settings::settingValue('delaytime'); $delaytime = $delaytime ? (int) $delaytime : 2; $colorCli = new ColorCLI; @@ -45,18 +44,18 @@ unset($value); function start_apps($tmux_session): void { - $htop = Settings::settingValue('site.tmux.htop'); - $vnstat = Settings::settingValue('site.tmux.vnstat'); - $vnstat_args = Settings::settingValue('site.tmux.vnstat_args'); - $tcptrack = Settings::settingValue('site.tmux.tcptrack'); - $tcptrack_args = Settings::settingValue('site.tmux.tcptrack_args'); - $nmon = Settings::settingValue('site.tmux.nmon'); - $bwmng = Settings::settingValue('site.tmux.bwmng'); - $mytop = Settings::settingValue('site.tmux.mytop'); - $redis = Settings::settingValue('site.tmux.redis'); - $showprocesslist = Settings::settingValue('site.tmux.showprocesslist'); - $processupdate = Settings::settingValue('site.tmux.processupdate'); - $console_bash = Settings::settingValue('site.tmux.console'); + $htop = Settings::settingValue('htop'); + $vnstat = Settings::settingValue('vnstat'); + $vnstat_args = Settings::settingValue('vnstat_args'); + $tcptrack = Settings::settingValue('tcptrack'); + $tcptrack_args = Settings::settingValue('tcptrack_args'); + $nmon = Settings::settingValue('nmon'); + $bwmng = Settings::settingValue('bwmng'); + $mytop = Settings::settingValue('mytop'); + $redis = Settings::settingValue('redis'); + $showprocesslist = Settings::settingValue('showprocesslist'); + $processupdate = Settings::settingValue('processupdate'); + $console_bash = Settings::settingValue('console'); if ((int) $htop === 1 && command_exist('htop')) { Process::run("tmux new-window -t $tmux_session -n htop 'printf \"\033]2;htop\033\" && htop'"); diff --git a/misc/update/update_binaries.php b/misc/update/update_binaries.php index a8475c91e..3211681ef 100644 --- a/misc/update/update_binaries.php +++ b/misc/update/update_binaries.php @@ -8,7 +8,7 @@ use Blacklight\Binaries; use Blacklight\ColorCLI; use Blacklight\NNTP; -$maxHeaders = (int) Settings::settingValue('..max_headers_iteration') ?: 1000000; +$maxHeaders = (int) Settings::settingValue('max_headers_iteration') ?: 1000000; $colorCli = new ColorCLI; // Create the connection here and pass