function BackupDatabase() { $db = new DB(); $c = new ColorCLI(); $DIR = dirname(__FILE__); if (Utility::hasCommand("php5")) { $PHP = "php5"; } else { $PHP = "php"; } //Backup based on database system if ($db->dbSystem() == "mysql") { system("{$PHP} {$DIR}mysqldump_tables.php db dump ../../"); } else { if ($db->dbSystem() == "pgsql") { exit($c->error("Currently not supported on this platform.")); } } }
*/ require_once dirname(__FILE__) . '/../../../www/config.php'; use newznab\db\Settings; $colorCLI = new ColorCLI(); $warning = <<<WARNING This script will (re)set the password hashes for older hashes, before the change of hashing mchanism, with the user's email ..as the new password. It is intended for use ONLY if you have a *lot* of users, as this is not secure (a user's email addresses may be known to other users). If you only have a few users then run setUsersPasswordHash.php for each of them instead. WARNING; $usage = "\nUsage: php {$argv[0]} <IUnderStandTheRisks>"; echo $colorCLI->warning($warning); if ($argc != 2) { exit($colorCLI->error("\nWrong number of parameters{$usage}")); } else { if ($argv[1] !== 1 && $argv[1] != '<IUnderStandTheRisks>' && $argv[1] != 'IUnderStandTheRisks' && $argv[1] != 'true') { exit($colorCLI->error("\nInvalid parameter(s){$usage}")); } } $pdo = new Settings(); $users = $pdo->query("SELECT id, username, email, password FROM users"); $update = $pdo->Prepare('UPDATE users SET password = :password WHERE id = :id'); $Users = new Users(['Settings' => $pdo]); foreach ($users as $user) { if (needUpdate($user)) { $hash = $Users->hashPassword($user['email']); if ($hash !== false) { $update->execute([':password' => $hash, ':id' => $user['id']]); echo $colorCLI->primary('Updating hash for user:'******'username'];
echo $output->primary("Checking for files in the renamed directories."); $status = 0; $dirs = array(['old' => 'misc/testing/DB_scripts', 'newpath' => 'misc/testing/DB'], ['old' => 'misc/testing/Dev_testing/Subject_testing', 'newpath' => 'misc/testing/Dev/Subject'], ['old' => 'misc/testing/Dev_testing', 'newpath' => 'misc/testing/Dev'], ['old' => 'misc/testing/PostProc_testing', 'newpath' => 'misc/testing/PostProc'], ['old' => 'misc/testing/Regex_testing', 'newpath' => 'misc/testing/Regex'], ['old' => 'misc/testing/Release_scripts', 'newpath' => 'misc/testing/Release'], ['old' => 'misc/update_scripts/nix_scripts/tmux/powerline/themes', 'newpath' => 'misc/update/nix/tmux/powerline/themes'], ['old' => 'misc/update_scripts/nix_scripts/tmux/powerline', 'newpath' => 'misc/update/nix/tmux/powerline'], ['old' => 'misc/update_scripts/nix_scripts/screen/sequential', 'newpath' => 'misc/update/nix/screen/sequential'], ['old' => 'misc/update_scripts/nix_scripts/tmux/', 'newpath' => 'misc/update/nix/tmux'], ['old' => 'misc/update_scripts/nix_scripts', 'newpath' => 'misc/update/nix'], ['old' => 'misc/update_scripts/python_scripts/lib', 'newpath' => 'misc/update/python/lib'], ['old' => 'misc/update_scripts/python_scripts', 'newpath' => 'misc/update/python'], ['old' => 'misc/update_scripts/win_scripts', 'newpath' => 'misc/update/win'], ['old' => 'misc/update_scripts', 'newpath' => 'misc/update']); $tatus = 0; foreach ($dirs as $dir) { if (isset($dir['old'])) { $pathOld = nZEDb_ROOT . $dir['old']; if (file_exists($pathOld)) { $pathNew = nZEDb_ROOT . $dir['newpath']; echo $output->info("Moving contents of '{$pathOld}' to '{$pathNew}'"); $dirIt = new \DirectoryIterator($pathOld); foreach ($dirIt as $item) { if ($item->isDot()) { continue; } echo $output->info(" Moving {$item->getPathname()}"); if (rename($item->getPathname(), $pathNew . DIRECTORY_SEPARATOR . $item->getFilename()) === false) { echo $output->error(" FAILED!"); $status = 1; } } $d = dir($pathOld); if ($d->read() === false) { @unlink($pathOld); } else { echo $output->error("Could not move all files. Check your permissions!"); } } } } exit((int) $status);
use nzedb\db\Settings; $pdo = new Settings(); $DIR = nZEDb_MISC; $smarty = new Smarty(); $dbname = DB_NAME; $cli = new ColorCLI(); if (isset($argv[1]) && ($argv[1] == "true" || $argv[1] == "safe")) { $restart = (new Tmux())->isRunning(); system("cd {$DIR} && git pull"); if (\nzedb\utility\Utility::hasCommand("php5")) { $PHP = "php5"; } else { $PHP = "php"; } echo $cli->header("Patching database - {$dbname}."); $safe = $argv[1] === "safe" ? true : false; system("{$PHP} " . nZEDb_ROOT . 'cli' . DS . "update_db.php true {$safe}"); // Remove folders from smarty. $cleared = $smarty->clearCompiledTemplate(); if ($cleared) { echo $cli->header("The smarty template cache has been cleaned for you"); } else { echo $cli->header("You should clear your smarty template cache at: " . SMARTY_DIR . "templates_c"); } if ($restart) { echo $cli->header("Starting tmux scripts."); $pdo->queryExec("UPDATE tmux SET value = '1' WHERE setting = 'RUNNING'"); } } else { exit($cli->error("\nThis script will automatically do a git pull, patch the DB and delete the smarty folder contents.\n\n" . "php {$argv['0']} true ...: To run.\n" . "php {$argv['0']} safe ...: Tto run a backup of your database and then update.\n")); }
<?php // To troubleshoot what's actually on usenet. require_once dirname(__FILE__) . '/../../../www/config.php'; $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")); } $nntp = new NNTP(); if ($nntp->doConnect() !== true) { exit; } $first = $argv[2]; $group = $argv[1]; // Select a group. $groupArr = $nntp->selectGroup($group); print_r($groupArr); // Insert actual local part numbers here. $msg = $nntp->getXOVER($first . '-' . $first); // Print out the array of headers. print_r($msg); // get postdate for an article $binaries = new Binaries(['NNTP' => $nntp]); $newdate = $binaries->postdate($first, $groupArr); echo $cli->primary("The posted date for " . $group . ", article " . $first . " is " . date('Y-m-d H:i:s', $newdate));
preg_match_all('/<epno>(.+)<\\/epno>/i', $episodes[0], $epnos); $AniDBAPIArray['epnos'] = isset($epnos[1]) ? implode($epnos[1], '|') : ''; preg_match_all('/<airdate>(.+)<\\/airdate>/i', $episodes[0], $airdates); $AniDBAPIArray['airdates'] = isset($airdates[1]) ? implode($airdates[1], '|') : ''; preg_match_all('/<title xml:lang="en">(.+)<\\/title>/i', $episodes[0], $episodetitles); $AniDBAPIArray['episodetitles'] = isset($episodetitles[1]) ? implode($episodetitles[1], '|') : ''; $sleeptime = 10 + rand(2, 10); if ($this->echooutput) { $this->c->doEcho($this->c->primary("[" . date('d-m-Y G:i') . "] Start waitloop for " . $sleeptime . " seconds to comply with flooding rule.")); } sleep($sleeptime); return $AniDBAPIArray; } } } // end class AniDBstandAlone $c = new ColorCLI(); if (isset($argv[1]) && is_numeric($argv[1])) { // create a new AniDB object $anidb = new AniDBstandAlone(true); // next get the title list and populate the DB, update animetitles once a week $anidb->animetitlesUpdate(); // sleep between 1 and 3 minutes before it starts, this way if from a cron process the start times are random if (isset($argv[2]) && $argv[2] == 'cron') { sleep(rand(60, 180)); } // then get the titles, this is where we will make the real changes $anidb->getAniDBInfo((int) $argv[1] + rand(1, 12)); } else { echo $c->error("This script is designed to gather all show data from anidb and add it to the anidb table for nZEDb, as part of this process we need the number of API queries that can be executed max.\nTo execute this script run:\nphp populate_anidb.php 30\n"); }
<?php // This script updates all releases with the guid from the nzb file. require_once dirname(__FILE__) . '/../../../www/config.php'; use nzedb\db\Settings; $cli = new ColorCLI(); if (isset($argv[1])) { $del = false; if (isset($argv[2])) { $del = $argv[2]; } create_guids($argv[1], $del); } else { exit($cli->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")); } function create_guids($live, $delete = false) { $pdo = new Settings(); $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); $timestart = TIME(); $relcount = $deleted = $total = 0; $relrecs = false; if ($live == "true") { $relrecs = $pdo->queryDirect(sprintf("SELECT id, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY id DESC")); } else { if ($live == "limited") { $relrecs = $pdo->queryDirect(sprintf("SELECT id, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY id DESC LIMIT 10000")); } } if ($relrecs) { $total = $relrecs->rowCount();
case 'update version info': case 'run hooks': $hook = '/usr/bin/php ' . NN_LIB . 'build/git-hooks/runHooks.php'; if ($hook != $file[$index]) { if (VERBOSE) { echo $out->primary('Replace: "' . $file[$index] . '" with "' . $hook . '"'); } $file[$index] = $hook; $changed = true; } else { echo $out->primary("Skipped: " . $file[$index]); } break; default: $index--; echo $out->error('Invalid hook placeholder!!'); break; } } else { if (preg_match('#^PROJECT=(?P<path>.*)$#', $file[$index], $match)) { if ($match['path'] != NN_ROOT) { $file[$index] = 'PROJECT=' . NN_ROOT; $changed = true; } } else { if (VERBOSE) { echo $out->primary("Skipped: " . $file[$index]); } } } $index++;
<?php require_once dirname(__FILE__) . '/../../../www/config.php'; if (!isset($argv[1])) { exit; } $group = $argv[1]; //$cleaner = new CollectionsCleaning(); $nntp = new NNTP(); $cli = new ColorCLI(); if ($nntp->doConnect() !== true) { exit($cli->error("Unable to connect to usenet.")); } $number = 1000000; //exec("tmux kill-session -t NNTPProxy"); $groupArr = $nntp->selectGroup($group); if ($nntp->isError($groupArr) || !isset($groupArr['first']) || !isset($groupArr['last'])) { exit; } print_r($groupArr); if (isset($argv[2]) && is_numeric($argv[2])) { $first = $argv[2]; } else { if ($groupArr['last'] - $number > $groupArr['first']) { $first = $groupArr['last'] - $number; } else { $first = $groupArr['first']; } } $last = $groupArr['last']; @unlink(nZEDb_RES . 'logs' . DS . 'not_yenc' . DS . $group . '.txt');
<?php require_once dirname(__FILE__) . '/../../../www/config.php'; use nzedb\db\Settings; exit('Needs to be rewritten'); $cli = new ColorCLI(); if (!isset($argv[1])) { exit($cli->error("\nThis script will set bitwise = 0 or all rename bits to unchecked or just specific bits.\n\n" . "php {$argv['0']} true ...: To reset bitwise on all releases to 0.\n" . "php {$argv['0']} rename ...: To reset bitwise on all releases for just rename bits (4, 8, 16, 32, 64, 128).\n" . "php {$argv['0']} 512 ...: To reset a specific bit.\n")); } $pdo = new Settings(); $res = false; if ($argv[1] === 'true') { $res = $pdo->queryExec('UPDATE releases SET bitwise = 0, iscategorized = 0, isrenamed = 0, nzbstatus = 0, ishashed = 0, isrequestid = 0'); } else { if ($argv[1] === 'rename') { $res = $pdo->queryExec('UPDATE releases SET isrenamed = 0, bitwise = ((bitwise & ~248)|0)'); } else { if (is_numeric($argv[1])) { $res = $pdo->queryExec('UPDATE releases SET bitwise = ((bitwise & ~' . $argv[1] . ')|0)'); } } } if ($res !== false && is_numeric($argv[1])) { echo $cli->header('Succesfully reset the bitwise of ' . number_format($res->rowCount()) . ' releases to 0 for bit(s) ' . $argv[1] . '.'); } else { if ($res !== false) { echo $cli->header('Succesfully reset the bitwise of ' . number_format($res->rowCount()) . ' releases to un-renamed.'); } else { echo $cli->header('No releases to be reset.'); } }
<?php require_once dirname(__FILE__) . "/../../../bin/config.php"; use newznab\db\Settings; $pdo = new Settings(); $covers = $updated = $deleted = 0; $c = new ColorCLI(); if ($argc == 1 || $argv[1] != 'true') { exit($c->error("\nThis script will check all images in covers/games and compare to db->gamesinfo.\nTo run:\nphp {$argv['0']} true\n")); } $path2covers = NN_COVERS . 'games' . DS; $dirItr = new RecursiveDirectoryIterator($path2covers); $itr = new RecursiveIteratorIterator($dirItr, RecursiveIteratorIterator::LEAVES_ONLY); foreach ($itr as $filePath) { if (is_file($filePath) && preg_match('/\\d+\\.jpg/', $filePath)) { preg_match('/(\\d+)\\.jpg/', basename($filePath), $match); if (isset($match[1])) { $run = $pdo->queryDirect("UPDATE gamesinfo SET cover = 1 WHERE cover = 0 AND id = " . $match[1]); if ($run !== false) { if ($run->rowCount() >= 1) { $covers++; } else { $run = $pdo->queryDirect("SELECT id FROM gamesinfo WHERE id = " . $match[1]); if ($run !== false && $run->rowCount() == 0) { echo $c->info($filePath . " not found in db."); } } } } } }
<?php require_once dirname(__FILE__) . '/../../../www/config.php'; use nzedb\db\Settings; $cli = new ColorCLI(); $rtkey = (new Settings())->getSetting('rottentomatokey'); if (isset($rtkey)) { $rt = new RottenTomato($rtkey); print_r(json_decode($rt->searchMovie("inception"))); $url = RottenTomato::API_URL . "movies.json?apikey=" . $rt->getApiKey() . "&q=inception&page_limit=50"; exit($cli->header("\nIf nothing was displayed above then there might be an error. If so, go to the following url: " . $url . "\n")); } else { exit($cli->error("\nNo rotten tomato key.\n")); }
/** * @note Disable group that does not exist on USP server * @param $id * * @return string */ public function disableIfNotExist($id) { $this->pdo->queryExec(sprintf("UPDATE groups SET active = 0 WHERE id = %d", $id)); $this->colorCLI->doEcho($this->colorCLI->error('Group does not exist on server, disabling')); }
<?php require_once dirname(__FILE__) . '/../../www/config.php'; $cli = new ColorCLI(); if (!isset($argv[1]) && ($argv[1] !== 'full' || !is_numeric($argv[1]))) { exit($cli->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\t...: to run on full database and show renames." . PHP_EOL . "php match_prefiles.php 2000 show\t...: to run against 2000 distinct releases and show renames." . PHP_EOL)); } $nameFixer = new NameFixer(); $nameFixer->getPreFileNames($argv);
<?php require_once dirname(__FILE__) . "/../../bin/config.php"; use newznab\db\Settings; $c = new ColorCLI(); if (!(isset($argv[1]) && ($argv[1] == "all" || $argv[1] == "misc" || preg_match('/\\([\\d, ]+\\)/', $argv[1]) || is_numeric($argv[1])))) { exit($c->error("\nThis script will attempt to re-categorize releases and is useful if changes have been made to Category.php.\n" . "No updates will be done unless the category changes\n" . "An optional last argument, test, will display the number of category changes that would be made\n" . "but will not update the database.\n\n" . "php {$argv['0']} all ...: To process all releases.\n" . "php {$argv['0']} misc ...: To process all releases in misc categories.\n" . "php {$argv['0']} 155 ...: To process all releases in groupid 155.\n" . "php {$argv['0']} '(155, 140)' ...: To process all releases in group_ids 155 and 140.\n")); } reCategorize($argv); function reCategorize($argv) { $c = new ColorCLI(); $where = ''; $update = true; if (isset($argv[1]) && is_numeric($argv[1])) { $where = ' AND groupid = ' . $argv[1]; } else { if (isset($argv[1]) && preg_match('/\\([\\d, ]+\\)/', $argv[1])) { $where = ' AND groupid IN ' . $argv[1]; } else { if (isset($argv[1]) && $argv[1] === 'misc') { $where = ' AND categoryid IN (1090, 2020, 3050, 4040, 5050, 6050, 7050, 8010)'; } } } if (isset($argv[2]) && $argv[2] === 'test') { $update = false; } if (isset($argv[1]) && (is_numeric($argv[1]) || preg_match('/\\([\\d, ]+\\)/', $argv[1]))) { echo $c->header("Categorizing all releases in {$argv[1]} using searchname. This can take a while, be patient."); } else {
<?php require_once dirname(__FILE__) . '/config.php'; use newznab\processing\PProcess; $c = new ColorCLI(); if (!isset($argv[1])) { exit($c->error("This script is not intended to be run manually, it is called from postprocess_threaded.py.")); } $tmux = new Tmux(); $torun = $tmux->get()->post; $pieces = explode(' =+= ', $argv[1]); $postprocess = new PProcess(['Echo' => true]); if (isset($pieces[6])) { // Create the connection here and pass $nntp = new NNTP(); if ($nntp->doConnect() === false) { exit($c->error("Unable to connect to usenet.")); } $postprocess->processAdditional($nntp, $argv[1]); $nntp->doQuit(); } else { if (isset($pieces[3])) { // Create the connection here and pass $nntp = new NNTP(); if ($nntp->doConnect() === false) { exit($c->error("Unable to connect to usenet.")); } $postprocess->processNfos($argv[1], $nntp); $nntp->doQuit(); } else { if (isset($pieces[2])) {
<?php require_once dirname(__FILE__) . "/config.php"; use newznab\db\Settings; use newznab\processing\PProcess; $c = new ColorCLI(); if (!isset($argv[1])) { exit($c->error("This script is not intended to be run manually, it is called from fixreleasenames_threaded.py.")); } else { if (isset($argv[1])) { $db = new Settings(); $namefixer = new \NameFixer(['Settings' => $pdo]); $pieces = explode(' ', $argv[1]); if (isset($pieces[1]) && $pieces[0] == 'nfo') { $release = $pieces[1]; if ($res = $db->queryOneRow(sprintf('SELECT rel.guid AS guid, nfo.releaseid AS nfoid, rel.groupid, rel.categoryid, rel.name, rel.searchname, uncompress(nfo) AS textstring, rel.id AS releaseid FROM releases rel INNER JOIN releasenfo nfo ON (nfo.releaseid = rel.id) WHERE rel.id = %d', $release))) { //ignore encrypted nfos if (preg_match('/^=newz\\[NZB\\]=\\w+/', $res['textstring'])) { $namefixer->done = $namefixer->matched = false; $db->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE id = %d', $res['releaseid'])); $namefixer->checked++; echo '.'; } else { //echo $res['textstring']."\n"; $namefixer->done = $namefixer->matched = false; if ($namefixer->checkName($res, true, 'NFO, ', 1, 1) !== true) { echo '.'; } $namefixer->checked++; } }
<?php require_once dirname(__FILE__) . '/config.php'; $cli = new ColorCLI(); if (!isset($argv[1]) || $argv[1] != "all" && $argv[1] != "full" && $argv[1] != "web" && !is_numeric($argv[1]) || !isset($argv[2]) || !in_array($argv[2], ['true', 'false'])) { exit($cli->error(PHP_EOL . "This script tries to match a release request ID by group to a PreDB request ID by group doing local lookup only." . PHP_EOL . "In addition an optional final argument is time, in minutes, to check releases that have previously been checked." . PHP_EOL . PHP_EOL . "Argument 1: full|all|number|web => (mandatory)" . PHP_EOL . "all does only requestid releases, full does full database, number limits to x amount of releases, web does web requestID's" . PHP_EOL . "Argument 2: true|false => (mandatory) Display full info on how the release was renamed or not." . PHP_EOL . "Argument 3: number => (optional) This is to limit how old the releases to work on (in hours)." . PHP_EOL . "php requestid.php 1000 true => to limit to 1000 sorted by newest postdate and show renaming." . PHP_EOL . PHP_EOL . "php requestid.php full true => to run on full database and show renaming." . PHP_EOL . "php requestid.php all true => to run on all requestid releases (including previously renamed) and show renaming." . PHP_EOL)); } if ($argv[1] === 'web') { (new RequestIDWeb())->lookupRequestIDs(['limit' => $argv[1], 'show' => $argv[2], 'time' => isset($argv[3]) && is_numeric($argv[3]) && $argv[3] > 0 ? $argv[3] : 0]); } else { (new RequestIDLocal())->lookupRequestIDs(['limit' => $argv[1], 'show' => $argv[2], 'time' => isset($argv[3]) && is_numeric($argv[3]) && $argv[3] > 0 ? $argv[3] : 0]); }
if ($logs == 1) { return "2>&1 | tee -a {$path}/{$pane}-{$getdate}.log"; } else { return ""; } } function command_exist($cmd) { $returnVal = exec("which {$cmd} 2>/dev/null"); return empty($returnVal) ? false : true; } //check for apps $apps = array("time", "tmux", "nice", "python", "tee"); foreach ($apps as &$value) { if (!command_exist($value)) { exit($c->error("Tmux scripts require " . $value . " but it's not installed. Aborting.\n")); } } function python_module_exist($module) { $output = $returnCode = ''; exec("python -c \"import {$module}\"", $output, $returnCode); return $returnCode == 0 ? true : false; } $nntpproxy = $pdo->getSetting('nntpproxy'); if ($nntpproxy == '1') { $modules = array("nntp", "socketpool"); foreach ($modules as &$value) { if (!python_module_exist($value)) { exit($pdo->log->error("\nNNTP Proxy requires " . $value . " python module but it's not installed. Aborting.\n")); }
$sql = "ALTER TABLE {$tbl} ENGINE=TokuDB Compression=tokudb_lzma"; $pdo->queryExec($sql); $pdo->queryExec("OPTIMIZE TABLE {$tbl}"); } } } else { if (isset($argv[1]) && $argv[1] == "tokudb") { $tables = $pdo->query('SHOW table status WHERE Engine != "TokuDB" OR ROW_FORMAT="tokudb_lzma" OR Create_options != "`COMPRESSION`=tokudb_lzma"'); foreach ($tables as $row) { $tbl = $row['name']; if ($tbl !== 'releasesearch') { printf($cli->header("Converting {$tbl}")); $sql = "ALTER TABLE {$tbl} ENGINE=TokuDB row_format=tokudb_lzma"; $pdo->queryExec($sql); $pdo->queryExec("OPTIMIZE TABLE {$tbl}"); } } } else { exit($cli->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 releasesearch / predbhash 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 releasesearch / predbhash 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 releasesearch / predbhash 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 releasesearch 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 releasesearch 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 releasesearch / predbhash will not be converted as fulltext indexes are not supported.\n")); } } } } } } } } } } } }
<?php /* This script deletes releases that match certain criteria, type php removeCrapReleases.php false for details. */ require_once dirname(__FILE__) . '/../../../www/config.php'; $cli = new ColorCLI(); $n = PHP_EOL; $argCnt = count($argv); if ($argCnt === 1) { exit($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 | executable | gibberish | hashed | installbin | passworded | passwordurl | sample | scr | short | size | wmv' . $n . ' blacklist = Remove releases using the enabled blacklists in admin section of site.' . $n . ' blfiles = Remove releases using the enabled blacklists in admin section of site against filenames.' . $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 . ' 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 . ' codec = Remove releases where the release contains WMV file, x264 name, and Codec\\Setup.exe file (Spammer).' . $n . ' size = Remove releases smaller than 2MB and have only 1 file and not in books or mp3 section.' . $n . ' huge = Remove releases bigger than 200MB with just a single file.' . $n . $n . 'arg4 (Optional) = blacklist regular expression id number. Only works when blacklist is selected as third argument.' . $n . ' 100001 = Remove releases where the Binary Blacklist ID is 100001.' . $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")); } } if ($argCnt < 3) { exit($cli->error("Wrong usage! Type php {$argv['0']} false")); } if (isset($argv[3]) && $argv[3] === 'blacklist' && isset($argv[4])) { $blacklistID = $argv[4]; } $RR = new ReleaseRemover(); $RR->removeCrap($argv[1] === 'true' ? true : false, $argv[2], isset($argv[3]) ? $argv[3] : '', isset($blacklistID) ? $argv[4] : '');
// Test if your giantbomb key is working. $giantbombkey = (new \nzedb\db\Settings())->getSetting('giantbombkey'); $cli = new ColorCLI(); $obj = new GiantBomb($giantbombkey, $resp = "json"); $searchgame = "South Park The Stick of Truth"; $resultsfound = 0; $e = null; try { $fields = array("deck", "description", "original_game_rating", "api_detail_url", "image", "genres", "name", "platforms", "publishers", "original_release_date", "reviews", "site_detail_url"); $result = $obj->search($searchgame, $fields, 1); $result = json_decode(json_encode($result), true); if ($result['number_of_total_results'] != 0) { $resultsfound = count($result['results']); for ($i = 0; $i <= $resultsfound; $i++) { similar_text($result['results'][$i]['name'], $searchgame, $p); if ($p > 90) { $result = $result['results'][$i]; break; } } } } catch (Exception $e) { $result = false; } if ($result !== false && !empty($result)) { print_r($result); exit($cli->header("\nLooks like it is working alright.")); } else { print_r($e); exit($cli->error("\nThere was a problem attempting to query giantbomb. Maybe your key is wrong, or you are being throttled.\n")); }