Skip to content

Commit 3ac0d7c

Browse files
committed
Backported the patches:
[PATCH] Add placeholder values, update command_hint_txt to match [PATCH] Handle chrooted sites
1 parent 86f2148 commit 3ac0d7c

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

interface/web/sites/cron_edit.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,29 @@ function onShowEnd() {
7878
$app->tpl->setVar("edit_disabled", 0);
7979
}
8080

81+
$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `domain`, `document_root`, `hd_quota`, `php_cli_binary`
82+
FROM `web_domain`
83+
LEFT JOIN server_php ON web_domain.server_php_id = server_php.server_php_id
84+
WHERE `domain_id` = ?", $this->dataRecord["parent_domain_id"]);
85+
86+
if(!$parent_domain["domain_id"]) {
87+
$app->log("Parent domain not found", LOGLEVEL_WARN);
88+
return 0;
89+
}
90+
91+
$web_docroot_client = '';
92+
93+
if($this->dataRecord['type'] != 'chrooted') {
94+
$web_docroot_client = $this->parent_domain['document_root'];
95+
}
96+
97+
// web folder is hardcoded to /web:
98+
$web_docroot_client .= '/web';
99+
100+
// Example values for placeholders.
101+
$app->tpl->setVar("php_cli_binary", $parent_domain['php_cli_binary']);
102+
$app->tpl->setVar("docroot_client", $web_docroot_client);
103+
$app->tpl->setVar("domain", $parent_domain['domain']);
81104

82105
parent::onShowEnd();
83106
}

interface/web/sites/lib/lang/en_cron.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $wb['run_wday_error_format'] = 'Invalid format for days of the week.';
1919
$wb['command_error_format'] = 'Invalid command format. Please note that in case of an url call only http/https is allowed.';
2020
$wb['unknown_fieldtype_error'] = 'An unknown field type has been used.';
2121
$wb['server_id_error_empty'] = 'The server ID is empty.';
22-
$wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can use [web_root] placeholder that is replaced by /var/www/clients/clientX/webY/web.';
22+
$wb['command_hint_txt'] = 'e.g. /var/www/clients/clientX/webY/myscript.sh or https://www.mydomain.com/path/script.php, you can include the placeholders above that will be replaced with their value. Hover over the variable to see it\'s expected value.';
2323
$wb['log_output_txt'] = 'Log output';
2424
$wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with https:// as cron command.';
2525
$wb['command_error_empty'] = 'Command is empty.';

interface/web/sites/templates/cron_edit.htm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
<label for="command" class="col-sm-3 control-label">{tmpl_var name='command_txt'}</label>
5252
<div class="col-sm-9">
5353
<input type="text" name="command" id="command" value="{tmpl_var name='command'}" class="form-control" />
54-
<b>{tmpl_var name='variables_txt'}:</b> <a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='php_cli_binary'}" class="addPlaceholder">{SITE_PHP}</a>, <a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='docroot_client'}" class="addPlaceholder">{DOCROOT_CLIENT}</a>, <a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='domain'}" class="addPlaceholder">{DOMAIN}</a>
55-
<!--<br><br><p class="formHint">{tmpl_var name='command_hint_txt'}</p>-->
54+
<b>{tmpl_var name='variables_txt'}:</b>
55+
<a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='php_cli_binary'}" class="addPlaceholder">{SITE_PHP}</a>,
56+
<a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='docroot_client'}" class="addPlaceholder">{DOCROOT_CLIENT}</a>,
57+
<a href="javascript:void(0);" data-toggle="tooltip" title="{tmpl_var name='domain'}" class="addPlaceholder">{DOMAIN}</a>
58+
<br><br><p class="formHint">{tmpl_var name='command_hint_txt'}</p>
5659
</div>
5760
</div>
5861
<div class="form-group">

0 commit comments

Comments
 (0)