Пример #1
0
$table_status = array();
if ($TABLE != "") {
    $orig_fields = fields($TABLE);
    $table_status = table_status($TABLE);
    if (!$table_status) {
        $error = lang('No tables.');
    }
}
$row = $_POST;
$row["fields"] = (array) $row["fields"];
if ($row["auto_increment_col"]) {
    $row["fields"][$row["auto_increment_col"]]["auto_increment"] = true;
}
if ($_POST && !process_fields($row["fields"]) && !$error) {
    if ($_POST["drop"]) {
        queries_adminer_redirect(substr(ME, 0, -1), lang('Table has been dropped.'), drop_tables(array($TABLE)));
    } else {
        $fields = array();
        $all_fields = array();
        $use_all_fields = false;
        $foreign = array();
        ksort($row["fields"]);
        $orig_field = reset($orig_fields);
        $after = " FIRST";
        foreach ($row["fields"] as $key => $field) {
            $foreign_key = $foreign_keys[$field["type"]];
            $type_field = $foreign_key !== null ? $referencable_primary[$foreign_key] : $field;
            //! can collide with user defined type
            if ($field["field"] != "") {
                if (!$field["has_default"]) {
                    $field["default"] = null;
Пример #2
0
        if ($_POST["tables"]) {
            $result = truncate_tables($_POST["tables"]);
        }
        $message = lang('Tables have been truncated.');
    } elseif ($_POST["move"]) {
        $result = move_tables((array) $_POST["tables"], (array) $_POST["views"], $_POST["target"]);
        $message = lang('Tables have been moved.');
    } elseif ($_POST["copy"]) {
        $result = copy_tables((array) $_POST["tables"], (array) $_POST["views"], $_POST["target"]);
        $message = lang('Tables have been copied.');
    } elseif ($_POST["drop"]) {
        if ($_POST["views"]) {
            $result = drop_views($_POST["views"]);
        }
        if ($result && $_POST["tables"]) {
            $result = drop_tables($_POST["tables"]);
        }
        $message = lang('Tables have been dropped.');
    } elseif ($jush != "sql") {
        $result = $jush == "sqlite" ? queries("VACUUM") : apply_queries("VACUUM" . ($_POST["optimize"] ? "" : " ANALYZE"), $_POST["tables"]);
        $message = lang('Tables have been optimized.');
    } elseif (!$_POST["tables"]) {
        $message = lang('No tables.');
    } elseif ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])))) {
        while ($row = $result->fetch_assoc()) {
            $message .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>";
        }
    }
    queries_redirect(substr(ME, 0, -1), $message, $result);
}
page_header($_GET["ns"] == "" ? lang('Database') . ": " . h(DB) : lang('Schema') . ": " . h($_GET["ns"]), $error, true);
Пример #3
0
function dota2_uninstall()
{
    delete_option('steam_api_key');
    include_once 'drop_database.php';
    drop_tables();
}
Пример #4
0
function process_tables($db1, $db2)
{
    global $options;
    $tables1 = list_tables($db1);
    $tables2 = list_tables($db2);
    create_tables($db1, $tables1, $tables2);
    if ($options->drop_tables) {
        drop_tables($tables1, $tables2);
    }
    alter_tables($tables1, $tables2);
    alter_tables_columns($db1, $db2);
    process_indexes($tables1, $tables2, $db1, $db2);
}
error_reporting(E_ALL & ~E_DEPRECATED);
ini_set('display_errors', true);
require_once DIR_TESTROOT . '/wp-testlib/utils.php';
// configure wp
require_once DIR_TESTROOT . '/wp-config.php';
define('ABSPATH', realpath(DIR_WP) . '/');
// install wp
define('WP_BLOG_TITLE', rand_str());
define('WP_USER_NAME', rand_str());
define('WP_USER_EMAIL', rand_str() . '@example.com');
// initialize wp
define('WP_INSTALLING', 1);
$_SERVER['PATH_INFO'] = $_SERVER['SCRIPT_NAME'];
// prevent a warning from some sloppy code in wp-settings.php
require_once ABSPATH . 'wp-settings.php';
drop_tables();
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
wp_install(WP_BLOG_TITLE, WP_USER_NAME, WP_USER_EMAIL, true);
// make sure we're installed
assert(true == is_blog_installed());
define('PHPUnit_MAIN_METHOD', false);
$original_wpdb = $GLOBALS['wpdb'];
// hide warnings during testing, since that's the normal WP behaviour
if (!WP_DEBUG) {
    error_reporting(E_ALL ^ E_NOTICE);
}
$to = "To <*****@*****.**>";
$from = "From <*****@*****.**>";
$cc = "CC <*****@*****.**>";
$bcc = "BCC <*****@*****.**>";
$subject = "RFC2822 Testing";
Пример #6
0
$db = new database($db_type);
switch ($db_type) {
    case 'mssql':
        @($conn_result = $db->connect(NO_DSN, $db_server, $db_admin_name, $db_admin_pass, $db_name));
        break;
    case 'mysql':
        @($conn_result = $db->connect(NO_DSN, $db_server, $db_admin_name, $db_admin_pass, $db_name));
        break;
    case 'postgres':
        @($conn_result = $db->connect(NO_DSN, $db_server, $tl_db_login, $tl_db_passwd, $db_name));
        break;
}
// --------------------------------------------------------------------------------------------
if ($install && $conn_result['status'] != 0) {
    // BUGID 3654
    drop_tables($db, $db_table_prefix, $db_type);
}
// --------------------------------------------------------------------------------------------
$sqlParser = new SqlParser($db, $db_type, $db_table_prefix);
foreach ($a_sql_schema as $sql_schema) {
    foreach ($sql_schema as $sql_file) {
        echo "<br />Processing:" . $sql_file;
        $sqlParser->process($sql_file);
    }
    echo "<br />";
}
// Now data migration must be done if needed
if ($migration_process != '') {
    require_once $migration_functions_file;
    $migration_process($db, $tables);
}
Пример #7
0
$db = new database($db_type);
switch ($db_type) {
    case 'mssql':
        @($conn_result = $db->connect(NO_DSN, $db_server, $db_admin_name, $db_admin_pass, $db_name));
        break;
    case 'mysql':
        @($conn_result = $db->connect(NO_DSN, $db_server, $db_admin_name, $db_admin_pass, $db_name));
        break;
    case 'postgres':
        @($conn_result = $db->connect(NO_DSN, $db_server, $tl_db_login, $tl_db_passwd, $db_name));
        break;
}
// --------------------------------------------------------------------------------------------
if ($install && $conn_result['status'] != 0) {
    // BUGID 3654
    drop_tables($db, $db_table_prefix);
}
// --------------------------------------------------------------------------------------------
$sqlParser = new SqlParser($db, $db_type, $db_table_prefix);
foreach ($a_sql_schema as $sql_schema) {
    foreach ($sql_schema as $sql_file) {
        echo "<br />Processing:" . $sql_file;
        $sqlParser->process($sql_file);
    }
    echo "<br />";
}
// Now data migration must be done if needed
if ($migration_process != '') {
    require_once $migration_functions_file;
    $migration_process($db, $tables);
}
Пример #8
0
	$num_tables = mysql_num_rows($tableslist);
	for ($i=0; $i < $num_tables; $i++) {
		$row = mysql_fetch_array($tableslist);
		array_push($tablesarray, $row[0]);
	}
	mysql_free_result($tableslist);
	return $tablesarray;
}



