mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update constants
This commit is contained in:
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
|
||||
use nntmux\ReleaseImage;
|
||||
use nntmux\utility\Utility;
|
||||
|
||||
if (! isset($argv[1]) || $argv[1] !== 'yes') {
|
||||
exit(
|
||||
'This will verify path permissions for crucial locations in newznab-tmux for the current user running the script.'.PHP_EOL.
|
||||
'If a wrong permission is encountered, you will be alerted.'.PHP_EOL.
|
||||
'IT IS STRONGLY RECOMMENDED you run this against your apache/nginx user, in addition to your normal CLI user.'.PHP_EOL.
|
||||
'On linux you can run it against the apache/nginx user this way: sudo -u www-data php verify_permissions.php yes'.PHP_EOL.
|
||||
'See this page for a quick guide on setting up your permissions in linux: https://github.com/nZEDb/nZEDb/wiki/Setting-permissions-on-linux'.PHP_EOL.
|
||||
'If you are ready to run this script, pass yes as the first argument.'.PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap.php';
|
||||
|
||||
define('R', 1);
|
||||
define('W', 2);
|
||||
define('E', 4);
|
||||
|
||||
// Check All folders up to NN root folder.
|
||||
$string = DS;
|
||||
foreach (explode(DS, NN_ROOT) as $folder) {
|
||||
if ($folder) {
|
||||
$string .= $folder.DS;
|
||||
readable($string);
|
||||
executable($string);
|
||||
}
|
||||
}
|
||||
|
||||
// List of folders to check with required permissions.
|
||||
$folders = [
|
||||
NN_LIBS => [R],
|
||||
NN_LIBS.'smarty' => [R],
|
||||
NN_LIBS.'smarty'.DS.'templates_c' => [R, W],
|
||||
NN_RES => [R, W, E],
|
||||
NN_RES.'db' => [R, E],
|
||||
NN_RES.'db'.DS.'patches' => [R, E],
|
||||
NN_RES.'nzb' => [R],
|
||||
NN_LOGS => [R, W],
|
||||
NN_TMP => [R, W],
|
||||
NN_TMP.DS.'unrar' => [R, W, E],
|
||||
NN_TMP.DS.'yEnc' => [R, W, E],
|
||||
NN_VERSIONS => [R],
|
||||
];
|
||||
|
||||
// Add nzb folders.
|
||||
foreach ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f'] as $identifier) {
|
||||
$nzbFolder = NN_RES.'nzb'.DS.$identifier.DS;
|
||||
$folders[$nzbFolder] = [R, W];
|
||||
}
|
||||
|
||||
// Add covers paths.
|
||||
foreach (['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx', 'tvshow'] as $identifier) {
|
||||
$nzbFolder = NN_RES.'covers'.DS.$identifier.DS;
|
||||
$folders[$nzbFolder] = [R, W];
|
||||
}
|
||||
|
||||
// Set up covers paths.
|
||||
if (env('DB_PASSWORD') !== '') {
|
||||
$ri = new ReleaseImage();
|
||||
|
||||
$folders[$ri->audSavePath] = [R, W];
|
||||
$folders[$ri->imgSavePath] = [R, W];
|
||||
$folders[$ri->jpgSavePath] = [R, W];
|
||||
$folders[$ri->movieImgSavePath] = [R, W];
|
||||
$folders[$ri->vidSavePath] = [R, W];
|
||||
} else {
|
||||
echo 'Skipping cover folders check, as you have not set up a database yet. You can rerun this script after running install.'.PHP_EOL;
|
||||
}
|
||||
|
||||
// Check folders.
|
||||
foreach ($folders as $folder => $check) {
|
||||
exists($folder);
|
||||
foreach ($check as $type) {
|
||||
switch ($type) {
|
||||
case R:
|
||||
readable($folder);
|
||||
break;
|
||||
case W:
|
||||
writable($folder);
|
||||
break;
|
||||
case E:
|
||||
executable($folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo 'Your permissions seem right for this user. Note, this script does not verify all paths, only the most important ones.'.PHP_EOL;
|
||||
|
||||
if (! Utility::isWin()) {
|
||||
$user = posix_getpwuid(posix_geteuid());
|
||||
if ($user['name'] !== 'www-data') {
|
||||
echo 'If you have not already done so, please rerun this script using the www-data user: sudo -u www-data php verify_permissions.php yes'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
function readable($folder)
|
||||
{
|
||||
if (! is_readable($folder)) {
|
||||
exit('Error: This path is not readable: ('.$folder.') resolve this and rerun the script.'.PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function writable($folder)
|
||||
{
|
||||
if (! is_writable($folder)) {
|
||||
exit('Error: This path is not writable: ('.$folder.') resolve this and rerun the script.'.PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function executable($folder)
|
||||
{
|
||||
if (! is_executable($folder)) {
|
||||
exit('Error: This path is not executable: ('.$folder.') resolve this and rerun the script.'.PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function exists($folder)
|
||||
{
|
||||
if (! file_exists($folder)) {
|
||||
exit('Error: This path ('.$folder.') does not exist or is not readable. Create it or make it readable.'.PHP_EOL);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +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 2014 nZEDb
|
||||
*/
|
||||
require_once realpath(dirname(__DIR__).DIRECTORY_SEPARATOR.'bootstrap.php');
|
||||
|
||||
use nntmux\utility\Utility;
|
||||
use nntmux\utility\Versions;
|
||||
|
||||
if (! Utility::isCLI()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$vers = new Versions();
|
||||
if (isset($argc) && $argc > 1 && isset($argv[1]) && $argv[1] == true) {
|
||||
echo $vers->out->header('Checking versions...');
|
||||
|
||||
if ($vers->checkAll()) {
|
||||
$vers->save();
|
||||
} else {
|
||||
echo "No changes detected.\n";
|
||||
output($vers);
|
||||
}
|
||||
} else {
|
||||
$vers->checkAll(false);
|
||||
echo "Version info in file:\n";
|
||||
output($vers);
|
||||
}
|
||||
|
||||
function output($vers)
|
||||
{
|
||||
echo ' Commit: '.$vers->out->primary($vers->getCommit());
|
||||
echo 'SQL DB: '.$vers->out->primary($vers->getSQLPatchFromDb());
|
||||
echo 'SQL File: '.$vers->out->primary($vers->getSQLPatchFromFiles());
|
||||
echo ' Tag: '.$vers->out->primary($vers->getTagVersion());
|
||||
}
|
||||
Generated
+4
-4
@@ -139,7 +139,7 @@
|
||||
}
|
||||
],
|
||||
"description": "PHP Wrapper for Accessing the Steam Storefront API",
|
||||
"time": "2017-08-27T15:14:06+00:00"
|
||||
"time": "2017-08-27 15:14:06"
|
||||
},
|
||||
{
|
||||
"name": "barracudanetworks/forkdaemon-php",
|
||||
@@ -1525,7 +1525,7 @@
|
||||
}
|
||||
],
|
||||
"description": "A PHP library that acts as a wrapper for the GiantBomb API.",
|
||||
"time": "2017-05-29T12:05:57+00:00"
|
||||
"time": "2017-05-29 12:05:57"
|
||||
},
|
||||
{
|
||||
"name": "dnoegel/php-xdg-base-dir",
|
||||
@@ -2685,7 +2685,7 @@
|
||||
}
|
||||
],
|
||||
"description": "TVMaze-API-Wrapper",
|
||||
"time": "2016-05-04T01:31:56+00:00"
|
||||
"time": "2016-05-04 01:31:56"
|
||||
},
|
||||
{
|
||||
"name": "kevinrob/guzzle-cache-middleware",
|
||||
@@ -3292,7 +3292,7 @@
|
||||
"support": {
|
||||
"source": "https://github.com/nZEDb/Git.php/tree/master"
|
||||
},
|
||||
"time": "2016-10-30T19:06:19+00:00"
|
||||
"time": "2016-10-30 19:06:19"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// YOU SHOULD NOT EDIT ANYTHING IN THIS FILE, COPY .../nzedb/config/settings.example.php TO .../nzedb/config/settings.php AND EDIT THAT FILE!
|
||||
// YOU SHOULD NOT EDIT ANYTHING IN THIS FILE, COPY .../ntmux/config/settings.example.php TO .../nntmux/config/settings.php AND EDIT THAT FILE!
|
||||
|
||||
define('NN_MINIMUM_PHP_VERSION', '7.1.0');
|
||||
define('NN_MINIMUM_MYSQL_VERSION', '5.6');
|
||||
|
||||
Reference in New Issue
Block a user