From 1e7805788df0591a6007042e564a5b3b9d00b959 Mon Sep 17 00:00:00 2001
From: florian030 <florian@schaal-24.de>
Date: Tue, 18 Feb 2014 10:19:53 -0500
Subject: [PATCH] Merge branch 'master' of http://git.ispconfig.org/ispconfig/ispconfig3
---
install/dist/tpl/gentoo/apache_ispconfig.vhost.master | 4 +-
server/conf/apache_apps.vhost.master | 2
interface/web/sites/lib/lang/de_cron.lng | 2 +
interface/web/sites/lib/lang/en_cron.lng | 2 +
install/tpl/apache_ispconfig.vhost.master | 4 +-
install/dist/lib/opensuse.lib.php | 2
interface/web/sites/form/cron.tform.php | 6 +++
install/tpl/apache_apps.vhost.master | 4 +-
server/lib/classes/cron.d/200-logfiles.inc.php | 24 ++++++++++++
server/plugins-available/cron_plugin.inc.php | 26 +++++++++++--
install/dist/tpl/gentoo/apache_apps.vhost.master | 4 +-
install/sql/incremental/upd_0068.sql | 7 ++-
server/conf/vhost.conf.master | 4 +-
install/sql/ispconfig3.sql | 1
server/lib/classes/cron.d/100-monitor_disk_usage.inc.php | 5 +-
interface/web/client/form/domain.tform.php | 2
interface/web/sites/templates/cron_edit.htm | 8 +++
install/sql/incremental/upd_0069.sql | 1
18 files changed, 85 insertions(+), 23 deletions(-)
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index fd4b517..c66d888 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -677,7 +677,7 @@
$content = rf('/etc/apache2/httpd.conf');
if(!stristr($content, 'Include /etc/apache2/sites-enabled/')) {
- af('/etc/apache2/httpd.conf', "\n<Directory /srv/www>\n Options FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
+ af('/etc/apache2/httpd.conf', "\n<Directory /srv/www>\n Options +FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
}
unset($content);
diff --git a/install/dist/tpl/gentoo/apache_apps.vhost.master b/install/dist/tpl/gentoo/apache_apps.vhost.master
index aa90a73..ac29f81 100644
--- a/install/dist/tpl/gentoo/apache_apps.vhost.master
+++ b/install/dist/tpl/gentoo/apache_apps.vhost.master
@@ -15,7 +15,7 @@
DocumentRoot {apps_vhost_dir}
SuexecUserGroup ispapps ispapps
<Directory {apps_vhost_dir}>
- Options Indexes FollowSymLinks MultiViews +ExecCGI
+ Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride AuthConfig Indexes Limit Options FileInfo
<FilesMatch "\.ph(p[3-5]?|tml)$">
SetHandler fcgid-script
@@ -31,7 +31,7 @@
DocumentRoot {apps_vhost_dir}
AddType application/x-httpd-php .php
<Directory {apps_vhost_dir}>
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
diff --git a/install/dist/tpl/gentoo/apache_ispconfig.vhost.master b/install/dist/tpl/gentoo/apache_ispconfig.vhost.master
index bfd67bb..f4f08d2 100644
--- a/install/dist/tpl/gentoo/apache_ispconfig.vhost.master
+++ b/install/dist/tpl/gentoo/apache_ispconfig.vhost.master
@@ -14,7 +14,7 @@
DocumentRoot /var/www/ispconfig/
SuexecUserGroup ispconfig ispconfig
<Directory /var/www/ispconfig/>
- Options Indexes FollowSymLinks MultiViews +ExecCGI
+ Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride AuthConfig Indexes Limit Options FileInfo
<FilesMatch "\.ph(p[3-5]?|tml)$">
SetHandler fcgid-script
@@ -30,7 +30,7 @@
DocumentRoot /usr/local/ispconfig/interface/web/
AddType application/x-httpd-php .php
<Directory /usr/local/ispconfig/interface/web>
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
diff --git a/install/sql/incremental/upd_0068.sql b/install/sql/incremental/upd_0068.sql
index e7a0018..ab6425b 100644
--- a/install/sql/incremental/upd_0068.sql
+++ b/install/sql/incremental/upd_0068.sql
@@ -1,4 +1,5 @@
ALTER TABLE `dbispconfig`.`web_domain` ADD UNIQUE `serverdomain` ( `server_id` , `domain` );
-DROP INDEX rr ON dns_rr;
-ALTER TABLE `dns_rr` CHANGE `name` `name` VARCHAR( 128 ) NOT NULL ;
-CREATE INDEX `rr` ON dns_rr (`zone`,`type`,`name`);
\ No newline at end of file
+
+ALTER TABLE `dns_rr` DROP KEY rr,
+ CHANGE `name` `name` VARCHAR( 128 ) NOT NULL,
+ ADD KEY `rr` (`zone`,`type`,`name`);
diff --git a/install/sql/incremental/upd_0069.sql b/install/sql/incremental/upd_0069.sql
new file mode 100644
index 0000000..44b20e9
--- /dev/null
+++ b/install/sql/incremental/upd_0069.sql
@@ -0,0 +1 @@
+ALTER TABLE `cron` ADD `log` enum('n','y') NOT NULL default 'n' AFTER `run_wday`;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index d255aaa..71f84b1 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -402,6 +402,7 @@
`run_mday` varchar(100) NULL,
`run_month` varchar(100) NULL,
`run_wday` varchar(100) NULL,
+ `log` enum('n','y') NOT NULL default 'n',
`active` enum('n','y') NOT NULL default 'y',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
diff --git a/install/tpl/apache_apps.vhost.master b/install/tpl/apache_apps.vhost.master
index cfedb9e..d132b50 100644
--- a/install/tpl/apache_apps.vhost.master
+++ b/install/tpl/apache_apps.vhost.master
@@ -20,7 +20,7 @@
AddType application/x-httpd-php .php
<Directory {apps_vhost_dir}>
# php_admin_value open_basedir "{apps_vhost_dir}:/usr/share:/tmp"
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
@@ -31,7 +31,7 @@
DocumentRoot {apps_vhost_dir}
SuexecUserGroup ispapps ispapps
<Directory {apps_vhost_dir}>
- Options Indexes FollowSymLinks MultiViews +ExecCGI
+ Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride AuthConfig Indexes Limit Options FileInfo
AddHandler fcgid-script .php
FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master
index f3b32c0..7067cda 100644
--- a/install/tpl/apache_ispconfig.vhost.master
+++ b/install/tpl/apache_ispconfig.vhost.master
@@ -18,7 +18,7 @@
DocumentRoot /var/www/ispconfig/
SuexecUserGroup ispconfig ispconfig
<Directory /var/www/ispconfig/>
- Options -Indexes FollowSymLinks MultiViews +ExecCGI
+ Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride AuthConfig Indexes Limit Options FileInfo
AddHandler fcgid-script .php
FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
@@ -35,7 +35,7 @@
AddType application/x-httpd-php .php
<Directory /usr/local/ispconfig/interface/web>
# php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
diff --git a/interface/web/client/form/domain.tform.php b/interface/web/client/form/domain.tform.php
index a128783..549617e 100644
--- a/interface/web/client/form/domain.tform.php
+++ b/interface/web/client/form/domain.tform.php
@@ -100,7 +100,7 @@
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'domain_error_unique'),
2 => array ( 'type' => 'REGEX',
- 'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
+ 'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
'errmsg'=> 'domain_error_regex'),
),
'default' => '',
diff --git a/interface/web/sites/form/cron.tform.php b/interface/web/sites/form/cron.tform.php
index 4888967..4a169c3 100644
--- a/interface/web/sites/form/cron.tform.php
+++ b/interface/web/sites/form/cron.tform.php
@@ -172,6 +172,12 @@
'valuelimit' => 'list:url,full,chrooted',
'value' => array('url' => 'Url', 'full' => 'Full', 'chrooted' => 'Chrooted')
),
+ 'log' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'CHECKBOX',
+ 'default' => 'n',
+ 'value' => array(0 => 'n', 1 => 'y')
+ ),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
diff --git a/interface/web/sites/lib/lang/de_cron.lng b/interface/web/sites/lib/lang/de_cron.lng
index e9fed68..8be69ee 100644
--- a/interface/web/sites/lib/lang/de_cron.lng
+++ b/interface/web/sites/lib/lang/de_cron.lng
@@ -19,4 +19,6 @@
$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.';
+$wb['log_output_txt'] = 'Ausgabe loggen';
?>
diff --git a/interface/web/sites/lib/lang/en_cron.lng b/interface/web/sites/lib/lang/en_cron.lng
index e6ba8ad..6f3074a 100644
--- a/interface/web/sites/lib/lang/en_cron.lng
+++ b/interface/web/sites/lib/lang/en_cron.lng
@@ -19,4 +19,6 @@
$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.';
+$wb['log_output_txt'] = 'Log output';
?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/cron_edit.htm b/interface/web/sites/templates/cron_edit.htm
index 1c0cd02..20b1922 100644
--- a/interface/web/sites/templates/cron_edit.htm
+++ b/interface/web/sites/templates/cron_edit.htm
@@ -47,7 +47,13 @@
<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='log_output_txt'}</p>
+ <div class="multiField">
+ {tmpl_var name='log'}
+ </div>
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='active_txt'}</p>
diff --git a/server/conf/apache_apps.vhost.master b/server/conf/apache_apps.vhost.master
index 99665df..6d6d4e2 100644
--- a/server/conf/apache_apps.vhost.master
+++ b/server/conf/apache_apps.vhost.master
@@ -34,7 +34,7 @@
DocumentRoot {tmpl_var name='apps_vhost_dir'}
SuexecUserGroup ispapps ispapps
<Directory {tmpl_var name='apps_vhost_dir'}>
- Options Indexes FollowSymLinks MultiViews +ExecCGI
+ Options +Indexes +FollowSymLinks +MultiViews +ExecCGI
AllowOverride AuthConfig Indexes Limit Options FileInfo
AddHandler fcgid-script .php
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 271d3fd..2e90dde 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -57,7 +57,7 @@
</IfModule>
<Directory {tmpl_var name='web_document_root_www'}>
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
@@ -85,7 +85,7 @@
</tmpl_if>
</Directory>
<Directory {tmpl_var name='web_document_root'}>
- Options FollowSymLinks
+ Options +FollowSymLinks
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
diff --git a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
index 4f7f890..2af4041 100644
--- a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
@@ -73,8 +73,9 @@
//$dfData = shell_exec('df -hT 2>/dev/null');
$app->uses('getconf');
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
- $dfData = shell_exec('df -hT|grep -v "'.$web_config['website_basedir'].'/" 2>/dev/null');
-
+
+ $dfData = shell_exec('df -hT -x simfs | awk \'!x[$1]++\' 2>/dev/null');
+
// split into array
$df = explode("\n", $dfData);
diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php
index ebf159c..a802ff9 100644
--- a/server/lib/classes/cron.d/200-logfiles.inc.php
+++ b/server/lib/classes/cron.d/200-logfiles.inc.php
@@ -112,6 +112,30 @@
exec("gzip -c $logfile > $logfile.gz");
unlink($logfile);
}
+
+ $cron_logfiles = array('cron.log', 'cron_error.log', 'cron_wget.log');
+ foreach($cron_logfiles as $cron_logfile) {
+ $cron_logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/' . $cron_logfile);
+
+ // rename older files (move up by one)
+ $num = 7;
+ while($num >= 1 && is_file($cron_logfile . '.' . $num . '.gz')) {
+ rename($cron_logfile . '.' . $num . '.gz', $cron_logfile . '.' . ($num + 1) . '.gz');
+ $num--;
+ }
+
+ // compress current logfile
+ if(is_file($cron_logfile)) {
+ exec("gzip -c $cron_logfile > $cron_logfile.1.gz");
+ exec("cat /dev/null > $cron_logfile");
+ }
+ // remove older logs
+ $num = 7;
+ while(is_file($cron_logfile . '.' . $num . '.gz')) {
+ @unlink($cron_logfile . '.' . $num . '.gz');
+ $num++;
+ }
+ }
// rotate and compress the error.log when it exceeds a size of 10 MB
$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/error.log');
diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php
index 21d72e6..d02b1fd 100644
--- a/server/plugins-available/cron_plugin.inc.php
+++ b/server/plugins-available/cron_plugin.inc.php
@@ -193,7 +193,7 @@
$chr_cmd_count = 0;
//* read all active cron jobs from database and write them to file
- $cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
+ $cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, c.`log`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
if($cron_jobs && count($cron_jobs) > 0) {
foreach($cron_jobs as $job) {
if($job['run_month'] == '@reboot') {
@@ -201,20 +201,38 @@
} else {
$command = str_replace(" ", "", $job['run_min']) . "\t" . str_replace(" ", "", $job['run_hour']) . "\t" . str_replace(" ", "", $job['run_mday']) . "\t" . str_replace(" ", "", $job['run_month']) . "\t" . str_replace(" ", "", $job['run_wday']);
}
+
+ $log_target = ">/dev/null 2>&1";
+ $log_wget_target = '/dev/null';
+ $log_root = '';
+ if($job['log'] == 'y') {
+ if($job['type'] != 'chrooted') $log_root = $this->parent_domain['document_root'];
+ $log_root .= '/log';
+
+ $log_target = '>>' . $log_root . '/cron.log 2>>' . $log_root . '/cron_error.log';
+ $log_wget_target = $log_root . '/cron_wget.log';
+ }
+
$command .= "\t{$this->parent_domain['system_user']}"; //* running as user
if($job['type'] == 'url') {
- $command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
+ $command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O " . $log_wget_target . " " . escapeshellarg($job['command']) . " " . $log_target;
} 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'].'/';
- $command .= $job['command'];
+ if($job['type'] != 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
+ $command .= $job['command'] . " " . $log_target;
}
if($job['type'] == 'chrooted') {
--
Gitblit v1.9.1