'')); $dbp = str_replace('_', '\_', $match[2]); } else { $db = false; $dbp = $db_prefix; } // Dump each table. $tables = $smcFunc['db_list_tables'](false, $db_prefix . '%'); foreach ($tables as $tableName) { // Are we dumping the structures? if (isset($_REQUEST['struct'])) { $db_chunks .= $crlf . '--' . $crlf . '-- Table structure for table `' . $tableName . '`' . $crlf . '--' . $crlf . $crlf . $smcFunc['db_table_sql']($tableName) . ';' . $crlf; } else // This is needed to speedup things later $smcFunc['db_table_sql']($tableName); // How about the data? if (!isset($_REQUEST['data']) || substr($tableName, -10) == 'log_errors') continue; $first_round = true; $close_table = false; // Are there any rows in this table? while ($get_rows = $smcFunc['db_insert_sql']($tableName, $first_round)) { if (empty($get_rows)) break; // Time is what we need here! if (function_exists('apache_reset_timeout')) @apache_reset_timeout(); elseif (!empty($time_limit) && ($start_time + $time_limit - 20 > time())) { $start_time = time(); @set_time_limit(150); } if ($first_round) { $db_chunks .= $crlf . '--' . $crlf . '-- Dumping data in `' . $tableName . '`' . $crlf . '--' . $crlf . $crlf; $first_round = false; } $db_chunks .= $get_rows; $current_used_memory += $smcFunc['strlen']($db_chunks); $db_backup .= $db_chunks; unset($db_chunks); $db_chunks = ''; if ($current_used_memory > $memory_limit) { echo $output_function($db_backup); $current_used_memory = 0; // This is probably redundant unset($db_backup); $db_backup = ''; } $close_table = true; } // No rows to get - skip it. if ($close_table) $db_backup .= '-- --------------------------------------------------------' . $crlf; } $db_backup .= $crlf . '-- Done' . $crlf; echo $output_function($db_backup); exit; } /** * Dummy/helper function, it simply returns the string passed as argument * @param $string, a string * @return the string passed */ function un_compressed($string = '') { return $string; }