removing unneeded file install_configs.php;
making $cronscriptDebug a setting in the database (no messing around in the files for debugging); removed unnecessary unset() in cron_init.php; setting of correct file-ownership of logfiles in apache and lighttpd crons;
This commit is contained in:
@@ -95,6 +95,14 @@ return array(
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_debug_cron' => array(
|
||||
'label' => $lng['serversettings']['cron']['debug'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'debug_cron',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -549,6 +549,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (118, 'panel', 'frontend', 'froxlor');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (119, 'spf', 'use_spf', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (120, 'spf', 'spf_entry', '@ IN TXT "v=spf1 a mx -all"');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (121, 'system', 'debug_cron', '0');
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r1 to 0.9-r2");
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (119, 'spf', 'use_spf', '0');");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (120, 'spf', 'spf_entry', '@ IN TXT \"v=spf1 a mx -all\"');");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'use_spf', '0');");
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'spf_entry', '@ IN TXT \"v=spf1 a mx -all\"');");
|
||||
|
||||
// Convert all data to UTF-8 to have a sane standard across all data
|
||||
$result = $db->query("SHOW TABLES");
|
||||
@@ -64,3 +64,21 @@ if($settings['panel']['frontend'] == 'froxlor'
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r2';
|
||||
}
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '0.9-r2')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r2 to 0.9-r3");
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');");
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'0.9-r3\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '0.9-r3';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ if(@php_sapi_name() != 'cli'
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
$cronscriptDebug = false;
|
||||
$lockdir = '/var/run/';
|
||||
$lockFilename = 'froxlor_' . basename($_SERVER['PHP_SELF'], '.php') . '.lock-';
|
||||
$lockfName = $lockFilename . getmypid();
|
||||
@@ -158,8 +157,6 @@ if(isset($needrootdb)
|
||||
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
|
||||
}*/
|
||||
|
||||
unset($sql['root_user'], $sql['root_password']);
|
||||
|
||||
if($db->link_id == 0)
|
||||
{
|
||||
/**
|
||||
@@ -199,6 +196,8 @@ if(!isset($settings['panel']['version'])
|
||||
|
||||
fwrite($debugHandler, 'Froxlor Version and Database Version are correct' . "\n");
|
||||
|
||||
$cronscriptDebug = ($settings['system']['debug_cron'] == '1') ? true : false;
|
||||
|
||||
$cronbasedir = makeCorrectDir($pathtophpfiles . '/scripts/');
|
||||
$crondir = new DirectoryIterator($cronbasedir);
|
||||
$cronfilename = basename($_SERVER['PHP_SELF'], '.php');
|
||||
|
||||
@@ -65,7 +65,7 @@ define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
|
||||
$version = '0.9-r2';
|
||||
$version = '0.9-r3';
|
||||
$dbversion = '2';
|
||||
|
||||
?>
|
||||
|
||||
@@ -1253,5 +1253,7 @@ $lng['spf']['spf_entry'] = 'SPF entry for all domains';
|
||||
$lng['panel']['dirsmissing'] = 'The given directory could not be found.';
|
||||
$lng['panel']['toomanydirs'] = 'Too many subdirectories. Falling back to manual path-select.';
|
||||
$lng['panel']['abort'] = 'Abort';
|
||||
$lng['serversettings']['cron']['debug']['title'] = 'Cronscript debugging';
|
||||
$lng['serversettings']['cron']['debug']['description'] = 'Activate to keep the lockfile after a cron-run for debugging.<br /><b>Attention:</b>Keeping the lockfile can cause the next scheduled cron not to run properly.';
|
||||
|
||||
?>
|
||||
|
||||
@@ -1233,5 +1233,7 @@ $lng['spf']['spf_entry'] = 'SPF Eintrag für alle Domains';
|
||||
$lng['panel']['dirsmissing'] = 'Das angegebene Verzeichnis konnte nicht gefunden werden.';
|
||||
$lng['panel']['toomanydirs'] = 'Zu viele Unterverzeichnisse. Weiche auf manuelle Verzeichniseingabe aus.';
|
||||
$lng['panel']['abort'] = 'Abbrechen';
|
||||
$lng['serversettings']['cron']['debug']['title'] = 'Debuggen des Cronscripts';
|
||||
$lng['serversettings']['cron']['debug']['description'] = 'Wenn aktiviert, wird die Lockdatei nach dem Cronlauf zum Debuggen nicht gelöscht<br /><b>Achtung:</b>Eine alte Lockdatei kann weitere Cronjobs behindern und dafür sorgen, dass diese nicht vollständig ausgeführt werden.';
|
||||
|
||||
?>
|
||||
|
||||
@@ -363,9 +363,17 @@ class apache
|
||||
else
|
||||
{
|
||||
// The normal access/error - logging is enabled
|
||||
$error_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log');
|
||||
chown($error_log, $this->settings['system']['httpuser']);
|
||||
chgrp($error_log, $this->settings['system']['httpgroup']);
|
||||
|
||||
$access_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
chown($access_log, $this->settings['system']['httpuser']);
|
||||
chgrp($access_log, $this->settings['system']['httpgroup']);
|
||||
|
||||
$logfiles_text.= ' ErrorLog "' . $error_log . "\"\n";
|
||||
$logfiles_text.= ' CustomLog "' . $access_log .'" combined' . "\n";
|
||||
|
||||
$logfiles_text.= ' ErrorLog "' . $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log' . "\"\n";
|
||||
$logfiles_text.= ' CustomLog "' . $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log" combined' . "\n";
|
||||
}
|
||||
|
||||
if($this->settings['system']['awstats_enabled'] == '1')
|
||||
|
||||
@@ -272,7 +272,7 @@ class lighttpd
|
||||
{
|
||||
// The normal access/error - logging is enabled
|
||||
|
||||
$filename = $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log';
|
||||
$filename = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log');
|
||||
|
||||
if(!is_file($filename))
|
||||
{
|
||||
@@ -280,12 +280,12 @@ class lighttpd
|
||||
fclose($ourFileHandle);
|
||||
}
|
||||
|
||||
chown($filename, $this->settings[system]['httpuser']);
|
||||
chgrp($filename, $this->settings[system]['httpgroup']);
|
||||
chown($filename, $this->settings['system']['httpuser']);
|
||||
chgrp($filename, $this->settings['system']['httpgroup']);
|
||||
|
||||
//access log
|
||||
|
||||
$filename = $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log';
|
||||
$filename = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
|
||||
if(!is_file($filename))
|
||||
{
|
||||
@@ -294,8 +294,9 @@ class lighttpd
|
||||
}
|
||||
|
||||
$logfiles_text.= ' accesslog.filename = "' . $filename . '"' . "\n";
|
||||
chown($filename, $this->settings[system]['httpuser']);
|
||||
chgrp($filename, $this->settings[system]['httpgroup']);
|
||||
|
||||
chown($filename, $this->settings['system']['httpuser']);
|
||||
chgrp($filename, $this->settings['system']['httpgroup']);
|
||||
}
|
||||
|
||||
return $logfiles_text;
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: install_configs.php 2698 2009-04-13 20:25:59Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* STARTING REDUNDANT CODE, WHICH IS SOME KINDA HEADER FOR EVERY CRON SCRIPT.
|
||||
* When using this "header" you have to change $lockFilename for your needs.
|
||||
* Don't forget to also copy the footer which closes database connections
|
||||
* and the lockfile!
|
||||
*/
|
||||
|
||||
include (dirname(__FILE__) . '/../lib/cron_init.php');
|
||||
|
||||
/**
|
||||
* END REDUNDANT CODE (CRONSCRIPT "HEADER")
|
||||
*/
|
||||
|
||||
require ($pathtophpfiles . '/lib/configfiles_index.inc.php');
|
||||
require ($pathtophpfiles . '/lib/userdata.inc.php');
|
||||
|
||||
$replace_arr = Array(
|
||||
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||
'<SQL_UNPRIVILEGED_PASSWORD>' => $sql['password'],
|
||||
'<SQL_DB>' => $sql['db'],
|
||||
'<SQL_HOST>' => $sql['host'],
|
||||
'<SERVERNAME>' => $settings['system']['hostname'],
|
||||
'<SERVERIP>' => $settings['system']['ipaddress'],
|
||||
'<NAMESERVERS>' => $settings['system']['nameservers'],
|
||||
'<VIRTUAL_MAILBOX_BASE>' => $settings['system']['vmail_homedir'],
|
||||
'<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'],
|
||||
'<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'],
|
||||
'<AWSTATS_PATH>' => $settings['system']['awstats_path'],
|
||||
'<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : ''
|
||||
);
|
||||
|
||||
$cli_params = $_SERVER['argv'];
|
||||
unset($cli_params[0]);
|
||||
|
||||
if(isset($cli_params[1]) && $cli_params[1] != '' && isset($configfiles[$cli_params[1]]))
|
||||
{
|
||||
$distribution = $cli_params[1];
|
||||
unset($cli_params[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'No valid distribution specified!' . "\n";
|
||||
}
|
||||
|
||||
foreach($cli_params as $cli_param)
|
||||
{
|
||||
list($service, $daemon) = explode('=', $cli_param);
|
||||
echo $service . ' ' . $daemon;
|
||||
if(isset($configfiles[$distribution]['services'][$service]) && isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]))
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon] as $action => $value)
|
||||
{
|
||||
if(substr($action, 0, 8) == 'commands')
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
echo '=== COMMANDS BEGIN ===' . "\n";
|
||||
foreach($value as $command)
|
||||
{
|
||||
echo '-- running ' . $command . "\n";
|
||||
if(in_array('reallydoit', $cli_params))
|
||||
{
|
||||
passthru($command);
|
||||
}
|
||||
}
|
||||
echo '==== COMMANDS END ====' . "\n";
|
||||
}
|
||||
}
|
||||
elseif(substr($action, 0, 5) == 'files')
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
echo '=== FILES BEGIN ===' . "\n";
|
||||
while(list($filename, $realname) = each($value))
|
||||
{
|
||||
$file_content = file_get_contents('./templates/misc/configfiles/' . $distribution . '/' . $daemon . '/' . $filename);
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
echo '-- filename: ' . $realname . "\n";
|
||||
echo '-- filecontent:' . "\n" . '---' . "\n";
|
||||
echo $file_content;
|
||||
echo '---' . "\n";
|
||||
if(in_array('reallydoit', $cli_params))
|
||||
{
|
||||
if(file_exists($realname))
|
||||
{
|
||||
exec('mv ' . escapeshellarg($realname) . ' ' . escapeshellarg($realname) . '.orig');
|
||||
}
|
||||
file_put_contents($realname, $file_content);
|
||||
}
|
||||
}
|
||||
echo '==== FILES END ====' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']))
|
||||
{
|
||||
echo '=== RESTART BEGIN ===' . "\n";
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'] as $command)
|
||||
{
|
||||
echo '-- running ' . $command . "\n";
|
||||
if(in_array('reallydoit', $cli_params))
|
||||
{
|
||||
passthru($command);
|
||||
}
|
||||
}
|
||||
echo '==== RESTART END ====' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* STARTING CRONSCRIPT FOOTER
|
||||
*/
|
||||
|
||||
include ($pathtophpfiles . '/lib/cron_shutdown.php');
|
||||
|
||||
/**
|
||||
* END CRONSCRIPT FOOTER
|
||||
*/
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user