[ Index ] |
|
Code source de Serendipity 1.2 |
1 <?php # $Id: functions_upgrader.inc.php 1696 2007-05-18 07:59:14Z garvinhicking $ 2 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) 3 # All rights reserved. See LICENSE file for licensing details 4 5 if (IN_serendipity !== true) { 6 die ("Don't hack!"); 7 } 8 9 if (defined('S9Y_FRAMEWORK_UPGRADER')) { 10 return; 11 } 12 @define('S9Y_FRAMEWORK_UPGRADER', true); 13 14 /** 15 * This is a list of functions that are used by the upgrader. Define functions here that 16 * are not used within usual Serendipity control flow 17 */ 18 19 /* A list of files which got obsoleted in 0.8 */ 20 $obsolete_files = array( 21 'serendipity.inc.php', 22 'serendipity_layout.inc.php', 23 'serendipity_layout_table.inc.php', 24 'serendipity_entries_overview.inc.php', 25 'serendipity_rss_exchange.inc.php', 26 'serendipity_admin_category.inc.php', 27 'serendipity_admin_comments.inc.php', 28 'serendipity_admin_entries.inc.php', 29 'serendipity_admin_images.inc.php', 30 'serendipity_admin_installer.inc.php', 31 'serendipity_admin_interop.inc.php', 32 'serendipity_admin_overview.inc.php', 33 'serendipity_admin_plugins.inc.php', 34 'serendipity_admin_templates.inc.php', 35 'serendipity_admin_upgrader.inc.php', 36 'serendipity_admin_users.inc.php', 37 'compat.php', 38 'serendipity_functions_config.inc.php', 39 'serendipity_functions_images.inc.php', 40 'serendipity_functions_installer.inc.php', 41 'serendipity_genpage.inc.php', 42 'serendipity_lang.inc.php', 43 'serendipity_plugin_api.php', 44 'serendipity_sidebar_items.php', 45 'serendipity_db.inc.php', 46 'serendipity_db_mysql.inc.php', 47 'serendipity_db_mysqli.inc.php', 48 'serendipity_db_postgres.inc.php', 49 'serendipity_db_pdo-postgres.inc.php', 50 'serendipity_db_sqlite.inc.php', 51 'serendipity_db_sqlite3.inc.php', 52 'htaccess.cgi.errordocs.tpl', 53 'htaccess.cgi.normal.tpl', 54 'htaccess.cgi.rewrite.tpl', 55 'htaccess.errordocs.tpl', 56 'htaccess.normal.tpl', 57 'htaccess.rewrite.tpl', 58 'serendipity_config_local.tpl', 59 'serendipity_config_user.tpl', 60 'INSTALL', 61 'LICENSE', 62 'NEWS', 63 'README', 64 'TODO', 65 'upgrade.sh', 66 'templates/default/layout.php' 67 ); 68 69 /** 70 * Fix inpropper plugin constant names 71 * 72 * Before Serendipity 0.8, some plugins contained localized strings for indiciating some 73 * configuration values. That got deprecated, and replaced by a language-independent constant. 74 * 75 * @access private 76 * @param string (reserved for future use) 77 * @return boolean 78 */ 79 function serendipity_fixPlugins($case) { 80 global $serendipity; 81 82 switch($case) { 83 case 'markup_column_names': 84 $affected_plugins = array( 85 'serendipity_event_bbcode', 86 'serendipity_event_contentrewrite', 87 'serendipity_event_emoticate', 88 'serendipity_event_geshi', 89 'serendipity_event_nl2br', 90 'serendipity_event_textwiki', 91 'serendipity_event_trackexits', 92 'serendipity_event_xhtmlcleanup', 93 'serendipity_event_markdown', 94 'serendipity_event_s9ymarkup', 95 'serendipity_event_searchhighlight', 96 'serendipity_event_textile' 97 ); 98 99 $elements = array( 100 'ENTRY_BODY', 101 'EXTENDED_BODY', 102 'COMMENT', 103 'HTML_NUGGET' 104 ); 105 106 $where = array(); 107 foreach($affected_plugins AS $plugin) { 108 $where[] = "name LIKE '$plugin:%'"; 109 } 110 111 $rows = serendipity_db_query("SELECT name, value, authorid 112 FROM {$serendipity['dbPrefix']}config 113 WHERE " . implode(' OR ', $where)); 114 if (!is_array($rows)) { 115 return false; 116 } 117 118 foreach($rows AS $row) { 119 if (preg_match('@^(serendipity_event_.+):([a-z0-9]+)/(.+)@i', $row['name'], $plugin_data)) { 120 foreach($elements AS $element) { 121 if ($plugin_data[3] != constant($element)) { 122 continue; 123 } 124 125 $new = $plugin_data[1] . ':' . $plugin_data[2] . '/' . $element; 126 serendipity_db_query("UPDATE {$serendipity['dbPrefix']}config 127 SET name = '$new' 128 WHERE name = '{$row['name']}' 129 AND value = '{$row['value']}' 130 AND authorid = '{$row['authorid']}'"); 131 } 132 } 133 } 134 135 return true; 136 break; 137 } 138 } 139 140 /** 141 * Create default groups, when migrating. 142 * 143 * @access private 144 */ 145 function serendipity_addDefaultGroups() { 146 global $serendipity; 147 148 serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}groups"); 149 serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}groupconfig"); 150 serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}authorgroups"); 151 152 serendipity_addDefaultGroup(USERLEVEL_EDITOR_DESC, USERLEVEL_EDITOR); 153 serendipity_addDefaultGroup(USERLEVEL_CHIEF_DESC, USERLEVEL_CHIEF); 154 serendipity_addDefaultGroup(USERLEVEL_ADMIN_DESC, USERLEVEL_ADMIN); 155 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |