[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements upgrading of DB tables 4 * 5 * b2evolution - {@link http://b2evolution.net/} 6 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} 7 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 8 * 9 * {@internal Open Source relicensing agreement: 10 * Daniel HAHLER grants Francois PLANQUE the right to license 11 * Daniel HAHLER's contributions to this file and the b2evolution project 12 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 13 * }} 14 * 15 * @package install 16 */ 17 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 18 19 load_funcs('_core/_param.funcs.php'); 20 21 22 /** 23 * Create a DB version checkpoint 24 * 25 * This is useful when the next operation might timeout or fail! 26 * The checkpoint will allow to restart the script and continue where it stopped 27 * 28 * @param string version of DB at checkpoint 29 */ 30 function set_upgrade_checkpoint( $version ) 31 { 32 global $DB, $script_start_time, $locale; 33 34 echo "Creating DB schema version checkpoint at $version... "; 35 36 if( $version < 8060 ) 37 { 38 $query = 'UPDATE T_settings SET db_version = '.$version; 39 } 40 else 41 { 42 $query = "UPDATE T_settings 43 SET set_value = '$version' 44 WHERE set_name = 'db_version'"; 45 } 46 $DB->query( $query ); 47 48 $elapsed_time = time() - $script_start_time; 49 50 echo "OK. (Elapsed upgrade time: $elapsed_time seconds)<br />\n"; 51 flush(); 52 53 if( $elapsed_time > ini_get( 'max_execution_time' ) - 10 ) 54 { 55 echo 'We are reaching the time limit for this script. Please click <a href="index.php?locale='.$locale.'&action=evoupgrade">continue</a>...'; 56 // Dirty temporary solution: 57 exit(); 58 } 59 60 } 61 62 63 /** 64 * @return boolean Does a given index key name exist in DB? 65 */ 66 function db_index_exists( $table, $index_name ) 67 { 68 global $DB; 69 70 $index_name = strtolower($index_name); 71 72 foreach( $DB->get_results('SHOW INDEX FROM '.$table) as $row ) 73 { 74 if( strtolower($row->Key_name) == $index_name ) 75 { 76 return true; 77 } 78 } 79 80 return false; 81 } 82 83 84 /** 85 * @return boolean Does a given column name exist in DB? 86 */ 87 function db_col_exists( $table, $col_name ) 88 { 89 global $DB; 90 91 $col_name = strtolower($col_name); 92 93 foreach( $DB->get_results('SHOW COLUMNS FROM '.$table) as $row ) 94 if( strtolower($row->Field) == $col_name ) 95 return true; 96 97 return false; 98 } 99 100 /** 101 * @return boolean Does a list of given column names exist in DB? 102 */ 103 function db_cols_exist( $table, $col_names ) 104 { 105 global $DB; 106 107 foreach( $col_names as $k => $v ) 108 $col_names[$k] = strtolower($v); 109 110 foreach( $DB->get_results('SHOW COLUMNS FROM '.$table) as $row ) 111 if( ($key = array_search(strtolower($row->Field), $col_names)) !== false ) 112 unset( $col_names[$key] ); 113 114 return count($col_names) == 0; 115 } 116 117 /** 118 * Drops a column, if it exists. 119 */ 120 function db_drop_col( $table, $col_name ) 121 { 122 global $DB; 123 124 if( ! db_col_exists($table, $col_name) ) 125 return false; 126 127 $DB->query( 'ALTER TABLE '.$table.' DROP COLUMN '.$col_name ); 128 } 129 130 /** 131 * Add a column, if it does not already exist. 132 */ 133 function db_add_col( $table, $col_name, $col_desc ) 134 { 135 global $DB; 136 137 if( db_col_exists($table, $col_name) ) 138 return false; 139 140 $DB->query( 'ALTER TABLE '.$table.' ADD COLUMN '.$col_name.' '.$col_desc ); 141 } 142 143 144 /** 145 * Converts languages in a given table into according locales 146 * 147 * @param string name of the table 148 * @param string name of the column where lang is stored 149 * @param string name of the table's ID column 150 */ 151 function convert_lang_to_locale( $table, $columnlang, $columnID ) 152 { 153 global $DB, $locales, $default_locale; 154 155 if( !preg_match('/[a-z]{2}-[A-Z]{2}(-.{1,14})?/', $default_locale) ) 156 { // we want a valid locale 157 $default_locale = 'en-EU'; 158 } 159 160 echo 'Converting langs to locales for '. $table. '...<br />'; 161 162 // query given languages in $table 163 $query = "SELECT $columnID, $columnlang FROM $table"; 164 $languagestoconvert = array(); 165 foreach( $DB->get_results( $query, ARRAY_A ) as $row ) 166 { 167 // remember the ID for that locale 168 $languagestoconvert[ $row[ $columnlang ] ][] = $row[ $columnID ]; 169 } 170 171 foreach( $languagestoconvert as $lkey => $lIDs) 172 { // converting the languages we've found 173 $converted = false; 174 echo ' Converting lang \''. $lkey. '\' '; // (with IDs: '. implode( ', ', $lIDs ). ').. '; 175 176 if( preg_match('/[a-z]{2}-[A-Z]{2}(-.{1,14})?/', $lkey) ) 177 { // Already valid 178 echo 'nothing to update, already valid!<br />'; 179 continue; 180 } 181 182 if( (strlen($lkey) == 2) && ( substr( $default_locale, 0, 2 ) != $lkey ) ) 183 { // we have an old two letter lang code to convert 184 // and it doesn't match the default locale 185 foreach( $locales as $newlkey => $v ) 186 { // loop given locales 187 if( substr($newlkey, 0, 2) == strtolower($lkey) ) # TODO: check if valid/suitable 188 { // if language matches, update 189 $converted = $DB->query( " 190 UPDATE $table 191 SET $columnlang = '$newlkey' 192 WHERE $columnlang = '$lkey'" ); 193 echo 'to locale \''. $newlkey. '\'<br />'; 194 break; 195 } 196 } 197 } 198 199 if( !$converted ) 200 { // we have nothing converted yet, setting default: 201 $DB->query( "UPDATE $table 202 SET $columnlang = '$default_locale' 203 WHERE $columnlang = '$lkey'" ); 204 echo 'forced to default locale \''. $default_locale. '\'<br />'; 205 } 206 } 207 echo "\n"; 208 } // convert_lang_to_locale(-) 209 210 211 /** 212 * upgrade_b2evo_tables(-) 213 */ 214 function upgrade_b2evo_tables() 215 { 216 global $db_config, $tableprefix; 217 global $baseurl, $old_db_version, $new_db_version; 218 global $Group_Admins, $Group_Privileged, $Group_Bloggers, $Group_Users; 219 global $locales, $default_locale; 220 global $DB; 221 global $admin_url; 222 223 // used for defaults, when upgrading to 1.6 224 global $use_fileupload, $fileupload_allowedtypes, $fileupload_maxk, $doubleCheckReferers; 225 226 // new DB-delta functionality 227 global $schema_queries, $inc_path; 228 229 require_once dirname(__FILE__).'/_db_schema.inc.php'; 230 load_class('_core/model/db/_upgrade.funcs.php'); 231 232 233 // Check DB version: 234 check_db_version(); // MIGHT DIE 235 236 237 // Try to obtain some serious time to do some serious processing (5 minutes) 238 @set_time_limit( 300 ); 239 240 241 242 if( $old_db_version < 8010 ) 243 { 244 echo 'Upgrading users table... '; 245 $query = "ALTER TABLE T_users 246 MODIFY COLUMN user_pass CHAR(32) NOT NULL"; 247 $DB->query( $query ); 248 echo "OK.<br />\n"; 249 250 echo 'Upgrading blogs table... '; 251 $query = "ALTER TABLE T_blogs 252 MODIFY COLUMN blog_lang VARCHAR(20) NOT NULL DEFAULT 'en_US', 253 MODIFY COLUMN blog_longdesc TEXT NULL DEFAULT NULL"; 254 $DB->query( $query ); 255 echo "OK.<br />\n"; 256 257 echo 'Upgrading categories table... '; 258 $query = "ALTER TABLE T_categories 259 ADD COLUMN cat_description VARCHAR(250) NULL DEFAULT NULL, 260 ADD COLUMN cat_longdesc TEXT NULL DEFAULT NULL, 261 ADD COLUMN cat_icon VARCHAR(30) NULL DEFAULT NULL"; 262 $DB->query( $query ); 263 echo "OK.<br />\n"; 264 265 echo 'Upgrading posts table... '; 266 $query = "ALTER TABLE {$tableprefix}posts 267 MODIFY COLUMN post_lang VARCHAR(20) NOT NULL DEFAULT 'en_US', 268 ADD COLUMN post_urltitle VARCHAR(50) NULL DEFAULT NULL AFTER post_title, 269 ADD COLUMN post_url VARCHAR(250) NULL DEFAULT NULL AFTER post_urltitle, 270 ADD COLUMN post_comments ENUM('disabled', 'open', 'closed') NOT NULL DEFAULT 'open' AFTER post_wordcount"; 271 $DB->query( $query ); 272 echo "OK.<br />\n"; 273 274 echo 'Generating wordcounts... '; 275 $query = "SELECT ID, post_content FROM {$tableprefix}posts WHERE post_wordcount IS NULL"; 276 $i = 0; 277 foreach( $DB->get_results( $query, ARRAY_A ) as $row ) 278 { 279 $query_update_wordcount = "UPDATE {$tableprefix}posts 280 SET post_wordcount = " . bpost_count_words($row['post_content']) . " 281 WHERE ID = " . $row['ID']; 282 $DB->query($query_update_wordcount); 283 $i++; 284 } 285 echo "OK. ($i rows updated)<br />\n"; 286 287 set_upgrade_checkpoint( '8010' ); 288 } 289 290 291 if( $old_db_version < 8020 ) 292 { 293 echo 'Encoding passwords... '; 294 $query = "UPDATE T_users 295 SET user_pass = MD5(user_pass)"; 296 $DB->query( $query ); 297 echo "OK.<br />\n"; 298 299 set_upgrade_checkpoint( '8020' ); 300 } 301 302 303 if( $old_db_version < 8030 ) 304 { 305 echo 'Deleting unecessary logs... '; 306 $query = "DELETE FROM T_hitlog 307 WHERE hit_ignore = 'badchar'"; 308 $DB->query( $query ); 309 echo "OK.<br />\n"; 310 311 echo 'Updating blog urls... '; 312 $query = "SELECT blog_ID, blog_siteurl FROM T_blogs"; 313 $i = 0; 314 foreach( $DB->get_results( $query, ARRAY_A ) as $row ) 315 { 316 $blog_ID = $row['blog_ID']; 317 $blog_siteurl = $row['blog_siteurl']; 318 // echo $blog_ID.':'.$blog_siteurl; 319 if( strpos( $blog_siteurl.'/', $baseurl ) !== 0 ) 320 { // If not found at position 0 321 echo ' <strong>WARNING: please check blog #', $blog_ID, ' manually.</strong><br /> '; 322 continue; 323 } 324 // crop off the baseurl: 325 $blog_siteurl = substr( $blog_siteurl.'/', strlen( $baseurl) ); 326 // echo ' -> ', $blog_siteurl,'<br />'; 327 328 $query_update_blog = "UPDATE T_blogs SET blog_siteurl = '$blog_siteurl' WHERE blog_ID = $blog_ID"; 329 // echo $query_update_blog, '<br />'; 330 $DB->query( $query_update_blog ); 331 $i++; 332 } 333 echo "OK. ($i rows updated)<br />\n"; 334 335 set_upgrade_checkpoint( '8030' ); 336 } 337 338 339 if( $old_db_version < 8040 ) 340 { // upgrade to 0.8.7 341 echo 'Creating table for Antispam Blackist... '; 342 $query = "CREATE TABLE T_antispam ( 343 aspm_ID bigint(11) NOT NULL auto_increment, 344 aspm_string varchar(80) NOT NULL, 345 aspm_source enum( 'local','reported','central' ) NOT NULL default 'reported', 346 PRIMARY KEY aspm_ID (aspm_ID), 347 UNIQUE aspm_string (aspm_string) 348 )"; 349 $DB->query( $query ); 350 echo "OK.<br />\n"; 351 352 echo 'Creating default blacklist entries... '; 353 $query = "INSERT INTO T_antispam(aspm_string) VALUES ". 354 "('penis-enlargement'), ('online-casino'), ". 355 "('order-viagra'), ('order-phentermine'), ('order-xenical'), ". 356 "('order-prophecia'), ('sexy-lingerie'), ('-porn-'), ". 357 "('-adult-'), ('-tits-'), ('buy-phentermine'), ". 358 "('order-cheap-pills'), ('buy-xenadrine'), ('xxx'), ". 359 "('paris-hilton'), ('parishilton'), ('camgirls'), ('adult-models')"; 360 $DB->query( $query ); 361 echo "OK.<br />\n"; 362 363 echo 'Upgrading Settings table... '; 364 $query = "ALTER TABLE T_settings 365 ADD COLUMN last_antispam_update datetime NOT NULL default '2000-01-01 00:00:00'"; 366 $DB->query( $query ); 367 echo "OK.<br />\n"; 368 369 set_upgrade_checkpoint( '8040' ); 370 } 371 372 373 if( $old_db_version < 8050 ) 374 { // upgrade to 0.8.9 375 echo 'Upgrading blogs table... '; 376 $query = "ALTER TABLE T_blogs 377 ADD COLUMN blog_allowtrackbacks tinyint(1) NOT NULL default 1, 378 ADD COLUMN blog_allowpingbacks tinyint(1) NOT NULL default 0, 379 ADD COLUMN blog_pingb2evonet tinyint(1) NOT NULL default 0, 380 ADD COLUMN blog_pingtechnorati tinyint(1) NOT NULL default 0, 381 ADD COLUMN blog_pingweblogs tinyint(1) NOT NULL default 0, 382 ADD COLUMN blog_pingblodotgs tinyint(1) NOT NULL default 0, 383 ADD COLUMN blog_disp_bloglist tinyint NOT NULL DEFAULT 1"; 384 $DB->query( $query ); 385 echo "OK.<br />\n"; 386 387 // Create User Groups 388 global $Group_Admins, $Group_Privileged, $Group_Bloggers, $Group_Users; 389 echo 'Creating table for Groups... '; 390 $query = "CREATE TABLE T_groups ( 391 grp_ID int(11) NOT NULL auto_increment, 392 grp_name varchar(50) NOT NULL default '', 393 grp_perm_admin enum('none','hidden','visible') NOT NULL default 'visible', 394 grp_perm_blogs enum('user','viewall','editall') NOT NULL default 'user', 395 grp_perm_stats enum('none','view','edit') NOT NULL default 'none', 396 grp_perm_spamblacklist enum('none','view','edit') NOT NULL default 'none', 397 grp_perm_options enum('none','view','edit') NOT NULL default 'none', 398 grp_perm_users enum('none','view','edit') NOT NULL default 'none', 399 grp_perm_templates TINYINT NOT NULL DEFAULT 0, 400 grp_perm_files enum('none','view','add','edit') NOT NULL default 'none', 401 PRIMARY KEY grp_ID (grp_ID) 402 )"; 403 $DB->query( $query ); 404 echo "OK.<br />\n"; 405 406 echo 'Creating default groups... '; 407 $Group_Admins = new Group(); // COPY ! 408 $Group_Admins->set( 'name', 'Administrators' ); 409 $Group_Admins->set( 'perm_admin', 'visible' ); 410 $Group_Admins->set( 'perm_blogs', 'editall' ); 411 $Group_Admins->set( 'perm_stats', 'edit' ); 412 $Group_Admins->set( 'perm_spamblacklist', 'edit' ); 413 $Group_Admins->set( 'perm_files', 'all' ); 414 $Group_Admins->set( 'perm_options', 'edit' ); 415 $Group_Admins->set( 'perm_templates', 1 ); 416 $Group_Admins->set( 'perm_users', 'edit' ); 417 $Group_Admins->dbinsert(); 418 419 $Group_Privileged = new Group(); // COPY ! 420 $Group_Privileged->set( 'name', 'Privileged Bloggers' ); 421 $Group_Privileged->set( 'perm_admin', 'visible' ); 422 $Group_Privileged->set( 'perm_blogs', 'viewall' ); 423 $Group_Privileged->set( 'perm_stats', 'view' ); 424 $Group_Privileged->set( 'perm_spamblacklist', 'edit' ); 425 $Group_Privileged->set( 'perm_files', 'add' ); 426 $Group_Privileged->set( 'perm_options', 'view' ); 427 $Group_Privileged->set( 'perm_templates', 0 ); 428 $Group_Privileged->set( 'perm_users', 'view' ); 429 $Group_Privileged->dbinsert(); 430 431 $Group_Bloggers = new Group(); // COPY ! 432 $Group_Bloggers->set( 'name', 'Bloggers' ); 433 $Group_Bloggers->set( 'perm_admin', 'visible' ); 434 $Group_Bloggers->set( 'perm_blogs', 'user' ); 435 $Group_Bloggers->set( 'perm_stats', 'none' ); 436 $Group_Bloggers->set( 'perm_spamblacklist', 'view' ); 437 $Group_Bloggers->set( 'perm_files', 'view' ); 438 $Group_Bloggers->set( 'perm_options', 'none' ); 439 $Group_Bloggers->set( 'perm_templates', 0 ); 440 $Group_Bloggers->set( 'perm_users', 'none' ); 441 $Group_Bloggers->dbinsert(); 442 443 $Group_Users = new Group(); // COPY ! 444 $Group_Users->set( 'name', 'Basic Users' ); 445 $Group_Users->set( 'perm_admin', 'none' ); 446 $Group_Users->set( 'perm_blogs', 'user' ); 447 $Group_Users->set( 'perm_stats', 'none' ); 448 $Group_Users->set( 'perm_spamblacklist', 'none' ); 449 $Group_Users->set( 'perm_files', 'none' ); 450 $Group_Users->set( 'perm_options', 'none' ); 451 $Group_Users->set( 'perm_templates', 0 ); 452 $Group_Users->set( 'perm_users', 'none' ); 453 $Group_Users->dbinsert(); 454 echo "OK.<br />\n"; 455 456 457 echo 'Creating table for Blog-User permissions... '; 458 $query = "CREATE TABLE T_coll_user_perms ( 459 bloguser_blog_ID int(11) unsigned NOT NULL default 0, 460 bloguser_user_ID int(11) unsigned NOT NULL default 0, 461 bloguser_ismember tinyint NOT NULL default 0, 462 bloguser_perm_poststatuses set('published','deprecated','protected','private','draft') NOT NULL default '', 463 bloguser_perm_delpost tinyint NOT NULL default 0, 464 bloguser_perm_comments tinyint NOT NULL default 0, 465 bloguser_perm_cats tinyint NOT NULL default 0, 466 bloguser_perm_properties tinyint NOT NULL default 0, 467 bloguser_perm_media_upload tinyint NOT NULL default 0, 468 bloguser_perm_media_browse tinyint NOT NULL default 0, 469 bloguser_perm_media_change tinyint NOT NULL default 0, 470 PRIMARY KEY bloguser_pk (bloguser_blog_ID,bloguser_user_ID) 471 )"; 472 $DB->query( $query ); 473 echo "OK.<br />\n"; 474 $tablegroups_isuptodate = true; 475 $tableblogusers_isuptodate = true; 476 477 echo 'Creating user blog permissions... '; 478 // Admin: full rights for all blogs (look 'ma, doing a natural join! :>) 479 $query = "INSERT INTO T_coll_user_perms( bloguser_blog_ID, bloguser_user_ID, bloguser_ismember, 480 bloguser_perm_poststatuses, bloguser_perm_delpost, bloguser_perm_comments, 481 bloguser_perm_cats, bloguser_perm_properties) 482 SELECT blog_ID, ID, 1, 'published,deprecated,protected,private,draft', 1, 1, 1, 1 483 FROM T_users, T_blogs 484 WHERE user_level = 10"; 485 $DB->query( $query ); 486 487 // Normal users: basic rights for all blogs (can't stop doing joins :P) 488 $query = "INSERT INTO T_coll_user_perms( bloguser_blog_ID, bloguser_user_ID, bloguser_ismember, 489 bloguser_perm_poststatuses, bloguser_perm_delpost, bloguser_perm_comments, 490 bloguser_perm_cats, bloguser_perm_properties) 491 SELECT blog_ID, ID, 1, 'published,protected,private,draft', 0, 1, 0, 0 492 FROM T_users, T_blogs 493 WHERE user_level > 0 AND user_level < 10"; 494 $DB->query( $query ); 495 echo "OK.<br />\n"; 496 497 echo 'Upgrading users table... '; 498 $query = "ALTER TABLE T_users 499 ADD COLUMN user_notify tinyint(1) NOT NULL default 1, 500 ADD COLUMN user_grp_ID int(4) NOT NULL default 1, 501 MODIFY COLUMN user_idmode varchar(20) NOT NULL DEFAULT 'login', 502 ADD KEY user_grp_ID (user_grp_ID)"; 503 $DB->query( $query ); 504 echo "OK.<br />\n"; 505 506 echo 'Assigning user groups... '; 507 508 // Default is 1, so admins are already set. 509 510 // Basic Users: 511 $query = "UPDATE T_users 512 SET user_grp_ID = $Group_Users->ID 513 WHERE user_level = 0"; 514 $DB->query( $query ); 515 516 // Bloggers: 517 $query = "UPDATE T_users 518 SET user_grp_ID = $Group_Bloggers->ID 519 WHERE user_level > 0 AND user_level < 10"; 520 $DB->query( $query ); 521 522 echo "OK.<br />\n"; 523 524 echo 'Upgrading settings table... '; 525 $query = "ALTER TABLE T_settings 526 DROP COLUMN time_format, 527 DROP COLUMN date_format, 528 ADD COLUMN pref_newusers_grp_ID int unsigned DEFAULT 4 NOT NULL, 529 ADD COLUMN pref_newusers_level tinyint unsigned DEFAULT 1 NOT NULL, 530 ADD COLUMN pref_newusers_canregister tinyint unsigned DEFAULT 0 NOT NULL"; 531 $DB->query( $query ); 532 echo "OK.<br />\n"; 533 534 echo 'Creating default groups... '; 535 $Group_Admins = new Group(); // COPY ! 536 $Group_Admins->set( 'name', 'Administrators' ); 537 $Group_Admins->set( 'perm_admin', 'visible' ); 538 $Group_Admins->set( 'perm_blogs', 'editall' ); 539 $Group_Admins->set( 'perm_stats', 'edit' ); 540 $Group_Admins->set( 'perm_spamblacklist', 'edit' ); 541 $Group_Admins->set( 'perm_files', 'all' ); 542 $Group_Admins->set( 'perm_options', 'edit' ); 543 $Group_Admins->set( 'perm_templates', 1 ); 544 $Group_Admins->set( 'perm_users', 'edit' ); 545 $Group_Admins->dbinsert(); 546 547 $Group_Privileged = new Group(); // COPY ! 548 $Group_Privileged->set( 'name', 'Privileged Bloggers' ); 549 $Group_Privileged->set( 'perm_admin', 'visible' ); 550 $Group_Privileged->set( 'perm_blogs', 'viewall' ); 551 $Group_Privileged->set( 'perm_stats', 'view' ); 552 $Group_Privileged->set( 'perm_spamblacklist', 'edit' ); 553 $Group_Privileged->set( 'perm_files', 'add' ); 554 $Group_Privileged->set( 'perm_options', 'view' ); 555 $Group_Privileged->set( 'perm_templates', 0 ); 556 $Group_Privileged->set( 'perm_users', 'view' ); 557 $Group_Privileged->dbinsert(); 558 559 $Group_Bloggers = new Group(); // COPY ! 560 $Group_Bloggers->set( 'name', 'Bloggers' ); 561 $Group_Bloggers->set( 'perm_admin', 'visible' ); 562 $Group_Bloggers->set( 'perm_blogs', 'user' ); 563 $Group_Bloggers->set( 'perm_stats', 'none' ); 564 $Group_Bloggers->set( 'perm_spamblacklist', 'view' ); 565 $Group_Bloggers->set( 'perm_files', 'view' ); 566 $Group_Bloggers->set( 'perm_options', 'none' ); 567 $Group_Bloggers->set( 'perm_templates', 0 ); 568 $Group_Bloggers->set( 'perm_users', 'none' ); 569 $Group_Bloggers->dbinsert(); 570 571 $Group_Users = new Group(); // COPY ! 572 $Group_Users->set( 'name', 'Basic Users' ); 573 $Group_Users->set( 'perm_admin', 'none' ); 574 $Group_Users->set( 'perm_blogs', 'user' ); 575 $Group_Users->set( 'perm_stats', 'none' ); 576 $Group_Users->set( 'perm_spamblacklist', 'none' ); 577 $Group_Users->set( 'perm_files', 'none' ); 578 $Group_Users->set( 'perm_options', 'none' ); 579 $Group_Users->set( 'perm_templates', 0 ); 580 $Group_Users->set( 'perm_users', 'none' ); 581 $Group_Users->dbinsert(); 582 echo "OK.<br />\n"; 583 584 set_upgrade_checkpoint( '8050' ); 585 } 586 587 588 if( $old_db_version < 8060 ) 589 { // upgrade to 0.9 590 // Important check: 591 $stub_list = $DB->get_col( "SELECT blog_stub 592 FROM T_blogs 593 GROUP BY blog_stub 594 HAVING COUNT(*) > 1" ); 595 if( !empty($stub_list) ) 596 { 597 echo '<div class="error"><p class="error">'; 598 printf( T_("It appears that the following blog stub names are used more than once: ['%s']" ), implode( "','", $stub_list ) ); 599 echo '</p><p>'; 600 printf( T_("I can't upgrade until you make them unique. DB field: [%s]" ), $db_config['aliases']['T_blogs'].'.blog_stub' ); 601 echo '</p></div>'; 602 return false; 603 } 604 605 // Create locales 606 echo 'Creating table for Locales... '; 607 $query = "CREATE TABLE T_locales ( 608 loc_locale varchar(20) NOT NULL default '', 609 loc_charset varchar(15) NOT NULL default 'iso-8859-1', 610 loc_datefmt varchar(10) NOT NULL default 'y-m-d', 611 loc_timefmt varchar(10) NOT NULL default 'H:i:s', 612 loc_name varchar(40) NOT NULL default '', 613 loc_messages varchar(20) NOT NULL default '', 614 loc_priority tinyint(4) UNSIGNED NOT NULL default '0', 615 loc_enabled tinyint(4) NOT NULL default '1', 616 PRIMARY KEY loc_locale( loc_locale ) 617 ) COMMENT='saves available locales'"; 618 $DB->query( $query ); 619 echo "OK.<br />\n"; 620 621 echo 'Upgrading posts table... '; 622 $query = "UPDATE {$tableprefix}posts 623 SET post_urltitle = NULL"; 624 $DB->query( $query ); 625 626 $query = "ALTER TABLE {$tableprefix}posts 627 CHANGE COLUMN post_date post_issue_date datetime NOT NULL default '1000-01-01 00:00:00', 628 ADD COLUMN post_mod_date datetime NOT NULL default '1000-01-01 00:00:00' 629 AFTER post_issue_date, 630 CHANGE COLUMN post_lang post_locale varchar(20) NOT NULL default 'en-EU', 631 DROP COLUMN post_url, 632 CHANGE COLUMN post_trackbacks post_url varchar(250) NULL default NULL, 633 MODIFY COLUMN post_flags SET( 'pingsdone', 'imported' ), 634 ADD COLUMN post_renderers VARCHAR(179) NOT NULL default 'default', 635 DROP INDEX post_date, 636 ADD INDEX post_issue_date( post_issue_date ), 637 ADD UNIQUE post_urltitle( post_urltitle )"; 638 $DB->query( $query ); 639 640 $query = "UPDATE {$tableprefix}posts 641 SET post_mod_date = post_issue_date"; 642 $DB->query( $query ); 643 echo "OK.<br />\n"; 644 645 // convert given languages to locales 646 convert_lang_to_locale( "{$tableprefix}posts", 'post_locale', 'ID' ); 647 648 echo 'Upgrading blogs table... '; 649 $query = "ALTER TABLE T_blogs 650 CHANGE blog_lang blog_locale varchar(20) NOT NULL default 'en-EU', 651 CHANGE blog_roll blog_notes TEXT NULL, 652 MODIFY COLUMN blog_default_skin VARCHAR(30) NOT NULL DEFAULT 'custom', 653 DROP COLUMN blog_filename, 654 ADD COLUMN blog_access_type VARCHAR(10) NOT NULL DEFAULT 'index.php' AFTER blog_locale, 655 ADD COLUMN blog_force_skin tinyint(1) NOT NULL default 0 AFTER blog_default_skin, 656 ADD COLUMN blog_in_bloglist tinyint(1) NOT NULL DEFAULT 1 AFTER blog_disp_bloglist, 657 ADD COLUMN blog_links_blog_ID INT(4) NOT NULL DEFAULT 0, 658 ADD UNIQUE KEY blog_stub (blog_stub)"; 659 $DB->query( $query ); 660 661 $query = "UPDATE T_blogs 662 SET blog_access_type = 'stub', 663 blog_default_skin = 'custom'"; 664 $DB->query( $query ); 665 666 echo "OK.<br />\n"; 667 668 // convert given languages to locales 669 convert_lang_to_locale( 'T_blogs', 'blog_locale', 'blog_ID' ); 670 671 672 echo 'Converting settings table... '; 673 674 // get old settings 675 $query = 'SELECT * FROM T_settings'; 676 $row = $DB->get_row( $query, ARRAY_A ); 677 678 #echo 'oldrow:<br />'; pre_dump($row); 679 $transform = array( 680 'posts_per_page' => array(5), // note: moved to blogsettings in 2.0 681 'what_to_show' => array('posts'), // note: moved to blogsettings in 2.0 682 'archive_mode' => array('monthly'),// note: moved to blogsettings in 2.0 683 'time_difference' => array(0), 684 'AutoBR' => array(0), 685 'last_antispam_update' => array('2000-01-01 00:00:00', 'antispam_last_update'), 686 'pref_newusers_grp_ID' => array($Group_Users->ID, 'newusers_grp_ID'), 687 'pref_newusers_level' => array(1, 'newusers_level'), 688 'pref_newusers_canregister' => array(0, 'newusers_canregister'), 689 ); 690 691 $_trans = array(); 692 foreach( $transform as $oldkey => $newarr ) 693 { 694 $newname = ( isset($newarr[1]) ? $newarr[1] : $oldkey ); 695 if( !isset( $row[$oldkey] ) ) 696 { 697 echo ' ·Setting '.$oldkey.' not found, using defaults.<br />'; 698 $_trans[ $newname ] = $newarr[0]; 699 } 700 else 701 { 702 $_trans[ $newname ] = $row[$oldkey]; 703 } 704 } 705 706 // drop old table 707 $DB->query( 'DROP TABLE IF EXISTS T_settings' ); 708 709 // create new table 710 $DB->query( 711 'CREATE TABLE T_settings ( 712 set_name VARCHAR( 30 ) NOT NULL , 713 set_value VARCHAR( 255 ) NULL , 714 PRIMARY KEY ( set_name ) 715 )'); 716 717 // insert defaults and use transformed settings 718 create_default_settings( $_trans ); 719 720 if( !isset( $tableblogusers_isuptodate ) ) 721 { 722 echo 'Upgrading Blog-User permissions table... '; 723 $query = "ALTER TABLE T_coll_user_perms 724 ADD COLUMN bloguser_ismember tinyint NOT NULL default 0 AFTER bloguser_user_ID"; 725 $DB->query( $query ); 726 727 // Any row that is created holds at least one permission, 728 // minimum permsission is to be a member, so we add that one too, to all existing rows. 729 $DB->query( "UPDATE T_coll_user_perms 730 SET bloguser_ismember = 1" ); 731 echo "OK.<br />\n"; 732 } 733 734 echo 'Upgrading Comments table... '; 735 $query = "ALTER TABLE T_comments 736 ADD COLUMN comment_author_ID int unsigned NULL default NULL AFTER comment_status, 737 MODIFY COLUMN comment_author varchar(100) NULL, 738 MODIFY COLUMN comment_author_email varchar(100) NULL, 739 MODIFY COLUMN comment_author_url varchar(100) NULL, 740 MODIFY COLUMN comment_author_IP varchar(23) NOT NULL default ''"; 741 $DB->query( $query ); 742 echo "OK.<br />\n"; 743 744 echo 'Upgrading Users table... '; 745 $query = "ALTER TABLE T_users ADD user_locale VARCHAR( 20 ) DEFAULT 'en-EU' NOT NULL AFTER user_yim"; 746 $DB->query( $query ); 747 echo "OK.<br />\n"; 748 749 set_upgrade_checkpoint( '8060' ); 750 } 751 752 753 if( $old_db_version < 8062 ) 754 { // upgrade to 0.9.0.4 755 cleanup_post_quotes('ID'); 756 757 set_upgrade_checkpoint( '8062' ); 758 } 759 760 761 if( $old_db_version < 8064 ) 762 { // upgrade to 0.9.0.6 763 cleanup_comment_quotes(); 764 765 set_upgrade_checkpoint( '8064' ); 766 } 767 768 769 if( $old_db_version < 8066 ) 770 { // upgrade to 0.9.1 771 echo 'Adding catpost index... '; 772 $DB->query( 'ALTER TABLE T_postcats ADD UNIQUE catpost ( postcat_cat_ID, postcat_post_ID )' ); 773 echo "OK.<br />\n"; 774 775 set_upgrade_checkpoint( '8066' ); 776 } 777 778 779 if( $old_db_version < 8800 ) 780 { // ---------------------------------- upgrade to 1.6 "phoenix ALPHA" 781 782 echo 'Dropping old Hitlog table... '; 783 $DB->query( 'DROP TABLE IF EXISTS T_hitlog' ); 784 echo "OK.<br />\n"; 785 786 // New tables: 787 echo 'Creating table for active sessions... '; 788 $DB->query( "CREATE TABLE T_sessions ( 789 sess_ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 790 sess_key CHAR(32) NULL, 791 sess_lastseen DATETIME NOT NULL, 792 sess_ipaddress VARCHAR(15) NOT NULL DEFAULT '', 793 sess_user_ID INT(10) DEFAULT NULL, 794 sess_agnt_ID INT UNSIGNED NULL, 795 sess_data TEXT DEFAULT NULL, 796 PRIMARY KEY( sess_ID ) 797 )" ); 798 echo "OK.<br />\n"; 799 800 801 echo 'Creating user settings table... '; 802 $DB->query( "CREATE TABLE T_usersettings ( 803 uset_user_ID INT(11) UNSIGNED NOT NULL, 804 uset_name VARCHAR( 30 ) NOT NULL, 805 uset_value VARCHAR( 255 ) NULL, 806 PRIMARY KEY ( uset_user_ID, uset_name ) 807 )"); 808 echo "OK.<br />\n"; 809 810 811 echo 'Creating plugins table... '; 812 $DB->query( "CREATE TABLE T_plugins ( 813 plug_ID INT(11) UNSIGNED NOT NULL auto_increment, 814 plug_priority INT(11) NOT NULL default 50, 815 plug_classname VARCHAR(40) NOT NULL default '', 816 PRIMARY KEY ( plug_ID ) 817 )"); 818 echo "OK.<br />\n"; 819 820 821 echo 'Creating table for Post Statuses... '; 822 $query="CREATE TABLE {$tableprefix}poststatuses ( 823 pst_ID int(11) unsigned not null AUTO_INCREMENT, 824 pst_name varchar(30) not null, 825 primary key ( pst_ID ) 826 )"; 827 $DB->query( $query ); 828 echo "OK.<br />\n"; 829 830 831 echo 'Creating table for Post Types... '; 832 $query="CREATE TABLE {$tableprefix}posttypes ( 833 ptyp_ID int(11) unsigned not null AUTO_INCREMENT, 834 ptyp_name varchar(30) not null, 835 primary key (ptyp_ID) 836 )"; 837 $DB->query( $query ); 838 echo "OK.<br />\n"; 839 840 841 echo 'Creating table for File Meta Data... '; 842 $DB->query( "CREATE TABLE T_files ( 843 file_ID int(11) unsigned not null AUTO_INCREMENT, 844 file_root_type enum('absolute','user','group','collection') not null default 'absolute', 845 file_root_ID int(11) unsigned not null default 0, 846 file_path varchar(255) not null default '', 847 file_title varchar(255), 848 file_alt varchar(255), 849 file_desc text, 850 primary key (file_ID), 851 unique file (file_root_type, file_root_ID, file_path) 852 )" ); 853 echo "OK.<br />\n"; 854 855 856 echo 'Creating table for base domains... '; 857 $DB->query( "CREATE TABLE T_basedomains ( 858 dom_ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 859 dom_name VARCHAR(250) NOT NULL DEFAULT '', 860 dom_status ENUM('unknown','whitelist','blacklist') NOT NULL DEFAULT 'unknown', 861 dom_type ENUM('unknown','normal','searcheng','aggregator') NOT NULL DEFAULT 'unknown', 862 PRIMARY KEY (dom_ID), 863 UNIQUE dom_name (dom_name) 864 )" ); // fp> the unique key was only named in version 1.9. Crap. Put the name back here to save as many souls as possible. bulk has not upgraded from 0.9 yet :/ 865 echo "OK.<br />\n"; 866 867 set_upgrade_checkpoint( '8820' ); 868 } 869 870 871 if( $old_db_version < 8840 ) 872 { 873 874 echo 'Creating table for user agents... '; 875 $DB->query( "CREATE TABLE T_useragents ( 876 agnt_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, 877 agnt_signature VARCHAR(250) NOT NULL, 878 agnt_type ENUM('rss','robot','browser','unknown') DEFAULT 'unknown' NOT NULL , 879 PRIMARY KEY (agnt_ID) )" ); 880 echo "OK.<br />\n"; 881 882 883 echo 'Creating table for Hit-Logs... '; 884 $query = "CREATE TABLE T_hitlog ( 885 hit_ID INT(11) NOT NULL AUTO_INCREMENT, 886 hit_sess_ID INT UNSIGNED, 887 hit_datetime DATETIME NOT NULL, 888 hit_uri VARCHAR(250) DEFAULT NULL, 889 hit_referer_type ENUM('search','blacklist','referer','direct','spam') NOT NULL, 890 hit_referer VARCHAR(250) DEFAULT NULL, 891 hit_referer_dom_ID INT UNSIGNED DEFAULT NULL, 892 hit_blog_ID int(11) UNSIGNED NULL DEFAULT NULL, 893 hit_remote_addr VARCHAR(40) DEFAULT NULL, 894 PRIMARY KEY (hit_ID), 895 INDEX hit_datetime ( hit_datetime ), 896 INDEX hit_blog_ID (hit_blog_ID) 897 )"; 898 $DB->query( $query ); 899 echo "OK.<br />\n"; 900 901 902 echo 'Creating table for subscriptions... '; 903 $DB->query( "CREATE TABLE T_subscriptions ( 904 sub_coll_ID int(11) unsigned not null, 905 sub_user_ID int(11) unsigned not null, 906 sub_items tinyint(1) not null, 907 sub_comments tinyint(1) not null, 908 primary key (sub_coll_ID, sub_user_ID) 909 )" ); 910 echo "OK.<br />\n"; 911 912 913 echo 'Creating table for blog-group permissions... '; 914 $DB->query( "CREATE TABLE T_coll_group_perms ( 915 bloggroup_blog_ID int(11) unsigned NOT NULL default 0, 916 bloggroup_group_ID int(11) unsigned NOT NULL default 0, 917 bloggroup_ismember tinyint NOT NULL default 0, 918 bloggroup_perm_poststatuses set('published','deprecated','protected','private','draft') NOT NULL default '', 919 bloggroup_perm_delpost tinyint NOT NULL default 0, 920 bloggroup_perm_comments tinyint NOT NULL default 0, 921 bloggroup_perm_cats tinyint NOT NULL default 0, 922 bloggroup_perm_properties tinyint NOT NULL default 0, 923 bloggroup_perm_media_upload tinyint NOT NULL default 0, 924 bloggroup_perm_media_browse tinyint NOT NULL default 0, 925 bloggroup_perm_media_change tinyint NOT NULL default 0, 926 PRIMARY KEY bloggroup_pk (bloggroup_blog_ID,bloggroup_group_ID) )" ); 927 echo "OK.<br />\n"; 928 929 930 echo 'Upgrading blogs table... '; 931 $query = "ALTER TABLE T_blogs 932 MODIFY COLUMN blog_ID int(11) unsigned NOT NULL auto_increment, 933 MODIFY COLUMN blog_links_blog_ID INT(11) NULL DEFAULT NULL, 934 CHANGE COLUMN blog_stub blog_urlname VARCHAR(255) NOT NULL DEFAULT 'urlname', 935 ADD COLUMN blog_allowcomments VARCHAR(20) NOT NULL default 'post_by_post' AFTER blog_keywords, 936 ADD COLUMN blog_allowblogcss TINYINT(1) NOT NULL default 1 AFTER blog_allowpingbacks, 937 ADD COLUMN blog_allowusercss TINYINT(1) NOT NULL default 1 AFTER blog_allowblogcss, 938 ADD COLUMN blog_stub VARCHAR(255) NOT NULL DEFAULT 'stub' AFTER blog_staticfilename, 939 ADD COLUMN blog_commentsexpire INT(4) NOT NULL DEFAULT 0 AFTER blog_links_blog_ID, 940 ADD COLUMN blog_media_location ENUM( 'default', 'subdir', 'custom', 'none' ) DEFAULT 'default' NOT NULL AFTER blog_commentsexpire, 941 ADD COLUMN blog_media_subdir VARCHAR( 255 ) NOT NULL AFTER blog_media_location, 942 ADD COLUMN blog_media_fullpath VARCHAR( 255 ) NOT NULL AFTER blog_media_subdir, 943 ADD COLUMN blog_media_url VARCHAR(255) NOT NULL AFTER blog_media_fullpath, 944 DROP INDEX blog_stub, 945 ADD UNIQUE blog_urlname ( blog_urlname )"; 946 $DB->query( $query ); 947 echo "OK.<br />\n"; 948 949 set_upgrade_checkpoint( '8840' ); 950 } 951 952 953 if( $old_db_version < 8850 ) 954 { 955 956 echo 'Updating relative URLs... '; 957 // We need to move the slashes to the end: 958 $query = "UPDATE T_blogs 959 SET blog_siteurl = CONCAT( SUBSTRING(blog_siteurl,2) , '/' ) 960 WHERE blog_siteurl LIKE '/%'"; 961 $DB->query( $query ); 962 echo "OK.<br />\n"; 963 964 echo 'Copying urlnames to stub names... '; 965 $query = 'UPDATE T_blogs 966 SET blog_stub = blog_urlname'; 967 $DB->query( $query ); 968 echo "OK.<br />\n"; 969 970 set_upgrade_checkpoint( '8850' ); 971 } 972 973 974 if( $old_db_version < 8855 ) 975 { 976 977 echo 'Upgrading posts table... '; 978 $query = "ALTER TABLE {$tableprefix}posts 979 DROP COLUMN post_karma, 980 DROP COLUMN post_autobr, 981 DROP INDEX post_author, 982 DROP INDEX post_issue_date, 983 DROP INDEX post_category, 984 CHANGE COLUMN ID post_ID int(11) unsigned NOT NULL auto_increment, 985 CHANGE COLUMN post_author post_creator_user_ID int(11) unsigned NOT NULL, 986 CHANGE COLUMN post_issue_date post_datestart datetime NOT NULL, 987 CHANGE COLUMN post_mod_date post_datemodified datetime NOT NULL, 988 CHANGE COLUMN post_category post_main_cat_ID int(11) unsigned NOT NULL, 989 ADD post_parent_ID int(11) unsigned NULL AFTER post_ID, 990 ADD post_lastedit_user_ID int(11) unsigned NULL AFTER post_creator_user_ID, 991 ADD post_assigned_user_ID int(11) unsigned NULL AFTER post_lastedit_user_ID, 992 ADD post_datedeadline datetime NULL AFTER post_datestart, 993 ADD post_datecreated datetime NULL AFTER post_datedeadline, 994 ADD post_pst_ID int(11) unsigned NULL AFTER post_status, 995 ADD post_ptyp_ID int(11) unsigned NULL AFTER post_pst_ID, 996 ADD post_views int(11) unsigned NOT NULL DEFAULT 0 AFTER post_flags, 997 ADD post_commentsexpire datetime DEFAULT NULL AFTER post_comments, 998 ADD post_priority int(11) unsigned null, 999 ADD INDEX post_creator_user_ID( post_creator_user_ID ), 1000 ADD INDEX post_parent_ID( post_parent_ID ), 1001 ADD INDEX post_assigned_user_ID( post_assigned_user_ID ), 1002 ADD INDEX post_datestart( post_datestart ), 1003 ADD INDEX post_main_cat_ID( post_main_cat_ID ), 1004 ADD INDEX post_ptyp_ID( post_ptyp_ID ), 1005 ADD INDEX post_pst_ID( post_pst_ID ) "; 1006 $DB->query( $query ); 1007 echo "OK.<br />\n"; 1008 1009 set_upgrade_checkpoint( '8855' ); 1010 } 1011 1012 1013 if( $old_db_version < 8860 ) 1014 { 1015 1016 1017 echo 'Updating post data... '; 1018 $query = "UPDATE {$tableprefix}posts 1019 SET post_lastedit_user_ID = post_creator_user_ID, 1020 post_datecreated = post_datestart"; 1021 $DB->query( $query ); 1022 echo "OK.<br />\n"; 1023 1024 1025 task_begin( 'Upgrading users table... ' ); 1026 $DB->query( 'UPDATE T_users 1027 SET dateYMDhour = \'2000-01-01 00:00:00\' 1028 WHERE dateYMDhour = \'0000-00-00 00:00:00\'' ); 1029 $DB->query( 'ALTER TABLE T_users 1030 MODIFY COLUMN dateYMDhour DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\', 1031 CHANGE COLUMN ID user_ID int(11) unsigned NOT NULL auto_increment, 1032 MODIFY COLUMN user_icq int(11) unsigned DEFAULT 0 NOT NULL, 1033 ADD COLUMN user_showonline tinyint(1) NOT NULL default 1 AFTER user_notify' ); 1034 task_end(); 1035 1036 1037 set_upgrade_checkpoint( '8860' ); 1038 } 1039 1040 1041 if( $old_db_version < 8900 ) 1042 { 1043 1044 echo 'Setting new defaults... '; 1045 $query = 'INSERT INTO T_settings (set_name, set_value) 1046 VALUES 1047 ( "reloadpage_timeout", "300" ), 1048 ( "upload_enabled", "'.(isset($use_fileupload) ? (int)$use_fileupload : '1').'" ), 1049 ( "upload_allowedext", "'.(isset($fileupload_allowedtypes) ? $fileupload_allowedtypes : 'jpg gif png').'" ), 1050 ( "upload_maxkb", "'.(isset($fileupload_maxk) ? (int)$fileupload_maxk : '96').'" ) 1051 '; 1052 $DB->query( $query ); 1053 // Replace "paged" mode with "posts" // note: moved to blogsettings in 2.0 1054 $DB->query( 'UPDATE T_settings 1055 SET set_value = "posts" 1056 WHERE set_name = "what_to_show" 1057 AND set_value = "paged"' ); 1058 echo "OK.<br />\n"; 1059 1060 1061 if( !isset( $tableblogusers_isuptodate ) ) 1062 { // We have created the blogusers table before and it's already clean! 1063 echo 'Altering table for Blog-User permissions... '; 1064 $DB->query( 'ALTER TABLE T_coll_user_perms 1065 MODIFY COLUMN bloguser_blog_ID int(11) unsigned NOT NULL default 0, 1066 MODIFY COLUMN bloguser_user_ID int(11) unsigned NOT NULL default 0, 1067 ADD COLUMN bloguser_perm_media_upload tinyint NOT NULL default 0, 1068 ADD COLUMN bloguser_perm_media_browse tinyint NOT NULL default 0, 1069 ADD COLUMN bloguser_perm_media_change tinyint NOT NULL default 0' ); 1070 echo "OK.<br />\n"; 1071 } 1072 1073 1074 task_begin( 'Altering comments table...' ); 1075 $DB->query( 'UPDATE T_comments 1076 SET comment_date = \'2000-01-01 00:00:00\' 1077 WHERE comment_date = \'0000-00-00 00:00:00\'' ); 1078 $DB->query( 'ALTER TABLE T_comments 1079 MODIFY COLUMN comment_date DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\', 1080 MODIFY COLUMN comment_post_ID int(11) unsigned NOT NULL default 0' ); 1081 task_end(); 1082 1083 set_upgrade_checkpoint( '8900' ); 1084 } 1085 1086 if( $old_db_version < 9000 ) 1087 { 1088 echo 'Altering Posts to Categories table... '; 1089 $DB->query( "ALTER TABLE T_postcats 1090 MODIFY COLUMN postcat_post_ID int(11) unsigned NOT NULL, 1091 MODIFY COLUMN postcat_cat_ID int(11) unsigned NOT NULL" ); 1092 echo "OK.<br />\n"; 1093 1094 1095 echo 'Altering Categories table... '; 1096 $DB->query( "ALTER TABLE T_categories 1097 MODIFY COLUMN cat_ID int(11) unsigned NOT NULL auto_increment, 1098 MODIFY COLUMN cat_parent_ID int(11) unsigned NULL, 1099 MODIFY COLUMN cat_blog_ID int(11) unsigned NOT NULL default 2" ); 1100 echo "OK.<br />\n"; 1101 1102 1103 echo 'Altering Locales table... '; 1104 $DB->query( 'ALTER TABLE T_locales 1105 ADD loc_startofweek TINYINT UNSIGNED NOT NULL DEFAULT 1 AFTER loc_timefmt' ); 1106 echo "OK.<br />\n"; 1107 1108 1109 if( !isset( $tablegroups_isuptodate ) ) 1110 { // We have created the groups table before and it's already clean! 1111 echo 'Altering Groups table... '; 1112 $DB->query( "ALTER TABLE T_groups 1113 ADD COLUMN grp_perm_admin enum('none','hidden','visible') NOT NULL default 'visible' AFTER grp_name, 1114 ADD COLUMN grp_perm_files enum('none','view','add','edit') NOT NULL default 'none'" ); 1115 echo "OK.<br />\n"; 1116 } 1117 1118 1119 echo 'Creating table for Post Links... '; 1120 $DB->query( "CREATE TABLE T_links ( 1121 link_ID int(11) unsigned not null AUTO_INCREMENT, 1122 link_datecreated datetime not null, 1123 link_datemodified datetime not null, 1124 link_creator_user_ID int(11) unsigned not null, 1125 link_lastedit_user_ID int(11) unsigned not null, 1126 link_item_ID int(11) unsigned NOT NULL, 1127 link_dest_item_ID int(11) unsigned NULL, 1128 link_file_ID int(11) unsigned NULL, 1129 link_ltype_ID int(11) unsigned NOT NULL default 1, 1130 link_external_url VARCHAR(255) NULL, 1131 link_title TEXT NULL, 1132 PRIMARY KEY (link_ID), 1133 INDEX link_item_ID( link_item_ID ), 1134 INDEX link_dest_item_ID (link_dest_item_ID), 1135 INDEX link_file_ID (link_file_ID) 1136 )" ); 1137 echo "OK.<br />\n"; 1138 1139 1140 echo 'Creating default Post Types... '; 1141 $DB->query( " 1142 INSERT INTO {$tableprefix}posttypes ( ptyp_ID, ptyp_name ) 1143 VALUES ( 1, 'Post' ), 1144 ( 2, 'Link' )" ); 1145 echo "OK.<br />\n"; 1146 1147 1148 set_upgrade_checkpoint( '9000' ); 1149 } 1150 1151 1152 if( $old_db_version < 9100 ) 1153 { // 1.8 ALPHA 1154 1155 echo 'Creating table for plugin events... '; 1156 $DB->query( ' 1157 CREATE TABLE T_pluginevents( 1158 pevt_plug_ID INT(11) UNSIGNED NOT NULL, 1159 pevt_event VARCHAR(40) NOT NULL, 1160 pevt_enabled TINYINT NOT NULL DEFAULT 1, 1161 PRIMARY KEY( pevt_plug_ID, pevt_event ) 1162 )' ); 1163 echo "OK.<br />\n"; 1164 1165 1166 echo 'Altering Links table... '; 1167 $DB->query( 'ALTER TABLE T_links 1168 CHANGE link_item_ID link_itm_ID INT( 11 ) UNSIGNED NOT NULL, 1169 CHANGE link_dest_item_ID link_dest_itm_ID INT( 11 ) UNSIGNED NULL' ); 1170 echo "OK.<br />\n"; 1171 1172 1173 if( $old_db_version >= 9000 ) 1174 { // sess_agnt_ID used in Phoenix-Alpha 1175 echo 'Altering sessions table... '; 1176 $query = " 1177 ALTER TABLE T_sessions 1178 DROP COLUMN sess_agnt_ID"; 1179 $DB->query( $query ); 1180 echo "OK.<br />\n"; 1181 } 1182 1183 echo 'Creating table for file types... '; 1184 $DB->query( ' 1185 CREATE TABLE T_filetypes ( 1186 ftyp_ID int(11) unsigned NOT NULL auto_increment, 1187 ftyp_extensions varchar(30) NOT NULL, 1188 ftyp_name varchar(30) NOT NULL, 1189 ftyp_mimetype varchar(50) NOT NULL, 1190 ftyp_icon varchar(20) default NULL, 1191 ftyp_viewtype varchar(10) NOT NULL, 1192 ftyp_allowed tinyint(1) NOT NULL default 0, 1193 PRIMARY KEY (ftyp_ID) 1194 )' ); 1195 echo "OK.<br />\n"; 1196 1197 echo 'Creating default file types... '; 1198 // TODO: dh> shouldn't they get localized to the app's default locale? 1199 $DB->query( "INSERT INTO T_filetypes 1200 (ftyp_ID, ftyp_extensions, ftyp_name, ftyp_mimetype, ftyp_icon, ftyp_viewtype, ftyp_allowed) 1201 VALUES 1202 (1, 'gif', 'GIF image', 'image/gif', 'image2.png', 'image', 1), 1203 (2, 'png', 'PNG image', 'image/png', 'image2.png', 'image', 1), 1204 (3, 'jpg jpeg', 'JPEG image', 'image/jpeg', 'image2.png', 'image', 1), 1205 (4, 'txt', 'Text file', 'text/plain', 'document.png', 'text', 1), 1206 (5, 'htm html', 'HTML file', 'text/html', 'html.png', 'browser', 0), 1207 (6, 'pdf', 'PDF file', 'application/pdf', 'pdf.png', 'browser', 1), 1208 (7, 'doc', 'Microsoft Word file', 'application/msword', 'doc.gif', 'external', 1), 1209 (8, 'xls', 'Microsoft Excel file', 'application/vnd.ms-excel', 'xls.gif', 'external', 1), 1210 (9, 'ppt', 'Powerpoint', 'application/vnd.ms-powerpoint', 'ppt.gif', 'external', 1), 1211 (10, 'pps', 'Powerpoint slideshow', 'pps', 'pps.gif', 'external', 1), 1212 (11, 'zip', 'Zip archive', 'application/zip', 'zip.gif', 'external', 1), 1213 (12, 'php php3 php4 php5 php6', 'Php files', 'application/x-httpd-php', 'php.gif', 'text', 0) 1214 " ); 1215 echo "OK.<br />\n"; 1216 1217 echo 'Giving Administrator Group edit perms on files... '; 1218 $DB->query( 'UPDATE T_groups 1219 SET grp_perm_files = "edit" 1220 WHERE grp_ID = 1' ); 1221 // Later versions give 'all' on install, but we won't upgrade to that for security. 1222 echo "OK.<br />\n"; 1223 1224 echo 'Giving Administrator Group full perms on media for all blogs... '; 1225 $DB->query( 'UPDATE T_coll_group_perms 1226 SET bloggroup_perm_media_upload = 1, 1227 bloggroup_perm_media_browse = 1, 1228 bloggroup_perm_media_change = 1 1229 WHERE bloggroup_group_ID = 1' ); 1230 echo "OK.<br />\n"; 1231 1232 1233 if( $old_db_version >= 9000 ) 1234 { // Uninstall all ALPHA (potentially incompatible) plugins 1235 echo 'Uninstalling all existing plugins... '; 1236 $DB->query( 'DELETE FROM T_plugins WHERE 1=1' ); 1237 echo "OK.<br />\n"; 1238 } 1239 1240 // NOTE: basic plugins get installed separatly for upgrade and install.. 1241 1242 1243 set_upgrade_checkpoint( '9100' ); 1244 } 1245 1246 1247 if( $old_db_version < 9190 ) // Note: changed from 9200, to include the block below, if DB is not yet on 1.8 1248 { // 1.8 ALPHA (block #2) 1249 echo 'Altering Posts table... '; 1250 $DB->query( "ALTER TABLE {$tableprefix}posts 1251 CHANGE post_comments post_comment_status ENUM('disabled', 'open', 'closed') NOT NULL DEFAULT 'open'" ); 1252 echo "OK.<br />\n"; 1253 1254 1255 set_upgrade_checkpoint( '9190' ); 1256 } 1257 1258 1259 if( $old_db_version < 9192 ) 1260 { // 1.8 ALPHA (block #3) - The payload that db_delta() handled before 1261 1262 // This is a fix, which broke upgrade to 1.8 (from 1.6) in MySQL strict mode (inserted after 1.8 got released!): 1263 if( $DB->get_row( 'SHOW COLUMNS FROM T_hitlog LIKE "hit_referer_type"' ) ) 1264 { // a niiiiiiiice extra check :p 1265 task_begin( 'Deleting all "spam" hitlog entries... ' ); 1266 $DB->query( ' 1267 DELETE FROM T_hitlog 1268 WHERE hit_referer_type = "spam"' ); 1269 task_end(); 1270 } 1271 1272 task_begin( 'Upgrading users table... ' ); 1273 $DB->query( 'ALTER TABLE T_users 1274 CHANGE COLUMN user_firstname user_firstname varchar(50) NULL, 1275 CHANGE COLUMN user_lastname user_lastname varchar(50) NULL, 1276 CHANGE COLUMN user_nickname user_nickname varchar(50) NULL, 1277 CHANGE COLUMN user_icq user_icq int(11) unsigned NULL, 1278 CHANGE COLUMN user_email user_email varchar(255) NOT NULL, 1279 CHANGE COLUMN user_url user_url varchar(255) NULL, 1280 CHANGE COLUMN user_ip user_ip varchar(15) NULL, 1281 CHANGE COLUMN user_domain user_domain varchar(200) NULL, 1282 CHANGE COLUMN user_browser user_browser varchar(200) NULL, 1283 CHANGE COLUMN user_aim user_aim varchar(50) NULL, 1284 CHANGE COLUMN user_msn user_msn varchar(100) NULL, 1285 CHANGE COLUMN user_yim user_yim varchar(50) NULL, 1286 ADD COLUMN user_allow_msgform TINYINT NOT NULL DEFAULT \'1\' AFTER user_idmode, 1287 ADD COLUMN user_validated TINYINT(1) NOT NULL DEFAULT 0 AFTER user_grp_ID' ); 1288 task_end(); 1289 1290 task_begin( 'Creating blog settings...' ); 1291 $DB->query( 'CREATE TABLE T_coll_settings ( 1292 cset_coll_ID INT(11) UNSIGNED NOT NULL, 1293 cset_name VARCHAR( 30 ) NOT NULL, 1294 cset_value VARCHAR( 255 ) NULL, 1295 PRIMARY KEY ( cset_coll_ID, cset_name ) 1296 )' ); 1297 task_end(); 1298 set_upgrade_checkpoint( '9192' ); 1299 } 1300 1301 1302 if( $old_db_version < 9195 ) 1303 { 1304 task_begin( 'Upgrading posts table... ' ); 1305 $DB->query( 'ALTER TABLE '.$tableprefix.'posts 1306 CHANGE COLUMN post_content post_content text NULL, 1307 CHANGE COLUMN post_url post_url VARCHAR(255) NULL DEFAULT NULL, 1308 CHANGE COLUMN post_renderers post_renderers TEXT NOT NULL' ); 1309 task_end(); 1310 1311 task_begin( 'Upgrading comments table... ' ); 1312 $DB->query( 'ALTER TABLE T_comments 1313 CHANGE COLUMN comment_author_email comment_author_email varchar(255) NULL, 1314 CHANGE COLUMN comment_author_url comment_author_url varchar(255) NULL, 1315 ADD COLUMN comment_spam_karma TINYINT NULL AFTER comment_karma, 1316 ADD COLUMN comment_allow_msgform TINYINT NOT NULL DEFAULT \'0\' AFTER comment_spam_karma' ); 1317 task_end(); 1318 1319 set_upgrade_checkpoint( '9195' ); 1320 } 1321 1322 1323 if( $old_db_version < 9200 ) 1324 { 1325 task_begin( 'Upgrading hitlog table... ' ); 1326 $DB->query( 'ALTER TABLE T_hitlog 1327 CHANGE COLUMN hit_referer_type hit_referer_type ENUM(\'search\',\'blacklist\',\'referer\',\'direct\') NOT NULL, 1328 ADD COLUMN hit_agnt_ID INT UNSIGNED NULL AFTER hit_remote_addr' ); 1329 task_end(); 1330 1331 task_begin( 'Upgrading post links table... ' ); 1332 $DB->query( 'ALTER TABLE T_links 1333 ADD INDEX link_itm_ID( link_itm_ID ), 1334 ADD INDEX link_dest_itm_ID (link_dest_itm_ID)' ); 1335 task_end(); 1336 1337 task_begin( 'Upgrading plugins table... ' ); 1338 $DB->query( 'ALTER TABLE T_plugins 1339 CHANGE COLUMN plug_priority plug_priority TINYINT NOT NULL default 50, 1340 ADD COLUMN plug_code VARCHAR(32) NULL AFTER plug_classname, 1341 ADD COLUMN plug_apply_rendering ENUM( \'stealth\', \'always\', \'opt-out\', \'opt-in\', \'lazy\', \'never\' ) NOT NULL DEFAULT \'never\' AFTER plug_code, 1342 ADD COLUMN plug_version VARCHAR(42) NOT NULL default \'0\' AFTER plug_apply_rendering, 1343 ADD COLUMN plug_status ENUM( \'enabled\', \'disabled\', \'needs_config\', \'broken\' ) NOT NULL AFTER plug_version, 1344 ADD COLUMN plug_spam_weight TINYINT UNSIGNED NOT NULL DEFAULT 1 AFTER plug_status, 1345 ADD UNIQUE plug_code( plug_code ), 1346 ADD INDEX plug_status( plug_status )' ); 1347 task_end(); 1348 1349 task_begin( 'Creating plugin settings table... ' ); 1350 $DB->query( 'CREATE TABLE T_pluginsettings ( 1351 pset_plug_ID INT(11) UNSIGNED NOT NULL, 1352 pset_name VARCHAR( 30 ) NOT NULL, 1353 pset_value TEXT NULL, 1354 PRIMARY KEY ( pset_plug_ID, pset_name ) 1355 )' ); 1356 task_end(); 1357 1358 task_begin( 'Creating plugin user settings table... ' ); 1359 $DB->query( 'CREATE TABLE T_pluginusersettings ( 1360 puset_plug_ID INT(11) UNSIGNED NOT NULL, 1361 puset_user_ID INT(11) UNSIGNED NOT NULL, 1362 puset_name VARCHAR( 30 ) NOT NULL, 1363 puset_value TEXT NULL, 1364 PRIMARY KEY ( puset_plug_ID, puset_user_ID, puset_name ) 1365 )' ); 1366 task_end(); 1367 1368 task_begin( 'Creating scheduled tasks table... ' ); 1369 $DB->query( 'CREATE TABLE T_cron__task( 1370 ctsk_ID int(10) unsigned not null AUTO_INCREMENT, 1371 ctsk_start_datetime datetime not null, 1372 ctsk_repeat_after int(10) unsigned, 1373 ctsk_name varchar(50) not null, 1374 ctsk_controller varchar(50) not null, 1375 ctsk_params text, 1376 primary key (ctsk_ID) 1377 )' ); 1378 task_end(); 1379 1380 task_begin( 'Creating cron log table... ' ); 1381 $DB->query( 'CREATE TABLE T_cron__log( 1382 clog_ctsk_ID int(10) unsigned not null, 1383 clog_realstart_datetime datetime not null, 1384 clog_realstop_datetime datetime, 1385 clog_status enum(\'started\',\'finished\',\'error\',\'timeout\') not null default \'started\', 1386 clog_messages text, 1387 primary key (clog_ctsk_ID) 1388 )' ); 1389 task_end(); 1390 1391 task_begin( 'Upgrading blogs table... ' ); 1392 // blog_allowpingbacks is "DEFAULT 1" in the 0.9.0.11 dump.. - changed in 0.9.2?! 1393 $DB->query( 'ALTER TABLE T_blogs 1394 ALTER COLUMN blog_allowpingbacks SET DEFAULT 0, 1395 CHANGE COLUMN blog_media_subdir blog_media_subdir VARCHAR( 255 ) NULL, 1396 CHANGE COLUMN blog_media_fullpath blog_media_fullpath VARCHAR( 255 ) NULL, 1397 CHANGE COLUMN blog_media_url blog_media_url VARCHAR( 255 ) NULL' ); 1398 task_end(); 1399 1400 1401 set_upgrade_checkpoint( '9200' ); // at 1.8 "Summer Beta" release 1402 } 1403 1404 1405 // ____________________________ 1.9: ____________________________ 1406 1407 if( $old_db_version < 9290 ) 1408 { 1409 echo 'Post-fix hit_referer_type == NULL... '; 1410 // If you've upgraded from 1.6 to 1.8 and it did not break because of strict mode, there are now NULL values for what "spam" was: 1411 $DB->query( ' 1412 DELETE FROM T_hitlog 1413 WHERE hit_referer_type IS NULL' ); 1414 echo "OK.<br />\n"; 1415 1416 echo 'Marking administrator accounts as validated... '; 1417 $DB->query( ' 1418 UPDATE T_users 1419 SET user_validated = 1 1420 WHERE user_grp_ID = 1' ); 1421 echo "OK.<br />\n"; 1422 1423 echo 'Converting auto_prune_stats setting... '; 1424 $old_auto_prune_stats = $DB->get_var( ' 1425 SELECT set_value 1426 FROM T_settings 1427 WHERE set_name = "auto_prune_stats"' ); 1428 if( ! is_null($old_auto_prune_stats) && $old_auto_prune_stats < 1 ) 1429 { // This means it has been disabled before, so set auto_prune_stats_mode to "off"! 1430 $DB->query( ' 1431 REPLACE INTO T_settings ( set_name, set_value ) 1432 VALUES ( "auto_prune_stats_mode", "off" )' ); 1433 } 1434 echo "OK.<br />\n"; 1435 1436 echo 'Converting time_difference from hours to seconds... '; 1437 $DB->query( 'UPDATE T_settings SET set_value = set_value*3600 WHERE set_name = "time_difference"' ); 1438 echo "OK.<br />\n"; 1439 1440 1441 echo 'Updating hitlog capabilities... '; 1442 $DB->query( ' 1443 ALTER TABLE T_useragents ADD INDEX agnt_type ( agnt_type )' ); 1444 $DB->query( ' 1445 ALTER TABLE T_hitlog 1446 CHANGE COLUMN hit_referer_type hit_referer_type ENUM(\'search\',\'blacklist\',\'referer\',\'direct\',\'self\',\'admin\') NOT NULL' ); 1447 echo "OK.<br />\n"; 1448 1449 echo 'Updating plugin capabilities... '; 1450 $DB->query( ' 1451 ALTER TABLE T_plugins 1452 MODIFY COLUMN plug_status ENUM( \'enabled\', \'disabled\', \'needs_config\', \'broken\' ) NOT NULL' ); 1453 echo "OK.<br />\n"; 1454 1455 set_upgrade_checkpoint( '9290' ); 1456 } 1457 1458 1459 if( $old_db_version < 9300 ) 1460 { 1461 // This can be so long, it needs its own checkpoint protected block in case of failure 1462 echo 'Updating hitlog indexes... '; 1463 $DB->query( ' 1464 ALTER TABLE T_hitlog 1465 ADD INDEX hit_agnt_ID ( hit_agnt_ID ), 1466 ADD INDEX hit_uri ( hit_uri ), 1467 ADD INDEX hit_referer_dom_ID ( hit_referer_dom_ID ) 1468 ' ); 1469 echo "OK.<br />\n"; 1470 1471 set_upgrade_checkpoint( '9300' ); 1472 } 1473 1474 1475 if( $old_db_version < 9310 ) 1476 { 1477 echo 'Updating basedomains... '; 1478 $DB->query( ' 1479 UPDATE T_basedomains 1480 SET dom_status = "unknown"' ); // someone has filled this up with junk blacklists before 1481 $DB->query( ' 1482 ALTER TABLE T_basedomains ADD INDEX dom_type (dom_type)' ); 1483 echo "OK.<br />\n"; 1484 1485 set_upgrade_checkpoint( '9310' ); 1486 } 1487 1488 1489 if( $old_db_version < 9315 ) 1490 { 1491 echo 'Altering locales table... '; 1492 $DB->query( "ALTER TABLE T_locales CHANGE COLUMN loc_datefmt loc_datefmt varchar(20) NOT NULL default 'y-m-d'" ); 1493 $DB->query( "ALTER TABLE T_locales CHANGE COLUMN loc_timefmt loc_timefmt varchar(20) NOT NULL default 'H:i:s'" ); 1494 echo "OK.<br />\n"; 1495 1496 echo 'Creating item prerendering cache table... '; 1497 $DB->query( " 1498 CREATE TABLE {$tableprefix}item__prerendering( 1499 itpr_itm_ID INT(11) UNSIGNED NOT NULL, 1500 itpr_format ENUM('htmlbody', 'entityencoded', 'xml', 'text') NOT NULL, 1501 itpr_renderers TEXT NOT NULL, 1502 itpr_content_prerendered TEXT NULL, 1503 itpr_datemodified TIMESTAMP NOT NULL, 1504 PRIMARY KEY (itpr_itm_ID, itpr_format) 1505 )" ); 1506 echo "OK.<br />\n"; 1507 1508 echo 'Altering plugins table... '; 1509 $DB->query( "ALTER TABLE T_plugins ADD COLUMN plug_name VARCHAR(255) NULL default NULL AFTER plug_version" ); 1510 $DB->query( "ALTER TABLE T_plugins ADD COLUMN plug_shortdesc VARCHAR(255) NULL default NULL AFTER plug_name" ); 1511 echo "OK.<br />\n"; 1512 1513 set_upgrade_checkpoint( '9315' ); 1514 } 1515 1516 1517 if( $old_db_version < 9320 ) 1518 { // Dropping hit_datetime because it's very slow on INSERT (dh) 1519 // This can be so long, it needs its own checkpoint protected block in case of failure 1520 if( db_index_exists( 'T_hitlog', 'hit_datetime' ) ) 1521 { // only drop, if it still exists (may have been removed manually) 1522 echo 'Updating hitlog indexes... '; 1523 $DB->query( ' 1524 ALTER TABLE T_hitlog 1525 DROP INDEX hit_datetime 1526 ' ); 1527 echo "OK.<br />\n"; 1528 } 1529 1530 set_upgrade_checkpoint( '9320' ); 1531 } 1532 1533 1534 if( $old_db_version < 9326 ) 1535 { 1536 echo 'Removing obsolete settings... '; 1537 $DB->query( 'DELETE FROM T_settings WHERE set_name = "upload_allowedext"' ); 1538 echo "OK.<br />\n"; 1539 1540 echo 'Updating blogs... '; 1541 db_drop_col( 'T_blogs', 'blog_allowpingbacks' ); 1542 1543 // Remove and transform obsolete fields blog_pingb2evonet, blog_pingtechnorati, blog_pingweblogs, blog_pingblodotgs 1544 if( db_cols_exist( 'T_blogs', array('blog_pingb2evonet', 'blog_pingtechnorati', 'blog_pingweblogs', 'blog_pingblodotgs') ) ) 1545 { 1546 foreach( $DB->get_results( ' 1547 SELECT blog_ID, blog_pingb2evonet, blog_pingtechnorati, blog_pingweblogs, blog_pingblodotgs 1548 FROM T_blogs' ) as $row ) 1549 { 1550 $ping_plugins = $DB->get_var( 'SELECT cset_value FROM T_coll_settings WHERE cset_coll_ID = '.$row->blog_ID.' AND cset_name = "ping_plugins"' ); 1551 $ping_plugins = explode(',', $ping_plugins); 1552 if( $row->blog_pingb2evonet ) 1553 { 1554 $ping_plugins[] = 'ping_b2evonet'; 1555 } 1556 if( $row->blog_pingtechnorati || $row->blog_pingweblogs || $row->blog_pingblodotgs ) 1557 { // if either one of the previous pingers was enabled, add ping-o-matic: 1558 $ping_plugins[] = 'ping_pingomatic'; 1559 } 1560 1561 // Insert transformed/generated ping plugins collection setting: 1562 $ping_plugins = array_unique($ping_plugins); 1563 $DB->query( 'REPLACE INTO T_coll_settings 1564 ( cset_coll_ID, cset_name, cset_value ) 1565 VALUES ( '.$row->blog_ID.', "ping_plugins", "'.implode( ',', $ping_plugins ).'" )' ); 1566 } 1567 $DB->query( 'ALTER TABLE T_blogs 1568 DROP COLUMN blog_pingb2evonet, 1569 DROP COLUMN blog_pingtechnorati, 1570 DROP COLUMN blog_pingweblogs, 1571 DROP COLUMN blog_pingblodotgs' ); 1572 } 1573 echo "OK.<br />\n"; 1574 1575 1576 set_upgrade_checkpoint( '9326' ); 1577 } 1578 1579 1580 if( $old_db_version < 9328 ) 1581 { 1582 echo 'Updating posts... '; 1583 db_add_col( "{$tableprefix}posts", 'post_notifications_status', 'ENUM("noreq","todo","started","finished") NOT NULL DEFAULT "noreq" AFTER post_flags' ); 1584 db_add_col( "{$tableprefix}posts", 'post_notifications_ctsk_ID', 'INT(10) unsigned NULL DEFAULT NULL AFTER post_notifications_status' ); 1585 echo "OK.<br />\n"; 1586 set_upgrade_checkpoint( '9328' ); 1587 } 1588 1589 1590 if( $old_db_version < 9330 ) 1591 { 1592 if( db_col_exists( "{$tableprefix}posts", 'post_flags') ) 1593 { 1594 echo 'Updating post notifications... '; 1595 $DB->query( " 1596 UPDATE {$tableprefix}posts 1597 SET post_notifications_status = 'finished' 1598 WHERE post_flags LIKE '%pingsdone%'" ); 1599 db_drop_col( "{$tableprefix}posts", 'post_flags' ); 1600 echo "OK.<br />\n"; 1601 } 1602 set_upgrade_checkpoint( '9330' ); 1603 } 1604 1605 1606 if( $old_db_version < 9340 ) 1607 { 1608 echo 'Removing duplicate post link indexes... '; 1609 if( db_index_exists( 'T_links', 'link_item_ID' ) ) 1610 { // only drop, if it still exists (may have been removed manually) 1611 $DB->query( ' 1612 ALTER TABLE T_links 1613 DROP INDEX link_item_ID 1614 ' ); 1615 } 1616 if( db_index_exists( 'T_links', 'link_dest_item_ID' ) ) 1617 { // only drop, if it still exists (may have been removed manually) 1618 $DB->query( ' 1619 ALTER TABLE T_links 1620 DROP INDEX link_dest_item_ID 1621 ' ); 1622 } 1623 echo "OK.<br />\n"; 1624 1625 set_upgrade_checkpoint( '9340' ); 1626 } 1627 1628 // ____________________________ 1.10: ____________________________ 1629 1630 if( $old_db_version < 9345 ) 1631 { 1632 echo 'Updating post table... '; 1633 $DB->query( "ALTER TABLE {$tableprefix}posts CHANGE COLUMN post_content post_content MEDIUMTEXT NULL" ); 1634 echo "OK.<br />\n"; 1635 set_upgrade_checkpoint( '9345' ); 1636 } 1637 1638 if( $old_db_version < 9346 ) 1639 { 1640 echo 'Updating prerendering table... '; 1641 $DB->query( "ALTER TABLE {$tableprefix}item__prerendering CHANGE COLUMN itpr_content_prerendered itpr_content_prerendered MEDIUMTEXT NULL" ); 1642 echo "OK.<br />\n"; 1643 set_upgrade_checkpoint( '9346' ); 1644 } 1645 1646 if( $old_db_version < 9348 ) 1647 { 1648 echo 'Updating sessions table... '; 1649 $DB->query( 'ALTER TABLE T_sessions CHANGE COLUMN sess_data sess_data MEDIUMBLOB DEFAULT NULL' ); 1650 echo "OK.<br />\n"; 1651 set_upgrade_checkpoint( '9348' ); 1652 } 1653 1654 if( $old_db_version < 9350 ) 1655 { 1656 echo 'Updating hitlog table... '; 1657 $DB->query( 'ALTER TABLE T_hitlog CHANGE COLUMN hit_referer_type hit_referer_type ENUM(\'search\',\'blacklist\',\'spam\',\'referer\',\'direct\',\'self\',\'admin\') NOT NULL' ); 1658 echo "OK.<br />\n"; 1659 1660 set_upgrade_checkpoint( '9350' ); 1661 } 1662 1663 1664 // TODO: "If a user has permission to edit a blog, he should be able to put files in the media folder for that blog." - see http://forums.b2evolution.net/viewtopic.php?p=36417#36417 1665 /* 1666 // blueyed>> I've came up with the following, but it's too generic IMHO 1667 if( $old_db_version < 9300 ) 1668 { 1669 echo 'Setting automatic media perms on blogs (members can upload)... '; 1670 $users = $DB->query( ' 1671 UPDATE T_users 1672 SET bloguser_perm_media_upload = 1 1673 WHERE bloguser_ismember = 1' ); 1674 echo "OK.<br />\n"; 1675 } 1676 */ 1677 1678 1679 // ____________________________ 2.0: ____________________________ 1680 1681 if( $old_db_version < 9406 ) 1682 { 1683 echo 'Updating chapter url names... '; 1684 $DB->query( ' 1685 ALTER TABLE T_categories 1686 ADD COLUMN cat_urlname VARCHAR(255) NOT NULL' ); 1687 1688 // TODO: dh> "cID" is not that readable, is it? Should use a function instead. Also use it for cafelog upgrade then. 1689 $DB->query( ' 1690 UPDATE T_categories 1691 SET cat_urlname = CONCAT( "c" , cat_ID )' ); 1692 $DB->query( ' 1693 ALTER TABLE T_categories 1694 ADD UNIQUE cat_urlname ( cat_urlname )' ); 1695 echo "OK.<br />\n"; 1696 1697 echo 'Updating Settings... '; 1698 $DB->query( ' 1699 UPDATE T_settings 1700 SET set_value = "disabled" 1701 WHERE set_name = "links_extrapath" 1702 AND set_value = 0' ); 1703 $DB->query( ' 1704 UPDATE T_settings 1705 SET set_value = "ymd" 1706 WHERE set_name = "links_extrapath" 1707 AND set_value <> 0' ); 1708 echo "OK.<br />\n"; 1709 1710 set_upgrade_checkpoint( '9406' ); 1711 } 1712 1713 1714 if( $old_db_version < 9407 ) 1715 { 1716 echo 'Moving general settings to blog settings... '; 1717 $DB->query( 'REPLACE INTO T_coll_settings( cset_coll_ID, cset_name, cset_value ) 1718 SELECT blog_ID, set_name, set_value 1719 FROM T_blogs, T_settings 1720 WHERE set_name = "posts_per_page" 1721 OR set_name = "what_to_show" 1722 OR set_name = "archive_mode"' ); 1723 $DB->query( 'DELETE FROM T_settings 1724 WHERE set_name = "posts_per_page" 1725 OR set_name = "what_to_show" 1726 OR set_name = "archive_mode"' ); 1727 echo "OK.<br />\n"; 1728 1729 echo 'Upgrading blogs table... '; 1730 $query = "ALTER TABLE T_blogs 1731 DROP COLUMN blog_force_skin"; 1732 $DB->query( $query ); 1733 echo "OK.<br />\n"; 1734 1735 echo 'Upgrading groups table... '; 1736 $query = "ALTER TABLE T_groups 1737 CHANGE COLUMN grp_perm_files grp_perm_files enum('none','view','add','edit','all') NOT NULL default 'none'"; 1738 $DB->query( $query ); 1739 echo "OK.<br />\n"; 1740 1741 echo 'Upgrading files table... '; 1742 $query = "ALTER TABLE T_files 1743 CHANGE COLUMN file_root_type file_root_type enum('absolute','user','group','collection','skins') not null default 'absolute'"; 1744 $DB->query( $query ); 1745 echo "OK.<br />\n"; 1746 1747 echo 'Updating file types... '; 1748 // Only change this if it's close enough to a default install (non customized) 1749 $DB->query( "UPDATE T_filetypes 1750 SET ftyp_viewtype = 'text' 1751 WHERE ftyp_ID = 12 1752 AND ftyp_extensions = 'php php3 php4 php5 php6' 1753 AND ftyp_mimetype ='application/x-httpd-php' 1754 AND ftyp_icon = 'php.gif'" ); 1755 echo "OK.<br />\n"; 1756 1757 echo 'Remove obsolete user settings... '; 1758 $DB->query( 'DELETE FROM T_usersettings 1759 WHERE uset_name = "plugins_disp_avail"' ); 1760 echo "OK.<br />\n"; 1761 1762 set_upgrade_checkpoint( '9407' ); 1763 } 1764 1765 1766 if( $old_db_version < 9408 ) 1767 { 1768 echo 'Creating skins table... '; 1769 $DB->query( 'CREATE TABLE T_skins__skin ( 1770 skin_ID int(10) unsigned NOT NULL auto_increment, 1771 skin_name varchar(32) NOT NULL, 1772 skin_type enum(\'normal\',\'feed\') NOT NULL default \'normal\', 1773 skin_folder varchar(32) NOT NULL, 1774 PRIMARY KEY skin_ID (skin_ID), 1775 UNIQUE skin_folder( skin_folder ), 1776 KEY skin_name( skin_name ) 1777 )' ); 1778 echo "OK.<br />\n"; 1779 1780 echo 'Creating skin containers table... '; 1781 $DB->query( 'CREATE TABLE T_skins__container ( 1782 sco_skin_ID int(10) unsigned NOT NULL, 1783 sco_name varchar(40) NOT NULL, 1784 PRIMARY KEY (sco_skin_ID, sco_name) 1785 )' ); 1786 echo "OK.<br />\n"; 1787 1788 install_basic_skins(); 1789 1790 echo 'Creating widgets table... '; 1791 $DB->query( 'CREATE TABLE T_widget ( 1792 wi_ID INT(10) UNSIGNED auto_increment, 1793 wi_coll_ID INT(11) UNSIGNED NOT NULL, 1794 wi_sco_name VARCHAR( 40 ) NOT NULL, 1795 wi_order INT(10) UNSIGNED NOT NULL, 1796 wi_type ENUM( \'core\', \'plugin\' ) NOT NULL DEFAULT \'core\', 1797 wi_code VARCHAR(32) NOT NULL, 1798 wi_params TEXT NULL, 1799 PRIMARY KEY ( wi_ID ), 1800 UNIQUE wi_order( wi_coll_ID, wi_sco_name, wi_order ) 1801 )' ); 1802 echo "OK.<br />\n"; 1803 1804 echo 'Updating blogs table... '; 1805 $DB->query( 'ALTER TABLE T_blogs 1806 ALTER COLUMN blog_allowtrackbacks SET DEFAULT 0, 1807 DROP COLUMN blog_default_skin, 1808 ADD COLUMN blog_owner_user_ID int(11) unsigned NOT NULL default 1 AFTER blog_name, 1809 ADD COLUMN blog_skin_ID INT(10) UNSIGNED NOT NULL DEFAULT 1 AFTER blog_allowusercss' ); 1810 echo "OK.<br />\n"; 1811 1812 1813 install_basic_widgets(); 1814 1815 set_upgrade_checkpoint( '9408' ); 1816 } 1817 1818 1819 if( $old_db_version < 9409 ) 1820 { 1821 // Upgrade the blog access types: 1822 echo 'Updating blogs access types... '; 1823 $DB->query( 'UPDATE T_blogs 1824 SET blog_access_type = "absolute" 1825 WHERE blog_siteurl LIKE "http://%" 1826 OR blog_siteurl LIKE "https://%"' ); 1827 1828 $DB->query( 'UPDATE T_blogs 1829 SET blog_access_type = "relative", 1830 blog_siteurl = CONCAT( blog_siteurl, blog_stub ) 1831 WHERE blog_access_type = "stub"' ); 1832 1833 db_drop_col( 'T_blogs', 'blog_stub' ); 1834 1835 echo "OK.<br />\n"; 1836 1837 1838 echo 'Updating columns... '; 1839 $DB->query( "ALTER TABLE T_groups CHANGE COLUMN grp_perm_stats grp_perm_stats enum('none','user','view','edit') NOT NULL default 'none'" ); 1840 1841 $DB->query( "ALTER TABLE T_coll_user_perms CHANGE COLUMN bloguser_perm_poststatuses bloguser_perm_poststatuses set('published','deprecated','protected','private','draft','redirected') NOT NULL default ''" ); 1842 1843 $DB->query( "ALTER TABLE T_coll_group_perms CHANGE COLUMN bloggroup_perm_poststatuses bloggroup_perm_poststatuses set('published','deprecated','protected','private','draft','redirected') NOT NULL default ''" ); 1844 1845 $DB->query( "ALTER TABLE {$tableprefix}posts CHANGE COLUMN post_status post_status enum('published','deprecated','protected','private','draft','redirected') NOT NULL default 'published'" ); 1846 echo "OK.<br />\n"; 1847 1848 set_upgrade_checkpoint( '9409' ); 1849 } 1850 1851 1852 if( $old_db_version < 9410 ) 1853 { 1854 echo 'Updating columns... '; 1855 $DB->query( "ALTER TABLE T_comments CHANGE COLUMN comment_status comment_status ENUM('published','deprecated','protected','private','draft','redirected') DEFAULT 'published' NOT NULL" ); 1856 1857 $DB->query( "ALTER TABLE T_sessions CHANGE COLUMN sess_data sess_data MEDIUMBLOB DEFAULT NULL" ); 1858 1859 $DB->query( "ALTER TABLE T_hitlog CHANGE COLUMN hit_referer_type hit_referer_type ENUM('search','blacklist','spam','referer','direct','self','admin') NOT NULL" ); 1860 1861 echo "OK.<br />\n"; 1862 1863 set_upgrade_checkpoint( '9410' ); 1864 } 1865 1866 1867 if( $old_db_version < 9411 ) 1868 { 1869 echo 'Adding default Post Types... '; 1870 $DB->query( " 1871 REPLACE INTO {$tableprefix}posttypes ( ptyp_ID, ptyp_name ) 1872 VALUES ( 1000, 'Page' ), 1873 ( 2000, 'Reserved' ), 1874 ( 3000, 'Reserved' ), 1875 ( 4000, 'Reserved' ), 1876 ( 5000, 'Reserved' ) " ); 1877 echo "OK.<br />\n"; 1878 set_upgrade_checkpoint( '9411' ); 1879 } 1880 1881 1882 if( $old_db_version < 9412 ) 1883 { 1884 echo 'Adding field for post excerpts... '; 1885 $DB->query( "ALTER TABLE {$tableprefix}posts ADD COLUMN post_excerpt text NULL AFTER post_content" ); 1886 echo "OK.<br />\n"; 1887 set_upgrade_checkpoint( '9412' ); 1888 } 1889 1890 if( $old_db_version < 9414 ) 1891 { 1892 echo "Renaming tables..."; 1893 $DB->query( "RENAME TABLE {$tableprefix}item__prerendering TO T_items__prerendering, 1894 {$tableprefix}poststatuses TO T_items__status, 1895 {$tableprefix}posttypes TO T_items__type, 1896 {$tableprefix}posts TO T_items__item" ); 1897 echo "OK.<br />\n"; 1898 1899 echo "Creating Tag tables..."; 1900 $DB->query( "CREATE TABLE T_items__tag ( 1901 tag_ID int(11) unsigned not null AUTO_INCREMENT, 1902 tag_name varchar(50) not null, 1903 primary key (tag_ID), 1904 UNIQUE tag_name( tag_name ) 1905 )" ); 1906 1907 $DB->query( "CREATE TABLE T_items__itemtag ( 1908 itag_itm_ID int(11) unsigned NOT NULL, 1909 itag_tag_ID int(11) unsigned NOT NULL, 1910 PRIMARY KEY (itag_itm_ID, itag_tag_ID), 1911 UNIQUE tagitem ( itag_tag_ID, itag_itm_ID ) 1912 )" ); 1913 echo "OK.<br />\n"; 1914 1915 set_upgrade_checkpoint( '9414' ); 1916 } 1917 1918 1919 if( $old_db_version < 9416 ) 1920 { 1921 echo "Updating blogs table..."; 1922 $DB->query( "ALTER TABLE T_blogs 1923 ADD COLUMN blog_advanced_perms TINYINT(1) NOT NULL default 0 AFTER blog_owner_user_ID, 1924 DROP COLUMN blog_staticfilename" ); 1925 $DB->query( "UPDATE T_blogs 1926 SET blog_advanced_perms = 1" ); 1927 echo "OK.<br />\n"; 1928 1929 echo "Additionnal blog permissions..."; 1930 $DB->query( "ALTER TABLE T_coll_user_perms 1931 ADD COLUMN bloguser_perm_admin tinyint NOT NULL default 0 AFTER bloguser_perm_properties, 1932 ADD COLUMN bloguser_perm_edit ENUM('no','own','lt','le','all','redirected') NOT NULL default 'no' AFTER bloguser_perm_poststatuses" ); 1933 1934 $DB->query( "ALTER TABLE T_coll_group_perms 1935 ADD COLUMN bloggroup_perm_admin tinyint NOT NULL default 0 AFTER bloggroup_perm_properties, 1936 ADD COLUMN bloggroup_perm_edit ENUM('no','own','lt','le','all','redirected') NOT NULL default 'no' AFTER bloggroup_perm_poststatuses" ); 1937 1938 // Preserve full admin perms: 1939 $DB->query( "UPDATE T_coll_user_perms 1940 SET bloguser_perm_admin = 1 1941 WHERE bloguser_perm_properties <> 0" ); 1942 $DB->query( "UPDATE T_coll_group_perms 1943 SET bloggroup_perm_admin = 1 1944 WHERE bloggroup_perm_properties <> 0" ); 1945 1946 // Preserve full edit perms: 1947 $DB->query( "UPDATE T_coll_user_perms 1948 SET bloguser_perm_edit = 'all'" ); 1949 $DB->query( "UPDATE T_coll_group_perms 1950 SET bloggroup_perm_edit = 'all'" ); 1951 1952 echo "OK.<br />\n"; 1953 1954 set_upgrade_checkpoint( '9416' ); 1955 } 1956 1957 1958 if( $old_db_version < 9500 ) 1959 { 1960 task_begin( 'Normalizing columns...' ); 1961 $DB->query( 'ALTER TABLE T_blogs 1962 ALTER COLUMN blog_shortname SET DEFAULT \'\', 1963 ALTER COLUMN blog_tagline SET DEFAULT \'\', 1964 CHANGE COLUMN blog_description blog_description varchar(250) NULL default \'\', 1965 ALTER COLUMN blog_siteurl SET DEFAULT \'\'' ); 1966 task_end(); 1967 1968 task_begin( 'Normalizing dates...' ); 1969 $DB->query( 'UPDATE T_users 1970 SET dateYMDhour = \'2000-01-01 00:00:00\' 1971 WHERE dateYMDhour = \'0000-00-00 00:00:00\'' ); 1972 $DB->query( 'ALTER TABLE T_users 1973 MODIFY COLUMN dateYMDhour DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\'' ); 1974 $DB->query( 'UPDATE T_comments 1975 SET comment_date = \'2000-01-01 00:00:00\' 1976 WHERE comment_date = \'0000-00-00 00:00:00\'' ); 1977 $DB->query( 'ALTER TABLE T_comments 1978 MODIFY COLUMN comment_date DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\'' ); 1979 task_end(); 1980 1981 task_begin( 'Normalizing cron jobs...' ); 1982 $DB->query( 'UPDATE T_cron__task 1983 SET ctsk_controller = REPLACE(ctsk_controller, "cron/_", "cron/jobs/_" ) 1984 WHERE ctsk_controller LIKE "cron/_%"' ); 1985 task_end(); 1986 1987 task_begin( 'Extending comments table...' ); 1988 $DB->query( 'ALTER TABLE T_comments 1989 ADD COLUMN comment_rating TINYINT(1) NULL DEFAULT NULL AFTER comment_content, 1990 ADD COLUMN comment_featured TINYINT(1) NOT NULL DEFAULT 0 AFTER comment_rating, 1991 ADD COLUMN comment_nofollow TINYINT(1) NOT NULL DEFAULT 1 AFTER comment_featured;'); 1992 task_end(); 1993 1994 set_upgrade_checkpoint( '9500' ); 1995 } 1996 1997 1998 /* 1999 * ADD UPGRADES HERE. 2000 * 2001 * ALL DB CHANGES MUST BE EXPLICITELY CARRIED OUT. DO NOT RELY ON SCHEMA UPDATES! 2002 * Schema updates do not survive after several incremental changes. 2003 * 2004 * NOTE: every change that gets done here, should bump {@link $new_db_version} (by 100). 2005 */ 2006 2007 2008 // Just in case, make sure the db schema version is upto date at the end. 2009 if( $old_db_version != $new_db_version ) 2010 { // Update DB schema version to $new_db_version 2011 set_upgrade_checkpoint( $new_db_version ); 2012 } 2013 2014 2015 // This has to be at the end because plugin install may fail if the DB schema is not current (matching Plugins class). 2016 // Only new default plugins will be installed, based on $old_db_version. 2017 // dh> NOTE: if this fails (e.g. fatal error in one of the plugins), it will not get repeated 2018 install_basic_plugins( $old_db_version ); 2019 2020 2021 /* 2022 * Check to make sure the DB schema is up to date: 2023 */ 2024 $upgrade_db_deltas = array(); // This holds changes to make, if any (just all queries) 2025 2026 foreach( $schema_queries as $table => $query_info ) 2027 { 2028 foreach( db_delta( $query_info[1], array('drop_column', 'drop_index') ) as $table => $queries ) 2029 { 2030 foreach( $queries as $qinfo ) 2031 { 2032 foreach( $qinfo['queries'] as $query ) 2033 { // subqueries for this query (usually one, but may include required other queries) 2034 $upgrade_db_deltas[] = $query; 2035 } 2036 } 2037 } 2038 } 2039 2040 if( empty($upgrade_db_deltas) ) 2041 { 2042 echo '<p>'.T_('The database schema is up to date.').'</p>'; 2043 } 2044 else 2045 { 2046 // delta queries have to be confirmed or executed now.. 2047 2048 $confirmed_db_upgrade = param('confirmed', 'integer', 0); // force confirmation 2049 $upgrade_db_deltas_confirm_md5 = param( 'upgrade_db_deltas_confirm_md5', 'string', '' ); 2050 2051 if( ! $confirmed_db_upgrade ) 2052 { 2053 if( ! empty($upgrade_db_deltas_confirm_md5) ) 2054 { // received confirmation from form 2055 if( $upgrade_db_deltas_confirm_md5 != md5( implode('', $upgrade_db_deltas) ) ) 2056 { // unlikely to happen 2057 echo '<p class="error">' 2058 .T_('The DB schema has been changed since confirmation.') 2059 .'</p>'; 2060 } 2061 else 2062 { 2063 $confirmed_db_upgrade = true; 2064 } 2065 } 2066 } 2067 2068 if( ! $confirmed_db_upgrade ) 2069 { 2070 global $action, $locale; 2071 load_funcs( '_core/ui/forms/_form.class.php' ); 2072 $Form = & new Form( NULL, '', 'post' ); 2073 $Form->begin_form( 'fform', T_('Upgrade database') ); 2074 $Form->begin_fieldset(); 2075 $Form->hidden( 'upgrade_db_deltas_confirm_md5', md5(implode( '', $upgrade_db_deltas )) ); 2076 $Form->hidden( 'action', $action ); 2077 $Form->hidden( 'locale', $locale ); 2078 2079 2080 echo '<p>'.T_('The version number is correct, but we have detected changes in the database schema. This can happen with CVS versions...').'</p>'; 2081 2082 echo '<p>'.T_('The following database changes will be carried out. If you are not sure what this means, it will probably be alright.').'</p>'; 2083 2084 echo '<ul>'; 2085 foreach( $upgrade_db_deltas as $l_delta ) 2086 { 2087 #echo '<li><code>'.nl2br($l_delta).'</code></li>'; 2088 echo '<li><pre>'.str_replace( "\t", ' ', $l_delta ).'</pre></li>'; 2089 } 2090 echo '</ul>'; 2091 $Form->submit( array( '', T_('Upgrade database!'), 'ActionButton' ) ); 2092 $Form->end_form(); 2093 2094 return false; 2095 } 2096 2097 // Alter DB to match DB schema: 2098 install_make_db_schema_current( true ); 2099 } 2100 2101 return true; 2102 } 2103 2104 2105 /* 2106 * $Log: _functions_evoupgrade.php,v $ 2107 * Revision 1.232 2007/11/02 01:53:34 fplanque 2108 * comment ratings 2109 * 2110 * Revision 1.231 2007/10/11 14:02:48 fplanque 2111 * simplified 2112 * 2113 * Revision 1.230 2007/09/19 02:54:16 fplanque 2114 * bullet proof upgrade 2115 * 2116 * Revision 1.229 2007/07/03 23:21:32 blueyed 2117 * Fixed includes/requires in/for tests 2118 * 2119 * Revision 1.228 2007/06/25 11:02:30 fplanque 2120 * MODULES (refactored MVC) 2121 * 2122 * Revision 1.227 2007/06/13 19:06:17 fplanque 2123 * debugging 2124 * 2125 * Revision 1.226 2007/06/03 02:54:18 fplanque 2126 * Stuff for permission maniacs (admin part only, actual perms checks to be implemented) 2127 * Newbies will not see this complexity since advanced perms are now disabled by default. 2128 * 2129 * Revision 1.225 2007/05/31 03:02:23 fplanque 2130 * Advanced perms now disabled by default (simpler interface). 2131 * Except when upgrading. 2132 * Enable advanced perms in blog settings -> features 2133 * 2134 * Revision 1.224 2007/05/29 01:17:20 fplanque 2135 * advanced admin blog settings are now restricted by a special permission 2136 * 2137 * Revision 1.223 2007/05/17 20:44:19 fplanque 2138 * fixed upgrade. 2139 * 2140 * Revision 1.222 2007/05/14 02:47:23 fplanque 2141 * (not so) basic Tags framework 2142 * 2143 * Revision 1.221 2007/05/13 22:04:48 fplanque 2144 * basic excerpt support 2145 * 2146 * Revision 1.220 2007/05/13 20:44:52 fplanque 2147 * more pages support 2148 * 2149 * Revision 1.219 2007/05/02 18:28:19 fplanque 2150 * no message 2151 * 2152 * Revision 1.218 2007/04/27 09:34:45 fplanque 2153 * oops 2154 * 2155 * Revision 1.217 2007/04/27 09:11:37 fplanque 2156 * saving "spam" referers again (instead of buggy empty referers) 2157 * 2158 * Revision 1.216 2007/04/26 00:11:09 fplanque 2159 * (c) 2007 2160 * 2161 * Revision 1.215 2007/04/19 01:51:53 fplanque 2162 * upgrade checkpoints 2163 * 2164 * Revision 1.214 2007/03/26 12:59:18 fplanque 2165 * basic pages support 2166 * 2167 * Revision 1.213 2007/03/25 15:18:57 fplanque 2168 * cleanup 2169 * 2170 * Revision 1.212 2007/03/25 15:07:38 fplanque 2171 * multiblog fixes 2172 * 2173 * Revision 1.211 2007/03/12 14:10:10 waltercruz 2174 * Changing the WHERE 1 queries to boolean (WHERE 1=1) queries to satisfy the standarts 2175 * 2176 * Revision 1.210 2007/02/21 21:33:43 fplanque 2177 * allow jpeg extension on new installs/upgrades 2178 * 2179 * Revision 1.209 2007/02/13 00:38:11 blueyed 2180 * Changed DB fields for 1.10.0: sess_data to MEDIUMTEXT (serialize() does not completely convert the binary data to text); post_content and itpr_content_prerendered to MEDIUMTEXT 2181 * 2182 * Revision 1.208 2007/02/05 00:35:44 fplanque 2183 * small adjustments 2184 * 2185 * Revision 1.207 2007/02/03 19:00:49 fplanque 2186 * unbloat 2187 * 2188 * Revision 1.205 2007/01/23 04:19:50 fplanque 2189 * handling of blog owners 2190 * 2191 * Revision 1.204 2007/01/15 20:54:57 fplanque 2192 * minor fix 2193 * 2194 * Revision 1.203 2007/01/15 03:53:24 fplanque 2195 * refactoring / simplified installer 2196 * 2197 * Revision 1.202 2007/01/12 02:40:26 fplanque 2198 * widget default params proof of concept 2199 * (param customization to be done) 2200 * 2201 * Revision 1.201 2007/01/08 23:45:48 fplanque 2202 * A little less rough widget manager... 2203 * (can handle multiple instances of same widget and remembers order) 2204 * 2205 * Revision 1.200 2007/01/08 21:53:51 fplanque 2206 * typo 2207 * 2208 * Revision 1.199 2007/01/08 02:11:56 fplanque 2209 * Blogs now make use of installed skins 2210 * next step: make use of widgets inside of skins 2211 * 2212 * Revision 1.198 2006/12/20 23:07:24 blueyed 2213 * Moved list of available plugins to separate sub-screen/form 2214 * 2215 * Revision 1.197 2006/12/15 23:31:22 fplanque 2216 * reauthorized _ in urltitles. 2217 * No breaking of legacy permalinks. 2218 * - remains the default placeholder though. 2219 * 2220 * Revision 1.196 2006/12/07 20:31:29 fplanque 2221 * fixed install 2222 * 2223 * Revision 1.195 2006/12/07 20:03:33 fplanque 2224 * Woohoo! File editing... means all skin editing. 2225 * 2226 * Revision 1.194 2006/12/07 16:06:24 fplanque 2227 * prepared new file editing permission 2228 * 2229 * Revision 1.193 2006/12/04 22:24:51 blueyed 2230 * doc 2231 * 2232 * Revision 1.192 2006/12/04 21:25:18 fplanque 2233 * removed user skin switching 2234 * 2235 * Revision 1.191 2006/12/04 19:41:11 fplanque 2236 * Each blog can now have its own "archive mode" settings 2237 * 2238 * Revision 1.190 2006/12/04 18:16:51 fplanque 2239 * Each blog can now have its own "number of page/days to display" settings 2240 * 2241 * Revision 1.189 2006/11/18 16:34:24 blueyed 2242 * Removed todo 2243 * 2244 * Revision 1.188 2006/11/18 03:58:21 fplanque 2245 * removed duplicate indexes on T_links 2246 * 2247 * Revision 1.187 2006/11/14 23:17:00 fplanque 2248 * adding stuff into the 9010 block weeks later was really evil. why do we have blocks for? 2249 * 2250 * Revision 1.186 2006/11/01 00:24:07 blueyed 2251 * Fixed cafelog upgrade 2252 * 2253 * Revision 1.185 2006/10/14 21:11:48 blueyed 2254 * Actually insert the transformed/generated ping plugins setting(s). 2255 * 2256 * Revision 1.184 2006/10/14 20:53:13 blueyed 2257 * Transform blog ping settings to new Plugin structure. 2258 * 2259 * Revision 1.183 2006/10/11 17:21:09 blueyed 2260 * Fixes 2261 * 2262 * Revision 1.182 2006/10/10 23:00:41 blueyed 2263 * Fixed some table names to alias; fixed plugin install procedure; installed ping plugins; moved some upgrade code to 1.9 2264 * 2265 * Revision 1.181 2006/10/06 21:03:07 blueyed 2266 * Removed deprecated/unused "upload_allowedext" Setting, which restricted file extensions during upload though! 2267 * 2268 * Revision 1.180 2006/10/05 02:58:44 blueyed 2269 * Support for skipping index dropping, if it does not exist anymore. Should not bark out then! Also do not add the last checkpoint possibly twice. 2270 * 2271 * Revision 1.179 2006/10/05 02:42:22 blueyed 2272 * Remove index hit_datetime, because its slow on INSERT (e.g. 1s) 2273 * 2274 * Revision 1.178 2006/10/02 19:07:32 blueyed 2275 * Finished upgrade for 1.9-beta 2276 * 2277 * Revision 1.177 2006/10/01 22:11:43 blueyed 2278 * Ping services as plugins. 2279 * 2280 * Revision 1.176 2006/10/01 00:14:58 blueyed 2281 * plug_classpath should not have get merged already 2282 */ 2283 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |