diff --git a/Changelog b/Changelog index ad277ef8f..42eadc018 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-11-24 DariusIII + * Chg: Use bootstrap/autoload.php instead the bootstrap.php in root of install * Chg: Update whoops library 2017-11-23 DariusIII * Chg: Update Nfo class diff --git a/_install/install_nntmux.php b/_install/install_nntmux.php index a904295fb..e4aa00724 100644 --- a/_install/install_nntmux.php +++ b/_install/install_nntmux.php @@ -3,7 +3,7 @@ if (! defined('NN_INSTALLER')) { define('NN_INSTALLER', true); } -require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; include_once dirname(__DIR__).DIRECTORY_SEPARATOR.'nntmux'.DIRECTORY_SEPARATOR.'constants.php'; use nntmux\db\DB; diff --git a/app/Providers/YencServiceProvider.php b/app/Providers/YencServiceProvider.php index ff13cb026..b20d2e2d9 100644 --- a/app/Providers/YencServiceProvider.php +++ b/app/Providers/YencServiceProvider.php @@ -34,11 +34,11 @@ class YencServiceProvider extends ServiceProvider public static function config(array $options = []) { $defaults = [ - ['name' => [ - 'default' => 'Php', - ], - ], - ]; + ['name' => [ + 'default' => 'Php', + ], + ], + ]; $options += $defaults; diff --git a/build/NewPatches.php b/build/NewPatches.php index 264764a03..d83c786ee 100644 --- a/build/NewPatches.php +++ b/build/NewPatches.php @@ -18,7 +18,7 @@ * @author niel * @copyright 2015 nZEDb */ -require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DbUpdate; use nntmux\utility\Git; diff --git a/build/git-hooks/runHooks.php b/build/git-hooks/runHooks.php index 21fefb359..f8ea9a1d9 100755 --- a/build/git-hooks/runHooks.php +++ b/build/git-hooks/runHooks.php @@ -20,7 +20,7 @@ */ define('GIT_PRE_COMMIT', true); -require_once realpath(dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'bootstrap.php'); +require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\utility\Git; use App\Extensions\util\Versions; diff --git a/build/postInstall.php b/build/postInstall.php index e847c1d52..fb5af3aff 100644 --- a/build/postInstall.php +++ b/build/postInstall.php @@ -16,7 +16,7 @@ * @author niel * @copyright 2016 nZEDb */ -require_once '..'.DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once '..'.DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; $updates = NN_CONFIGS.'updates.json'; if (! file_exists($updates)) { diff --git a/cli/data/populate_anidb.php b/cli/data/populate_anidb.php index ef9cc989f..53d524646 100755 --- a/cli/data/populate_anidb.php +++ b/cli/data/populate_anidb.php @@ -2,7 +2,7 @@ /* This script is designed to gather all show data from anidb and add it to the anidb table for nntmux, as part of this process we need the number of PI queries that can be executed max and whether or not we want debuging the first argument if unset will try to do the entire list (a good way to get banned), the second option can be blank or true for debugging. * IF you are using this script then then you also want to edit anidb.php in www/lib and locate "604800" and replace it with 1204400, this will make sure it never tries to connect to anidb as this will fail */ -require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\ColorCLI; @@ -21,11 +21,14 @@ if ($argc > 1 && $argv[1] === 'true' && isset($argv[2])) { } } } else { - ColorCLI::doEcho(PHP_EOL.ColorCLI::error( - 'To execute this script you must provide a boolean argument.'.PHP_EOL. - 'Argument1: true|false to run this script or not'.PHP_EOL. - 'Argument2: full|info for what type of data to populate.'.PHP_EOL. - 'Argument3 (optional) anidbid to fetch info for'.PHP_EOL. - 'WARNING: Argument "info" without third argument will get you banned from AniDB almost instantly'), true - ); + ColorCLI::doEcho( + PHP_EOL.ColorCLI::error( + 'To execute this script you must provide a boolean argument.'.PHP_EOL. + 'Argument1: true|false to run this script or not'.PHP_EOL. + 'Argument2: full|info for what type of data to populate.'.PHP_EOL. + 'Argument3 (optional) anidbid to fetch info for'.PHP_EOL. + 'WARNING: Argument "info" without third argument will get you banned from AniDB almost instantly' + ), + true + ); } diff --git a/cli/data/populate_steam_apps.php b/cli/data/populate_steam_apps.php index 1057fcfb3..54bf74f52 100644 --- a/cli/data/populate_steam_apps.php +++ b/cli/data/populate_steam_apps.php @@ -1,6 +1,6 @@ 0 ? $argv[2] : 10000)); } @@ -27,28 +27,28 @@ function populate_rt($table, $max) $pdo = new DB(); switch ($table) { - case 'releases_rt': - $pdo->queryDirect('SET SESSION group_concat_max_len=8192'); - $query = ( - 'SELECT r.id, r.name, r.searchname, r.fromname, IFNULL(GROUP_CONCAT(rf.name SEPARATOR " "),"") filename + case 'releases_rt': + $pdo->queryDirect('SET SESSION group_concat_max_len=8192'); + $query = ( + 'SELECT r.id, r.name, r.searchname, r.fromname, IFNULL(GROUP_CONCAT(rf.name SEPARATOR " "),"") filename FROM releases r LEFT JOIN release_files rf ON(r.id=rf.releases_id) WHERE r.id > %d GROUP BY r.id ORDER BY r.id ASC LIMIT %d' - ); - $rtvalues = '(id, name, searchname, fromname, filename)'; - $totals = $pdo->queryOneRow('SELECT COUNT(id) AS c, MIN(id) AS min FROM releases'); - if (! $totals) { - exit("Could not get database information for releases table.\n"); - } - $total = $totals['c']; - $minId = $totals['min']; - break; - default: - exit(); - } + ); + $rtvalues = '(id, name, searchname, fromname, filename)'; + $totals = $pdo->queryOneRow('SELECT COUNT(id) AS c, MIN(id) AS min FROM releases'); + if (! $totals) { + exit("Could not get database information for releases table.\n"); + } + $total = $totals['c']; + $minId = $totals['min']; + break; + default: + exit(); + } $sphinx = new SphinxSearch(); $string = sprintf('REPLACE INTO %s %s VALUES ', $table, $rtvalues); @@ -67,17 +67,17 @@ function populate_rt($table, $max) $lastId = $row['id']; } switch ($table) { - case 'releases_rt': - $tempString .= sprintf( - '(%d,%s,%s,%s,%s),', - $row['id'], - $sphinx->sphinxQL->escapeString($row['name']), - $sphinx->sphinxQL->escapeString($row['searchname']), - $sphinx->sphinxQL->escapeString($row['fromname']), - $sphinx->sphinxQL->escapeString($row['filename']) - ); - break; - } + case 'releases_rt': + $tempString .= sprintf( + '(%d,%s,%s,%s,%s),', + $row['id'], + $sphinx->sphinxQL->escapeString($row['name']), + $sphinx->sphinxQL->escapeString($row['searchname']), + $sphinx->sphinxQL->escapeString($row['fromname']), + $sphinx->sphinxQL->escapeString($row['filename']) + ); + break; + } } if (! $tempString) { continue; diff --git a/misc/sphinxsearch/toggle_search_type.php b/misc/sphinxsearch/toggle_search_type.php index 82a405ec6..06a0356f6 100644 --- a/misc/sphinxsearch/toggle_search_type.php +++ b/misc/sphinxsearch/toggle_search_type.php @@ -1,28 +1,28 @@ log->error('Error, NN_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX to optimize for Sphinx!'.PHP_EOL); - } - break; - case 'standard': - revertToStandard(new DB()); - break; + case 'sphinx': + if (NN_RELEASE_SEARCH_TYPE == ReleaseSearch::SPHINX) { + optimizeForSphinx(new DB()); + } else { + echo PHP_EOL.$pdo->log->error('Error, NN_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX to optimize for Sphinx!'.PHP_EOL); + } + break; + case 'standard': + revertToStandard(new DB()); + break; } // Optimize database usage for Sphinx full-text @@ -44,25 +44,26 @@ function revertToStandard($pdo) if (isset($argv[2]) && in_array($argv[2], ['cinnodb', 'dinnodb', 'cmyisam', 'dmyisam'])) { switch ($argv[2]) { - case 'cinnnodb': - $engFormat = 'ENGINE = InnoDB ROW_FORMAT = Compressed'; - break; - case 'dinnodb': - $engFormat = 'ENGINE = InnoDB ROW_FORMAT = Dynamic'; - break; - case 'cmyisam': - $engFormat = 'ENGINE = MyISAM ROW_FORMAT = Compressed'; - break; - case 'dmyisam': - $engFormat = 'ENGINE = MyISAM ROW_FORMAT = Dynamic'; - break; - } + case 'cinnnodb': + $engFormat = 'ENGINE = InnoDB ROW_FORMAT = Compressed'; + break; + case 'dinnodb': + $engFormat = 'ENGINE = InnoDB ROW_FORMAT = Dynamic'; + break; + case 'cmyisam': + $engFormat = 'ENGINE = MyISAM ROW_FORMAT = Compressed'; + break; + case 'dmyisam': + $engFormat = 'ENGINE = MyISAM ROW_FORMAT = Dynamic'; + break; + } } echo PHP_EOL.$pdo->log->info('Dropping old table data and recreating fresh from schema. (Quick)'.PHP_EOL); $pdo->queryExec('DROP TABLE IF EXISTS release_search_data'); $pdo->queryExec( - sprintf(" + sprintf( + " CREATE TABLE release_search_data ( id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, releases_id INT(11) UNSIGNED NOT NULL, @@ -81,9 +82,9 @@ function revertToStandard($pdo) DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 1", - $engFormat - ) - ); + $engFormat + ) + ); echo $pdo->log->info('Populating the releasearch table with initial data. (Slow)'.PHP_EOL); $pdo->queryInsert('INSERT INTO release_search_data (releases_id, guid, name, searchname, fromname) @@ -93,7 +94,8 @@ function revertToStandard($pdo) dropSearchTriggers($pdo); - $pdo->exec(' + $pdo->exec( + ' CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO release_search_data (releases_id, guid, name, searchname, fromname) @@ -124,7 +126,7 @@ function revertToStandard($pdo) DELETE FROM release_search_data WHERE releases_id = OLD.id; END;' - ); + ); echo $pdo->log->header('Standard search should once again be available.'.PHP_EOL); } diff --git a/misc/testing/DB/change_USP_provider.php b/misc/testing/DB/change_USP_provider.php index f634ef141..d5b7d3a86 100644 --- a/misc/testing/DB/change_USP_provider.php +++ b/misc/testing/DB/change_USP_provider.php @@ -1,6 +1,6 @@ error( - "\nThis script will convert your tables to a new engine/format. Only tables not meeting the new engine/format will be converted.\n" - ."A comparison of these, excluding TokuDB, https://github.com/nZEDb/nZEDb/wiki/MySQL-Storage-Engine-Comparison\n\n" - ."php convert_mysql_tables.php dmyisam ...: Converts all the tables to Myisam Dynamic. This is the default and is recommended where ram is limited.\n" - ."php convert_mysql_tables.php fmyisam ...: Converts all the tables to Myisam Fixed. This can be faster, but to fully convert all tables requires changing varchar columns to char.\n" - ." This will use much more space than dynamic.\n" - ."php convert_mysql_tables.php dinnodb ...: Converts all the tables to InnoDB Dynamic. This is recommended when the total data and indexes can fit into the innodb_buffer_pool.\n" - ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" - ."php convert_mysql_tables.php cinnodb ...: Converts all the tables to InnoDB Compressed. All tables except releasenfo will be converted to Compressed row format.\n" - ." This is recommended when the total data and indexes can not fit into the innodb_buffer_pool using DYNAMIC row format.\n" - ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" - ."php convert_mysql_tables.php cinnodb-noparts ...: Converts all the tables to InnoDB Compressed. All tables except parts and releasenfo will be converted to Compressed row format.\n" - ." Alls parts* will be converted to MyISAM Dynamic. This is recommended when using Table Per Group.\n" - ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" - ."php convert_mysql_tables.php collections ...: Converts collections, binaries, parts to MyIsam.\n" - ."php convert_mysql_tables.php mariadb-tokudb ...: Converts all the tables to MariaDB Tokutek DB. Use this is you installed mariadb-tokudb-engine. \n" - ." The TokuDB engine needs to be activated first.\n" - ." https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/\n" - ." NB release_search_data will not be converted as tokudb does not support fulltext indexes.\n" - ."php convert_mysql_tables.php tokudb ...: Converts all the tables to Tokutek DB. Use this if you downloaded and installed the TokuDB binaries.\n" - ." http://www.tokutek.com/resources/support/gadownloads/\n" - ." NB release_search_data will not be converted as tokudb does not support fulltext indexes.\n" - ."php convert_mysql_tables.php table [ fmyisam, dmyisam, dinnodb, cinnodb ] ...: Converts 1 table to Engine, row_format specified.\n" - ." NB if converting to innodb and your innodb version < 5.6 release_search_data will not be converted as fulltext indexes are not supported.\n" - )); + "\nThis script will convert your tables to a new engine/format. Only tables not meeting the new engine/format will be converted.\n" + ."A comparison of these, excluding TokuDB, https://github.com/nZEDb/nZEDb/wiki/MySQL-Storage-Engine-Comparison\n\n" + ."php convert_mysql_tables.php dmyisam ...: Converts all the tables to Myisam Dynamic. This is the default and is recommended where ram is limited.\n" + ."php convert_mysql_tables.php fmyisam ...: Converts all the tables to Myisam Fixed. This can be faster, but to fully convert all tables requires changing varchar columns to char.\n" + ." This will use much more space than dynamic.\n" + ."php convert_mysql_tables.php dinnodb ...: Converts all the tables to InnoDB Dynamic. This is recommended when the total data and indexes can fit into the innodb_buffer_pool.\n" + ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" + ."php convert_mysql_tables.php cinnodb ...: Converts all the tables to InnoDB Compressed. All tables except releasenfo will be converted to Compressed row format.\n" + ." This is recommended when the total data and indexes can not fit into the innodb_buffer_pool using DYNAMIC row format.\n" + ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" + ."php convert_mysql_tables.php cinnodb-noparts ...: Converts all the tables to InnoDB Compressed. All tables except parts and releasenfo will be converted to Compressed row format.\n" + ." Alls parts* will be converted to MyISAM Dynamic. This is recommended when using Table Per Group.\n" + ." NB if your innodb version < 5.6 bookinfo / consoleinfo / musicinfo / release_search_data will not be converted as fulltext indexes are not supported.\n" + ."php convert_mysql_tables.php collections ...: Converts collections, binaries, parts to MyIsam.\n" + ."php convert_mysql_tables.php mariadb-tokudb ...: Converts all the tables to MariaDB Tokutek DB. Use this is you installed mariadb-tokudb-engine. \n" + ." The TokuDB engine needs to be activated first.\n" + ." https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/\n" + ." NB release_search_data will not be converted as tokudb does not support fulltext indexes.\n" + ."php convert_mysql_tables.php tokudb ...: Converts all the tables to Tokutek DB. Use this if you downloaded and installed the TokuDB binaries.\n" + ." http://www.tokutek.com/resources/support/gadownloads/\n" + ." NB release_search_data will not be converted as tokudb does not support fulltext indexes.\n" + ."php convert_mysql_tables.php table [ fmyisam, dmyisam, dinnodb, cinnodb ] ...: Converts 1 table to Engine, row_format specified.\n" + ." NB if converting to innodb and your innodb version < 5.6 release_search_data will not be converted as fulltext indexes are not supported.\n" + )); } diff --git a/misc/testing/DB/convert_to_tpg.php b/misc/testing/DB/convert_to_tpg.php index 44c88d2a0..c6c3c62e3 100644 --- a/misc/testing/DB/convert_to_tpg.php +++ b/misc/testing/DB/convert_to_tpg.php @@ -1,6 +1,6 @@ log->error("\nThis script will move all collections, binaries, parts into tables per group.\n\n" - ."php $argv[0] true ...: To process all parts and leave the parts/binaries/collections tables intact.\n" - ."php $argv[0] true truncate ...: To process all parts and truncate parts/binaries/collections tables after completed.\n")); + ."php $argv[0] true ...: To process all parts and leave the parts/binaries/collections tables intact.\n" + ."php $argv[0] true truncate ...: To process all parts and truncate parts/binaries/collections tables after completed.\n")); } $start = time(); @@ -43,26 +43,26 @@ if ($collections_rows instanceof \Traversable) { echo $pdo->log->header("Processing ${groupName}"); //collection $pdo->queryExec('INSERT IGNORE INTO collections_'.$row['groups_id'].' (subject, fromname, date, xref, totalfiles, groups_id, collectionhash, dateadded, filecheck, filesize, releaseid) ' - ."SELECT subject, fromname, date, xref, totalfiles, groups_id, collectionhash, dateadded, filecheck, filesize, releaseid FROM collections WHERE groups_id = ${row['groups_id']}"); + ."SELECT subject, fromname, date, xref, totalfiles, groups_id, collectionhash, dateadded, filecheck, filesize, releaseid FROM collections WHERE groups_id = ${row['groups_id']}"); $collections = $pdo->queryOneRow('SELECT COUNT(*) AS cnt FROM collections where groups_id = '.$row['groups_id']); $ncollections = $pdo->queryOneRow('SELECT COUNT(*) AS cnt FROM collections_'.$row['groups_id']); echo $pdo->log->primary("Group ${groupName}, Collections = ${collections['cnt']} [${ncollections['cnt']}]"); //binaries $pdo->queryExec("INSERT IGNORE INTO binaries_${row['groups_id']} (name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, collections_id) " - .'SELECT name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, n.id FROM binaries b ' - .'INNER JOIN collections c ON b.collections_id = c.id ' - ."INNER JOIN collections_${row['groups_id']} n ON c.collectionhash = n.collectionhash AND c.groups_id = ${row['groups_id']}"); + .'SELECT name, filenumber, totalparts, currentparts, binaryhash, partcheck, partsize, n.id FROM binaries b ' + .'INNER JOIN collections c ON b.collections_id = c.id ' + ."INNER JOIN collections_${row['groups_id']} n ON c.collectionhash = n.collectionhash AND c.groups_id = ${row['groups_id']}"); $binaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries b INNER JOIN collections c ON b.collections_id = c.id where c.groups_id = ${row['groups_id']}"); $nbinaries = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM binaries_${row['groups_id']}"); echo $pdo->log->primary("Group ${groupName}, Binaries = ${binaries['cnt']} [${nbinaries['cnt']}]"); //parts $pdo->queryExec("INSERT IGNORE INTO parts_${row['groups_id']} (messageid, number, partnumber, size, binaries_id, collections_id) " - .'SELECT messageid, number, partnumber, size, n.id, c.id FROM parts p ' - .'INNER JOIN binaries b ON p.binaries_id = b.id ' - ."INNER JOIN binaries_${row['groups_id']} n ON b.binaryhash = n.binaryhash " - ."INNER JOIN collections_${row['groups_id']} c on c.id = n.collections_id AND c.groups_id = ${row['groups_id']}"); + .'SELECT messageid, number, partnumber, size, n.id, c.id FROM parts p ' + .'INNER JOIN binaries b ON p.binaries_id = b.id ' + ."INNER JOIN binaries_${row['groups_id']} n ON b.binaryhash = n.binaryhash " + ."INNER JOIN collections_${row['groups_id']} c on c.id = n.collections_id AND c.groups_id = ${row['groups_id']}"); $parts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts p INNER JOIN binaries b ON p.binaries_id = b.id INNER JOIN collections c ON b.collections_id = c.id WHERE c.groups_id = ${row['groups_id']}"); $nparts = $pdo->queryOneRow("SELECT COUNT(*) AS cnt FROM parts_${row['groups_id']}"); echo $pdo->log->primary("Group ${groupName}, Parts = ${parts['cnt']} [${nparts['cnt']}]\n"); diff --git a/misc/testing/DB/mysqldump_tables.php b/misc/testing/DB/mysqldump_tables.php index 4582b35aa..94dfcb249 100644 --- a/misc/testing/DB/mysqldump_tables.php +++ b/misc/testing/DB/mysqldump_tables.php @@ -1,6 +1,6 @@ log->error("\nThis script can dump/restore all tables, compressed or OUTFILE/INFILE, or just collections/binaries/parts.\n\n" - ."**Single File\n" - ."php $argv[0] db dump /path/to/save/to ...: To dump the database.\n" - ."php $argv[0] db restore /path/to/restore/from ...: To restore the database.\n\n" - ."**Individual Table Files\n" - ."php $argv[0] all dump /path/to/save/to ...: To dump all tables.\n" - ."php $argv[0] all restore /path/to/restore/from ...: To restore all tables.\n\n" - ."**Three Tables (collections, binaries, parts)\n" - ."php $argv[0] test dump /path/to/save/to ...: To dump binaries and parts tables.\n" - ."php $argv[0] test restore /path/to/restore/from ...: To restore binaries and parts tables.\n\n" - ."**Individal Files - OUTFILE/INFILE - No schema\n" - ."**MySQL MUST have write permissions to this path\n" - ."php $argv[0] all outfile /path/to/save/to ...: To dump all tables, using OUTFILE.\n" - ."php $argv[0] all infile /path/to/restore/from ...: To restore all tables, using INFILE.\n\n"); + ."**Single File\n" + ."php $argv[0] db dump /path/to/save/to ...: To dump the database.\n" + ."php $argv[0] db restore /path/to/restore/from ...: To restore the database.\n\n" + ."**Individual Table Files\n" + ."php $argv[0] all dump /path/to/save/to ...: To dump all tables.\n" + ."php $argv[0] all restore /path/to/restore/from ...: To restore all tables.\n\n" + ."**Three Tables (collections, binaries, parts)\n" + ."php $argv[0] test dump /path/to/save/to ...: To dump binaries and parts tables.\n" + ."php $argv[0] test restore /path/to/restore/from ...: To restore binaries and parts tables.\n\n" + ."**Individal Files - OUTFILE/INFILE - No schema\n" + ."**MySQL MUST have write permissions to this path\n" + ."php $argv[0] all outfile /path/to/save/to ...: To dump all tables, using OUTFILE.\n" + ."php $argv[0] all infile /path/to/restore/from ...: To restore all tables, using INFILE.\n\n"); } if (file_exists('mysql-defaults.txt')) { diff --git a/misc/testing/DB/populate_nzb_guid.php b/misc/testing/DB/populate_nzb_guid.php index 95b4061ad..8fec6221c 100644 --- a/misc/testing/DB/populate_nzb_guid.php +++ b/misc/testing/DB/populate_nzb_guid.php @@ -1,6 +1,6 @@ error("\nThis script updates all releases with the guid (md5 hash of the first message-id) from the nzb file.\n\n" - ."php $argv[0] true ...: To create missing nzb_guids.\n" - ."php $argv[0] true delete ...: To create missing nzb_guids and delete invalid nzbs and releases.\n")); + ."php $argv[0] true ...: To create missing nzb_guids.\n" + ."php $argv[0] true delete ...: To create missing nzb_guids and delete invalid nzbs and releases.\n")); } function create_guids($live, $delete = false) diff --git a/misc/testing/DB/rename_to_lower.php b/misc/testing/DB/rename_to_lower.php index 802d71153..d45534cfe 100644 --- a/misc/testing/DB/rename_to_lower.php +++ b/misc/testing/DB/rename_to_lower.php @@ -1,6 +1,6 @@ log->error("\nThis script renames all table columns to lowercase, it can be dangerous. Please BACKUP your database before running this script.\n" - ."php rename_to_lower.php true ...: To rename all table columns to lowercase.\n")); + ."php rename_to_lower.php true ...: To rename all table columns to lowercase.\n")); } echo $pdo->log->warning('This script renames all table colums to lowercase.'); diff --git a/misc/testing/DB/reset_postprocessing.php b/misc/testing/DB/reset_postprocessing.php index f9db7b68d..e5f54bd46 100755 --- a/misc/testing/DB/reset_postprocessing.php +++ b/misc/testing/DB/reset_postprocessing.php @@ -1,6 +1,6 @@ rowCount(); foreach ($qry as $releases) { $pdo->queryExec( - sprintf(' + sprintf( + ' UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, tv_episodes_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %d', - $releases['id'] - ) - ); + $releases['id'] + ) + ); $consoletools->overWritePrimary('Resetting Releases: '.$consoletools->percentString(++$affected, $total)); } } @@ -290,8 +291,10 @@ if (isset($argv[1]) && ($argv[1] === 'xxx' || $argv[1] === 'all')) { $total = $qry->rowCount(); foreach ($qry as $releases) { $pdo->queryExec('UPDATE releases SET xxxinfo_id = 0 WHERE id = '.$releases['id']); - $consoletools->overWritePrimary('Resetting XXX Releases: '.$consoletools->percentString(++$concount, - $total)); + $consoletools->overWritePrimary('Resetting XXX Releases: '.$consoletools->percentString( + ++$concount, + $total + )); } } echo ColorCLI::header(PHP_EOL.number_format($concount).' xxxinfo_IDs reset.'); @@ -323,25 +326,25 @@ if (isset($argv[1]) && ($argv[1] === 'nfos' || $argv[1] === 'all')) { if ($ran === false) { exit( - ColorCLI::error( - '\nThis script will reset postprocessing per category. It can also truncate the associated tables.' - .'\nTo reset only those that have previously failed, those without covers, samples, previews, etc. use the ' - .'second argument false.\n' - .'To reset even those previously post processed, use the second argument true.\n' - .'To truncate the associated table, use the third argument truncate.\n\n' - .'php reset_postprocessing.php consoles true ...: To reset all consoles.\n' - .'php reset_postprocessing.php games true ...: To reset all games.\n' - .'php reset_postprocessing.php movies true ...: To reset all movies.\n' - .'php reset_postprocessing.php music true ...: To reset all music.\n' - .'php reset_postprocessing.php misc true ...: To reset all misc.\n' - .'php reset_postprocessing.php tv true ...: To reset all tv.\n' - .'php reset_postprocessing.php anime true ...: To reset all anime.\n' - .'php reset_postprocessing.php books true ...: To reset all books.\n' - .'php reset_postprocessing.php xxx true ...: To reset all xxx.\n' - .'php reset_postprocessing.php nfos true ...: To reset all nfos.\n' - .'php reset_postprocessing.php all true ...: To reset everything.\n' - ) - ); + ColorCLI::error( + '\nThis script will reset postprocessing per category. It can also truncate the associated tables.' + .'\nTo reset only those that have previously failed, those without covers, samples, previews, etc. use the ' + .'second argument false.\n' + .'To reset even those previously post processed, use the second argument true.\n' + .'To truncate the associated table, use the third argument truncate.\n\n' + .'php reset_postprocessing.php consoles true ...: To reset all consoles.\n' + .'php reset_postprocessing.php games true ...: To reset all games.\n' + .'php reset_postprocessing.php movies true ...: To reset all movies.\n' + .'php reset_postprocessing.php music true ...: To reset all music.\n' + .'php reset_postprocessing.php misc true ...: To reset all misc.\n' + .'php reset_postprocessing.php tv true ...: To reset all tv.\n' + .'php reset_postprocessing.php anime true ...: To reset all anime.\n' + .'php reset_postprocessing.php books true ...: To reset all books.\n' + .'php reset_postprocessing.php xxx true ...: To reset all xxx.\n' + .'php reset_postprocessing.php nfos true ...: To reset all nfos.\n' + .'php reset_postprocessing.php all true ...: To reset everything.\n' + ) + ); } else { echo PHP_EOL; } diff --git a/misc/testing/DB/reset_truncate.php b/misc/testing/DB/reset_truncate.php index 71d614d88..4ee09fe82 100644 --- a/misc/testing/DB/reset_truncate.php +++ b/misc/testing/DB/reset_truncate.php @@ -1,6 +1,6 @@ queryDirect('DELETE FROM releases WHERE nzbstatus = 0'); echo $pdo->log->primary($delcount->rowCount().' releases had no nzb, deleted.'); } else { - exit($pdo->log->error("\nThis script removes releases with no NZBs, resets all groups, truncates or drops(tpg) \n" - ."article tables. All other releases are left alone.\n" - ."php $argv[0] [true, drop] ...: To reset all groups and truncate/drop the tables.\n" - ) - ); + exit($pdo->log->error( + "\nThis script removes releases with no NZBs, resets all groups, truncates or drops(tpg) \n" + ."article tables. All other releases are left alone.\n" + ."php $argv[0] [true, drop] ...: To reset all groups and truncate/drop the tables.\n" + ) + ); } diff --git a/misc/testing/DB/resetdb.php b/misc/testing/DB/resetdb.php index 257ea73c5..7726f0f69 100644 --- a/misc/testing/DB/resetdb.php +++ b/misc/testing/DB/resetdb.php @@ -1,6 +1,6 @@ . */ -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\Users; diff --git a/misc/testing/DB/show_table_sizes.php b/misc/testing/DB/show_table_sizes.php index 0a93af47c..ed9735b91 100644 --- a/misc/testing/DB/show_table_sizes.php +++ b/misc/testing/DB/show_table_sizes.php @@ -1,6 +1,6 @@ log->error("\nThis script will show table data, index and free space used. The argument needed is numeric.\n\n" - ."php $argv[0] 1 ...: To show all tables with data + index space used greater than 1MB or free space greater than 1MB.\n" - ."php $argv[0] .01 ...: To show all tables with data + index space used greater than .01MB or free space greater than .01MB.\n")); + ."php $argv[0] 1 ...: To show all tables with data + index space used greater than 1MB or free space greater than 1MB.\n" + ."php $argv[0] .01 ...: To show all tables with data + index space used greater than .01MB or free space greater than .01MB.\n")); } passthru('clear'); $data = $index = $total = $free = 0; $table_data = "SELECT TABLE_NAME AS 'Table', TABLE_ROWS AS 'Rows', " - ."ENGINE AS 'engine', " - ."CREATE_OPTIONS AS 'format', " - ."((DATA_LENGTH) / POWER(1024,2)) AS 'data', " - ."((INDEX_LENGTH) / POWER(1024,2)) AS 'index', " - ."((DATA_FREE) / POWER(1024,2)) AS 'free', " - ."((DATA_LENGTH + INDEX_LENGTH) / POWER(1024,2)) AS 'total' " - ."FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema = '".env('DB_NAME')."' " - .'ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC'; + ."ENGINE AS 'engine', " + ."CREATE_OPTIONS AS 'format', " + ."((DATA_LENGTH) / POWER(1024,2)) AS 'data', " + ."((INDEX_LENGTH) / POWER(1024,2)) AS 'index', " + ."((DATA_FREE) / POWER(1024,2)) AS 'free', " + ."((DATA_LENGTH + INDEX_LENGTH) / POWER(1024,2)) AS 'total' " + ."FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema = '".env('DB_NAME')."' " + .'ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC'; $run = $pdo->queryDirect($table_data); @@ -45,16 +45,16 @@ printf($mask, 'Table Name', 'Engine', 'Row_Format', 'Data Size', 'Index Size', ' printf($mask, '', '', '', number_format($data, 2).' MB', number_format($index, 2).' MB', number_format($free, 2).' MB', number_format($total, 2).' MB'); $myisam = $pdo->queryOneRow('SELECT CONCAT(ROUND(KBS/POWER(1024,IF(pw<0,0,IF(pw>3,0,pw)))+0.49999), ' - ."SUBSTR(' KMG',IF(pw<0,0,IF(pw>3,0,pw))+1,1)) recommended_key_buffer_size " - .'FROM (SELECT SUM(index_length) KBS ' - .'FROM information_schema.tables ' - ."WHERE engine='MyISAM' AND table_schema NOT IN ('information_schema','mysql')) A, (SELECT 3 pw) B;", false); + ."SUBSTR(' KMG',IF(pw<0,0,IF(pw>3,0,pw))+1,1)) recommended_key_buffer_size " + .'FROM (SELECT SUM(index_length) KBS ' + .'FROM information_schema.tables ' + ."WHERE engine='MyISAM' AND table_schema NOT IN ('information_schema','mysql')) A, (SELECT 3 pw) B;", false); $innodb = $pdo->queryOneRow('SELECT CONCAT(ROUND(KBS/POWER(1024,IF(pw<0,0,IF(pw>3,0,pw)))+0.49999), ' - ."SUBSTR(' KMG',IF(pw<0,0,IF(pw>3,0,pw))+1,1)) recommended_innodb_buffer_pool_size " - .'FROM (SELECT SUM(index_length) KBS ' - .'FROM information_schema.tables ' - ."WHERE engine='InnoDB') A,(SELECT 3 pw) B;", false); + ."SUBSTR(' KMG',IF(pw<0,0,IF(pw>3,0,pw))+1,1)) recommended_innodb_buffer_pool_size " + .'FROM (SELECT SUM(index_length) KBS ' + .'FROM information_schema.tables ' + ."WHERE engine='InnoDB') A,(SELECT 3 pw) B;", false); $a = $myisam['recommended_key_buffer_size']; if ($myisam['recommended_key_buffer_size'] === null) { diff --git a/misc/testing/Dev/clean_nzbs.php b/misc/testing/Dev/clean_nzbs.php index 9eba73194..5c7f8a38d 100644 --- a/misc/testing/Dev/clean_nzbs.php +++ b/misc/testing/Dev/clean_nzbs.php @@ -1,6 +1,6 @@ $nzbFile) { continue; } - $newFileName = $nzb->getNZBPath(str_replace('.nzb.gz', '', $nzbFile->getBasename()), - $newLevel, - true); + $newFileName = $nzb->getNZBPath( + str_replace('.nzb.gz', '', $nzbFile->getBasename()), + $newLevel, + true + ); if ($newFileName != $nzbFile) { rename($nzbFile, $newFileName); chmod($newFileName, 0777); diff --git a/misc/testing/PostProc/check_covers.php b/misc/testing/PostProc/check_covers.php index 86cdf7494..afb489d5f 100644 --- a/misc/testing/PostProc/check_covers.php +++ b/misc/testing/PostProc/check_covers.php @@ -3,7 +3,7 @@ // -------------------------------------------------------------- // Scan for releases missing previews on disk // -------------------------------------------------------------- -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\Movie; @@ -55,9 +55,9 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { echo ColorCLI::header('Total releases missing covers that '.$couldbe.'their covers fixed = '.number_format($counterfixed)); } else { exit(ColorCLI::header("\nThis script checks if release covers actually exist on disk.\n\n" - ."Releases without covers may be reset for post-processing, thus regenerating them and related meta data.\n\n" - ."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n" - ."Optional LIMIT parameter restricts number of releases to be reset.\n\n" - ."php $argv[0] check [LIMIT] ...: Dry run, displays missing covers.\n" - ."php $argv[0] true [LIMIT] ...: Re-process releases missing covers.\n")); + ."Releases without covers may be reset for post-processing, thus regenerating them and related meta data.\n\n" + ."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n" + ."Optional LIMIT parameter restricts number of releases to be reset.\n\n" + ."php $argv[0] check [LIMIT] ...: Dry run, displays missing covers.\n" + ."php $argv[0] true [LIMIT] ...: Re-process releases missing covers.\n")); } diff --git a/misc/testing/PostProc/check_previews.php b/misc/testing/PostProc/check_previews.php index bf3f4ae6d..26380fc05 100644 --- a/misc/testing/PostProc/check_previews.php +++ b/misc/testing/PostProc/check_previews.php @@ -3,7 +3,7 @@ // -------------------------------------------------------------- // Scan for releases missing previews on disk // -------------------------------------------------------------- -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\NZB; use nntmux\db\DB; @@ -43,7 +43,8 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { echo $pdo->log->warning('Missing preview '.$nzbpath); if ($argv[1] === 'true') { $pdo->queryExec( - sprintf('UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %s', $row['id'])); + sprintf('UPDATE releases SET consoleinfo_id = NULL, gamesinfo_id = 0, imdbid = NULL, musicinfo_id = NULL, bookinfo_id = NULL, videos_id = 0, xxxinfo_id = 0, passwordstatus = -1, haspreview = -1, jpgstatus = 0, videostatus = 0, audiostatus = 0, nfostatus = -1 WHERE id = %s', $row['id']) + ); } } @@ -55,9 +56,9 @@ if (isset($argv[1]) && ($argv[1] === 'true' || $argv[1] === 'check')) { echo $pdo->log->header('Total releases missing previews that '.$couldbe.'reset for reprocessing= '.number_format($counterfixed)); } else { exit($pdo->log->header("\nThis script checks if release previews actually exist on disk.\n\n" - ."Releases without previews may be reset for post-processing, thus regenerating them and related meta data.\n\n" - ."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n" - ."Optional LIMIT parameter restricts number of releases to be reset.\n\n" - ."php $argv[0] check [LIMIT] ...: Dry run, displays missing previews.\n" - ."php $argv[0] true [LIMIT] ...: Re-process releases missing previews.\n")); + ."Releases without previews may be reset for post-processing, thus regenerating them and related meta data.\n\n" + ."Useful for recovery after filesystem corruption, or as an alternative re-postprocessing tool.\n\n" + ."Optional LIMIT parameter restricts number of releases to be reset.\n\n" + ."php $argv[0] check [LIMIT] ...: Dry run, displays missing previews.\n" + ."php $argv[0] true [LIMIT] ...: Re-process releases missing previews.\n")); } diff --git a/misc/testing/PostProc/getConsole.php b/misc/testing/PostProc/getConsole.php index b2af8bdfa..54a37e60d 100644 --- a/misc/testing/PostProc/getConsole.php +++ b/misc/testing/PostProc/getConsole.php @@ -2,7 +2,7 @@ //This script will update all records in the consoleinfo table -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\Console; @@ -13,12 +13,13 @@ $pdo = new DB(); $console = new Console(['Echo' => true, 'Settings' => $pdo]); $res = $pdo->queryDirect( - sprintf( - 'SELECT searchname, id FROM releases WHERE consoleinfo_id IS NULL AND categories_id + sprintf( + 'SELECT searchname, id FROM releases WHERE consoleinfo_id IS NULL AND categories_id BETWEEN %s AND %s ORDER BY id DESC', - Category::GAME_ROOT, - Category::GAME_OTHER - )); + Category::GAME_ROOT, + Category::GAME_OTHER + ) +); if ($res instanceof \Traversable) { echo $pdo->log->header('Updating console info for '.number_format($res->rowCount()).' releases.'); diff --git a/misc/testing/PostProc/getGameCovers.php b/misc/testing/PostProc/getGameCovers.php index 9d3ecf7b2..808181b1d 100644 --- a/misc/testing/PostProc/getGameCovers.php +++ b/misc/testing/PostProc/getGameCovers.php @@ -2,7 +2,7 @@ //This script will update all records in the gamesinfo table -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\Games; diff --git a/misc/testing/PostProc/getImdb.php b/misc/testing/PostProc/getImdb.php index 14478819f..a1a97f2bf 100644 --- a/misc/testing/PostProc/getImdb.php +++ b/misc/testing/PostProc/getImdb.php @@ -1,7 +1,7 @@ log->header('Total releases missing samples that '.$couldbe.'their samples updated = '.number_format($counterfixed)); } else { exit($pdo->log->header("\nThis script checks if XXX release samples actually exist on disk.\n\n" - ."php $argv[0] check ...: Dry run, displays missing samples.\n" - ."php $argv[0] true ...: Update XXX releases missing samples.\n")); + ."php $argv[0] check ...: Dry run, displays missing samples.\n" + ."php $argv[0] true ...: Update XXX releases missing samples.\n")); } diff --git a/misc/testing/PostProc/updateBookImages.php b/misc/testing/PostProc/updateBookImages.php index 0f0cc986e..e37d046cb 100644 --- a/misc/testing/PostProc/updateBookImages.php +++ b/misc/testing/PostProc/updateBookImages.php @@ -1,6 +1,6 @@ queryExec('TRUNCATE TABLE predb_imports'); } else { exit($pdo->log->error("\nThis script can export or import a predb dump file. You may use the full path, or a relative path.\n" - ."For importing, the script insert new rows and update existing matched rows. For databases not on the local system, use remote, else use local.\n" - ."For exporting, the path must be writeable by mysql, any existing file[predb_dump.csv] will be + ."For importing, the script insert new rows and update existing matched rows. For databases not on the local system, use remote, else use local.\n" + ."For exporting, the path must be writeable by mysql, any existing file[predb_dump.csv] will be overwritten.\n\n" - ."php dump_predb.php export /path/to/write/to ...: To export.\n" - ."php dump_predb.php [remote | local] /path/to/filename ...: To import.\n")); + ."php dump_predb.php export /path/to/write/to ...: To export.\n" + ."php dump_predb.php [remote | local] /path/to/filename ...: To import.\n")); } diff --git a/misc/testing/Releases/delete_releases.php b/misc/testing/Releases/delete_releases.php index f4f5b2ad4..3c50091c4 100644 --- a/misc/testing/Releases/delete_releases.php +++ b/misc/testing/Releases/delete_releases.php @@ -1,6 +1,6 @@ queryExec( - sprintf(' + sprintf( + ' UPDATE releases SET iscategorized = 1, videos_id = 0, @@ -97,10 +98,10 @@ function categorizeRelease($where, $update = true, $echooutput = false) xxxinfo_id = 0, categories_id = %d WHERE id = %d', - $catId, - $rowrel['id'] - ) - ); + $catId, + $rowrel['id'] + ) + ); } $chgcount++; } diff --git a/misc/testing/Releases/removeCrapReleases.php b/misc/testing/Releases/removeCrapReleases.php index 6cd3a870b..7ad7f19ee 100755 --- a/misc/testing/Releases/removeCrapReleases.php +++ b/misc/testing/Releases/removeCrapReleases.php @@ -1,7 +1,7 @@ error( - $n. - 'Run fixReleaseNames.php first to attempt to fix release names.'.$n. - 'This will miss some releases if you have not set fixReleaseNames to set the release as checked.'.$n.$n. - "php $argv[0] false Display full usage of this script.".$n. - "php $argv[0] true full Run this script with all options." - ) - ); + $cli->error( + $n. + 'Run fixReleaseNames.php first to attempt to fix release names.'.$n. + 'This will miss some releases if you have not set fixReleaseNames to set the release as checked.'.$n.$n. + "php $argv[0] false Display full usage of this script.".$n. + "php $argv[0] true full Run this script with all options." + ) + ); } if ($argCnt === 2) { if ($argv[1] === 'false') { exit( - "php $argv[0] arg1 arg2 arg3 arg4".$n.$n. - 'arg1 (Required) = true/false'.$n. - ' true = Run this script and delete releases.'.$n. - ' false = Run this script and show what could be deleted.'.$n.$n. - 'arg2 (Required) = full/number'.$n. - ' full = Run without a time limit.'.$n. - ' number = Run on releases up to this old.'.$n.$n. - 'arg3 (Optional) = blacklist | blfiles | codec | executable | gibberish | hashed | huge | nzb | installbin | passworded | passwordurl | sample | scr | short | size | wmv_all'.$n. - ' blfiles = Remove releases using the enabled blacklists in admin section of site against filenames.'.$n. - ' codec = Remove releases where the release contains AVI or WMV file and is in x264 category (the spammer).'.$n. - ' executable = Remove releases containing an exe file.'.$n. - ' gibberish = Remove releases where the name is letters/numbers only and 15 characters or longer.'.$n. - ' hashed = Remove releases where the name is letters/numbers only and 25 characters or longer.'.$n. - ' huge = Remove releases with single file with size of over 200 megabytes.'.$n. - ' nzb = Remove releases having 1 file that is an nzb file.'.$n. - ' installbin = Remove releases which contain an install.bin file.'.$n. - ' passworded = Remove releases which contain the word password in the title.'.$n. - ' passwordurl = Remove releases which contain a password.url file.'.$n. - ' sample = Remove releases that are smaller than 40MB more than 1 file and have sample in the title'.$n. - ' scr = Remove releases where .scr extension is found in the files or subject.'.$n. - ' short = Remove releases where the name is only numbers or letters and is 5 characters or less.'.$n. - ' wmv_all = Remove releases where the release contains WMV file in any group!!.'.$n. - ' size = Remove releases smaller than 1MB and have only 1 file and not in books or mp3 section.'.$n.$n. - 'examples:'.$n. - "php $argv[0] true 12 blacklist = Remove releases up to 12 hours old using site blacklists.".$n. - "php $argv[0] false full = Show what releases could have been removed.".$n. - "php $argv[0] true full installbin = Remove releases which containing an install.bin file.".$n. - "php $argv[0] true full blacklist 1 = Remove releases matching blacklist id 1.".$n - ); + "php $argv[0] arg1 arg2 arg3 arg4".$n.$n. + 'arg1 (Required) = true/false'.$n. + ' true = Run this script and delete releases.'.$n. + ' false = Run this script and show what could be deleted.'.$n.$n. + 'arg2 (Required) = full/number'.$n. + ' full = Run without a time limit.'.$n. + ' number = Run on releases up to this old.'.$n.$n. + 'arg3 (Optional) = blacklist | blfiles | codec | executable | gibberish | hashed | huge | nzb | installbin | passworded | passwordurl | sample | scr | short | size | wmv_all'.$n. + ' blfiles = Remove releases using the enabled blacklists in admin section of site against filenames.'.$n. + ' codec = Remove releases where the release contains AVI or WMV file and is in x264 category (the spammer).'.$n. + ' executable = Remove releases containing an exe file.'.$n. + ' gibberish = Remove releases where the name is letters/numbers only and 15 characters or longer.'.$n. + ' hashed = Remove releases where the name is letters/numbers only and 25 characters or longer.'.$n. + ' huge = Remove releases with single file with size of over 200 megabytes.'.$n. + ' nzb = Remove releases having 1 file that is an nzb file.'.$n. + ' installbin = Remove releases which contain an install.bin file.'.$n. + ' passworded = Remove releases which contain the word password in the title.'.$n. + ' passwordurl = Remove releases which contain a password.url file.'.$n. + ' sample = Remove releases that are smaller than 40MB more than 1 file and have sample in the title'.$n. + ' scr = Remove releases where .scr extension is found in the files or subject.'.$n. + ' short = Remove releases where the name is only numbers or letters and is 5 characters or less.'.$n. + ' wmv_all = Remove releases where the release contains WMV file in any group!!.'.$n. + ' size = Remove releases smaller than 1MB and have only 1 file and not in books or mp3 section.'.$n.$n. + 'examples:'.$n. + "php $argv[0] true 12 blacklist = Remove releases up to 12 hours old using site blacklists.".$n. + "php $argv[0] false full = Show what releases could have been removed.".$n. + "php $argv[0] true full installbin = Remove releases which containing an install.bin file.".$n. + "php $argv[0] true full blacklist 1 = Remove releases matching blacklist id 1.".$n + ); } else { exit($cli->error("Wrong usage! Type php $argv[0] false")); } diff --git a/misc/testing/Tests/regexverify.php b/misc/testing/Tests/regexverify.php index d45e5d5ff..229cc9431 100644 --- a/misc/testing/Tests/regexverify.php +++ b/misc/testing/Tests/regexverify.php @@ -6,7 +6,7 @@ // // by l2g // -require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap.php'; +require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; use nntmux\db\DB; use nntmux\Releases; diff --git a/misc/testing/Tests/test_amazon_API.php b/misc/testing/Tests/test_amazon_API.php index 09f6dd3db..37358e4d2 100644 --- a/misc/testing/Tests/test_amazon_API.php +++ b/misc/testing/Tests/test_amazon_API.php @@ -1,6 +1,6 @@ getMovieFanart((string) $argv[1]); diff --git a/misc/testing/Tests/test_giantbomb_API.php b/misc/testing/Tests/test_giantbomb_API.php index 83962f75f..46565a52a 100755 --- a/misc/testing/Tests/test_giantbomb_API.php +++ b/misc/testing/Tests/test_giantbomb_API.php @@ -1,6 +1,6 @@ search($searchgame, $fields, 1); $result = json_decode(json_encode($result), true); if ($result['number_of_total_results'] != 0) { diff --git a/misc/testing/Tests/test_nntp_server.php b/misc/testing/Tests/test_nntp_server.php index b5c9b57ed..d7303c9af 100755 --- a/misc/testing/Tests/test_nntp_server.php +++ b/misc/testing/Tests/test_nntp_server.php @@ -1,7 +1,7 @@ 0) { $seriesAppends = [ - 'networks' => $tmdb->client->getTvApi()->getTvshow($series['results'][0]['id'])['networks'], - 'alternative_titles' => $tmdb->client->getTvApi()->getAlternativeTitles($series['results'][0]['id']), - 'external_ids' => $tmdb->client->getTvApi()->getExternalIds($series['results'][0]['id']), - ]; + 'networks' => $tmdb->client->getTvApi()->getTvshow($series['results'][0]['id'])['networks'], + 'alternative_titles' => $tmdb->client->getTvApi()->getAlternativeTitles($series['results'][0]['id']), + 'external_ids' => $tmdb->client->getTvApi()->getExternalIds($series['results'][0]['id']), + ]; print_r($seriesAppends); if ($seriesAppends) { $series['results'][0]['networks'] = $seriesAppends['networks']; diff --git a/misc/testing/Tests/test_trakt_API.php b/misc/testing/Tests/test_trakt_API.php index e0844bc0e..4a56cb732 100755 --- a/misc/testing/Tests/test_trakt_API.php +++ b/misc/testing/Tests/test_trakt_API.php @@ -1,6 +1,6 @@ error('Invalid arguments. This script requires a text string (show name) followed by a season and episode number.'.PHP_EOL. - 'You can also optionally supply "YYYY" "MM" "DD" arguments instead of season/episode for an airdate lookup.') - ); + 'You can also optionally supply "YYYY" "MM" "DD" arguments instead of season/episode for an airdate lookup.') + ); } diff --git a/misc/testing/Tests/test_tvmaze_API.php b/misc/testing/Tests/test_tvmaze_API.php index 6a251b480..495c58f07 100755 --- a/misc/testing/Tests/test_tvmaze_API.php +++ b/misc/testing/Tests/test_tvmaze_API.php @@ -1,6 +1,6 @@ getPDO()); // Insert some data - $sql = sprintf(" + $sql = sprintf( + " INSERT INTO `testdata` (`id` ,`field1` ,`field2` ,`field3` ,`field4`) VALUES - ('%s', '%s', '%s', '%s', '%s')", $i, $i, $i, $i, $i + ('%s', '%s', '%s', '%s', '%s')", + $i, + $i, + $i, + $i, + $i ); $newDb->exec($sql); diff --git a/misc/testing/Various/renametopre.php b/misc/testing/Various/renametopre.php index 509affda4..647cc39cb 100644 --- a/misc/testing/Various/renametopre.php +++ b/misc/testing/Various/renametopre.php @@ -1,7 +1,7 @@ log->error( - "\nThis script will attempt to rename releases using regexes first from ReleaseCleaning.php and then from this file.\n" - ."An optional last argument, show, will display the release name changes.\n\n" - ."php $argv[0] full ...: To process all releases not previously renamed.\n" - ."php $argv[0] 2 ...: To process all releases added in the previous 2 hours not previously renamed.\n" - ."php $argv[0] all ...: To process all releases.\n" - ."php $argv[0] full 155 ...: To process all releases in groupid 155 not previously renamed.\n" - ."php $argv[0] all 155 ...: To process all releases in groupid 155.\n" - ."php $argv[0] all '(155, 140)' ...: To process all releases in group_ids 155 and 140.\n" - ."php $argv[0] predb_id ...: To process all releases where not matched to predb.\n" - )); + "\nThis script will attempt to rename releases using regexes first from ReleaseCleaning.php and then from this file.\n" + ."An optional last argument, show, will display the release name changes.\n\n" + ."php $argv[0] full ...: To process all releases not previously renamed.\n" + ."php $argv[0] 2 ...: To process all releases added in the previous 2 hours not previously renamed.\n" + ."php $argv[0] all ...: To process all releases.\n" + ."php $argv[0] full 155 ...: To process all releases in groupid 155 not previously renamed.\n" + ."php $argv[0] all 155 ...: To process all releases in groupid 155.\n" + ."php $argv[0] all '(155, 140)' ...: To process all releases in group_ids 155 and 140.\n" + ."php $argv[0] predb_id ...: To process all releases where not matched to predb.\n" + )); } preName($argv, $argc); @@ -95,9 +95,9 @@ function preName($argv, $argc) } resetSearchnames(); echo $pdo->log->header( - 'SELECT id, name, searchname, fromname, size, groups_id, categories_id FROM releases'.$why.$what. - $where.";\n" - ); + 'SELECT id, name, searchname, fromname, size, groups_id, categories_id FROM releases'.$why.$what. + $where.";\n" + ); $res = $pdo->queryDirect('SELECT id, name, searchname, fromname, size, groups_id, categories_id FROM releases'.$why.$what.$where); $total = $res->rowCount(); if ($total > 0) { @@ -135,10 +135,11 @@ function preName($argv, $argc) $files = $rf->get($row['id']); foreach ($files as $f) { if (preg_match( - '/^(?P