additional mkdir/chmod parameter fixes and cron-lock file adjustments

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-04 10:52:12 +01:00
parent 9ec76c9fd6
commit 9babcde3e5
5 changed files with 15 additions and 7 deletions

View File

@@ -24,6 +24,13 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
private static $debugHandler = null;
private static $noncron_params = [
'force',
'debug',
'no-fork',
'run-task'
];
public static function setArguments($argv = null)
{
self::$argv = $argv;
@@ -47,6 +54,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
echo "--run-task\t\trun a specific task [1 = re-generate configs, 4 = re-generate dns zones, 10 = re-set quotas, 99 = re-create cron.d-file]\n";
echo "--debug\t\t\toutput debug information about what is going on to STDOUT.\n";
echo "--no-fork\t\tdo not fork to backkground (traffic cron only).\n\n";
exit();
}
/**
@@ -161,7 +169,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
$crontype = "";
if (isset(self::$argv) && is_array(self::$argv) && count(self::$argv) > 1) {
for ($x = 1; $x < count(self::$argv); $x ++) {
if (substr(strtolower(self::$argv[$x]), 0, 2) == '--' && strlen(self::$argv[$x]) > 3) {
if (substr(self::$argv[$x], 0, 2) == '--' && strlen(self::$argv[$x]) > 3 && !in_array(substr(strtolower(self::$argv[$x]), 2),self::$noncron_params)) {
$crontype = substr(strtolower(self::$argv[$x]), 2);
$basename .= "-" . $crontype;
break;

View File

@@ -145,13 +145,13 @@ class SImExporter
// Catch image_data and save it
if (isset($index_split[2]) && $index_split[2] === 'image_data' && !empty($_data[$index_split[0].'.'.$index_split[1]])) {
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
if (!is_dir($path) && !mkdir($path, '0775')) {
if (!is_dir($path) && !mkdir($path, 0775)) {
throw new \Exception("img directory does not exist and cannot be created");
}
// Make sure we can write to the upload directory
if (!is_writable($path)) {
if (!chmod($path, '0775')) {
if (!chmod($path, 0775)) {
throw new \Exception("Cannot write to img directory");
}
}

View File

@@ -388,7 +388,7 @@ class Store
if (!chmod($path, 0775)) {
throw new \Exception("Cannot write to img directory");
}
}
}
// Make sure mime-type matches an image
if (!in_array(mime_content_type($_FILES[$fieldname]['tmp_name']), ['image/jpeg','image/jpg','image/png','image/gif'])) {