Textpattern | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * https://textpattern.com/ 6 * 7 * Copyright (C) 2020 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <https://www.gnu.org/licenses/>. 22 */ 23 24 if (!defined('TXP_UPDATE')) { 25 exit("Nothing here. You can't access this file directly."); 26 } 27 28 // Support for per-user private prefs. 29 $cols = getThings("DESCRIBE `".PFX."txp_prefs`"); 30 if (!in_array('user_name', $cols)) { 31 safe_alter('txp_prefs', "ADD user_name VARCHAR(64) NOT NULL DEFAULT ''"); 32 safe_create_index('txp_prefs', 'user_name', 'user_name'); 33 } 34 35 // Add columns for thumbnail dimensions. 36 $cols = getThings("DESCRIBE `".PFX."txp_image`"); 37 38 if (!in_array('thumb_w', $cols)) { 39 safe_alter('txp_image', "ADD thumb_w int(8) NOT NULL DEFAULT 0"); 40 } 41 42 if (!in_array('thumb_h', $cols)) { 43 safe_alter('txp_image', "ADD thumb_h int(8) NOT NULL DEFAULT 0"); 44 } 45 46 // Plugin flags. 47 $cols = getThings('DESCRIBE `'.PFX.'txp_plugin`'); 48 49 if (!in_array('flags', $cols)) { 50 safe_alter('txp_plugin', "ADD flags SMALLINT UNSIGNED NOT NULL DEFAULT 0"); 51 } 52 53 safe_alter('txp_plugin', "MODIFY code MEDIUMTEXT NOT NULL"); 54 safe_alter('txp_plugin', "MODIFY code_restore MEDIUMTEXT NOT NULL"); 55 56 safe_alter('txp_prefs', "MODIFY val TEXT NOT NULL"); 57 58 // Add author column to files and links, boldly assuming that the publisher in 59 // charge of updating this site is the author of any existing content items. 60 foreach (array('txp_file', 'txp_link') as $table) { 61 $cols = getThings("DESCRIBE `".PFX.$table."`"); 62 63 if (!in_array('author', $cols)) { 64 safe_alter($table, "ADD author varchar(64) NOT NULL DEFAULT ''"); 65 safe_create_index($table, 'author', 'author_idx'); 66 safe_update($table, "author = '".doSlash($txp_user)."'", "1 = 1"); 67 } 68 } 69 70 // Add indices on author columns. 71 safe_create_index('textpattern', 'AuthorID', 'author_idx'); 72 safe_create_index('txp_image', 'author', 'author_idx');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title