* 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 Froxlor team <*****@*****.**> (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Cron * */ if (@php_sapi_name() != 'cli') { die('This script will only work in the shell'); } openRootDB($debugHandler, $lockfile); /** * Backup */ if ($settings['system']['backup_enabled'] == '1') { 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;"); while ($row = $db->fetch_array($result)) { fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' started...' . "\n"); // backup if ($row['backup_allowed'] == '1' && $row['backup_enabled'] == '1') { // get uid & gid from ftp table $ftp_result = $db->query("SELECT uid, gid FROM `" . TABLE_FTP_USERS . "` WHERE `username` = '" . $db->escape($row['loginname']) . "';"); $ftp_row = mysql_fetch_array($ftp_result); // create backup dir an set rights if (!file_exists($settings['system']['backup_dir'] . $row['loginname'])) {
} if ($nonefound) { showUpdateStep("No missing settings found"); lastStepStatus(0); } updateToVersion('0.9.10-svn1'); } if (isFroxlorVersion('0.9.10-svn1')) { showUpdateStep("Updating from 0.9.10-svn1 to 0.9.10-svn2", false); showUpdateStep("Updating database table definition for panel_databases"); $db->query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` ADD `apsdb` tinyint(1) NOT NULL default '0' AFTER `dbserver`;"); lastStepStatus(0); showUpdateStep("Adding APS databases to customers overview"); $count_dbupdates = 0; $db_root = null; openRootDB(); $result = $db_root->query("SHOW DATABASES;"); while ($row = $db_root->fetch_array($result)) { if (preg_match('/^web([0-9]+)aps([0-9]+)$/', $row['Database'], $matches)) { $cid = $matches[1]; $databasedescription = 'APS DB'; $result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) VALUES ("' . (int) $cid . '", "' . $db->escape($row['Database']) . '", "' . $db->escape($databasedescription) . '", "0", "1")'); $result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1 WHERE `customerid`="' . (int) $cid . '"'); $count_dbupdates++; } } closeRootDB(); if ($count_dbupdates > 0) { lastStepStatus(0, "Found " . $count_dbupdates . " customer APS databases"); } else { lastStepStatus(0, "None found");