Skip to content

Commit 1f1350c

Browse files
committed
Clean up
1 parent eec2982 commit 1f1350c

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

server/plugins-available/cron_plugin.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ function _write_crontab() {
260260
}
261261

262262
$web_domain = $this->parent_domain['domain'];
263-
if($this->parent_domain['php_cli_binary'] == '') {
264-
// PHP cli binary not set or default was selected, fallback to just "php"
263+
if($this->parent_domain['php_cli_binary'] == '' || $job['type'] == 'chrooted') {
264+
// PHP cli binary not set or default was selected or it is a chrooted web, fallback to just "php"
265265
$web_php_cli = 'php';
266266
$app->log("PHP CLI binary not set for the website\'s selected PHP version or Default was selected. Falling back to \"php\" for cronjob id " . $job['id'], LOGLEVEL_DEBUG);
267267
} else {

server/plugins-available/shelluser_base_plugin.inc.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,32 +332,37 @@ function update($event_name, $data) {
332332
$app->system->chgrp($homedir.'/.profile', $data['new']['pgroup']);
333333
}
334334

335-
336-
337335
// Create .bashrc file
338336
$app->load('tpl');
339337

340338
$tpl = new tpl();
341339
$tpl->newTemplate("bash.bashrc.master");
342340

341+
// This is not a Jailkit chroot
343342
$tpl->setVar('jailkit_chroot', false);
344-
//$tpl->setVar('domain', $web['domain']);
345343
$php_bin_dir = dirname($web['php_cli_binary']);
346-
//$tpl->setVar('home_dir', $this->_get_home_dir(""));
347344

345+
// FIXME: Check if we need to add an additional field for the path environment variable that contains the path to the php binary
348346
if($web['server_php_id'] > 0) {
349-
$tpl->setVar('use_site_php', false);
350-
$tpl->setVar('php_bin_dir', $php_bin_dir);
351-
$tpl->setVar('use_php_alias', true);
352-
$tpl->setVar('php_alias', $web['php_cli_binary']);
347+
if(preg_match('/^(\/usr\/(s)?bin|\/(s)?bin)/', $php_bin_dir))
348+
{
349+
$tpl->setVar('use_site_php', false);
350+
$tpl->setVar('use_php_alias', true);
351+
$tpl->setVar('php_alias', $web['php_cli_binary']);
352+
} else {
353+
$tpl->setVar('use_site_php', true);
354+
$tpl->setVar('use_php_alias', false);
355+
$tpl->setVar('php_bin_dir', $php_bin_dir);
356+
}
353357
} else {
354358
$tpl->setVar('use_site_php', false);
359+
$tpl->setVar('use_php_alias', false);
355360
}
356361

357362
$bashrc = $homedir .'/.bashrc';
358363
if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
359364

360-
$app->system->file_put_contents($bashrc, $tpl->grab());
365+
file_put_contents($bashrc, $tpl->grab());
361366
unset($tpl);
362367

363368
$app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG);

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ function _setup_jailkit_chroot()
361361
$bashrc = $this->data['new']['dir'].'/etc/bash.bashrc';
362362
if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
363363

364-
$app->system->file_put_contents($bashrc, $tpl->grab());
364+
file_put_contents($bashrc, $tpl->grab());
365365

366366

367367
unset($tpl);

0 commit comments

Comments
 (0)