diff --git a/Changelog b/Changelog index 53e379903..46e532bd9 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2016-09-20 DariusIII + * Chg: Use DB class instead of Settings class where advanced settings functions are not used * Chg: Port yenc and yydecoder changes from nZEDb 2016-09-19 DariusIII * Chg: Forgot to add tinyMCE to all of the themes, move tinymce call to functions.js/utils.js diff --git a/app/extensions/command/Update.php b/app/extensions/command/Update.php index c91716013..9bf35d537 100644 --- a/app/extensions/command/Update.php +++ b/app/extensions/command/Update.php @@ -22,7 +22,6 @@ use \app\extensions\util\Git; use \app\extensions\util\Versions; use \lithium\console\command\Help; use \nntmux\db\DbUpdate; -use \nntmux\db\Settings; use \Smarty; @@ -95,7 +94,7 @@ class Update extends \app\extensions\console\Command $this->out("Db: $currentDb,\tFile: $currentXML"); if ($currentDb < $currentXML) { - $db = new DbUpdate(['backup' => false, 'db' => new Settings()]); + $db = new DbUpdate(['backup' => false]); $db->processPatches(['safe' => false]); } else { $this->out("Up to date.", 'info'); diff --git a/misc/testing/DB/change_USP_provider.php b/misc/testing/DB/change_USP_provider.php index 2d4836285..2f82350d0 100644 --- a/misc/testing/DB/change_USP_provider.php +++ b/misc/testing/DB/change_USP_provider.php @@ -1,7 +1,7 @@ log->setColor('Yellow') . "This script is used when you have switched UseNet Providers(USP) so you can pickup where you left off, rather than resetting all the groups.\nOnly use this script after you have updated your config.php file with your new USP info!!\nMake sure you " . $pdo->log->setColor('Red', 'Bold') . "DO NOT" . $pdo->log->setcolor('Yellow') . " have any update or postprocess scripts running when running this script!\n\n" . $pdo->log->setColor('Cyan') . "Usage: php change_USP_provider true\n"); diff --git a/misc/testing/DB/check_unique_indexes.php b/misc/testing/DB/check_unique_indexes.php index af36758ba..1ad24d3a7 100755 --- a/misc/testing/DB/check_unique_indexes.php +++ b/misc/testing/DB/check_unique_indexes.php @@ -1,9 +1,9 @@ true]); +$pdo = new DB(['checkVersion' => true]); $ftinnodb = $pdo->isDbVersionAtLeast('5.6'); if (isset($argv[1]) && isset($argv[2]) && $argv[2] == "fmyisam") { diff --git a/misc/testing/DB/convert_to_tpg.php b/misc/testing/DB/convert_to_tpg.php index 67709d56b..4cae0e57c 100644 --- a/misc/testing/DB/convert_to_tpg.php +++ b/misc/testing/DB/convert_to_tpg.php @@ -1,13 +1,13 @@ $pdo]); $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); $DoPartRepair = ($pdo->getSetting('partrepair') == '0') ? false : true; diff --git a/misc/testing/DB/convert_to_tpg_alt.php b/misc/testing/DB/convert_to_tpg_alt.php index d4892d71b..af81e08e1 100644 --- a/misc/testing/DB/convert_to_tpg_alt.php +++ b/misc/testing/DB/convert_to_tpg_alt.php @@ -1,12 +1,12 @@ log->error("\nThis script will move all collections, binaries, parts into tables per group.\n\n" diff --git a/misc/testing/DB/mysqldump_tables.php b/misc/testing/DB/mysqldump_tables.php index fe99130cf..3e64f06ff 100644 --- a/misc/testing/DB/mysqldump_tables.php +++ b/misc/testing/DB/mysqldump_tables.php @@ -1,13 +1,13 @@ $pdo]); $mreleases = $pdo->queryDirect(sprintf('SELECT id, imdbid FROM releases WHERE traktid = 0 AND imdbid IS NOT NULL AND imdbid != 0000000 ORDER BY id ASC')); diff --git a/misc/testing/DB/populate_nzb_guid.php b/misc/testing/DB/populate_nzb_guid.php index 24c820c33..0860b8704 100644 --- a/misc/testing/DB/populate_nzb_guid.php +++ b/misc/testing/DB/populate_nzb_guid.php @@ -1,7 +1,7 @@ $pdo->log]); $timestart = time(); $relcount = $deleted = $total = 0; diff --git a/misc/testing/DB/rename_to_lower.php b/misc/testing/DB/rename_to_lower.php index 18872ad20..b138e3051 100644 --- a/misc/testing/DB/rename_to_lower.php +++ b/misc/testing/DB/rename_to_lower.php @@ -4,7 +4,7 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . passthru('clear'); -$pdo = new nntmux\db\Settings(); +$pdo = new nntmux\db\DB(); if (!isset($argv[1]) || (isset($argv[1]) && $argv[1] !== 'true')) { exit($pdo->log->error("\nThis script renames all table columns to lowercase, it can be dangerous. Please BACKUP your database before running this script.\n" diff --git a/misc/testing/DB/reset_postprocessing.php b/misc/testing/DB/reset_postprocessing.php index c871f816f..d337c1d91 100755 --- a/misc/testing/DB/reset_postprocessing.php +++ b/misc/testing/DB/reset_postprocessing.php @@ -3,10 +3,10 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . use nntmux\Category; use nntmux\ConsoleTools; -use nntmux\db\Settings; +use nntmux\db\DB; $category = new Category(); -$pdo = new Settings(); +$pdo = new DB(); $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); $ran = false; diff --git a/misc/testing/DB/reset_truncate.php b/misc/testing/DB/reset_truncate.php index c9b18986f..a0218f4a0 100644 --- a/misc/testing/DB/reset_truncate.php +++ b/misc/testing/DB/reset_truncate.php @@ -1,9 +1,9 @@ queryExec("UPDATE groups SET first_record = 0, first_record_postdate = NULL, last_record = 0, last_record_postdate = NULL, last_updated = NULL"); diff --git a/misc/testing/DB/resetdb.php b/misc/testing/DB/resetdb.php index 628bfe996..610bd3cc9 100644 --- a/misc/testing/DB/resetdb.php +++ b/misc/testing/DB/resetdb.php @@ -1,7 +1,7 @@ log->error("\nThis script removes all releases and release related files. To run:\nphp resetdb.php true\n")); diff --git a/misc/testing/DB/setUserPasswordHash.php b/misc/testing/DB/setUserPasswordHash.php index 1dc2ad764..455b87e56 100644 --- a/misc/testing/DB/setUserPasswordHash.php +++ b/misc/testing/DB/setUserPasswordHash.php @@ -8,10 +8,10 @@ */ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Users; -$pdo = new Settings(); +$pdo = new DB(); if ($argc < 3) { exit( diff --git a/misc/testing/DB/setUserPasswordHashesToEmail.php b/misc/testing/DB/setUserPasswordHashesToEmail.php index 946b5d89d..e8a3854ae 100644 --- a/misc/testing/DB/setUserPasswordHashesToEmail.php +++ b/misc/testing/DB/setUserPasswordHashesToEmail.php @@ -17,7 +17,7 @@ */ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\ColorCLI; use nntmux\Users; @@ -40,7 +40,7 @@ if ($argc != 2) { exit($colorCLI->error("\nInvalid parameter(s)$usage")); } -$pdo = new Settings(); +$pdo = new DB(); $users = $pdo->query("SELECT id, username, email, password FROM users"); $update = $pdo->Prepare('UPDATE users SET password = :password WHERE id = :id'); diff --git a/misc/testing/DB/show_table_sizes.php b/misc/testing/DB/show_table_sizes.php index 05dd4da83..d1a79840e 100644 --- a/misc/testing/DB/show_table_sizes.php +++ b/misc/testing/DB/show_table_sizes.php @@ -1,9 +1,9 @@ log->error("\nThis script will show table data, index and free space used. The argument needed is numeric.\n\n" diff --git a/misc/testing/Dev/clean_nzbs.php b/misc/testing/Dev/clean_nzbs.php index 40ca32c93..cea45e673 100644 --- a/misc/testing/Dev/clean_nzbs.php +++ b/misc/testing/Dev/clean_nzbs.php @@ -5,10 +5,10 @@ use nntmux\ConsoleTools; use nntmux\NZB; use nntmux\ReleaseImage; use nntmux\Releases; -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\utility\Utility; -$pdo = new Settings(); +$pdo = new DB(); $dir = NN_RES . "movednzbs/"; diff --git a/misc/testing/NZB/nzb-reorg.php b/misc/testing/NZB/nzb-reorg.php index afdced7f5..0bb79dc44 100755 --- a/misc/testing/NZB/nzb-reorg.php +++ b/misc/testing/NZB/nzb-reorg.php @@ -3,13 +3,13 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . use nntmux\ConsoleTools; use nntmux\NZB; -use nntmux\db\Settings; +use nntmux\db\DB; if (!isset($argv[1]) || !isset($argv[2])) { exit("ERROR: You must supply the level you want to reorganize it to, and the source directory (You would use: 3 .../newznab/resources/nzb/ to move it to 3 levels deep)\n"); } -$pdo = new Settings(); +$pdo = new DB(); $nzb = new NZB($pdo); $consoleTools = new ConsoleTools(); diff --git a/misc/testing/PostProc/check_covers.php b/misc/testing/PostProc/check_covers.php index bfb3bc04b..7084beb85 100644 --- a/misc/testing/PostProc/check_covers.php +++ b/misc/testing/PostProc/check_covers.php @@ -4,7 +4,7 @@ // -------------------------------------------------------------- require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\utility\Utility; use nntmux\Releases; use nntmux\NZB; @@ -12,7 +12,7 @@ use nntmux\ReleaseImage; use nntmux\ConsoleTools; use nntmux\Movie; -$pdo = new Settings(); +$pdo = new DB(); $movie = new Movie(['Echo' => true, 'Settings' => $pdo]); $row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'"); diff --git a/misc/testing/PostProc/check_previews.php b/misc/testing/PostProc/check_previews.php index 7729479dd..4b5f534c2 100644 --- a/misc/testing/PostProc/check_previews.php +++ b/misc/testing/PostProc/check_previews.php @@ -4,14 +4,14 @@ // -------------------------------------------------------------- require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\utility\Utility; use nntmux\Releases; use nntmux\NZB; use nntmux\ReleaseImage; use nntmux\ConsoleTools; -$pdo = new Settings(); +$pdo = new DB(); $row = $pdo->queryOneRow("SELECT value FROM settings WHERE setting = 'coverspath'"); if ($row !== false) { diff --git a/misc/testing/PostProc/getConsole.php b/misc/testing/PostProc/getConsole.php index 5c46f58fc..b3eb9cc2c 100644 --- a/misc/testing/PostProc/getConsole.php +++ b/misc/testing/PostProc/getConsole.php @@ -4,13 +4,13 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); use nntmux\Category; -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Console; $category = new Category(); -$pdo = new Settings(); +$pdo = new DB(); $console = new Console(['Echo' => true, 'Settings' => $pdo]); $res = $pdo->queryDirect( diff --git a/misc/testing/PostProc/getGameCovers.php b/misc/testing/PostProc/getGameCovers.php index 4dfb5926d..1e319112d 100644 --- a/misc/testing/PostProc/getGameCovers.php +++ b/misc/testing/PostProc/getGameCovers.php @@ -3,11 +3,11 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Games; -$pdo = new Settings(); +$pdo = new DB(); $game = new Games(['Echo' => true, 'Settings' => $pdo]); $res = $pdo->query( diff --git a/misc/testing/PostProc/getImdb.php b/misc/testing/PostProc/getImdb.php index 8a7e16ebc..ef6b068ef 100644 --- a/misc/testing/PostProc/getImdb.php +++ b/misc/testing/PostProc/getImdb.php @@ -2,11 +2,11 @@ //This script will update all records in the movieinfo table require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\ColorCLI; use nntmux\Movie; -$pdo = new Settings(); +$pdo = new DB(); $c = new ColorCLI(); $movie = new Movie(['Echo' => true, 'Settings' => $pdo]); diff --git a/misc/testing/PostProc/getMovieCovers.php b/misc/testing/PostProc/getMovieCovers.php index ccaf6a70e..475965bc9 100644 --- a/misc/testing/PostProc/getMovieCovers.php +++ b/misc/testing/PostProc/getMovieCovers.php @@ -2,10 +2,10 @@ //This script will update all records in the movieinfo table where there is no cover require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Movie; -$pdo = new Settings(); +$pdo = new DB(); $movie = new Movie(['Echo' => true, 'Settings' => $pdo]); diff --git a/misc/testing/PostProc/getXXXCovers.php b/misc/testing/PostProc/getXXXCovers.php index b5deae19c..3c0e264a0 100644 --- a/misc/testing/PostProc/getXXXCovers.php +++ b/misc/testing/PostProc/getXXXCovers.php @@ -2,12 +2,12 @@ //This script will update all records in the xxxinfo table where there is no cover require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\XXX; use nntmux\ColorCLI; -$pdo = new Settings(); +$pdo = new DB(); $movie = new XXX(); $c = new ColorCLI(); diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php index 8855825b6..579bfbc65 100644 --- a/misc/testing/PostProc/updateBookImages.php +++ b/misc/testing/PostProc/updateBookImages.php @@ -1,10 +1,10 @@ log->error( diff --git a/misc/testing/Tests/regexverify.php b/misc/testing/Tests/regexverify.php index 6e9c9b3d8..0f8ccefc5 100644 --- a/misc/testing/Tests/regexverify.php +++ b/misc/testing/Tests/regexverify.php @@ -8,7 +8,7 @@ require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); use nntmux\Releases; -use nntmux\db\Settings; +use nntmux\db\DB; function handleError($errno, $errstr, $errfile, $errline, array $errcontext) @@ -29,7 +29,7 @@ $regs = array( ); $releases = new Releases(); -$db = new Settings(); +$db = new DB(); # fetch enabled regular expression $catsql = "select ID,groupname,regex from releaseregex where status = 1"; $res = $db->query($catsql); diff --git a/misc/testing/Tests/timetest.php b/misc/testing/Tests/timetest.php index b9455c4e7..dca870edd 100644 --- a/misc/testing/Tests/timetest.php +++ b/misc/testing/Tests/timetest.php @@ -2,10 +2,10 @@ //This Script Verifies your System Time vs Myself Time vs PHP Time require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; $res=""; -$db = new Settings(); +$db = new DB(); $res = $db->queryOneRow( sprintf("Select now()")); foreach($res as $time){ echo "Mysql Time Is Now ".$time."\n";} diff --git a/misc/testing/Various/renametopre.php b/misc/testing/Various/renametopre.php index 9aa89c63a..468fc2e36 100644 --- a/misc/testing/Various/renametopre.php +++ b/misc/testing/Various/renametopre.php @@ -9,7 +9,7 @@ use nntmux\Groups; use nntmux\NameFixer; use nntmux\ReleaseCleaning; use nntmux\ReleaseFiles; -use nntmux\db\Settings; +use nntmux\db\DB; /* * @@ -22,7 +22,7 @@ use nntmux\db\Settings; * release has been created * */ -$pdo = new Settings(); +$pdo = new DB(); if (!(isset($argv[1]) && ($argv[1] == "all" || $argv[1] == "full" || $argv[1] == "predb_id" || is_numeric($argv[1])))) { exit($pdo->log->error( diff --git a/misc/update/backfill.php b/misc/update/backfill.php index 5a7131b95..edecb0f1b 100644 --- a/misc/update/backfill.php +++ b/misc/update/backfill.php @@ -1,11 +1,11 @@ $pdo]); diff --git a/misc/update/decrypt_hashes.php b/misc/update/decrypt_hashes.php index fcdcc9a57..e8b855862 100755 --- a/misc/update/decrypt_hashes.php +++ b/misc/update/decrypt_hashes.php @@ -3,9 +3,9 @@ require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'bootstr use nntmux\ConsoleTools; use nntmux\NameFixer; -use nntmux\db\Settings; +use nntmux\db\DB; -$pdo = new Settings(); +$pdo = new DB(); if (!isset($argv[1]) || ($argv[1] != "all" && $argv[1] != "full" && !is_numeric($argv[1]))) { exit($pdo->log->error( diff --git a/misc/update/nix/tmux/bin/update_groups.php b/misc/update/nix/tmux/bin/update_groups.php index 5bdf6da81..d932c25c5 100644 --- a/misc/update/nix/tmux/bin/update_groups.php +++ b/misc/update/nix/tmux/bin/update_groups.php @@ -1,13 +1,13 @@ $pdo->log]); // Create the connection here and pass diff --git a/misc/update/nix/tmux/start.php b/misc/update/nix/tmux/start.php index 0617ce110..878d13861 100644 --- a/misc/update/nix/tmux/start.php +++ b/misc/update/nix/tmux/start.php @@ -9,10 +9,10 @@ //require_once realpath(dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); require_once realpath(dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Tmux; -$pdo = new Settings(); +$pdo = new DB(); $tmux = new Tmux(); $tmux_settings = $tmux->get(); diff --git a/nntmux/AniDB.php b/nntmux/AniDB.php index 55c2c13ce..f13700ef8 100755 --- a/nntmux/AniDB.php +++ b/nntmux/AniDB.php @@ -1,12 +1,12 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } /** diff --git a/nntmux/Categorize.php b/nntmux/Categorize.php index 451097164..a642ab9f7 100644 --- a/nntmux/Categorize.php +++ b/nntmux/Categorize.php @@ -1,7 +1,7 @@ pdo = new Settings(); - $this->categorizeForeign = ($this->pdo->getSetting('categorizeforeign') == "0") ? false : true; - $this->catWebDL = ($this->pdo->getSetting('catwebdl') == "0") ? false : true; + $this->categorizeForeign = (Settings::value('categorizeforeign') == "0") ? false : true; + $this->catWebDL = (Settings::value('catwebdl') == "0") ? false : true; $this->regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'category_regexes']); } diff --git a/nntmux/Category.php b/nntmux/Category.php index 2f1553558..f556eecdc 100644 --- a/nntmux/Category.php +++ b/nntmux/Category.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } /** diff --git a/nntmux/CollectionsCleaning.php b/nntmux/CollectionsCleaning.php index 91b32968a..1844b8269 100644 --- a/nntmux/CollectionsCleaning.php +++ b/nntmux/CollectionsCleaning.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->_regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'collection_regexes']); } diff --git a/nntmux/Contents.php b/nntmux/Contents.php index 54b1472aa..f289a3ee5 100644 --- a/nntmux/Contents.php +++ b/nntmux/Contents.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } public function get() diff --git a/nntmux/DnzbFailures.php b/nntmux/DnzbFailures.php index f57f49969..e2a769dcf 100644 --- a/nntmux/DnzbFailures.php +++ b/nntmux/DnzbFailures.php @@ -2,7 +2,7 @@ namespace nntmux; -use nntmux\db\Settings; +use nntmux\db\DB; /** @@ -11,7 +11,7 @@ use nntmux\db\Settings; class DnzbFailures { /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ public $pdo; @@ -30,7 +30,7 @@ class DnzbFailures ]; $options += $defaults; - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->rc = new ReleaseComments(['Settings' => $this->pdo]); } diff --git a/nntmux/Forum.php b/nntmux/Forum.php index a1a1cc343..fc4b01940 100644 --- a/nntmux/Forum.php +++ b/nntmux/Forum.php @@ -1,12 +1,12 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } public function add($parentid, $userid, $subject, $message, $locked = 0, $sticky = 0, $replies = 0) diff --git a/nntmux/Genres.php b/nntmux/Genres.php index 93dc43185..9521b66b6 100644 --- a/nntmux/Genres.php +++ b/nntmux/Genres.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } public function getGenres($type = '', $activeonly = false) diff --git a/nntmux/Groups.php b/nntmux/Groups.php index de5e4072b..78254a5aa 100644 --- a/nntmux/Groups.php +++ b/nntmux/Groups.php @@ -1,12 +1,12 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->colorCLI = ($options['ColorCLI'] instanceof ColorCLI ? $options['ColorCLI'] : new ColorCLI()); $this->cbpm = ['collections', 'binaries', 'parts', 'missed_parts']; } diff --git a/nntmux/IRCScraper.php b/nntmux/IRCScraper.php index 1a3f89a12..6dd940755 100644 --- a/nntmux/IRCScraper.php +++ b/nntmux/IRCScraper.php @@ -1,6 +1,6 @@ _titleIgnoreRegex = SCRAPE_IRC_TITLE_IGNORE; } - $this->_pdo = new Settings(); + $this->_pdo = new DB(); $this->_groupList = []; $this->_silent = $silent; $this->_debug = $debug; diff --git a/nntmux/Menu.php b/nntmux/Menu.php index 91e3c4f44..cc607ef55 100644 --- a/nntmux/Menu.php +++ b/nntmux/Menu.php @@ -1,7 +1,7 @@ pdo = ($settings instanceof Settings ? $settings : new Settings()); + $this->pdo = ($settings instanceof DB ? $settings : new DB()); } public function get($role, $serverurl) diff --git a/nntmux/NZBExport.php b/nntmux/NZBExport.php index 6a2cd087b..22185a861 100644 --- a/nntmux/NZBExport.php +++ b/nntmux/NZBExport.php @@ -1,7 +1,7 @@ browser = $options['Browser']; $this->echoCLI = (!$this->browser && NN_ECHOCLI && $options['Echo']); - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Setting'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Setting'] : new DB()); $this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases(['Settings' => $this->pdo])); $this->nzb = ($options['NZB'] instanceof NZB ? $options['NZB'] : new NZB($this->pdo)); } diff --git a/nntmux/NameFixer.php b/nntmux/NameFixer.php index 6c325682a..ebe4b2a1b 100755 --- a/nntmux/NameFixer.php +++ b/nntmux/NameFixer.php @@ -1,7 +1,7 @@ echooutput = ($options['Echo'] && NN_ECHOCLI); $this->relid = $this->fixed = $this->checked = 0; - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->othercats = implode(",", Category::OTHERS_GROUP); $this->timeother = sprintf(' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) AND rel.categories_id IN (%s) GROUP BY rel.id ORDER BY postdate DESC', $this->othercats); $this->timeall = ' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) GROUP BY rel.id ORDER BY postdate DESC'; diff --git a/nntmux/Nfo.php b/nntmux/Nfo.php index fdc302947..54d7423a1 100644 --- a/nntmux/Nfo.php +++ b/nntmux/Nfo.php @@ -249,9 +249,17 @@ class Nfo */ static public function NfoQueryString(Settings &$pdo) { - $maxSize = $pdo->getSetting('maxsizetoprocessnfo'); - $minSize = $pdo->getSetting('minsizetoprocessnfo'); - $maxRetries = (int)($pdo->getSetting('maxnforetries') >= 0 ? -((int)$pdo->getSetting('maxnforetries') + 1) : self::NFO_UNPROC); + if ($pdo instanceof Settings) { + $maxSize = $pdo->getSetting('maxsizetoprocessnfo'); + $minSize = $pdo->getSetting('minsizetoprocessnfo'); + $maxRetries = (int)($pdo->getSetting('maxnforetries') >= 0 ? + -((int)$pdo->getSetting('maxnforetries') + 1) : self::NFO_UNPROC); + } else { + $maxSize = \app\models\Settings::value('maxsizetoprocessnfo'); + $minSize = \app\models\Settings::value('minsizetoprocessnfo'); + $value = \app\models\Settings::value('maxnforetries'); + $maxRetries = (int)$value >= 0 ? -((int)$value + 1) : self::NFO_UNPROC; + } return ( sprintf( 'AND r.nzbstatus = %d AND r.nfostatus BETWEEN %d AND %d %s %s', diff --git a/nntmux/PreDb.php b/nntmux/PreDb.php index e4addc331..36ba7657a 100644 --- a/nntmux/PreDb.php +++ b/nntmux/PreDb.php @@ -1,7 +1,7 @@ echooutput = ($options['Echo'] && NN_ECHOCLI); - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } /** diff --git a/nntmux/Regexes.php b/nntmux/Regexes.php index 989303834..abeff2360 100644 --- a/nntmux/Regexes.php +++ b/nntmux/Regexes.php @@ -1,12 +1,12 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->tableName = $options['Table_Name']; } diff --git a/nntmux/ReleaseCleaning.php b/nntmux/ReleaseCleaning.php index 5436f7b61..c8dd2420f 100644 --- a/nntmux/ReleaseCleaning.php +++ b/nntmux/ReleaseCleaning.php @@ -1,7 +1,7 @@ e1 = CollectionsCleaning::REGEX_FILE_EXTENSIONS . CollectionsCleaning::REGEX_END; $this->e2 = CollectionsCleaning::REGEX_FILE_EXTENSIONS . CollectionsCleaning::REGEX_SUBJECT_SIZE . CollectionsCleaning::REGEX_END; - $this->pdo = ($settings instanceof Settings ? $settings : new Settings()); + $this->pdo = ($settings instanceof DB ? $settings : new DB()); $this->_regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'release_naming_regexes']); } diff --git a/nntmux/ReleaseExtra.php b/nntmux/ReleaseExtra.php index 28e99660f..93d3efaf3 100644 --- a/nntmux/ReleaseExtra.php +++ b/nntmux/ReleaseExtra.php @@ -1,22 +1,22 @@ pdo = ($settings instanceof Settings ? $settings : new Settings()); + $this->pdo = ($settings instanceof DB ? $settings : new DB()); } /** diff --git a/nntmux/ReleaseFiles.php b/nntmux/ReleaseFiles.php index 6149d8173..bf5d4de6b 100644 --- a/nntmux/ReleaseFiles.php +++ b/nntmux/ReleaseFiles.php @@ -1,7 +1,7 @@ pdo = ($settings instanceof Settings ? $settings : new Settings()); + $this->pdo = ($settings instanceof DB ? $settings : new DB()); $this->sphinxSearch = new SphinxSearch(); } diff --git a/nntmux/ReleaseRemover.php b/nntmux/ReleaseRemover.php index 3f6639d71..3e4cec055 100644 --- a/nntmux/ReleaseRemover.php +++ b/nntmux/ReleaseRemover.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->consoleTools = ($options['ConsoleTools'] instanceof ConsoleTools ? $options['ConsoleTools'] : new ConsoleTools(['ColorCLI' => $this->pdo->log])); $this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases(['Settings' => $this->pdo])); $this->nzb = ($options['NZB'] instanceof NZB ? $options['NZB'] : new NZB($this->pdo)); diff --git a/nntmux/ReleaseSearch.php b/nntmux/ReleaseSearch.php index 9457612d5..e68bc1a1f 100644 --- a/nntmux/ReleaseSearch.php +++ b/nntmux/ReleaseSearch.php @@ -1,7 +1,7 @@ sphinxQueryOpt = ";limit=10000;maxmatches=10000;sort=relevance;mode=extended"; - $this->pdo = ($settings instanceof Settings ? $settings : new Settings()); + $this->pdo = ($settings instanceof DB ? $settings : new DB()); } /** diff --git a/nntmux/RequestID.php b/nntmux/RequestID.php index 674bef79a..b87c2871b 100644 --- a/nntmux/RequestID.php +++ b/nntmux/RequestID.php @@ -1,7 +1,7 @@ echoOutput = ($options['Echo'] && NN_ECHOCLI); - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->category = ($options['Categorize'] instanceof Categorize ? $options['Categorize'] : new Categorize(['Settings' => $this->pdo])); $this->groups = ($options['Groups'] instanceof Groups ? $options['Groups'] : new Groups(['Settings' => $this->pdo])); $this->consoleTools = ($options['ConsoleTools'] instanceof ConsoleTools ? $options['ConsoleTools'] : new ConsoleTools(['ColorCLI' => $this->pdo->log])); @@ -163,7 +163,7 @@ abstract class RequestID protected $category; /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ protected $pdo; diff --git a/nntmux/Sharing.php b/nntmux/Sharing.php index 0ecfc3b57..fe1ab8aa7 100644 --- a/nntmux/Sharing.php +++ b/nntmux/Sharing.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); // Get all sharing info from DB. $check = $this->pdo->queryOneRow('SELECT * FROM sharing'); diff --git a/nntmux/Sites.php b/nntmux/Sites.php index b9e1dd402..d2c3adcb1 100644 --- a/nntmux/Sites.php +++ b/nntmux/Sites.php @@ -3,7 +3,7 @@ namespace nntmux; use app\extensions\util\Versions; use nntmux\libraries\Cache; -use nntmux\db\Settings; +use nntmux\db\DB; class Sites @@ -23,7 +23,7 @@ class Sites const ERR_SABCOMPLETEPATH = -8; /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ protected $_db; @@ -42,7 +42,7 @@ class Sites ]; $options += $defaults; - $this->_db = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->_db = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); if (defined('NN_VERSIONS')) { try { diff --git a/nntmux/SphinxSearch.php b/nntmux/SphinxSearch.php index c914e6785..e326200b5 100755 --- a/nntmux/SphinxSearch.php +++ b/nntmux/SphinxSearch.php @@ -2,7 +2,6 @@ namespace nntmux; use nntmux\db\DB; -use nntmux\db\Settings; class SphinxSearch { @@ -61,9 +60,9 @@ class SphinxSearch /** * Delete release from Sphinx RT tables. * @param array $identifiers ['g' => Release GUID(mandatory), 'id' => ReleaseID(optional, pass false)] - * @param \nntmux\db\Settings $pdo + * @param \nntmux\db\DB $pdo */ - public function deleteRelease($identifiers, Settings $pdo) + public function deleteRelease($identifiers, DB $pdo) { if (!is_null($this->sphinxQL)) { if ($identifiers['i'] === false) { @@ -100,9 +99,9 @@ class SphinxSearch * Update Sphinx Relases index for given releaseid. * * @param int $releaseID - * @param \nntmux\db\Settings $pdo + * @param \nntmux\db\DB $pdo */ - public function updateRelease($releaseID, Settings $pdo) + public function updateRelease($releaseID, DB $pdo) { if (!is_null($this->sphinxQL)) { $new = $pdo->queryOneRow( diff --git a/nntmux/UserMovies.php b/nntmux/UserMovies.php index 3f7a20022..e60f7e56f 100644 --- a/nntmux/UserMovies.php +++ b/nntmux/UserMovies.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } /** diff --git a/nntmux/UserSeries.php b/nntmux/UserSeries.php index 3e7182590..b44da4d9b 100755 --- a/nntmux/UserSeries.php +++ b/nntmux/UserSeries.php @@ -1,7 +1,7 @@ pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); } /** diff --git a/nntmux/Videos.php b/nntmux/Videos.php index b69f87c19..dc6aee126 100644 --- a/nntmux/Videos.php +++ b/nntmux/Videos.php @@ -1,7 +1,7 @@ null, ]; $options += $defaults; - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->catWhere = "r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER; } diff --git a/nntmux/db/populate/PopulateTitles.php b/nntmux/db/populate/PopulateTitles.php index 4a9a900bc..9348eef02 100644 --- a/nntmux/db/populate/PopulateTitles.php +++ b/nntmux/db/populate/PopulateTitles.php @@ -20,13 +20,13 @@ */ namespace nntmux\db\populate; -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\utility\Utility; class PopulateTitles { /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ public $pdo; @@ -67,7 +67,7 @@ class PopulateTitles $this->mainTable = $options['main-table']; $this->tempTable = $options['main-table'] . '_tmp'; - if (isset($options['pdo']) && $options['pdo'] instanceof Settings) { + if (isset($options['pdo']) && $options['pdo'] instanceof DB) { $this->pdo = $options['pdo']; } } @@ -123,7 +123,7 @@ class PopulateTitles protected function pdo() { if ($this->pdo === null) { - $this->pdo = new Settings(); + $this->pdo = new DB(); } return $this->pdo; } diff --git a/nntmux/http/API.php b/nntmux/http/API.php index d7dc99f45..c9ed8d1ad 100755 --- a/nntmux/http/API.php +++ b/nntmux/http/API.php @@ -20,7 +20,7 @@ */ namespace nntmux\http; -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\utility\Utility; use nntmux\Category; use nntmux\Groups; @@ -32,8 +32,8 @@ use nntmux\Groups; */ class API extends Capabilities { - /** Settings class - * @var \nntmux\db\Settings + /** DB class + * @var \nntmux\db\DB */ public $pdo; @@ -54,7 +54,7 @@ class API extends Capabilities { ]; $options += $defaults; - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->getRequest = $options['Request']; } diff --git a/nntmux/http/RSS.php b/nntmux/http/RSS.php index 5a2c57a98..3c19fe3f3 100755 --- a/nntmux/http/RSS.php +++ b/nntmux/http/RSS.php @@ -2,7 +2,7 @@ namespace nntmux\http; -use nntmux\db\Settings; +use nntmux\db\DB; use nntmux\Releases; use nntmux\Category; use nntmux\NZB; @@ -19,8 +19,8 @@ Class RSS extends Capabilities */ public $releases; - /** Settings class - * @var \nntmux\db\Settings + /** DB class + * @var \nntmux\db\DB */ public $pdo; @@ -36,7 +36,7 @@ Class RSS extends Capabilities ]; $options += $defaults; - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->releases = ( $options['Releases'] instanceof Releases ? $options['Releases'] : new Releases(['Settings' => $this->pdo]) ); diff --git a/nntmux/libraries/Forking.php b/nntmux/libraries/Forking.php index 7d4100d9d..1c3f08b92 100644 --- a/nntmux/libraries/Forking.php +++ b/nntmux/libraries/Forking.php @@ -1,6 +1,7 @@ work = []; // Init Settings here, as forking causes errors when it's destroyed. - $this->pdo = new Settings(); + $this->pdo = new DB(); // Process extra work that should not be forked and done before forking. $this->processStartWork(); @@ -1077,7 +1079,7 @@ class Forking extends \fork_daemon private $safeBackfillGroup = ''; /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ public $pdo; diff --git a/nntmux/libraries/ForkingImportNZB.php b/nntmux/libraries/ForkingImportNZB.php index a786910bb..15bff6291 100644 --- a/nntmux/libraries/ForkingImportNZB.php +++ b/nntmux/libraries/ForkingImportNZB.php @@ -1,7 +1,7 @@ new Settings(), + 'settings' => new DB(), ]; $options += $defaults; diff --git a/nntmux/processing/Videos.php b/nntmux/processing/Videos.php index 937febd4b..673f5c0c8 100644 --- a/nntmux/processing/Videos.php +++ b/nntmux/processing/Videos.php @@ -20,7 +20,7 @@ */ namespace nntmux\processing; -use nntmux\db\Settings; +use nntmux\db\DB; /** * Parent class for TV/Film and any similar classes to inherit from. @@ -35,7 +35,7 @@ abstract class Videos const TYPE_ANIME = 2; // Type of video is a Anime /** - * @var \nntmux\db\Settings + * @var \nntmux\db\DB */ public $pdo; @@ -66,7 +66,7 @@ abstract class Videos //date_default_timezone_set('UTC'); TODO: Make this a DTO instead and use as needed $this->echooutput = ($options['Echo'] && NN_ECHOCLI); - $this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings()); + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); $this->titleCache = []; } diff --git a/nntmux/utility/Country.php b/nntmux/utility/Country.php index f26a81a71..1ddf3d8f9 100644 --- a/nntmux/utility/Country.php +++ b/nntmux/utility/Country.php @@ -20,7 +20,7 @@ */ namespace nntmux\utility; -use nntmux\db\Settings; +use nntmux\db\DB; /** * Class Country @@ -34,13 +34,13 @@ Class Country * * @param string $country * - * @param Settings $pdo + * @param DB $pdo * * @return mixed */ public static function countryCode($country, $pdo) { - $pdo = ($pdo instanceof Settings ? $pdo : new Settings()); + $pdo = ($pdo instanceof DB ? $pdo : new DB()); if (!is_array($country) && strlen($country) > 2) { $code = $pdo->queryOneRow( sprintf(' @@ -56,4 +56,4 @@ Class Country } return ''; } -} \ No newline at end of file +}