From 06c5cb95df505223ed07049d30305b86d1b020cd Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 4 Apr 2017 15:03:47 +0200 Subject: [PATCH] Change path handling in scripts --- Changelog | 1 + misc/IRCScraper/scrape.php | 2 +- misc/sphinxsearch/create_se_tables.php | 2 +- misc/sphinxsearch/optimize.php | 2 +- misc/sphinxsearch/populate_rt_indexes.php | 2 +- misc/sphinxsearch/toggle_search_type.php | 2 +- misc/testing/DB/change_USP_provider.php | 2 +- misc/testing/DB/check_unique_indexes.php | 2 +- misc/testing/DB/convert_mysql_tables.php | 2 +- misc/testing/DB/convert_to_tpg.php | 2 +- misc/testing/DB/convert_to_tpg_alt.php | 2 +- misc/testing/DB/mysqldump_tables.php | 2 +- misc/testing/DB/populateTraktID.php | 2 +- misc/testing/DB/populate_nzb_guid.php | 2 +- misc/testing/DB/rename_to_lower.php | 2 +- misc/testing/DB/reset_postprocessing.php | 2 +- misc/testing/DB/reset_truncate.php | 2 +- misc/testing/DB/resetdb.php | 2 +- misc/testing/DB/setUserPasswordHash.php | 2 +- .../DB/setUserPasswordHashesToEmail.php | 2 +- misc/testing/DB/show_table_sizes.php | 2 +- misc/testing/Dev/clean_nzbs.php | 2 +- misc/testing/NZB/nzb-reorg.php | 2 +- misc/testing/PostProc/check_covers.php | 2 +- misc/testing/PostProc/check_previews.php | 2 +- misc/testing/PostProc/getConsole.php | 2 +- misc/testing/PostProc/getImdb.php | 2 +- misc/testing/PostProc/getMovieCovers.php | 2 +- misc/testing/PostProc/getXXXCovers.php | 2 +- misc/testing/PostProc/getXXXSamples.php | 2 +- misc/testing/PostProc/updateBookImages.php | 2 +- misc/testing/PostProc/updateConsoleImages.php | 2 +- misc/testing/PostProc/updateGamesImages.php | 2 +- misc/testing/PostProc/updateMovieImages.php | 2 +- misc/testing/PostProc/updateMusicImages.php | 2 +- misc/testing/PostProc/updateXXXImages.php | 2 +- misc/testing/PreDB/dump_predb.php | 2 +- misc/testing/Releases/delete_releases.php | 2 +- misc/testing/Releases/fixReleaseNames.php | 2 +- misc/testing/Releases/recategorize.php | 2 +- misc/testing/Releases/removeCrapReleases.php | 2 +- misc/testing/Tests/regexverify.php | 2 +- misc/testing/Tests/test_amazon_API.php | 2 +- misc/testing/Tests/test_cache_server.php | 2 +- misc/testing/Tests/test_giantbomb_API.php | 2 +- misc/testing/Tests/test_nntp_server.php | 2 +- misc/testing/Tests/test_regex.php | 2 +- misc/testing/Tests/test_rottentomato_API.php | 18 -------------- misc/testing/Tests/test_tmdb_API.php | 2 +- misc/testing/Tests/test_trakt_API.php | 2 +- misc/testing/Tests/test_tvdb_API.php | 2 +- misc/testing/Tests/test_tvmaze_API.php | 2 +- misc/testing/Tests/timetest.php | 2 +- misc/testing/Tests/transactiontest.php | 2 ++ misc/testing/Various/renametopre.php | 2 +- .../tpg_delete_triggers_2015-08-14.php | 2 +- misc/testing/_run_once/tpg_fixes.php | 2 +- .../tpg_update_triggers_2014-09-25.php | 2 +- misc/testing/dumpnfo.php | 2 +- misc/testing/fix_filesize.php | 2 +- misc/testing/nzb-export.php | 2 +- misc/testing/nzb-import.php | 2 +- misc/testing/refreshMovie.php | 2 +- misc/testing/rottentom.php | 24 ------------------- misc/testing/spotnab.php | 2 +- misc/testing/tidynzbfolder.php | 2 +- misc/testing/updateCategories.php | 2 +- misc/update/backfill.php | 2 +- misc/update/decrypt_hashes.php | 2 +- misc/update/match_prefiles.php | 2 +- .../multiprocessing/.do_not_run/require.php | 2 +- .../multiprocessing/.do_not_run/switch.php | 2 +- misc/update/nix/multiprocessing/backfill.php | 2 +- misc/update/nix/multiprocessing/binaries.php | 4 ++-- .../nix/multiprocessing/fixrelnames.php | 2 +- misc/update/nix/multiprocessing/import.php | 2 +- .../nix/multiprocessing/postprocess.php | 4 ++-- misc/update/nix/multiprocessing/releases.php | 4 ++-- misc/update/nix/multiprocessing/requestid.php | 4 ++-- misc/update/nix/multiprocessing/safe.php | 2 +- .../nix/multiprocessing/update_per_group.php | 4 ++-- misc/update/nix/tmux/bin/fixreleasenames.php | 2 +- misc/update/nix/tmux/bin/groupfixrelnames.php | 2 +- misc/update/nix/tmux/bin/postprocess_pre.php | 2 +- .../nix/tmux/bin/postprocess_threaded.php | 2 +- misc/update/nix/tmux/bin/showsleep.php | 2 +- misc/update/nix/tmux/bin/update_groups.php | 2 +- misc/update/nix/tmux/monitor.php | 2 +- misc/update/nix/tmux/run.php | 2 +- misc/update/nix/tmux/start.php | 2 +- misc/update/nix/tmux/stop.php | 2 +- misc/update/postprocess.php | 2 +- misc/update/requestid.php | 2 +- misc/update/update_binaries.php | 2 +- 94 files changed, 98 insertions(+), 137 deletions(-) delete mode 100755 misc/testing/Tests/test_rottentomato_API.php delete mode 100644 misc/testing/rottentom.php diff --git a/Changelog b/Changelog index d94f1d9f1..a7199cbaf 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-04-04 DariusIII + * Chg: Change path handling in scripts * Chg: Use ColorCLI directly * Chg: Add material design icons 2017-04-03 DariusIII diff --git a/misc/IRCScraper/scrape.php b/misc/IRCScraper/scrape.php index b758ade68..a2ce4101e 100644 --- a/misc/IRCScraper/scrape.php +++ b/misc/IRCScraper/scrape.php @@ -1,5 +1,5 @@ . */ -require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'bootstrap.php'); +require_once dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'bootstrap.php'; use nntmux\db\DB; use nntmux\ColorCLI; diff --git a/misc/testing/DB/show_table_sizes.php b/misc/testing/DB/show_table_sizes.php index d1a79840e..49952ff78 100644 --- a/misc/testing/DB/show_table_sizes.php +++ b/misc/testing/DB/show_table_sizes.php @@ -1,5 +1,5 @@ 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")); -} diff --git a/misc/testing/Tests/test_tmdb_API.php b/misc/testing/Tests/test_tmdb_API.php index 23d308542..ff6decec9 100755 --- a/misc/testing/Tests/test_tmdb_API.php +++ b/misc/testing/Tests/test_tmdb_API.php @@ -1,6 +1,6 @@ */ -require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'bootstrap.php'); +require_once dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'bootstrap.php'; use app\models\Settings; use nntmux\db\DB; diff --git a/misc/testing/nzb-export.php b/misc/testing/nzb-export.php index cda7cb514..9342c7f06 100644 --- a/misc/testing/nzb-export.php +++ b/misc/testing/nzb-export.php @@ -1,5 +1,5 @@ getSetting('rottentomatokey'); -$rt = new RottenTomato($rtkey); - -if (isset($rtkey) && $rtkey !='') -{ - $rt = new RottenTomato($rtkey); - - //print_r($rt->getMoviesBoxOffice()); - //print_r($rt->getMoviesInTheaters()); - //print_r($rt->getOpeningMovies()); - //print_r($rt->getUpcomingMovies()); - //print_r($rt->getNewDvdReleasess()); - //print_r($rt->getMovieInfo("770805418")); - //print_r($rt->getMovieReviews("770805418")); - //print_r($rt->getMovieCast("770805418")); - print_r($rt->movieSearch("moviename")); -} diff --git a/misc/testing/spotnab.php b/misc/testing/spotnab.php index 7231a4c14..13968f21f 100644 --- a/misc/testing/spotnab.php +++ b/misc/testing/spotnab.php @@ -172,7 +172,7 @@ SHARING recognize or want to test out the source. */ -require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'bootstrap.php'); +require_once dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'bootstrap.php'; use nntmux\SpotNab; diff --git a/misc/testing/tidynzbfolder.php b/misc/testing/tidynzbfolder.php index d5b853522..f2c26cb0e 100644 --- a/misc/testing/tidynzbfolder.php +++ b/misc/testing/tidynzbfolder.php @@ -1,5 +1,5 @@ processWorkType( diff --git a/misc/update/nix/multiprocessing/binaries.php b/misc/update/nix/multiprocessing/binaries.php index 563bdcdd4..5f42dbc1d 100644 --- a/misc/update/nix/multiprocessing/binaries.php +++ b/misc/update/nix/multiprocessing/binaries.php @@ -5,6 +5,6 @@ if (!isset($argv[1]) || !is_numeric($argv[1])) { ); } declare(ticks=1); -require('.do_not_run/require.php'); +require __DIR__ . '.do_not_run/require.php'; use nntmux\libraries\Forking; -(new Forking())->processWorkType('binaries', array(0 => $argv[1])); \ No newline at end of file +(new Forking())->processWorkType('binaries', array(0 => $argv[1])); diff --git a/misc/update/nix/multiprocessing/fixrelnames.php b/misc/update/nix/multiprocessing/fixrelnames.php index d77799b4b..a0ab33a95 100644 --- a/misc/update/nix/multiprocessing/fixrelnames.php +++ b/misc/update/nix/multiprocessing/fixrelnames.php @@ -7,7 +7,7 @@ if (!isset($argv[1]) || !in_array($argv[1], ['standard', 'predbft'])) { ); } -require('.do_not_run/require.php'); +require __DIR__ . '.do_not_run/require.php'; use nntmux\libraries\Forking; diff --git a/misc/update/nix/multiprocessing/import.php b/misc/update/nix/multiprocessing/import.php index 814ee9dd6..4a80b8df4 100644 --- a/misc/update/nix/multiprocessing/import.php +++ b/misc/update/nix/multiprocessing/import.php @@ -1,6 +1,6 @@ processWorkType('postProcess_' . $argv[1], (isset($argv[2]) && $argv[2] === 'true' ? [0 => true] : [])); \ No newline at end of file +(new Forking())->processWorkType('postProcess_' . $argv[1], (isset($argv[2]) && $argv[2] === 'true' ? [0 => true] : [])); diff --git a/misc/update/nix/multiprocessing/releases.php b/misc/update/nix/multiprocessing/releases.php index fbd68c7f1..227a77c7d 100644 --- a/misc/update/nix/multiprocessing/releases.php +++ b/misc/update/nix/multiprocessing/releases.php @@ -1,7 +1,7 @@ processWorkType('releases'); \ No newline at end of file +(new Forking())->processWorkType('releases'); diff --git a/misc/update/nix/multiprocessing/requestid.php b/misc/update/nix/multiprocessing/requestid.php index a70c72787..c0a09dfdc 100644 --- a/misc/update/nix/multiprocessing/requestid.php +++ b/misc/update/nix/multiprocessing/requestid.php @@ -1,7 +1,7 @@ processWorkType('request_id'); \ No newline at end of file +(new Forking())->processWorkType('request_id'); diff --git a/misc/update/nix/multiprocessing/safe.php b/misc/update/nix/multiprocessing/safe.php index f8d3783e4..2938a0949 100644 --- a/misc/update/nix/multiprocessing/safe.php +++ b/misc/update/nix/multiprocessing/safe.php @@ -8,7 +8,7 @@ if (!isset($argv[1]) || !in_array($argv[1], ['backfill', 'binaries'])) { } declare(ticks=1); -require('.do_not_run/require.php'); +require __DIR__ . '.do_not_run/require.php'; use \nntmux\libraries\Forking; diff --git a/misc/update/nix/multiprocessing/update_per_group.php b/misc/update/nix/multiprocessing/update_per_group.php index 46f431434..d01e216c8 100644 --- a/misc/update/nix/multiprocessing/update_per_group.php +++ b/misc/update/nix/multiprocessing/update_per_group.php @@ -1,8 +1,8 @@ processWorkType('update_per_group'); \ No newline at end of file +(new Forking())->processWorkType('update_per_group'); diff --git a/misc/update/nix/tmux/bin/fixreleasenames.php b/misc/update/nix/tmux/bin/fixreleasenames.php index 26873f8fa..e83c51987 100644 --- a/misc/update/nix/tmux/bin/fixreleasenames.php +++ b/misc/update/nix/tmux/bin/fixreleasenames.php @@ -1,5 +1,5 @@