Merge branch 'master' of git://github.com/Froxlor/Froxlor
This commit is contained in:
@@ -53,6 +53,12 @@ class Database {
|
|||||||
*/
|
*/
|
||||||
private static $_dbname = null;
|
private static $_dbname = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sql-access data
|
||||||
|
*/
|
||||||
|
private static $_needsqldata = false;
|
||||||
|
private static $_sqldata = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for PDOStatement::execute so we can catch the PDOException
|
* Wrapper for PDOStatement::execute so we can catch the PDOException
|
||||||
* and display the error nicely on the panel
|
* and display the error nicely on the panel
|
||||||
@@ -119,6 +125,40 @@ class Database {
|
|||||||
self::$_needroot = $needroot;
|
self::$_needroot = $needroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enable the temporary access to sql-access data
|
||||||
|
* note: if you want root-sqldata you need to
|
||||||
|
* call needRoot(true) first. Also, this will
|
||||||
|
* only give you the data ONCE as it disable itself
|
||||||
|
* after the first access to the data
|
||||||
|
*
|
||||||
|
* @param bool $needsql
|
||||||
|
*/
|
||||||
|
public static function needSqlData($needsql = false) {
|
||||||
|
self::$_needsqldata = $needsql;
|
||||||
|
self::$_sqldata = array();
|
||||||
|
self::$_link = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the sql-access data as array using indeces
|
||||||
|
* 'user', 'passwd' and 'host'. Returns false if not enabled
|
||||||
|
*
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
public static function getSqlData() {
|
||||||
|
if (self::$_sqldata !== null
|
||||||
|
&& is_array(self::$_sqldata)
|
||||||
|
&& isset(self::$_sqldata['user'])
|
||||||
|
) {
|
||||||
|
return self::$_sqldata;
|
||||||
|
// automatically disable sql-data
|
||||||
|
self::$_sqldata = null;
|
||||||
|
self::$_needsqldata = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* let's us interact with the PDO-Object by using static
|
* let's us interact with the PDO-Object by using static
|
||||||
* call like "Database::function()"
|
* call like "Database::function()"
|
||||||
@@ -194,6 +234,15 @@ class Database {
|
|||||||
$host = $sql["host"];
|
$host = $sql["host"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save sql-access-data if needed
|
||||||
|
if (self::$_needsqldata) {
|
||||||
|
self::$_sqldata = array(
|
||||||
|
'user' => $user,
|
||||||
|
'passwd' => $password,
|
||||||
|
'host' => $host
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// build up connection string
|
// build up connection string
|
||||||
$driver = 'mysql';
|
$driver = 'mysql';
|
||||||
$dsn = $driver.":";
|
$dsn = $driver.":";
|
||||||
|
|||||||
@@ -316,7 +316,12 @@ class paging {
|
|||||||
|| ($natSorting === null && $this->natSorting == true)
|
|| ($natSorting === null && $this->natSorting == true)
|
||||||
) {
|
) {
|
||||||
// Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556
|
// Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556
|
||||||
$sortcode = 'ORDER BY CONCAT( IF( ASCII( LEFT( ' . $sortfield . ', 5 ) ) > 57, LEFT( ' . $sortfield . ', 1 ), \'0\' ), IF( ASCII( RIGHT( ' . $sortfield . ', 1 ) ) > 57, LPAD( ' . $sortfield . ', 255, \'0\' ), LPAD( CONCAT( ' . $sortfield . ', \'-\' ), 255, \'0\' ) ) ) ' . $sortorder;
|
$sortcode = "ORDER BY CONCAT( IF( ASCII( LEFT( " . $sortfield . ", 5 ) ) > 57,
|
||||||
|
LEFT( " . $sortfield . ", 1 ), 0 ),
|
||||||
|
IF( ASCII( RIGHT( " . $sortfield . ", 1 ) ) > 57,
|
||||||
|
LPAD( " . $sortfield . ", 255, '0' ),
|
||||||
|
LPAD( CONCAT( " . $sortfield . ", '-' ), 255, '0' )
|
||||||
|
)) " . $sortorder;
|
||||||
} else {
|
} else {
|
||||||
$sortcode = 'ORDER BY ' . $sortfield . ' ' . $sortorder;
|
$sortcode = 'ORDER BY ' . $sortfield . ' ' . $sortorder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,39 +24,39 @@
|
|||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
//dont do anything when module is disabled
|
//dont do anything when module is disabled
|
||||||
if((int)$settings['autoresponder']['autoresponder_active'] == 0)
|
if ((int)$settings['autoresponder']['autoresponder_active'] == 0) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//only send autoresponder to mails which were delivered since last run
|
//only send autoresponder to mails which were delivered since last run
|
||||||
if((int)$settings['autoresponder']['last_autoresponder_run'] == 0)
|
if ((int)$settings['autoresponder']['last_autoresponder_run'] == 0) {
|
||||||
{
|
|
||||||
//mails from last 5 minutes, otherwise all mails will be parsed -> mailbomb prevention
|
//mails from last 5 minutes, otherwise all mails will be parsed -> mailbomb prevention
|
||||||
$cycle = 300;
|
$cycle = 300;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// calculate seconds since last check
|
// calculate seconds since last check
|
||||||
$cycle = time() - (int)$settings['autoresponder']['last_autoresponder_run'];
|
$cycle = time() - (int)$settings['autoresponder']['last_autoresponder_run'];
|
||||||
|
|
||||||
//prevent mailbombs when cycle is bigger than two days
|
//prevent mailbombs when cycle is bigger than two days
|
||||||
if($cycle > (2 * 60 * 60 * 24))$cycle = (60 * 60 * 24);
|
if($cycle > (2 * 60 * 60 * 24))$cycle = (60 * 60 * 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set last_autoresponder_run
|
// set last_autoresponder_run
|
||||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . (int)time() . "' WHERE `settinggroup` = 'autoresponder' AND `varname` = 'last_autoresponder_run'");
|
$upd_stmt = Database::prepare("
|
||||||
|
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :timeval
|
||||||
|
WHERE `settinggroup` = 'autoresponder' AND `varname` = 'last_autoresponder_run'
|
||||||
|
");
|
||||||
|
Database::pexecute($upd_stmt, array('timeval' => time()));
|
||||||
|
|
||||||
// get all customer set ip autoresponders
|
// get all customer set ip autoresponders
|
||||||
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` INNER JOIN `" . TABLE_MAIL_USERS . "` ON `" . TABLE_MAIL_AUTORESPONDER . "`.`email` = `" . TABLE_MAIL_USERS . "`.`email` WHERE `enabled` = 1");
|
$result_stmt = Database::query("
|
||||||
|
SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` INNER JOIN `" . TABLE_MAIL_USERS . "`
|
||||||
|
ON `" . TABLE_MAIL_AUTORESPONDER . "`.`email` = `" . TABLE_MAIL_USERS . "`.`email`
|
||||||
|
WHERE `enabled` = 1
|
||||||
|
");
|
||||||
|
|
||||||
if($db->num_rows($result) > 0)
|
if (Database::num_rows() > 0) {
|
||||||
{
|
|
||||||
while($row = $db->fetch_array($result))
|
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
{
|
//check if specific autoresponder should be used
|
||||||
/*
|
|
||||||
* check if specific autoresponder should be used
|
|
||||||
*/
|
|
||||||
$ts_now = time();
|
$ts_now = time();
|
||||||
$ts_start = (int)$row['date_from'];
|
$ts_start = (int)$row['date_from'];
|
||||||
$ts_end = (int)$row['date_until'];
|
$ts_end = (int)$row['date_until'];
|
||||||
@@ -69,11 +69,10 @@ if($db->num_rows($result) > 0)
|
|||||||
if($ts_end != -1 && $ts_end < $ts_now) continue;
|
if($ts_end != -1 && $ts_end < $ts_now) continue;
|
||||||
|
|
||||||
// setup mail-path (e.g. /var/customers/mail/[loginname]/[user@domain.tld]/new
|
// setup mail-path (e.g. /var/customers/mail/[loginname]/[user@domain.tld]/new
|
||||||
$path = $row['homedir'] . $row['maildir'] . "new/";
|
$path = makeCorrectDir($row['homedir'] . $row['maildir'] . "new/");
|
||||||
|
|
||||||
// if the directory does not exist, inform syslog
|
// if the directory does not exist, inform syslog
|
||||||
if(!is_dir($path))
|
if (!is_dir($path)) {
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error accessing maildir: " . $path);
|
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error accessing maildir: " . $path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,10 +83,8 @@ if($db->num_rows($result) > 0)
|
|||||||
);
|
);
|
||||||
|
|
||||||
$responded_counter = 0;
|
$responded_counter = 0;
|
||||||
foreach ($its as $fullFilename => $it )
|
foreach ($its as $fullFilename => $it ) {
|
||||||
{
|
if ($it->getFilename() == '.' || $it->getFilename() == '..') {
|
||||||
if($it->getFilename() == '.' || $it->getFilename() == '..')
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +94,7 @@ if($db->num_rows($result) > 0)
|
|||||||
* than our cycle-seconds?
|
* than our cycle-seconds?
|
||||||
*/
|
*/
|
||||||
$filemtime = $it->getMTime();
|
$filemtime = $it->getMTime();
|
||||||
if(time() - $filemtime <= $cycle)
|
if (time() - $filemtime <= $cycle) {
|
||||||
{
|
|
||||||
// why not read up to k lines?
|
// why not read up to k lines?
|
||||||
// I've been patching this forever, to avoid FATAL ERROR / memory exhausted
|
// I've been patching this forever, to avoid FATAL ERROR / memory exhausted
|
||||||
// (fgets() is now binary safe, too)
|
// (fgets() is now binary safe, too)
|
||||||
@@ -113,8 +109,7 @@ if($db->num_rows($result) > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// error reading mail contents or just empty
|
// error reading mail contents or just empty
|
||||||
if(count($content) == 0)
|
if (count($content) == 0) {
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Unable to read mail from maildir: " . dirname($fullFilename));
|
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Unable to read mail from maildir: " . dirname($fullFilename));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -124,11 +119,9 @@ if($db->num_rows($result) > 0)
|
|||||||
$to = '';
|
$to = '';
|
||||||
$sender = '';
|
$sender = '';
|
||||||
$spam = false;
|
$spam = false;
|
||||||
foreach($content as $line)
|
foreach ($content as $line) {
|
||||||
{
|
|
||||||
// header ends on first empty line, skip rest of mail
|
// header ends on first empty line, skip rest of mail
|
||||||
if(strlen(rtrim($line)) == 0)
|
if (strlen(rtrim($line)) == 0) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,15 +178,14 @@ if($db->num_rows($result) > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for amavis/spamassassin spam headers
|
//check for amavis/spamassassin spam headers
|
||||||
if(preg_match("/^X-Spam-Status: (Yes|No)(.*)$/", $line, $match))
|
if (preg_match("/^X-Spam-Status: (Yes|No)(.*)$/", $line, $match)) {
|
||||||
{
|
if(strtolower($match[1]) == 'yes') {
|
||||||
if($match[1] == 'Yes')
|
|
||||||
$spam = true;
|
$spam = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//check for precedence header
|
//check for precedence header
|
||||||
if(preg_match("/^Precedence: (bulk|list|junk)(.*)$/", $line, $match))
|
if (preg_match("/^Precedence: (bulk|list|junk)(.*)$/", $line, $match)) {
|
||||||
{
|
|
||||||
// use the spam flag to skip reply
|
// use the spam flag to skip reply
|
||||||
$spam = true;
|
$spam = true;
|
||||||
}
|
}
|
||||||
@@ -201,20 +193,17 @@ if($db->num_rows($result) > 0)
|
|||||||
|
|
||||||
// check if the receiver is really the one
|
// check if the receiver is really the one
|
||||||
// with the autoresponder
|
// with the autoresponder
|
||||||
if(!strlen($to) || $to != $row['email'])
|
if (!strlen($to) || $to != $row['email']) {
|
||||||
{
|
|
||||||
$to = '';
|
$to = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//skip mail when marked as spam
|
//skip mail when marked as spam
|
||||||
if($spam == true)
|
if ($spam == true) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//error while parsing mail
|
//error while parsing mail
|
||||||
if($to == '' || $from == '')
|
if ($to == '' || $from == '') {
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse");
|
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -222,8 +211,7 @@ if($db->num_rows($result) > 0)
|
|||||||
//important! prevent mailbombs when mail comes from a maildaemon/mailrobot
|
//important! prevent mailbombs when mail comes from a maildaemon/mailrobot
|
||||||
//robot/daemon mails must go to Sender: field in envelope header
|
//robot/daemon mails must go to Sender: field in envelope header
|
||||||
//refers to "Das Postfix-Buch" / RFC 2822
|
//refers to "Das Postfix-Buch" / RFC 2822
|
||||||
if($sender != '')
|
if ($sender != '') {
|
||||||
{
|
|
||||||
$from = $sender;
|
$from = $sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,8 +221,7 @@ if($db->num_rows($result) > 0)
|
|||||||
//check if mail is already an answer
|
//check if mail is already an answer
|
||||||
$fullcontent = implode("", $content);
|
$fullcontent = implode("", $content);
|
||||||
|
|
||||||
if(strstr($fullcontent, $message) || $from == $to)
|
if (strstr($fullcontent, $message) || $from == $to) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,109 +15,140 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(@php_sapi_name() != 'cli'){
|
|
||||||
die('This script will only work in the shell');
|
|
||||||
}
|
|
||||||
|
|
||||||
openRootDB($debugHandler, $lockfile);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backup
|
* Backup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($settings['system']['backup_enabled'] == '1') {
|
if ($settings['system']['backup_enabled'] == '1') {
|
||||||
|
|
||||||
fwrite($debugHandler, 'backup customers started...' . "\n");
|
fwrite($debugHandler, 'backup customers started...' . "\n");
|
||||||
|
|
||||||
$result = $db->query("SELECT customerid, loginname, guid, documentroot, backup_allowed, backup_enabled FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC;");
|
// get sql-root access data for mysqldump
|
||||||
while($row = $db->fetch_array($result)){
|
Database::needRoot(true);
|
||||||
|
Database::needSqlData(true);
|
||||||
|
$sql_root = Database::getSqlData();
|
||||||
|
Database::needRoot(false);
|
||||||
|
|
||||||
|
$result_stmt = Database::query("
|
||||||
|
SELECT customerid, loginname, guid, documentroot, backup_allowed, backup_enabled
|
||||||
|
FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC;
|
||||||
|
");
|
||||||
|
|
||||||
|
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' started...' . "\n");
|
fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' started...' . "\n");
|
||||||
|
|
||||||
// backup
|
// backup
|
||||||
if($row['backup_allowed'] == '1' && $row['backup_enabled'] == '1'){
|
if ($row['backup_allowed'] == '1'
|
||||||
|
&& $row['backup_enabled'] == '1'
|
||||||
|
) {
|
||||||
// get uid & gid from ftp table
|
// get uid & gid from ftp table
|
||||||
$ftp_result = $db->query("SELECT uid, gid FROM `" . TABLE_FTP_USERS . "` WHERE `username` = '" . $db->escape($row['loginname']) . "';");
|
$ftp_result_stmt = Database::prepare("
|
||||||
$ftp_row = mysql_fetch_array($ftp_result);
|
SELECT uid, gid FROM `" . TABLE_FTP_USERS . "`
|
||||||
|
WHERE `username` = :loginname
|
||||||
|
");
|
||||||
|
$ftp_row = Database::pexecute_first($ftp_result_stmt, array('loginname' => $row['loginname']));
|
||||||
|
|
||||||
// create backup dir an set rights
|
// create backup dir an set rights
|
||||||
if(!file_exists($settings['system']['backup_dir'] . $row['loginname'])) {
|
$_backupdir = makeCorrectDir($settings['system']['backup_dir'] . $row['loginname']);
|
||||||
safe_exec('install -d ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . ' -o ' . escapeshellarg($ftp_row['uid']) . ' -g ' . escapeshellarg($ftp_row['gid']) . ' -m ' . '0500');
|
if (!file_exists($_backupdir)) {
|
||||||
|
safe_exec('install -d ' . escapeshellarg($_backupdir) . ' -o ' . escapeshellarg($ftp_row['uid']) . ' -g ' . escapeshellarg($ftp_row['gid']) . ' -m ' . '0500');
|
||||||
}
|
}
|
||||||
|
|
||||||
// create customers html backup
|
// create customers html backup
|
||||||
safe_exec('tar -C ' . escapeshellarg($row['documentroot']) . ' -c -z -f ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($row['loginname']) . 'html.tar.gz .');
|
safe_exec('tar -C ' . escapeshellarg($row['documentroot']) . ' -c -z -f ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . 'html.tar.gz .');
|
||||||
|
|
||||||
// get customer dbs
|
// get customer dbs
|
||||||
$dbs_result = $db->query("SELECT databasename FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid` = '" . $db->escape($row['customerid']) . "';");
|
$dbs_result_stmt = Database::prepare("
|
||||||
while($dbs_row = $db->fetch_array($dbs_result)){
|
SELECT `databasename` FROM `" . TABLE_PANEL_DATABASES . "`
|
||||||
|
WHERE `customerid` = :customerid
|
||||||
|
");
|
||||||
|
Database::pexecute($dbs_result_stmt, array('customerid' => $row['customerid']));
|
||||||
|
|
||||||
|
while ($dbs_row = $dbs_result_stmt->fetch(PDO::FETCH_ASSOC)){
|
||||||
// create customers sql backup
|
// create customers sql backup
|
||||||
safe_exec(escapeshellcmd($settings['system']['backup_mysqldump_path']) . ' --opt --force --allow-keywords -u ' . escapeshellarg($sql_root[0]['user']) . ' -p' . escapeshellarg($sql_root[0]['password']) . ' -h ' . $sql_root[0]['host'] . ' -B ' . escapeshellarg($dbs_row['databasename']) . ' -r ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql' );
|
safe_exec(escapeshellcmd($settings['system']['backup_mysqldump_path']) . ' --opt --force --allow-keywords -u ' . escapeshellarg($sql_root['user']) . ' -p' . escapeshellarg($sql_root['passwd']) . ' -h ' . $sql_root['host'] . ' -B ' . escapeshellarg($dbs_row['databasename']) . ' -r ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql' );
|
||||||
// compress sql backup
|
// compress sql backup
|
||||||
safe_exec('tar -C ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . ' -c -z -f ' . escapeshellarg($settings['system']['backup_dir']) . $row['loginname'] . '/' . escapeshellarg($dbs_row['databasename']) . '.tar.gz ' . escapeshellarg($dbs_row['databasename']) . '.sql');
|
safe_exec('tar -C ' . escapeshellarg($_backupdir) . ' -c -z -f ' . escapeshellarg($settings['system']['backup_dir']) . $row['loginname'] . '/' . escapeshellarg($dbs_row['databasename']) . '.tar.gz ' . escapeshellarg($dbs_row['databasename']) . '.sql');
|
||||||
// remove uncompresed sql files
|
// remove uncompresed sql files
|
||||||
safe_exec('rm ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql');
|
safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql');
|
||||||
}
|
}
|
||||||
|
|
||||||
// create 1 big file with html & db
|
// create 1 big file with html & db
|
||||||
if ($settings['system']['backup_bigfile'] == 1) {
|
if ($settings['system']['backup_bigfile'] == 1) {
|
||||||
safe_exec('tar -C ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . ' --exclude=' . escapeshellarg($row['loginname']) . '.tar.gz -c -z -f ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($row['loginname']) . '.tar.gz .');
|
safe_exec('tar -C ' . escapeshellarg($_backupdir) . '/' . ' --exclude=' . escapeshellarg($row['loginname']) . '.tar.gz -c -z -f ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . '.tar.gz .');
|
||||||
// remove separated files
|
// remove separated files
|
||||||
$tmp_files = scandir($settings['system']['backup_dir'] . $row['loginname']);
|
$tmp_files = scandir($_backupdir);
|
||||||
foreach ($tmp_files as $tmp_file) {
|
foreach ($tmp_files as $tmp_file) {
|
||||||
if (preg_match('/.*(html|sql|aps).*\.tar\.gz$/', $tmp_file) && !preg_match('/^' . $row['loginname'] . '\.tar\.gz$/', $tmp_file)) {
|
if (preg_match('/.*(html|sql|aps).*\.tar\.gz$/', $tmp_file) && !preg_match('/^' . $row['loginname'] . '\.tar\.gz$/', $tmp_file)) {
|
||||||
safe_exec('rm ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($tmp_file) . '');
|
safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($tmp_file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//remove big file if separated backups are used
|
//remove big file if separated backups are used
|
||||||
if (file_exists($settings['system']['backup_dir'] . $row['loginname'] . '/' . $row['loginname'] . '.tar.gz')) {
|
if (file_exists(makeCorrectFile($_backupdir . '/' . $row['loginname'] . '.tar.gz'))) {
|
||||||
safe_exec('rm ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($row['loginname']) . '.tar.gz');
|
safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . '.tar.gz');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chown & chmod files to prevent manipulation
|
// chown & chmod files to prevent manipulation
|
||||||
safe_exec('chown ' . escapeshellarg($row['guid']) . ':' . escapeshellarg($row['guid']) . ' ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/*');
|
safe_exec('chown ' . escapeshellarg($row['guid']) . ':' . escapeshellarg($row['guid']) . ' ' . escapeshellarg($_backupdir) . '/*');
|
||||||
safe_exec('chmod 0400 ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/*');
|
safe_exec('chmod 0400 ' . escapeshellarg($_backupdir) . '/*');
|
||||||
|
|
||||||
// create ftp backup user
|
// create ftp backup user
|
||||||
$user_result = $db->query("SELECT username, password FROM `" . TABLE_FTP_USERS . "` WHERE `customerid` = '" . $db->escape($row['customerid']) . "' AND `username` = '" . $db->escape($row['loginname']) . "';");
|
$user_result_stmt = Database::prepare("
|
||||||
$user_row = mysql_fetch_array($user_result);
|
SELECT username, password FROM `" . TABLE_FTP_USERS . "`
|
||||||
$db->query("REPLACE INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('" . $db->escape($row['customerid']) . "', '" . $db->escape($row['loginname']) . "_backup', '" . $db->escape($user_row['password']) . "', '" . $db->escape($settings['system']['backup_dir']) . $db->escape($row['loginname']) . "/', 'y', '" . $db->escape($row['guid']) . "', '" . $db->escape($row['guid']) . "')");
|
WHERE `customerid` = :customerid AND `username` = :username;
|
||||||
|
");
|
||||||
|
$user_row = Database::pexecute_first($user_result_stmt, array('customerid' => $row['customerid'], 'username' => $row['loginname']));
|
||||||
|
|
||||||
|
$ins_stmt = Database::prepare("
|
||||||
|
REPLACE INTO `" . TABLE_FTP_USERS . "`
|
||||||
|
(`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`)
|
||||||
|
VALUES
|
||||||
|
(:customerid, :username, :password, :homedir, 'y', :guid, :guid)
|
||||||
|
");
|
||||||
|
$ins_data = array(
|
||||||
|
'customerid' => $row['customerid'],
|
||||||
|
'username' => $row['loginname']."_backup",
|
||||||
|
'password' => $user_row['password'],
|
||||||
|
'homedir' => makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/'),
|
||||||
|
'guid' => $row['guid']
|
||||||
|
);
|
||||||
|
Database::pexecute($ins_stmt, $ins_data);
|
||||||
|
|
||||||
if ($settings['system']['backup_ftp_enabled'] == '1') {
|
if ($settings['system']['backup_ftp_enabled'] == '1') {
|
||||||
// upload backup to customers ftp server
|
// upload backup to customers ftp server
|
||||||
$ftp_files = scandir($settings['system']['backup_dir'] . $row['loginname']);
|
$_ftpdir = makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/');
|
||||||
|
$ftp_files = scandir($_ftpdir);
|
||||||
|
|
||||||
foreach ($ftp_files as $ftp_file) {
|
foreach ($ftp_files as $ftp_file) {
|
||||||
if (preg_match('/.*\.tar\.gz$/', $ftp_file)) {
|
if (preg_match('/.*\.tar\.gz$/', $ftp_file)) {
|
||||||
|
|
||||||
$ftp_con = ftp_connect($settings['system']['backup_ftp_server']);
|
$ftp_con = ftp_connect($settings['system']['backup_ftp_server']);
|
||||||
$ftp_login = ftp_login($ftp_con, $settings['system']['backup_ftp_user'], $settings['system']['backup_ftp_pass']);
|
$ftp_login = ftp_login($ftp_con, $settings['system']['backup_ftp_user'], $settings['system']['backup_ftp_pass']);
|
||||||
|
|
||||||
/* Check whether to use passive mode or not */
|
// Check whether to use passive mode or not
|
||||||
if($settings['system']['backup_ftp_passive'] == 1)
|
if ($settings['system']['backup_ftp_passive'] == 1) {
|
||||||
{
|
|
||||||
ftp_pasv($ftp_con, true);
|
ftp_pasv($ftp_con, true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ftp_pasv($ftp_con, false);
|
ftp_pasv($ftp_con, false);
|
||||||
}
|
}
|
||||||
|
$_file = makeCorrectFile($_ftpdir.'/'.$ftp_file);
|
||||||
$ftp_upload = ftp_put($ftp_con, $ftp_file, $settings['system']['backup_dir'] . $row['loginname'] . "/" . $ftp_file, FTP_BINARY);
|
$ftp_upload = ftp_put($ftp_con, $ftp_file, $_file, FTP_BINARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' finished...' . "\n");
|
fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' finished...' . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// delete old backup data (deletes backup if customer or admin disables backup)
|
// delete old backup data (deletes backup if customer or admin disables backup)
|
||||||
elseif ($row['backup_allowed'] == '0' || $row['backup_enabled'] == '0') {
|
elseif ($row['backup_allowed'] == '0' || $row['backup_enabled'] == '0') {
|
||||||
if (file_exists($settings['system']['backup_dir'] . $row['loginname'] . '/')){
|
$_ftpdir = makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/');
|
||||||
$files = scandir($settings['system']['backup_dir'] . $row['loginname'] . '/');
|
if (file_exists($_ftpdir)){
|
||||||
|
$files = scandir($_ftpdir);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (preg_match('/.*\.tar\.gz$/', $file)){
|
if (preg_match('/.*\.tar\.gz$/', $file)){
|
||||||
safe_exec('rm ' . escapeshellarg($settings['system']['backup_dir']) . escapeshellarg($row['loginname']) . '/' . escapeshellarg($file) . '');
|
$_file = makeCorrectFile($_ftpdir.'/'.$file);
|
||||||
|
safe_exec('rm -f ' . escapeshellarg($_file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,5 +156,3 @@ if($settings['system']['backup_enabled'] == '1'){
|
|||||||
}
|
}
|
||||||
fwrite($debugHandler, 'backup customers finished...' . "\n");
|
fwrite($debugHandler, 'backup customers finished...' . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,161 +0,0 @@
|
|||||||
<?php if (!defined('MASTER_CRONJOB')) die('You cannot access this file directly!');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This file is part of the Froxlor project.
|
|
||||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
|
||||||
* Copyright (c) 2010 the Froxlor 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.froxlor.org/misc/COPYING.txt
|
|
||||||
*
|
|
||||||
* @copyright (c) the authors
|
|
||||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
|
||||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
||||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
|
||||||
* @package Cron
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LOOK INTO EVERY CUSTOMER DIR TO SEE IF THERE ARE ANY .HTACCESS FILE TO "TRANSLATE"
|
|
||||||
*/
|
|
||||||
|
|
||||||
if($settings['system']['webserver'] == 'lighttpd')
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_lighttp.htaccess: Searching for .htaccess files to translate' . "\n");
|
|
||||||
$lpath = makeCorrectDir(strrchr($settings['system']['apacheconf_vhost'], '/'));
|
|
||||||
$htaccessfh = @fopen($lpath . 'syscp-htaccess.conf', 'w');
|
|
||||||
|
|
||||||
if($htaccessfh !== false)
|
|
||||||
{
|
|
||||||
read_directory($settings['system']['documentroot_prefix'], 25, $htaccessfh);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' ERROR: Cannot open file ' . $lpath . 'syscp-htaccess.conf' . "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_lighttp.htaccess: You don\'t use Lighttpd, you do not have to run this cronscript!' . "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FUNCTIONS
|
|
||||||
*/
|
|
||||||
|
|
||||||
function read_directory($dir1 = null, $min_depth = 25, $htaccessfh = null)
|
|
||||||
{
|
|
||||||
global $htaccessfh, $theme;
|
|
||||||
|
|
||||||
if(!is_string($dir1))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$depth = explode("/", $dir1);
|
|
||||||
$current_depth = sizeof($depth);
|
|
||||||
|
|
||||||
if($current_depth < $min_depth)
|
|
||||||
{
|
|
||||||
$min_depth = $current_depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dir = $dir1;
|
|
||||||
$dh = opendir($dir);
|
|
||||||
|
|
||||||
while($file = readdir($dh))
|
|
||||||
{
|
|
||||||
if(($file != ".")
|
|
||||||
&& ($file != ".."))
|
|
||||||
{
|
|
||||||
$file = $dir . "/" . $file;
|
|
||||||
for ($i = 0;$i <= ($current_depth - $min_depth);$i++)
|
|
||||||
|
|
||||||
// $file is sub-directory
|
|
||||||
|
|
||||||
if($ddh = @opendir($file))
|
|
||||||
{
|
|
||||||
read_directory($file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(strtolower($file) == '.htaccess')
|
|
||||||
{
|
|
||||||
parseHtaccess($file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closedir($dh);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseHtaccess($file = null)
|
|
||||||
{
|
|
||||||
global $debugHandler, $htaccessfh, $theme;
|
|
||||||
$htacc = @file_get_contents($file);
|
|
||||||
|
|
||||||
if($htacc != "")
|
|
||||||
{
|
|
||||||
$htlines = array();
|
|
||||||
$htlines = explode("\n", $htacc);
|
|
||||||
$userhasrewrites = false;
|
|
||||||
$userrewrites = array();
|
|
||||||
$rule = array();
|
|
||||||
foreach($htlines as $htl)
|
|
||||||
{
|
|
||||||
if(preg_match('/^RewriteEngine\ on$/si', $htl) !== null)
|
|
||||||
{
|
|
||||||
$userhasrewrites = true;
|
|
||||||
}
|
|
||||||
elseif(preg_match('/^RewriteRule\ +\^(.*)\$\(.*)$/si', $htl, $rule) !== null)
|
|
||||||
{
|
|
||||||
$regex = isset($rule[0]) ? $rule[0] : '';
|
|
||||||
$relativeuri = isset($rule[1]) ? $rule[1] : '';
|
|
||||||
|
|
||||||
if($regex != ''
|
|
||||||
&& $relativeuri != '')
|
|
||||||
{
|
|
||||||
$userrewrites[]['regex'] = $regex;
|
|
||||||
$userrewrites[]['relativeuri'] = $relativeuri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($userhasrewrites)
|
|
||||||
{
|
|
||||||
fwrite($htaccessfh, '$PHYSICAL["path"] == "' . dirname($file) . '" {' . "\n");
|
|
||||||
fwrite($htaccessfh, ' url.rewrite-once = (' . "\n");
|
|
||||||
$count = 1;
|
|
||||||
$max = count($userrewrites);
|
|
||||||
foreach($userrewrites as $usrrw)
|
|
||||||
{
|
|
||||||
fwrite($htaccessfh, ' "^' . $usrrw['regex'] . '$" => "' . $usrrw['relativeuri'] . '"');
|
|
||||||
|
|
||||||
if($count < $max)
|
|
||||||
{
|
|
||||||
fwrite($htaccessfh, ',' . "\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fwrite($htaccessfh, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite($htaccessfh, ' )' . "\n");
|
|
||||||
fwrite($htaccessfh, '}' . "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' WARNING: file ' . $file . ' seems to be empty or there was an error' . "\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -17,9 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
// necessary includes
|
||||||
* necessary includes
|
|
||||||
*/
|
|
||||||
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.dns.10.bind.php');
|
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.dns.10.bind.php');
|
||||||
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.10.apache.php');
|
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.10.apache.php');
|
||||||
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.15.apache_fcgid.php');
|
require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.15.apache_fcgid.php');
|
||||||
@@ -31,13 +29,15 @@ require_once makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.35.nginx_
|
|||||||
/**
|
/**
|
||||||
* LOOK INTO TASKS TABLE TO SEE IF THERE ARE ANY UNDONE JOBS
|
* LOOK INTO TASKS TABLE TO SEE IF THERE ARE ANY UNDONE JOBS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Searching for tasks to do' . "\n");
|
fwrite($debugHandler, ' cron_tasks: Searching for tasks to do' . "\n");
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Searching for tasks to do");
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Searching for tasks to do");
|
||||||
$result_tasks = $db->query("SELECT `id`, `type`, `data` FROM `" . TABLE_PANEL_TASKS . "` ORDER BY `id` ASC");
|
$result_tasks_stmt = Database::query("
|
||||||
|
SELECT `id`, `type`, `data` FROM `" . TABLE_PANEL_TASKS . "` ORDER BY `id` ASC
|
||||||
|
");
|
||||||
|
$num_results = Database::num_rows();
|
||||||
$resultIDs = array();
|
$resultIDs = array();
|
||||||
|
|
||||||
while ($row = $db->fetch_array($result_tasks)) {
|
while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
|
||||||
$resultIDs[] = $row['id'];
|
$resultIDs[] = $row['id'];
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
/**
|
/**
|
||||||
* TYPE=1 MEANS TO REBUILD APACHE VHOSTS.CONF
|
* TYPE=1 MEANS TO REBUILD APACHE VHOSTS.CONF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($row['type'] == '1') {
|
if ($row['type'] == '1') {
|
||||||
|
|
||||||
// get configuration-I/O object
|
// get configuration-I/O object
|
||||||
@@ -89,6 +88,7 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* FIXME
|
||||||
* as we might have a change from mod_php to fcgid/fpm or the other way around
|
* as we might have a change from mod_php to fcgid/fpm or the other way around
|
||||||
* we need to check customer directory permissions
|
* we need to check customer directory permissions
|
||||||
* -> 0.9.31
|
* -> 0.9.31
|
||||||
@@ -104,20 +104,28 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
fwrite($debugHandler, ' cron_tasks: Task2 started - create new home' . "\n");
|
fwrite($debugHandler, ' cron_tasks: Task2 started - create new home' . "\n");
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task2 started - create new home');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task2 started - create new home');
|
||||||
|
|
||||||
if(is_array($row['data']))
|
if (is_array($row['data'])) {
|
||||||
{
|
|
||||||
// define paths
|
// define paths
|
||||||
$userhomedir = makeCorrectDir($settings['system']['documentroot_prefix'] . '/' . $row['data']['loginname'] . '/');
|
$userhomedir = makeCorrectDir($settings['system']['documentroot_prefix'] . '/' . $row['data']['loginname'] . '/');
|
||||||
$usermaildir = makeCorrectDir($settings['system']['vmail_homedir'] . '/' . $row['data']['loginname'] . '/');
|
$usermaildir = makeCorrectDir($settings['system']['vmail_homedir'] . '/' . $row['data']['loginname'] . '/');
|
||||||
|
|
||||||
// stats directory
|
// stats directory
|
||||||
if($settings['system']['awstats_enabled'] == '1')
|
if ($settings['system']['awstats_enabled'] == '1') {
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: mkdir -p ' . escapeshellarg($userhomedir . 'awstats'));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: mkdir -p ' . escapeshellarg($userhomedir . 'awstats'));
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($userhomedir . 'awstats'));
|
safe_exec('mkdir -p ' . escapeshellarg($userhomedir . 'awstats'));
|
||||||
|
// in case we changed from the other stats -> remove old
|
||||||
|
// (yes i know, the stats are lost - that's why you should not change all the time!)
|
||||||
|
if (file_exists($userhomedir . 'webalizer')) {
|
||||||
|
safe_exec('rm -rf ' . escapeshellarg($userhomedir . 'webalizer'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: mkdir -p ' . escapeshellarg($userhomedir . 'webalizer'));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: mkdir -p ' . escapeshellarg($userhomedir . 'webalizer'));
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($userhomedir . 'webalizer'));
|
safe_exec('mkdir -p ' . escapeshellarg($userhomedir . 'webalizer'));
|
||||||
|
// in case we changed from the other stats -> remove old
|
||||||
|
// (yes i know, the stats are lost - that's why you should not change all the time!)
|
||||||
|
if (file_exists($userhomedir . 'awstats')) {
|
||||||
|
safe_exec('rm -rf ' . escapeshellarg($userhomedir . 'awstats'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// maildir
|
// maildir
|
||||||
@@ -125,8 +133,7 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
safe_exec('mkdir -p ' . escapeshellarg($usermaildir));
|
safe_exec('mkdir -p ' . escapeshellarg($usermaildir));
|
||||||
|
|
||||||
//check if admin of customer has added template for new customer directories
|
//check if admin of customer has added template for new customer directories
|
||||||
if((int)$row['data']['store_defaultindex'] == 1)
|
if ((int)$row['data']['store_defaultindex'] == 1) {
|
||||||
{
|
|
||||||
storeDefaultIndex($row['data']['loginname'], $userhomedir, $cronlog, true);
|
storeDefaultIndex($row['data']['loginname'], $userhomedir, $cronlog, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,25 +148,15 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TYPE=3 MEANS TO DO NOTHING
|
|
||||||
*/
|
|
||||||
elseif ($row['type'] == '3')
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TYPE=4 MEANS THAT SOMETHING IN THE BIND CONFIG HAS CHANGED. REBUILD froxlor_bind.conf IF BIND IS ENABLED
|
* TYPE=4 MEANS THAT SOMETHING IN THE BIND CONFIG HAS CHANGED. REBUILD froxlor_bind.conf IF BIND IS ENABLED
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '4' && (int)$settings['system']['bind_enable'] != 0)
|
elseif ($row['type'] == '4' && (int)$settings['system']['bind_enable'] != 0) {
|
||||||
{
|
if (!isset($nameserver)) {
|
||||||
if(!isset($nameserver))
|
|
||||||
{
|
|
||||||
$nameserver = new bind($db, $cronlog, $debugHandler, $settings);
|
$nameserver = new bind($db, $cronlog, $debugHandler, $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings['dkim']['use_dkim'] == '1')
|
if ($settings['dkim']['use_dkim'] == '1') {
|
||||||
{
|
|
||||||
$nameserver->writeDKIMconfigs();
|
$nameserver->writeDKIMconfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,13 +166,16 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
/**
|
/**
|
||||||
* TYPE=5 MEANS THAT A NEW FTP-ACCOUNT HAS BEEN CREATED, CREATE THE DIRECTORY
|
* TYPE=5 MEANS THAT A NEW FTP-ACCOUNT HAS BEEN CREATED, CREATE THE DIRECTORY
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '5')
|
elseif ($row['type'] == '5') {
|
||||||
{
|
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Creating new FTP-home');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Creating new FTP-home');
|
||||||
$result_directories = $db->query('SELECT `f`.`homedir`, `f`.`uid`, `f`.`gid`, `c`.`documentroot` AS `customerroot` FROM `' . TABLE_FTP_USERS . '` `f` LEFT JOIN `' . TABLE_PANEL_CUSTOMERS . '` `c` USING (`customerid`) WHERE `f`.`username` NOT LIKE \'%_backup\'');
|
// FIXME %_backup clause not necessary after backup-feature is being removed
|
||||||
|
$result_directories_stmt = Database::query("
|
||||||
|
SELECT `f`.`homedir`, `f`.`uid`, `f`.`gid`, `c`.`documentroot` AS `customerroot`
|
||||||
|
FROM `" . TABLE_FTP_USERS . "` `f` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING (`customerid`)
|
||||||
|
WHERE `f`.`username` NOT LIKE '%_backup'
|
||||||
|
");
|
||||||
|
|
||||||
while($directory = $db->fetch_array($result_directories))
|
while ($directory = $db->fetch_array($result_directories)) {
|
||||||
{
|
|
||||||
mkDirWithCorrectOwnership($directory['customerroot'], $directory['homedir'], $directory['uid'], $directory['gid']);
|
mkDirWithCorrectOwnership($directory['customerroot'], $directory['homedir'], $directory['uid'], $directory['gid']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,90 +183,77 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
/**
|
/**
|
||||||
* TYPE=6 MEANS THAT A CUSTOMER HAS BEEN DELETED AND THAT WE HAVE TO REMOVE ITS FILES
|
* TYPE=6 MEANS THAT A CUSTOMER HAS BEEN DELETED AND THAT WE HAVE TO REMOVE ITS FILES
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '6')
|
elseif ($row['type'] == '6') {
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Task6 started - deleting customer data' . "\n");
|
fwrite($debugHandler, ' cron_tasks: Task6 started - deleting customer data' . "\n");
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task6 started - deleting customer data');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task6 started - deleting customer data');
|
||||||
|
|
||||||
if(is_array($row['data']))
|
if (is_array($row['data'])) {
|
||||||
{
|
if (isset($row['data']['loginname'])) {
|
||||||
if(isset($row['data']['loginname']))
|
// remove homedir
|
||||||
{
|
|
||||||
/*
|
|
||||||
* remove homedir
|
|
||||||
*/
|
|
||||||
$homedir = makeCorrectDir($settings['system']['documentroot_prefix'] . '/' . $row['data']['loginname']);
|
$homedir = makeCorrectDir($settings['system']['documentroot_prefix'] . '/' . $row['data']['loginname']);
|
||||||
|
|
||||||
if($homedir != '/'
|
if (file_exists($homedir)
|
||||||
|
&& $homedir != '/'
|
||||||
&& $homedir != $settings['system']['documentroot_prefix']
|
&& $homedir != $settings['system']['documentroot_prefix']
|
||||||
&& substr($homedir, 0, strlen($settings['system']['documentroot_prefix'])) == $settings['system']['documentroot_prefix'])
|
&& substr($homedir, 0, strlen($settings['system']['documentroot_prefix'])) == $settings['system']['documentroot_prefix']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($homedir));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($homedir));
|
||||||
safe_exec('rm -rf '.escapeshellarg($homedir));
|
safe_exec('rm -rf '.escapeshellarg($homedir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// remove backup dir
|
||||||
* remove backup dir
|
// FIXME remove when backup-feature has been removed
|
||||||
*/
|
|
||||||
$backupdir = makeCorrectDir($settings['system']['backup_dir'] . $row['data']['loginname']);
|
$backupdir = makeCorrectDir($settings['system']['backup_dir'] . $row['data']['loginname']);
|
||||||
|
|
||||||
if($backupdir != '/'
|
if (file_exists($backupdir)
|
||||||
|
&& $backupdir != '/'
|
||||||
&& $backupdir != $settings['system']['backup_dir']
|
&& $backupdir != $settings['system']['backup_dir']
|
||||||
&& substr($backupdir, 0, strlen($settings['system']['backup_dir'])) == $settings['system']['backup_dir'])
|
&& substr($backupdir, 0, strlen($settings['system']['backup_dir'])) == $settings['system']['backup_dir']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($backupdir));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($backupdir));
|
||||||
safe_exec('rm -rf '.escapeshellarg($backupdir));
|
safe_exec('rm -rf '.escapeshellarg($backupdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// remove maildir
|
||||||
* remove maildir
|
|
||||||
*/
|
|
||||||
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] . '/' . $row['data']['loginname']);
|
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] . '/' . $row['data']['loginname']);
|
||||||
|
|
||||||
if($maildir != '/'
|
if (file_exists($maildir)
|
||||||
|
&& $maildir != '/'
|
||||||
&& $maildir != $settings['system']['vmail_homedir']
|
&& $maildir != $settings['system']['vmail_homedir']
|
||||||
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
||||||
&& is_dir($maildir)
|
&& is_dir($maildir)
|
||||||
&& fileowner($maildir) == $settings['system']['vmail_uid']
|
&& fileowner($maildir) == $settings['system']['vmail_uid']
|
||||||
&& filegroup($maildir) == $settings['system']['vmail_gid'])
|
&& filegroup($maildir) == $settings['system']['vmail_gid']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
|
||||||
safe_exec('rm -rf '.escapeshellarg($maildir));
|
safe_exec('rm -rf '.escapeshellarg($maildir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// remove tmpdir if it exists
|
||||||
* remove tmpdir if it exists
|
|
||||||
*/
|
|
||||||
$tmpdir = makeCorrectDir($settings['system']['mod_fcgid_tmpdir'] . '/' . $row['data']['loginname'] . '/');
|
$tmpdir = makeCorrectDir($settings['system']['mod_fcgid_tmpdir'] . '/' . $row['data']['loginname'] . '/');
|
||||||
|
|
||||||
if (is_dir($tmpdir)
|
if (file_exists($tmpdir)
|
||||||
|
&& is_dir($tmpdir)
|
||||||
&& $tmpdir != "/"
|
&& $tmpdir != "/"
|
||||||
&& $tmpdir != $settings['system']['mod_fcgid_tmpdir']
|
&& $tmpdir != $settings['system']['mod_fcgid_tmpdir']
|
||||||
&& substr($tmpdir, 0, strlen($settings['system']['mod_fcgid_tmpdir'])) == $settings['system']['mod_fcgid_tmpdir'])
|
&& substr($tmpdir, 0, strlen($settings['system']['mod_fcgid_tmpdir'])) == $settings['system']['mod_fcgid_tmpdir']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($tmpdir));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($tmpdir));
|
||||||
safe_exec('rm -rf '.escapeshellarg($tmpdir));
|
safe_exec('rm -rf '.escapeshellarg($tmpdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// webserver logs
|
||||||
* see if we have some php-fcgid leftovers if used
|
|
||||||
* and remove them, #200
|
|
||||||
* UPDATE: this is being done in ConfigIO::cleanUp()
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* webserver logs
|
|
||||||
*/
|
|
||||||
$logsdir = makeCorrectFile($settings['system']['logfiles_directory'].'/'.$row['data']['loginname']);
|
$logsdir = makeCorrectFile($settings['system']['logfiles_directory'].'/'.$row['data']['loginname']);
|
||||||
if ($logsdir != '/'
|
|
||||||
|
if (file_exists($logsdir)
|
||||||
|
&& $logsdir != '/'
|
||||||
&& $logsdir != makeCorrectDir($settings['system']['logfiles_directory'])
|
&& $logsdir != makeCorrectDir($settings['system']['logfiles_directory'])
|
||||||
&& substr($logsdir, 0, strlen($settings['system']['logfiles_directory'])) == $settings['system']['logfiles_directory']
|
&& substr($logsdir, 0, strlen($settings['system']['logfiles_directory'])) == $settings['system']['logfiles_directory']
|
||||||
) {
|
) {
|
||||||
// build up wildcard for webX-{access,error}.log{*}
|
// build up wildcard for webX-{access,error}.log{*}
|
||||||
$logfiles = $logsdir.'-*';
|
$logfiles .= '-*';
|
||||||
safe_exec('rm -f '.escapeshellarg($logfiles));
|
safe_exec('rm -f '.escapeshellarg($logfiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,19 +261,16 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
/**
|
/**
|
||||||
* TYPE=7 Customer deleted an email account and wants the data to be deleted on the filesystem
|
* TYPE=7 Customer deleted an email account and wants the data to be deleted on the filesystem
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '7')
|
elseif ($row['type'] == '7') {
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Task7 started - deleting customer e-mail data' . "\n");
|
fwrite($debugHandler, ' cron_tasks: Task7 started - deleting customer e-mail data' . "\n");
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task7 started - deleting customer e-mail data');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task7 started - deleting customer e-mail data');
|
||||||
|
|
||||||
if(is_array($row['data']))
|
if (is_array($row['data'])) {
|
||||||
{
|
|
||||||
if (isset($row['data']['loginname'])
|
if (isset($row['data']['loginname'])
|
||||||
&& isset($row['data']['email'])
|
&& isset($row['data']['email'])
|
||||||
) {
|
) {
|
||||||
/*
|
// remove specific maildir
|
||||||
* remove specific maildir
|
|
||||||
*/
|
|
||||||
$email_full = $row['data']['email'];
|
$email_full = $row['data']['email'];
|
||||||
if (empty($email_full)) {
|
if (empty($email_full)) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_ERROR, 'FATAL: Task7 asks to delete a email account but email field is empty!');
|
$cronlog->logAction(CRON_ACTION, LOG_ERROR, 'FATAL: Task7 asks to delete a email account but email field is empty!');
|
||||||
@@ -296,31 +280,37 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
$maildirname = trim($settings['system']['vmail_maildirname']);
|
$maildirname = trim($settings['system']['vmail_maildirname']);
|
||||||
// Add trailing slash to Maildir if needed
|
// Add trailing slash to Maildir if needed
|
||||||
$maildirpath = $maildirname;
|
$maildirpath = $maildirname;
|
||||||
if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/";
|
if (!empty($maildirname) and substr($maildirname,-1) != "/") {
|
||||||
|
$maildirpath .= "/";
|
||||||
|
}
|
||||||
|
|
||||||
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $email_domain .'/'. $email_user);
|
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $email_domain .'/'. $email_user);
|
||||||
|
|
||||||
if($maildir != '/' && !empty($maildir) && !empty($email_full)
|
if ($maildir != '/'
|
||||||
|
&& !empty($maildir)
|
||||||
|
&& !empty($email_full)
|
||||||
&& $maildir != $settings['system']['vmail_homedir']
|
&& $maildir != $settings['system']['vmail_homedir']
|
||||||
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
||||||
&& is_dir($maildir)
|
&& is_dir($maildir)
|
||||||
&& is_dir(makeCorrectDir($maildir.'/'.$maildirpath))
|
&& is_dir(makeCorrectDir($maildir.'/'.$maildirpath))
|
||||||
&& fileowner($maildir) == $settings['system']['vmail_uid']
|
&& fileowner($maildir) == $settings['system']['vmail_uid']
|
||||||
&& filegroup($maildir) == $settings['system']['vmail_gid'])
|
&& filegroup($maildir) == $settings['system']['vmail_gid']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
|
||||||
safe_exec('rm -rf '.escapeshellarg($maildir));
|
safe_exec('rm -rf '.escapeshellarg($maildir));
|
||||||
}
|
|
||||||
else {
|
} else {
|
||||||
// backward-compatibility for old folder-structure
|
// backward-compatibility for old folder-structure
|
||||||
$maildir_old = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $row['data']['email']);
|
$maildir_old = makeCorrectDir($settings['system']['vmail_homedir'] .'/'. $row['data']['loginname'] .'/'. $row['data']['email']);
|
||||||
|
|
||||||
if ($maildir_old != '/' && !empty($maildir_old)
|
if ($maildir_old != '/'
|
||||||
|
&& !empty($maildir_old)
|
||||||
&& $maildir_old != $settings['system']['vmail_homedir']
|
&& $maildir_old != $settings['system']['vmail_homedir']
|
||||||
&& substr($maildir_old, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
&& substr($maildir_old, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir']
|
||||||
&& is_dir($maildir_old)
|
&& is_dir($maildir_old)
|
||||||
&& fileowner($maildir_old) == $settings['system']['vmail_uid']
|
&& fileowner($maildir_old) == $settings['system']['vmail_uid']
|
||||||
&& filegroup($maildir_old) == $settings['system']['vmail_gid'])
|
&& filegroup($maildir_old) == $settings['system']['vmail_gid']
|
||||||
{
|
) {
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir_old));
|
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir_old));
|
||||||
safe_exec('rm -rf '.escapeshellarg($maildir_old));
|
safe_exec('rm -rf '.escapeshellarg($maildir_old));
|
||||||
}
|
}
|
||||||
@@ -333,23 +323,21 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
* TYPE=8 Customer deleted a ftp account and wants the homedir to be deleted on the filesystem
|
* TYPE=8 Customer deleted a ftp account and wants the homedir to be deleted on the filesystem
|
||||||
* refs #293
|
* refs #293
|
||||||
*/
|
*/
|
||||||
elseif ($row['type'] == '8')
|
elseif ($row['type'] == '8') {
|
||||||
{
|
|
||||||
fwrite($debugHandler, ' cron_tasks: Task8 started - deleting customer ftp homedir' . "\n");
|
fwrite($debugHandler, ' cron_tasks: Task8 started - deleting customer ftp homedir' . "\n");
|
||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task8 started - deleting customer ftp homedir');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task8 started - deleting customer ftp homedir');
|
||||||
|
|
||||||
if(is_array($row['data']))
|
if (is_array($row['data'])) {
|
||||||
{
|
|
||||||
if (isset($row['data']['loginname'])
|
if (isset($row['data']['loginname'])
|
||||||
&& isset($row['data']['homedir'])
|
&& isset($row['data']['homedir'])
|
||||||
) {
|
) {
|
||||||
/*
|
// remove specific homedir
|
||||||
* remove specific homedir
|
|
||||||
*/
|
|
||||||
$ftphomedir = makeCorrectDir($row['data']['homedir']);
|
$ftphomedir = makeCorrectDir($row['data']['homedir']);
|
||||||
$customerdocroot = makeCorrectDir($settings['system']['documentroot_prefix'].'/'.$row['data']['loginname'].'/');
|
$customerdocroot = makeCorrectDir($settings['system']['documentroot_prefix'].'/'.$row['data']['loginname'].'/');
|
||||||
|
|
||||||
if($ftphomedir != '/'
|
if(file_exists($ftphomedir)
|
||||||
|
&& $ftphomedir != '/'
|
||||||
&& $ftphomedir != $settings['system']['documentroot_prefix']
|
&& $ftphomedir != $settings['system']['documentroot_prefix']
|
||||||
&& $ftphomedir != $customerdocroot
|
&& $ftphomedir != $customerdocroot
|
||||||
) {
|
) {
|
||||||
@@ -371,8 +359,8 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
$usedquota = getFilesystemQuota();
|
$usedquota = getFilesystemQuota();
|
||||||
|
|
||||||
// Select all customers Froxlor knows about
|
// Select all customers Froxlor knows about
|
||||||
$result = $db->query("SELECT `guid`, `loginname`, `diskspace` FROM `" . TABLE_PANEL_CUSTOMERS . "`;");
|
$result_stmt = Database::query("SELECT `guid`, `loginname`, `diskspace` FROM `" . TABLE_PANEL_CUSTOMERS . "`;");
|
||||||
while ($row = $db->fetch_array($result)) {
|
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
// We do not want to set a quota for root by accident
|
// We do not want to set a quota for root by accident
|
||||||
if ($row['guid'] != 0) {
|
if ($row['guid'] != 0) {
|
||||||
// The user has no quota in Froxlor, but on the filesystem
|
// The user has no quota in Froxlor, but on the filesystem
|
||||||
@@ -394,15 +382,18 @@ while ($row = $db->fetch_array($result_tasks)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($db->num_rows($result_tasks) != 0) {
|
if ($num_results != 0) {
|
||||||
$where = array();
|
$where = array();
|
||||||
|
$where_data = array();
|
||||||
foreach ($resultIDs as $id) {
|
foreach ($resultIDs as $id) {
|
||||||
$where[] = '`id`=\'' . (int)$id . '\'';
|
$where[] = "`id` = :id_" . (int)$id;
|
||||||
|
$where_data['id_'.$id] = $id;
|
||||||
}
|
}
|
||||||
$where = implode($where, ' OR ');
|
$where = implode($where, ' OR ');
|
||||||
$db->query('DELETE FROM `' . TABLE_PANEL_TASKS . '` WHERE ' . $where);
|
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_TASKS . "` WHERE " . $where);
|
||||||
|
Database::pexecute($del_stmt, $where_data);
|
||||||
unset($resultIDs);
|
unset($resultIDs);
|
||||||
unset($where);
|
unset($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'last_tasks_run\' ');
|
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = 'system' AND `varname` = 'last_tasks_run';");
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
'mail' => $current_diskspace['mail'],
|
'mail' => $current_diskspace['mail'],
|
||||||
'mysql' => $current_diskspace['mysql']
|
'mysql' => $current_diskspace['mysql']
|
||||||
);
|
);
|
||||||
$ins_stmt = Database::preapre("
|
$ins_stmt = Database::prepare("
|
||||||
INSERT INTO `" . TABLE_PANEL_DISKSPACE . "` SET
|
INSERT INTO `" . TABLE_PANEL_DISKSPACE . "` SET
|
||||||
`customerid` = :customerid,
|
`customerid` = :customerid,
|
||||||
`year` = :year,
|
`year` = :year,
|
||||||
@@ -535,7 +535,7 @@ while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
'mail' => $admin_diskspace[$row['adminid']]['mail'],
|
'mail' => $admin_diskspace[$row['adminid']]['mail'],
|
||||||
'mysql' => $admin_diskspace[$row['adminid']]['mysql']
|
'mysql' => $admin_diskspace[$row['adminid']]['mysql']
|
||||||
);
|
);
|
||||||
$ins_stmt = Database::preapre("
|
$ins_stmt = Database::prepare("
|
||||||
INSERT INTO `" . TABLE_PANEL_DISKSPACE_ADMINS . "` SET
|
INSERT INTO `" . TABLE_PANEL_DISKSPACE_ADMINS . "` SET
|
||||||
`adminid` = :adminid,
|
`adminid` = :adminid,
|
||||||
`year` = :year,
|
`year` = :year,
|
||||||
|
|||||||
Reference in New Issue
Block a user