public function cronDbBackup() { require_once WCF_DIR . 'lib/system/database/DatabaseDumper.class.php'; $allTables = WCF::getDB()->getTableNames(); $tablesEx = DatabaseDumper::getTableStates($allTables); $rowCount = 0; $tables = array(); foreach ($tablesEx as $table) { $rowCount += $table['Rows']; $tables[] = $table['Name']; } // comment buffer $limit = $rowCount + 10000; $offset = -1; $backupFile = WCF_DIR . 'acp/backup/' . date('YmdHis') . '.sql.gz'; $file = new ZipFile($backupFile, 'wb'); $loopTimeLimit = 3600; $loopStart = time(); $tableName = ''; // write header info $head = "-- WoltLab Community Framework\n"; $head .= "-- database: " . WCF::getDB()->getDatabaseName() . "\n"; $head .= "-- generated at " . date('r') . "\n\n"; $head .= "-- DO NOT EDIT THIS FILE\n\n"; $head .= "-- WCF DATABASE CHARSET\n"; $head .= "SET NAMES " . WCF::getDB()->getCharset() . ";\n\n"; $file->write($head); @set_time_limit(3600); DatabaseDumper::export($file, $tables, $limit, $loopTimeLimit, $loopStart, 0, $tableName); }