Skip to content
Snippets Groups Projects
Commit 0a02ee3d authored by Marius Cramer's avatar Marius Cramer
Browse files

Implemented: FS#3346 - Add a [web_root] placeholder to cronjob command

parent 41add69c
No related merge requests found
......@@ -19,4 +19,5 @@ $wb['run_wday_error_format'] = 'Das Format für Wochentage ist nicht korrekt.';
$wb['command_error_format'] = 'Das Format für den Befehl ist nicht korrekt. Beachten Sie, dass bei einem URL Aufruf nur http und https erlaubt ist.';
$wb['unknown_fieldtype_error'] = 'Es wurde ein unbekanntes Feld verwendet.';
$wb['server_id_error_empty'] = 'Die Server-ID ist leer.';
$wb['command_hint_txt'] = 'z. B. /var/www/clients/clientX/webY/myscript.sh oder http://www.mydomain.com/path/script.php. Der Platzhalter [web_root] wird durch /var/www/clients/clientX/webY/web ersetzt.';
?>
......@@ -19,4 +19,5 @@ $wb['run_wday_error_format'] = 'Invalid format for days of the week.';
$wb['command_error_format'] = 'Invalid command format. Please note that in case of an url call only http/https is allowed.';
$wb['unknown_fieldtype_error'] = 'An unknown field type has been used.';
$wb['server_id_error_empty'] = 'The server ID is empty.';
$wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or http://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.';
?>
\ No newline at end of file
......@@ -47,7 +47,7 @@
<div class="ctrlHolder">
<label for="command">{tmpl_var name='command_txt'}</label>
<input name="command" id="command" value="{tmpl_var name='command'}" size="30" maxlength="255" type="text" class="textInput" />
<p class="formHint">e.g. /var/www/clients/client1/myscript.sh or http://www.mydomain.com/path/script.php</p>
<p class="formHint">{tmpl_var name='command_hint_txt'}</p>
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='active_txt'}</p>
......
......@@ -205,15 +205,20 @@ class cron_plugin {
if($job['type'] == 'url') {
$command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
} else {
$web_root = '';
if($job['type'] == 'chrooted') {
if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) {
//* delete the unneeded path part
$job['command'] = substr($job['command'], strlen($this->parent_domain['document_root']));
}
} else {
$web_root = $this->parent_domain['document_root'];
}
$web_root .= '/web';
$job['command'] = str_replace('[web_root]', $web_root, $job['command']);
$command .= "\t";
if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
if($job['type'] != 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
$command .= $job['command'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment