From 0a02ee3d2c7f18221dbfbe3a8e9440c0002df4a3 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Tue, 18 Feb 2014 08:29:20 -0500
Subject: [PATCH] Implemented: FS#3346 - Add a [web_root] placeholder to cronjob command

---
 server/plugins-available/cron_plugin.inc.php |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php
index 21d72e6..af25ecc 100644
--- a/server/plugins-available/cron_plugin.inc.php
+++ b/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'];
 				}
 

--
Gitblit v1.9.1