23 include __DIR__ .
'/header.php';
31 $op =
$system->cleanVars($_REQUEST,
'op',
'list',
'string');
34 $xoops->header(
'admin:maintenance/maintenance_dump.tpl');
45 foreach (
$files as $filename_path) {
46 $filename = basename(strtolower($filename_path));
47 if ($filename !=
'index.html') {
48 $file_arr[
$count][
'name'] = $filename;
49 $stat = stat($filename_path);
50 $file_arr[
$count][
'size'] = number_format($stat[
'size']/1024);
55 if (isset($file_arr)) {
56 $xoops->tpl()->assign(
'file_arr', array_reverse($file_arr));
65 $xoops->tpl()->assign(
'files',
true);
71 if (!
$xoops->security()->check()) {
72 $xoops->redirect(
'dump.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
77 $dump_modules = isset($_REQUEST[
'dump_modules']) ? $_REQUEST[
'dump_modules'] :
false;
78 $dump_tables = isset($_REQUEST[
'dump_tables']) ? $_REQUEST[
'dump_tables'] :
false;
79 $drop =
$system->cleanVars($_REQUEST,
'drop', 1,
'int');
81 if (($dump_tables ==
true && $dump_modules ==
true) || ($dump_tables ==
false && $dump_modules ==
false)) {
87 $sql_text .=
"# Dump SQL, Generated by XOOPS \n";
89 $sql_text .=
"# \n\n";
90 if ($dump_tables !=
false) {
91 $result_module = array();
92 for (
$i = 0;
$i < count($dump_tables); ++
$i) {
94 $result_tables[
$i][
'name'] = $db->prefix .
'_' . $dump_tables[
$i];
95 $result_structure = $dump->dump_table_structure($db->prefix .
'_' . $dump_tables[
$i], $drop);
96 $sql_text .= $result_structure[
'sql_text'];
97 $result_tables[
$i][
'structure'] = $result_structure[
'structure'];
99 $result_data = $dump->dump_table_datas($db->prefix .
'_' . $dump_tables[$i]);
100 $sql_text .= $result_data[
'sql_text'];
101 $result_tables[
$i][
'records'] = $result_data[
'records'];
103 $xoops->tpl()->assign(
'result_t', $result_tables);
105 if ($dump_modules !=
false) {
106 $result_module = array();
107 for ($i = 0; $i < count($dump_modules); ++
$i) {
110 $result_module[
$i][
'name'] = ucfirst($dump_modules[$i]);
111 $modtables =
$module->getInfo(
'tables');
112 if ($modtables !=
false && is_array($modtables)) {
114 foreach ($modtables as $table) {
116 $result_tables[
$count][
'name'] = $db->prefix .
'_' . $table;
117 $result_structure = $dump->dump_table_structure($db->prefix .
'_' . $table, $drop);
118 $sql_text .= $result_structure[
'sql_text'];
119 $result_tables[
$count][
'structure'] = $result_structure[
'structure'];
122 $result_data = $dump->dump_table_datas($db->prefix .
'_' . $table);
123 $sql_text .= $result_data[
'sql_text'];
124 $result_tables[
$count][
'records'] = $result_data[
'records'];
127 $result_module[
$i][
'table'] = $result_tables;
129 $result_module[
$i][
'table'] =
false;
131 unset($result_tables);
133 $xoops->tpl()->assign(
'result_m', $result_module);
135 $xoops->tpl()->assign(
'result_write',
true);
136 $result_write = $dump->dump_write($sql_text);
137 $xoops->tpl()->assign(
'write', $result_write[
'write']);
138 $xoops->tpl()->assign(
'file_name', $result_write[
'file_name']);
142 $filename =
$system->cleanVars($_REQUEST,
'filename',
'',
'string');
143 if ($filename ==
'') {
150 case 'dump_deleteall':
153 foreach (
$files as $filename_path) {
154 if (basename(strtolower($filename_path)) !=
'index.html') {
155 unlink($filename_path);
162 $form =
$xoops->getModuleForm(null,
'maintenance');
const _AM_MAINTENANCE_DUMP_ERROR_TABLES_OR_MODULES
const _AM_MAINTENANCE_DUMP_DELETED
static getFormatMediumDate()
const _AM_MAINTENANCE_DUMP_LIST
const _AM_MAINTENANCE_DUMP_NOFILE
const _AM_MAINTENANCE_DUMP_DELETEDALL
const _AM_MAINTENANCE_DUMP_FORM