Exemplo n.º 1
0
    $ok = null;
    // NODE: What is love(d), baby don't hurt me
    // AUTHOR: Who loves it
    // IP: IP address of who loves it (if anonymous)
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\tnode " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(node),\n\t\t\t\tauthor " . DB_TYPE_ID . ",\n\t\t\t\tip " . DB_TYPE_IP . ",\n\t\t\t\t\tUNIQUE(author,ip)\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
$table = 'SH_TABLE_NODE_STAR';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    // AUTHOR: whom likes the thing
    // NODE: what they like
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\tauthor " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(author),\n\t\t\t\tnode " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(node)\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
Exemplo n.º 2
0
<?php

$table = 'SH_TABLE_GLOBAL';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            echo "Creating Table...\n";
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\t`key` " . DB_TYPE_ASCII(64) . " DEFAULT '',\n\t\t\t\t\tINDEX(`key`),\n\t\t\t\t`value` " . DB_TYPE_UNICODE(128) . " DEFAULT '',\n\t\t\t\ttimestamp " . DB_TYPE_TIMESTAMP . "\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
        case 1:
            $ok = table_Nop($table);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    // Because this is Global, we do a few more things //
    $global_default = array_merge($SH_GLOBAL_DEFAULT, array_fill_keys(global_GetTableConstants(), 0));
    // Add elements found in the defaults that don't exist yet //
    $global_diff = array_diff_key($global_default, $SH);
    $global_diff_count = count($global_diff);
    if ($global_diff_count > 0) {
        print "Adding " . $global_diff_count . " missing element(s) to " . $table . "\n";
        foreach ($global_diff as $key => $value) {
            print "  * " . $key . " = " . (is_string($value) ? "\"" . $value . "\"\n" : $value . "\n");
            global_Set($key, $value);
Exemplo n.º 3
0
<?php

$table = 'SH_TABLE_LEGACY_USER';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid BIGINT UNSIGNED NOT NULL AUTO_INCREMENT \n\t\t\t\t\tUNIQUE,\n\t\t\t\tslug VARCHAR(64) CHARSET latin1 NOT NULL DEFAULT '',\n\t\t\t\t\tINDEX(slug),\n\t\t\t\tmail VARCHAR(64) NOT NULL DEFAULT '',\n\t\t\t\t\tINDEX(mail),\n\t\t\t\tuser_id BIGINT UNSIGNED NOT NULL,\n\t\t\t\tjoined DATETIME NOT NULL\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
Exemplo n.º 4
0
    table_Exit($table);
}
$table = 'SH_TABLE_THEME_FINAL_VOTE';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\tuser " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(user),\n\t\t\t\tnode " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(node),\n\t\t\t\t\tUNIQUE `user_node` (user,node),\n\t\t\t\ttimestamp " . DB_TYPE_TIMESTAMP . ",\n\t\t\t\tvalue INT NOT NULL,\n\t\t\t\t\tINDEX (value)\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
// *** //
$table = 'SH_TABLE_THEME_HISTORY';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\tnode " . DB_TYPE_ID . ",\n\t\t\t\tshorthand " . DB_TYPE_ASCII(20) . ",\n\t\t\t\tname " . DB_TYPE_UNICODE(64) . ",\n\t\t\t\ttheme " . DB_TYPE_UNICODE(64) . "\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
Exemplo n.º 5
0
            //				id ".DB_TYPE_UID.",
            //				user ".DB_TYPE_ID.",
            //					INDEX(user),
            //				ip ".DB_TYPE_IP.",
            //					INDEX(ip),
            //					UNIQUE `user_ip` (user, ip),
            //				first_access ".DB_TYPE_TIMESTAMP.",
            //				last_access ".DB_TYPE_TIMESTAMP.",
            //				total ".DB_TYPE_UINT64."
            //			)".DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}
$table = 'SH_TABLE_USER_STRIKE';
if (in_array(constant($table), $TABLE_LIST)) {
    $ok = null;
    table_Init($table);
    switch ($TABLE_VERSION) {
        case 0:
            $ok = table_Create($table, "CREATE TABLE " . SH_TABLE_PREFIX . constant($table) . " (\n\t\t\t\tid " . DB_TYPE_UID . ",\n\t\t\t\tuser " . DB_TYPE_ID . ",\n\t\t\t\t\tINDEX(user),\n\t\t\t\tnode " . DB_TYPE_ID . ",\n\t\t\t\ttimestamp " . DB_TYPE_TIMESTAMP . ",\n\t\t\t\treason TEXT NOT NULL\n\t\t\t)" . DB_CREATE_SUFFIX);
            if (!$ok) {
                break;
            }
            $TABLE_VERSION++;
    }
    table_Exit($table);
}