safe_alter('txp_css', "DROP INDEX name, ADD UNIQUE name (name(250))"); 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");
* Textpattern is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Textpattern. If not, see <http://www.gnu.org/licenses/>. */ if (!defined('TXP_UPDATE')) { exit("Nothing here. You can't access this file directly."); } // Support for per-user private prefs. $cols = getThings("DESCRIBE `" . PFX . "txp_prefs`"); if (!in_array('user_name', $cols)) { safe_alter('txp_prefs', "ADD user_name VARCHAR(64) NOT NULL DEFAULT ''"); safe_drop_index('txp_prefs', 'prefs_idx'); safe_alter('txp_prefs', "ADD UNIQUE prefs_idx (prefs_id, name, user_name)"); safe_create_index('txp_prefs', 'user_name', 'user_name'); } // Remove a few global prefs in favour of future private ones. safe_delete('txp_prefs', "user_name = '' AND name IN ('article_list_pageby', 'author_list_pageby', 'comment_list_pageby', 'file_list_pageby', 'image_list_pageby', 'link_list_pageby', 'log_list_pageby')"); // Use dedicated prefs function for setting custom fields. safe_update('txp_prefs', "html = 'custom_set'", "name IN ('custom_1_set', 'custom_2_set', 'custom_3_set', 'custom_4_set', 'custom_5_set', 'custom_6_set', 'custom_7_set', 'custom_8_set', 'custom_9_set', 'custom_10_set') AND html = 'text_input'"); // Send comments prefs. safe_update('txp_prefs', "html = 'commentsendmail'", "name = 'comments_sendmail' AND html = 'yesnoradio'"); // Timezone prefs. safe_update('txp_prefs', "html = 'is_dst'", "name = 'is_dst' AND html = 'yesnoradio'"); if (!safe_field("name", 'txp_prefs', "name = 'auto_dst'")) { safe_insert('txp_prefs', "prefs_id = 1, name = 'auto_dst', val = '0', type = '0', event = 'publish', html = 'yesnoradio', position = '115'"); } if (!safe_field("name", 'txp_prefs', "name = 'timezone_key'")) {