$s = "mysql.solostyle.net";
$u = "solostyle";
$p = 'qas??wed';
$db = "iam";

select_db($s, $u, $p, $db);

$year = $_POST['year'];
print $year;
print $_POST['func'];
if ($_POST['func'] == "copy") 
	copy_tables($year);
if ($_POST['func'] == "drop")
	drop_tables($year);

mysql_close();

?>
Пример #9
0
 /**
  * Set up db image and remapping options
  *
  * @version 1.0
  * @since 1.0
  */
 function setupDB()
 {
     global $razor;
     // Clear any tables left over from previous tests
     drop_tables($razor->db_object);
 }
Пример #10
0
         $prefix = $_POST['prefix'];
     }
     if (!mysql_query("SELECT 1 FROM `" . $prefix . "group` LIMIT 1")) {
         //            die(mysql_error());
         echo '
     <div class="alert alert-info">
         No serposcope tables found, recreating all the tables...
     </div>      
 ';
         drop_tables($prefix);
         if (create_tables($prefix) && mysql_errno() == 0) {
             echo "\n                    <div class='alert alert-success'>\n                        Successfully recreated the tables\n                    </div>\n                ";
             $nextStep = 3;
         } else {
             echo "\n            <div class='alert alert-error'>\n                SQL error : " . mysql_error() . "\n            </div>";
             drop_tables($prefix);
         }
     } else {
         $oldversion = null;
         if ($res = mysql_query("SELECT version FROM `" . $prefix . "version` LIMIT 1")) {
             if ($array = mysql_fetch_assoc($res)) {
                 $oldversion = $array['version'];
             }
         }
         if ($oldversion == null) {
             $oldversion = 1;
         }
         if ($oldversion == SQL_VERSION) {
             echo '
         <div class="alert alert-info">
             Serposcope tables found, no table to upgrade ...