diff --git a/Changelog b/Changelog index 42eadc018..afcfea5d3 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-11-24 DariusIII + * Chg: Remove bootstrap.php * Chg: Use bootstrap/autoload.php instead the bootstrap.php in root of install * Chg: Update whoops library 2017-11-23 DariusIII diff --git a/bootstrap.php b/bootstrap.php deleted file mode 100644 index 2888f4f0d..000000000 --- a/bootstrap.php +++ /dev/null @@ -1,19 +0,0 @@ -. - * @author niel - * @copyright 2016 nZEDb - */ -require_once __DIR__.'/bootstrap/autoload.php'; diff --git a/misc/testing/DB/check_unique_indexes.php b/misc/testing/DB/check_unique_indexes.php index 911914f8f..43204f301 100755 --- a/misc/testing/DB/check_unique_indexes.php +++ b/misc/testing/DB/check_unique_indexes.php @@ -9,9 +9,9 @@ $pdo = new DB(); if (! isset($argv[1])) { if ($argv[1] !== 'test' || $argv[1] !== 'alter') { exit($pdo->log->error("\nThis script will scan nntmux_fi_schema.sql for all UNIQUE INDEXES.\n" - ."It will verify that you have them. If you do not, you can choose to run manually or allow the script to run them.\n\n" - ."php $argv[0] test ...: To verify all unique indexes.\n" - ."php $argv[0] alter ...: To add missing unique indexes.\n")); + ."It will verify that you have them. If you do not, you can choose to run manually or allow the script to run them.\n\n" + ."php $argv[0] test ...: To verify all unique indexes.\n" + ."php $argv[0] alter ...: To add missing unique indexes.\n")); } } diff --git a/misc/testing/DB/convert_to_tpg.php b/misc/testing/DB/convert_to_tpg.php index c6c3c62e3..09df27a20 100644 --- a/misc/testing/DB/convert_to_tpg.php +++ b/misc/testing/DB/convert_to_tpg.php @@ -14,13 +14,14 @@ $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); $DoPartRepair = (Settings::settingValue('..partrepair') == '0') ? false : true; if ((! isset($argv[1])) || $argv[1] != 'true') { - exit($pdo->log->error("\nMandatory argument missing\n\n" - ."This script will allow you to move from single collections/binaries/parts tables to TPG without having to run reset_truncate.\n" - ."Please STOP all update scripts before running this script.\n\n" - ."Use the following options to run:\n" - ."php $argv[0] true ...: Convert c/b/p to tpg leaving current collections/binaries/parts tables in-tact.\n" - ."php $argv[0] true delete ...: Convert c/b/p to tpg and TRUNCATE current collections/binaries/parts tables.\n" - )); + exit($pdo->log->error( + "\nMandatory argument missing\n\n" + ."This script will allow you to move from single collections/binaries/parts tables to TPG without having to run reset_truncate.\n" + ."Please STOP all update scripts before running this script.\n\n" + ."Use the following options to run:\n" + ."php $argv[0] true ...: Convert c/b/p to tpg leaving current collections/binaries/parts tables in-tact.\n" + ."php $argv[0] true delete ...: Convert c/b/p to tpg and TRUNCATE current collections/binaries/parts tables.\n" + )); } $clen = $pdo->queryOneRow('SELECT COUNT(*) AS total FROM collections;'); diff --git a/misc/testing/PostProc/getGameCovers.php b/misc/testing/PostProc/getGameCovers.php index 808181b1d..2c2f2bf02 100644 --- a/misc/testing/PostProc/getGameCovers.php +++ b/misc/testing/PostProc/getGameCovers.php @@ -12,7 +12,7 @@ $pdo = new DB(); $game = new Games(['Echo' => true, 'Settings' => $pdo]); $res = $pdo->query( - sprintf('SELECT id, title FROM gamesinfo WHERE cover = 0 ORDER BY id DESC LIMIT 100') + sprintf('SELECT id, title FROM gamesinfo WHERE cover = 0 ORDER BY id DESC LIMIT 100') ); $total = count($res); if ($total > 0) { diff --git a/misc/testing/Releases/delete_releases.php b/misc/testing/Releases/delete_releases.php index 3c50091c4..9e89c25da 100644 --- a/misc/testing/Releases/delete_releases.php +++ b/misc/testing/Releases/delete_releases.php @@ -16,39 +16,40 @@ $cli = new ColorCLI(); // Print arguments/usage. $totalArgs = count($argv); if ($totalArgs < 2) { - exit($cli->info($n. - 'This deletes releases based on a list of criteria you pass.'.$n. - 'Usage:'.$n.$n. - 'List of supported criteria:'.$n. - 'fromname : Look for names of people who posted releases (the poster name). (modifiers: equals, like)'.$n. - 'groupname : Look in groups. (modifiers: equals, like)'.$n. - 'guid : Look for a specific guid. (modifiers: equals)'.$n. - 'name : Look for a name (the usenet name). (modifiers: equals, like)'.$n. - 'searchname : Look for a name (the search name). (modifiers: equals, like)'.$n. - 'size : Release must be (bigger than |smaller than |exactly) this size.(bytes) (modifiers: equals,bigger,smaller)'.$n. - 'adddate : Look for releases added to our DB (older than|newer than) x hours. (modifiers: bigger,smaller)'.$n. - 'postdate : Look for posted to usenet (older than|newer than) x hours. (modifiers: bigger,smaller)'.$n. - 'completion : Look for completion (less than) (modifiers: smaller)'.$n. - 'categories_id : Look for releases within specified category (modifiers: equals)'.$n. - 'imdbid : Look for releases with imdbid (modifiers: equals)'.$n. - 'rageid : Look for releases with rageid (modifiers: equals)'.$n. - 'totalpart : Look for releases with certain number of parts (modifiers: equals,bigger,smaller)'.$n. - 'nzbstatus : Look for releases with nzbstatus (modifiers: equals)'.$n.$n. - 'List of Modifiers:'.$n. - 'equals : Match must be exactly this. (fromname=equals="john" will only look for "john", not "johndoe")'.$n. - 'like : Match can be similar to this. Separate words using spaces(ie:"cars hdtv x264").'.$n. - ' (fromname=like="john" will look for any posters with john in it (ie:john@smith.com)'.$n. - 'bigger : Match must be bigger than this. (postdate=bigger="3" means older than 3 hours ago)'.$n. - 'smaller : Match must be smaller than this (postdate=smaller="3" means between now and 3 hours ago.'.$n.$n. - 'Extra:'.$n. - 'ignore : Ignore the user check. (before running we ask you if you want to run the query to delete)'.$n.$n. - 'Examples:'.$n. - $_SERVER['_'].' '.$argv[0].' groupname=equals="alt.binaries.teevee" searchname=like="olympics 2014" postdate=bigger="5"'.$n. - $_SERVER['_'].' '.$argv[0].' guid=equals="8fb5956bae3de4fb94edcc69da44d6883d586fd0"'.$n. - $_SERVER['_'].' '.$argv[0].' size=smaller="104857600" size=bigger="2048" groupname=like="movies"'.$n. - $_SERVER['_'].' '.$argv[0].' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore'.$n. - $_SERVER['_'].' '.$argv[0].' imdbid=equals=NULL categories_id=equals=2999 nzbstatus=equals=1 adddate=bigger=2880 # Remove other movie releases with non-cleaned names added > 120 days ago' - )); + exit($cli->info( + $n. + 'This deletes releases based on a list of criteria you pass.'.$n. + 'Usage:'.$n.$n. + 'List of supported criteria:'.$n. + 'fromname : Look for names of people who posted releases (the poster name). (modifiers: equals, like)'.$n. + 'groupname : Look in groups. (modifiers: equals, like)'.$n. + 'guid : Look for a specific guid. (modifiers: equals)'.$n. + 'name : Look for a name (the usenet name). (modifiers: equals, like)'.$n. + 'searchname : Look for a name (the search name). (modifiers: equals, like)'.$n. + 'size : Release must be (bigger than |smaller than |exactly) this size.(bytes) (modifiers: equals,bigger,smaller)'.$n. + 'adddate : Look for releases added to our DB (older than|newer than) x hours. (modifiers: bigger,smaller)'.$n. + 'postdate : Look for posted to usenet (older than|newer than) x hours. (modifiers: bigger,smaller)'.$n. + 'completion : Look for completion (less than) (modifiers: smaller)'.$n. + 'categories_id : Look for releases within specified category (modifiers: equals)'.$n. + 'imdbid : Look for releases with imdbid (modifiers: equals)'.$n. + 'rageid : Look for releases with rageid (modifiers: equals)'.$n. + 'totalpart : Look for releases with certain number of parts (modifiers: equals,bigger,smaller)'.$n. + 'nzbstatus : Look for releases with nzbstatus (modifiers: equals)'.$n.$n. + 'List of Modifiers:'.$n. + 'equals : Match must be exactly this. (fromname=equals="john" will only look for "john", not "johndoe")'.$n. + 'like : Match can be similar to this. Separate words using spaces(ie:"cars hdtv x264").'.$n. + ' (fromname=like="john" will look for any posters with john in it (ie:john@smith.com)'.$n. + 'bigger : Match must be bigger than this. (postdate=bigger="3" means older than 3 hours ago)'.$n. + 'smaller : Match must be smaller than this (postdate=smaller="3" means between now and 3 hours ago.'.$n.$n. + 'Extra:'.$n. + 'ignore : Ignore the user check. (before running we ask you if you want to run the query to delete)'.$n.$n. + 'Examples:'.$n. + $_SERVER['_'].' '.$argv[0].' groupname=equals="alt.binaries.teevee" searchname=like="olympics 2014" postdate=bigger="5"'.$n. + $_SERVER['_'].' '.$argv[0].' guid=equals="8fb5956bae3de4fb94edcc69da44d6883d586fd0"'.$n. + $_SERVER['_'].' '.$argv[0].' size=smaller="104857600" size=bigger="2048" groupname=like="movies"'.$n. + $_SERVER['_'].' '.$argv[0].' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore'.$n. + $_SERVER['_'].' '.$argv[0].' imdbid=equals=NULL categories_id=equals=2999 nzbstatus=equals=1 adddate=bigger=2880 # Remove other movie releases with non-cleaned names added > 120 days ago' + )); } $RR = new ReleaseRemover(); diff --git a/misc/testing/Tests/test_amazon_API.php b/misc/testing/Tests/test_amazon_API.php index 37358e4d2..d4aba7782 100644 --- a/misc/testing/Tests/test_amazon_API.php +++ b/misc/testing/Tests/test_amazon_API.php @@ -16,12 +16,12 @@ $client = new \GuzzleHttp\Client(); $request = new \ApaiIO\Request\GuzzleRequest($client); $conf - ->setCountry('com') - ->setAccessKey($pubkey) - ->setSecretKey($privkey) - ->setAssociateTag($asstag) - ->setRequest($request) - ->setResponseTransformer(new \ApaiIO\ResponseTransformer\XmlToSimpleXmlObject()); + ->setCountry('com') + ->setAccessKey($pubkey) + ->setSecretKey($privkey) + ->setAssociateTag($asstag) + ->setRequest($request) + ->setResponseTransformer(new \ApaiIO\ResponseTransformer\XmlToSimpleXmlObject()); $search = new Search(); $search->setCategory('VideoGames'); diff --git a/misc/testing/Tests/test_nntp_server.php b/misc/testing/Tests/test_nntp_server.php index d7303c9af..100e8d477 100755 --- a/misc/testing/Tests/test_nntp_server.php +++ b/misc/testing/Tests/test_nntp_server.php @@ -11,7 +11,7 @@ $cli = new ColorCLI(); if (! isset($argv[2]) || ! is_numeric($argv[2])) { exit($cli->error("\nTest your nntp connection, get group information and postdate for specific article.\n\n" - ."php $argv[0] alt.binaries.teevee 595751142 ...: To test nntp on alt.binaries.teevee with artivle 595751142.\n")); + ."php $argv[0] alt.binaries.teevee 595751142 ...: To test nntp on alt.binaries.teevee with artivle 595751142.\n")); } $nntp = new NNTP(); if ($nntp->doConnect() !== true) { diff --git a/misc/testing/tidynzbfolder.php b/misc/testing/tidynzbfolder.php index a88136269..b12f15948 100644 --- a/misc/testing/tidynzbfolder.php +++ b/misc/testing/tidynzbfolder.php @@ -15,16 +15,16 @@ $r = new Releases(); $it = new RecursiveDirectoryIterator($site->nzbpath); foreach(new RecursiveIteratorIterator($it) as $file) { - $releaseGUID = str_replace(".nzb.gz", "", $file->getFilename()); - $rel = $db->queryOneRow(sprintf("SELECT ID from releases where guid = %s", $db->escapeString($releaseGUID))); - if (!$rel) - { - $r->delete($releaseGUID, true); - } - else - { - echo "not deleting ".$file->getFilename()."\n"; - } + $releaseGUID = str_replace(".nzb.gz", "", $file->getFilename()); + $rel = $db->queryOneRow(sprintf("SELECT ID from releases where guid = %s", $db->escapeString($releaseGUID))); + if (!$rel) + { + $r->delete($releaseGUID, true); + } + else + { + echo "not deleting ".$file->getFilename()."\n"; + } } */ @@ -32,14 +32,14 @@ foreach(new RecursiveIteratorIterator($it) as $file) // Option Two - delete all from the database where it doesnt exist on disk // /* - $res = $db->queryDirect("select guid from releases"); - while ($row = $db->getAssocArray($res)) - { - $nzbpath = $site->nzbpath.substr($row["guid"], 0, 1)."/".$row["guid"].".nzb.gz"; - if (!file_exists($nzbpath)) - { - echo "deleted ".$row["guid"]; - $r->delete($row["guid"], true); - } - } + $res = $db->queryDirect("select guid from releases"); + while ($row = $db->getAssocArray($res)) + { + $nzbpath = $site->nzbpath.substr($row["guid"], 0, 1)."/".$row["guid"].".nzb.gz"; + if (!file_exists($nzbpath)) + { + echo "deleted ".$row["guid"]; + $r->delete($row["guid"], true); + } + } */ diff --git a/misc/update/match_prefiles.php b/misc/update/match_prefiles.php index 7b9988474..892e3051d 100755 --- a/misc/update/match_prefiles.php +++ b/misc/update/match_prefiles.php @@ -7,13 +7,14 @@ use nntmux\NameFixer; if (! isset($argv[1]) && ($argv[1] !== 'full' || ! is_numeric($argv[1]))) { exit( - ColorCLI::error(PHP_EOL - .'This script tries to match release filenames to PreDB filenames.'.PHP_EOL - .'To display the changes, use "show" as the second argument. The optional third argument will limit the amount of filenames to attempt to match.'.PHP_EOL.PHP_EOL - .'php match_prefiles.php full show ...: to run on full database and show renames.'.PHP_EOL - .'php match_prefiles.php 2000 show ...: to run against 2000 distinct releases and show renames.'.PHP_EOL - ) - ); + ColorCLI::error( + PHP_EOL + .'This script tries to match release filenames to PreDB filenames.'.PHP_EOL + .'To display the changes, use "show" as the second argument. The optional third argument will limit the amount of filenames to attempt to match.'.PHP_EOL.PHP_EOL + .'php match_prefiles.php full show ...: to run on full database and show renames.'.PHP_EOL + .'php match_prefiles.php 2000 show ...: to run against 2000 distinct releases and show renames.'.PHP_EOL + ) + ); } $nameFixer = new NameFixer(); diff --git a/misc/update/postprocess.php b/misc/update/postprocess.php index 7434a3c1d..c74965503 100644 --- a/misc/update/postprocess.php +++ b/misc/update/postprocess.php @@ -13,53 +13,53 @@ $pdo = new DB(); * whether or not those methods of operation require NNTP. **/ $args = [ - 'additional' => true, - 'all' => true, - 'allinf' => true, - 'amazon' => false, - 'anime' => false, - 'book' => false, - 'console' => false, - 'games' => false, - 'movies' => false, - 'music' => false, - 'nfo' => true, - 'pre' => true, - 'sharing' => true, - 'spotnab' => true, - 'tv' => false, - 'tvdb' => false, - 'xxx' => false, + 'additional' => true, + 'all' => true, + 'allinf' => true, + 'amazon' => false, + 'anime' => false, + 'book' => false, + 'console' => false, + 'games' => false, + 'movies' => false, + 'music' => false, + 'nfo' => true, + 'pre' => true, + 'sharing' => true, + 'spotnab' => true, + 'tv' => false, + 'tvdb' => false, + 'xxx' => false, ]; $bool = [ - 'true', - 'false', + 'true', + 'false', ]; if (! isset($argv[1]) || ! in_array($argv[1], $args, false) || ! isset($argv[2]) || ! in_array($argv[2], $bool, false)) { exit( - \nntmux\ColorCLI::error( - "\nIncorrect arguments.\n" - ."The second argument (true/false) determines wether to echo or not.\n\n" - ."php postprocess.php all true ...: Does all the types of post processing.\n" - ."php postprocess.php pre true ...: Processes all Predb sites.\n" - ."php postprocess.php nfo true ...: Processes NFO files.\n" - ."php postprocess.php movies true ...: Processes movies.\n" - ."php postprocess.php music true ...: Processes music.\n" - ."php postprocess.php console true ...: Processes console games.\n" - ."php postprocess.php games true ...: Processes games.\n" - ."php postprocess.php book true ...: Processes books.\n" - ."php postprocess.php anime true ...: Processes anime.\n" - ."php postprocess.php tv true ...: Processes tv.\n" - ."php postprocess.php xxx true ...: Processes xxx.\n" - ."php postprocess.php additional true ...: Processes previews/mediainfo/etc...\n" - ."php postprocess.php sharing true ...: Processes uploading/downloading comments.\n" - ."php postprocess.php spotnab true ...: Processes uploading/downloading comments from spotnab.\n" - ."php postprocess.php allinf true ...: Does all the types of post processing on a loop, sleeping 15 seconds between.\n" - ."php postprocess.php amazon true ...: Does all the amazon (books/console/games/music/xxx).\n" - ) - ); + \nntmux\ColorCLI::error( + "\nIncorrect arguments.\n" + ."The second argument (true/false) determines wether to echo or not.\n\n" + ."php postprocess.php all true ...: Does all the types of post processing.\n" + ."php postprocess.php pre true ...: Processes all Predb sites.\n" + ."php postprocess.php nfo true ...: Processes NFO files.\n" + ."php postprocess.php movies true ...: Processes movies.\n" + ."php postprocess.php music true ...: Processes music.\n" + ."php postprocess.php console true ...: Processes console games.\n" + ."php postprocess.php games true ...: Processes games.\n" + ."php postprocess.php book true ...: Processes books.\n" + ."php postprocess.php anime true ...: Processes anime.\n" + ."php postprocess.php tv true ...: Processes tv.\n" + ."php postprocess.php xxx true ...: Processes xxx.\n" + ."php postprocess.php additional true ...: Processes previews/mediainfo/etc...\n" + ."php postprocess.php sharing true ...: Processes uploading/downloading comments.\n" + ."php postprocess.php spotnab true ...: Processes uploading/downloading comments from spotnab.\n" + ."php postprocess.php allinf true ...: Does all the types of post processing on a loop, sleeping 15 seconds between.\n" + ."php postprocess.php amazon true ...: Does all the amazon (books/console/games/music/xxx).\n" + ) + ); } $nntp = null; @@ -76,61 +76,61 @@ $charArray = ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', ' switch ($argv[1]) { - case 'all': - $postProcess->processAll($nntp); - break; - case 'allinf': - $i = 1; - while ($i = 1) { - $postProcess->processAll($nntp); - sleep(15); - } - break; - case 'additional': - $postProcess->processAdditional($nntp, '', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); - break; - case 'amazon': - $postProcess->processBooks(); - $postProcess->processConsoles(); - $postProcess->processGames(); - $postProcess->processMusic(); - $postProcess->processXXX(); - break; - case 'anime': - $postProcess->processAnime(); - break; - case 'book': - $postProcess->processBooks(); - break; - case 'console': - $postProcess->processConsoles(); - break; - case 'games': - $postProcess->processGames(); - break; - case 'nfo': - $postProcess->processNfos($nntp, '', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); - break; - case 'movies': - $postProcess->processMovies('', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); - break; - case 'music': - $postProcess->processMusic(); - break; - case 'pre': - break; - case 'sharing': - $postProcess->processSharing($nntp); - break; - case 'spotnab': - $postProcess->processSpotnab(); - break; - case 'tv': - $postProcess->processTv('', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); - break; - case 'xxx': - $postProcess->processXXX(); - break; - default: - exit; + case 'all': + $postProcess->processAll($nntp); + break; + case 'allinf': + $i = 1; + while ($i = 1) { + $postProcess->processAll($nntp); + sleep(15); + } + break; + case 'additional': + $postProcess->processAdditional($nntp, '', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); + break; + case 'amazon': + $postProcess->processBooks(); + $postProcess->processConsoles(); + $postProcess->processGames(); + $postProcess->processMusic(); + $postProcess->processXXX(); + break; + case 'anime': + $postProcess->processAnime(); + break; + case 'book': + $postProcess->processBooks(); + break; + case 'console': + $postProcess->processConsoles(); + break; + case 'games': + $postProcess->processGames(); + break; + case 'nfo': + $postProcess->processNfos($nntp, '', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); + break; + case 'movies': + $postProcess->processMovies('', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); + break; + case 'music': + $postProcess->processMusic(); + break; + case 'pre': + break; + case 'sharing': + $postProcess->processSharing($nntp); + break; + case 'spotnab': + $postProcess->processSpotnab(); + break; + case 'tv': + $postProcess->processTv('', (isset($argv[3]) && in_array($argv[3], $charArray, false) ? $argv[3] : '')); + break; + case 'xxx': + $postProcess->processXXX(); + break; + default: + exit; }