Remove bootstrap.php

This commit is contained in:
DariusIII
2017-11-24 15:39:33 +01:00
parent f46d3518ba
commit df7d3305e7
11 changed files with 179 additions and 194 deletions
+1
View File
@@ -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
-19
View File
@@ -1,19 +0,0 @@
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program (see LICENSE.txt in the base directory. If
* not, see:.
*
* @link <http://www.gnu.org/licenses/>.
* @author niel
* @copyright 2016 nZEDb
*/
require_once __DIR__.'/bootstrap/autoload.php';
+3 -3
View File
@@ -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"));
}
}
+8 -7
View File
@@ -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;');
+1 -1
View File
@@ -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) {
+34 -33
View File
@@ -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();
+6 -6
View File
@@ -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');
+1 -1
View File
@@ -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) {
+20 -20
View File
@@ -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);
}
}
*/
+8 -7
View File
@@ -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();
+97 -97
View File
@@ -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;
}