示例#1
0
safe_alter('txp_file', "DROP INDEX filename,           ADD UNIQUE filename (filename(250))");
safe_alter('txp_form', "DROP PRIMARY KEY,              ADD PRIMARY KEY (name(250))");
safe_alter('txp_page', "DROP PRIMARY KEY,              ADD PRIMARY KEY (name(250))");
safe_alter('txp_section', "DROP PRIMARY KEY,              ADD PRIMARY KEY (name(250))");
safe_alter('txp_prefs', "DROP INDEX prefs_idx,          ADD UNIQUE prefs_idx (prefs_id, name(185), user_name)");
safe_alter('txp_prefs', "DROP INDEX name,               ADD INDEX name (name(250))");
safe_alter('textpattern', "DROP INDEX section_status_idx, ADD INDEX section_status_idx (Section(249), Status)");
safe_alter('textpattern', "DROP INDEX url_title_idx,      ADD INDEX url_title_idx (url_title(250))");
// txp_discuss_nonce didn't have a primary key in 4.0.3, so we recreate its index in two steps
safe_drop_index('txp_discuss_nonce', "PRIMARY");
safe_alter('txp_discuss_nonce', "ADD PRIMARY KEY (nonce(250))");
// Fix typo: textinput should be text_input
safe_update('txp_prefs', "html = 'text_input'", "name = 'timezone_key'");
// Fix typo: position 40 should be 0 (because it's a hidden pref)
safe_update('txp_prefs', "position = 0", "name = 'language'");
// Fix typo: position should be 60 instead of 30 (so it appears just below the site name)
safe_update('txp_prefs', "position = 60", "name = 'site_slogan'");
// Enforce some table changes that happened after 4.0.3 but weren't part of update scripts until now
safe_alter('txp_css', "MODIFY name  VARCHAR(255) NOT NULL");
safe_alter('txp_lang', "MODIFY lang  VARCHAR(16)  NOT NULL");
safe_alter('txp_lang', "MODIFY name  VARCHAR(64)  NOT NULL");
safe_alter('txp_lang', "MODIFY event VARCHAR(64)  NOT NULL");
safe_drop_index('txp_form', "name");
safe_drop_index('txp_page', "name");
safe_drop_index('txp_plugin', "name_2");
safe_drop_index('txp_section', "name");
// The txp_priv table was created for version 1.0, but never used nor created in later versions.
safe_drop('txp_priv');
// Add generic token table.
safe_create('txp_token', "\nid           INT          NOT NULL AUTO_INCREMENT,\nreference_id INT          DEFAULT 0,\ntype         VARCHAR(255) DEFAULT '',\nselector     CHAR(12)     DEFAULT '',\ntoken        VARCHAR(255) DEFAULT '',\nexpires      DATETIME     DEFAULT '0000-00-00 00:00:00',\nPRIMARY KEY (id)\n");
示例#2
0
}
// 1.0: max file upload size.
if (safe_field("val", 'txp_prefs', "name = 'file_max_upload_size'") === false) {
    safe_insert('txp_prefs', "prefs_id = 1, name = 'file_max_upload_size', val = 2000000");
}
// 1.0: txp_file root cat.
if (!safe_field("name", 'txp_category', "type = 'file' AND name = 'root'")) {
    safe_insert('txp_category', "name = 'root', type = 'file', lft = 1, rgt = 0");
}
rebuild_tree('root', 1, 'file');
// 1.0: txp_file folder.
if (safe_field("val", 'txp_prefs', "name = 'file_base_path'") === false) {
    safe_insert('txp_prefs', "val = '{$tempdir}', name = 'file_base_path', prefs_id = 1");
}
// 1.0: txp_file table.
safe_create('txp_file', "\n    id          INT          NOT NULL AUTO_INCREMENT,\n    filename    VARCHAR(255) NOT NULL DEFAULT '',\n    category    VARCHAR(255) NOT NULL DEFAULT '',\n    permissions VARCHAR(32)  NOT NULL DEFAULT '0',\n    description TEXT         NOT NULL DEFAULT '',\n    downloads   INT UNSIGNED NOT NULL DEFAULT '0',\n    PRIMARY KEY     (id),\n    UNIQUE filename (filename)");
if (safe_field("name", 'txp_form', "type = 'file'") === false) {
    safe_insert('txp_form', "\n        name = 'files',\n        type = 'file',\n        Form = '<txp:text item=\"file\" />: \n<txp:file_download_link>\n<txp:file_download_name /> [<txp:file_download_size format=\"auto\" decimals=\"2\" />]\n</txp:file_download_link>\n<br />\n<txp:text item=\"category\" />: <txp:file_download_category /><br />\n<txp:text item=\"download\" />: <txp:file_download_downloads />'");
}
// EOF: non image file upload tab.
// 1.0: improved comment spam nonce.
$txpnonce = getThings("DESCRIBE `" . PFX . "txp_discuss_nonce`");
if (!in_array('secret', $txpnonce)) {
    safe_alter('txp_discuss_nonce', "ADD secret VARCHAR(255) NOT NULL DEFAULT ''");
}
// 1.0: flag for admin-side plugins.
$txpplugin = getThings("DESCRIBE `" . PFX . "txp_plugin`");
if (!in_array('type', $txpplugin)) {
    safe_alter('txp_plugin', "ADD type INT NOT NULL DEFAULT '0'");
}
// 1.0: log status and method.