public function writeDump($filename) { if (!dbBackup::setOutputFile($filename)) { return false; } dbBackup::doDump(); dbBackup::closeFile($this->file); return true; }
define('PATH', dirname(__FILE__) . '/'); define('PARENT', 1); define('CRON_RUN', 1); include PATH . 'control/system/core/init.php'; include PATH . 'control/mail-data.php'; include PATH . 'control/classes/class.backup.php'; if (!is_writeable(PATH . 'backups') || !is_dir(PATH . 'backups')) { die('"<b>' . PATH . 'backups' . '</b>" folder must exist and be writeable. Please check directory and permissions..'); } $filepath = PATH . 'backups/' . $msg_script33 . '-' . date('dMY', $MSDT->mswTimeStamp()) . '-' . date('His', $MSDT->mswTimeStamp()) . '.gz'; $BACKUP = new dbBackup($filepath, true); $BACKUP->settings = $SETTINGS; //----------------------- // Backup database //----------------------- $BACKUP->doDump(); //------------------------------------------- // Send emails if there are backup emails.. //------------------------------------------- if (file_exists($filepath) && $SETTINGS->backupEmails) { $em_add = ''; $em = ''; if (strpos($SETTINGS->backupEmails, ',') !== false) { // Multiple addresses.. $emails = array_map('trim', explode(',', $SETTINGS->backupEmails)); // First email is main address.. if (isset($emails[0])) { $em = $emails[0]; // Now remove it from array.. unset($emails[0]); }