Marius Cramer
2014-02-18 0a02ee3d2c7f18221dbfbe3a8e9440c0002df4a3
Implemented: FS#3346 - Add a [web_root] placeholder to cronjob command
4 files modified
11 ■■■■ changed files
interface/web/sites/lib/lang/de_cron.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_cron.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/cron_edit.htm 2 ●●● patch | view | raw | blame | history
server/plugins-available/cron_plugin.inc.php 7 ●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/de_cron.lng
@@ -19,4 +19,5 @@
$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.';
?>
interface/web/sites/lib/lang/en_cron.lng
@@ -19,4 +19,5 @@
$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.';
?>
interface/web/sites/templates/cron_edit.htm
@@ -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>
server/plugins-available/cron_plugin.inc.php
@@ -205,15 +205,20 @@
                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'];
                }