Ejemplo n.º 1
0
$tab = "admin";
$nav = "dump";
/**
 * Checking permissions
 */
require_once "../auth/login_check.php";
loginCheck(OPEN_PROFILE_ADMINISTRATOR, false);
// Not in DEMO to prevent users' malice
require_once "../lib/Dump.php";
@set_time_limit(OPEN_EXEC_TIME_LIMIT);
$auxConn = new DbConnection();
if (!$auxConn->connect()) {
    $auxConn->close();
    Error::connection($auxConn);
}
$localQuery = 'SHOW TABLE STATUS FROM ' . Dump::backQuote(OPEN_DATABASE);
if (!$auxConn->exec($localQuery)) {
    $auxConn->close();
    Error::connection($auxConn);
}
/**
 * Show page
 */
$title = _("Optimize Database");
require_once "../layout/header.php";
/**
 * Breadcrumb
 */
$links = array(_("Admin") => "../admin/index.php", _("Dumps") => "../admin/dump_view_form.php", $title => "");
echo HTML::breadcrumb($links, "icon icon_dump");
unset($links);
Ejemplo n.º 2
0
     $tmpSelect = implode($_POST['table_select'], OPEN_SEPARATOR);
     $tmpSelect = OPEN_SEPARATOR . $tmpSelect . OPEN_SEPARATOR;
 } else {
     $tableSelect = _("All Tables");
 }
 $dumpBuffer .= '# ' . sprintf(_("Table Summary: %s"), $tableSelect) . DUMP_CRLF . '# ' . str_repeat('-', 45) . DUMP_CRLF;
 if (isset($_POST['create_db'])) {
     $dumpBuffer .= DUMP_CRLF . 'CREATE DATABASE ' . OPEN_DATABASE . ';' . DUMP_CRLF;
 }
 if (isset($_POST['use_dbname'])) {
     $dumpBuffer .= DUMP_CRLF . 'USE ' . OPEN_DATABASE . ';' . DUMP_CRLF;
 }
 for ($i = 0; $i < $numTables; $i++) {
     $table = $single ? $_POST['table_select'][$i] : $auxConn->tableName($i);
     if (isset($tmpSelect) && strpos(' ' . $tmpSelect, OPEN_SEPARATOR . $table . OPEN_SEPARATOR) || !isset($tmpSelect) && !empty($table)) {
         $formattedTableName = isset($_POST['use_backquotes']) ? Dump::backQuote($table) : '"' . $table . '"';
         // If only datas, no need to displays table name
         if ($_POST['what'] != 'dataonly') {
             $dumpBuffer .= DUMP_CRLF . '#' . DUMP_CRLF . '# ' . sprintf(_("Table structure for table %s"), $formattedTableName) . DUMP_CRLF . '#' . DUMP_CRLF . DUMP_CRLF . Dump::SQLDefinition(OPEN_DATABASE, $table, array('drop' => isset($_POST['drop']) ? $_POST['drop'] : null, 'use_backquotes' => isset($_POST['use_backquotes']) ? $_POST['use_backquotes'] : null)) . ';' . DUMP_CRLF;
         }
         // At least data
         if ($_POST['what'] == 'data' || $_POST['what'] == 'dataonly') {
             $dumpBuffer .= DUMP_CRLF . '#' . DUMP_CRLF . '# ' . sprintf(_("Dumping data for table %s"), $formattedTableName) . DUMP_CRLF . '#' . DUMP_CRLF . DUMP_CRLF;
             if ($_POST['what'] == 'dataonly' && isset($_POST['add_delete'])) {
                 $dumpBuffer .= 'DELETE * FROM ' . $formattedTableName . ';' . DUMP_CRLF . DUMP_CRLF;
             }
             if (!isset($limitFrom) || !isset($limitTo)) {
                 $limitFrom = $limitTo = 0;
             }
             $dumpBuffer .= Dump::SQLData(OPEN_DATABASE, $table, array('from' => $limitFrom, 'to' => $limitTo, 'use_backquotes' => isset($_POST['use_backquotes']) ? $_POST['use_backquotes'] : null, 'show_columns' => isset($_POST['show_columns']) ? $_POST['show_columns'] : null, 'extended_inserts' => isset($_POST['extended_inserts']) ? $_POST['extended_inserts'] : null));
         }