diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-27 15:20:39 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-27 15:20:39 +0100 |
| commit | d382219ba2235527cd5213cf72d419b38eaf6ddb (patch) | |
| tree | a3f12494e1a1338f739b96476996c33f4490ca23 /admin | |
| parent | 2986e32b3c805ed3fd6ad012e01a58c0fd3bb25e (diff) | |
| download | liberty-d382219ba2235527cd5213cf72d419b38eaf6ddb.tar.gz liberty-d382219ba2235527cd5213cf72d419b38eaf6ddb.tar.bz2 liberty-d382219ba2235527cd5213cf72d419b38eaf6ddb.zip | |
Drop old update mechanism and start clean
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/upgrade_inc.php | 846 | ||||
| -rw-r--r-- | admin/upgrades/2.1.0.php | 68 | ||||
| -rw-r--r-- | admin/upgrades/2.1.1.php | 51 | ||||
| -rw-r--r-- | admin/upgrades/2.1.2.php | 37 | ||||
| -rw-r--r-- | admin/upgrades/2.1.3.php | 38 | ||||
| -rw-r--r-- | admin/upgrades/2.1.4.php | 41 | ||||
| -rw-r--r-- | admin/upgrades/3.0.0.php | 25 | ||||
| -rwxr-xr-x | admin/upgrades/5.0.0.php | 12 |
8 files changed, 12 insertions, 1106 deletions
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php deleted file mode 100644 index 1f99cc4..0000000 --- a/admin/upgrade_inc.php +++ /dev/null @@ -1,846 +0,0 @@ -<?php - -global $gBitSystem, $gUpgradeFrom, $gUpgradeTo; - -$upgrades = array( - - 'BWR1' => array( - 'BWR2' => array( - // STEP 1 -array( 'QUERY' => - array( 'SQL92' => array( - "ALTER TABLE `".BIT_DB_PREFIX."tiki_content` ADD `last_hit` INT8 NOT NULL DEFAULT 0", - "ALTER TABLE `".BIT_DB_PREFIX."tiki_content` ADD `event_time` INT8 NOT NULL DEFAULT 0", - "UPDATE `".BIT_DB_PREFIX."tiki_content` SET `last_hit` = `last_modified` ,`event_time` = 0", - )), -), - -array( 'DATADICT' => array( - array( 'RENAMETABLE' => array( - 'tiki_content' => 'liberty_content', - 'tiki_content_id_seq' => 'liberty_content_id_seq', - 'tiki_attachments' => 'liberty_attachments', - 'tiki_attachments_id_seq' => 'liberty_attachments_id_seq', - 'tiki_files' => 'liberty_files', - 'tiki_files_file_id_seq' => 'liberty_files_id_seq', - 'tiki_structures' => 'liberty_structures', - 'tiki_structures_id_seq' => 'liberty_structures_id_seq', - 'tiki_comments' => 'liberty_comments', - 'tiki_comments_comment_id_seq' => 'liberty_comment_id_seq', - 'tiki_content_types' => 'liberty_content_types', - 'tiki_link_cache' => 'liberty_link_cache', - 'tiki_history' => 'liberty_content_history', - 'tiki_actionlog' => 'liberty_action_log', - 'tiki_copyrights' => 'liberty_copyrights', - 'tiki_links' => 'liberty_content_links', - 'tiki_user_preferences' => 'liberty_content_prefs', - 'users_object_permissions' => 'liberty_content_permissions', - )), - array( 'CREATE' => array ( - 'liberty_process_queue' => " - process_id I4 NOTNULL AUTO PRIMARY, - content_id I4 NOTNULL, - queue_date I8 NOTNULL, - begin_date I8, - end_date I8, - process_status C(64), - log_message XL, - processor C(250), - processor_parameters XL - CONSTRAINT ', CONSTRAINT `liberty_process_queue` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) ' - ", - 'liberty_content_data' => " - content_id I4 PRIMARY, - data XL NOTNULL, - data_type C(32) PRIMARY - CONSTRAINT ', CONSTRAINT `liberty_content_data_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) ' - ", - 'liberty_content_hits' => " - content_id I4 PRIMARY, - hits I4 NOTNULL DEFAULT 1, - last_hit I8 NOTNULL DEFAULT 1 - CONSTRAINT ', CONSTRAINT `liberty_content_hits_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) ' - ", - 'liberty_content_status' => " - content_status_id I4 PRIMARY KEY, - content_status_name C(128) NOTNULL - ", - 'liberty_aliases' => " - alias_title C(250) PRIMARY, - content_id INT NOTNULL PRIMARY - CONSTRAINT ', CONSTRAINT liberty_aliases_content_fkey FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`(`content_id`) ' - ", - 'liberty_meta_titles' => " - meta_title_id I4 PRIMARY, - meta_title C(250) NOTNULL - ", - 'liberty_meta_types' => " - meta_type_id I4 PRIMARY, - meta_type C(250) NOTNULL - ", - 'liberty_attachment_meta_data' => " - attachment_id I4 PRIMARY NOTNULL, - meta_type_id I4 PRIMARY NOTNULL, - meta_title_id I4 PRIMARY NOTNULL, - meta_value XL - CONSTRAINT ' - , CONSTRAINT `liberty_meta_id_ref` FOREIGN KEY (`attachment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_attachments` (`attachment_id`) - , CONSTRAINT `liberty_meta_type_ref` FOREIGN KEY (`meta_type_id`) REFERENCES `".BIT_DB_PREFIX."liberty_meta_types` (`meta_type_id`) - , CONSTRAINT `liberty_meta_title_ref` FOREIGN KEY (`meta_title_id`) REFERENCES `".BIT_DB_PREFIX."liberty_meta_titles` (`meta_title_id`) ' - ", - 'liberty_attachment_prefs' => " - attachment_id I4 PRIMARY, - pref_name C(40) PRIMARY, - pref_value C(250) - CONSTRAINT ', CONSTRAINT `lib_attachment_prefs_content_ref` FOREIGN KEY (`attachment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_attachments` (`attachment_id`)' - ", - )), - array( 'ALTER' => array( - 'liberty_content' => array( - 'lang_code' => array( '`lang_code`', 'VARCHAR(32)' ), - 'content_status_id' => array( '`content_status_id`', 'I4' ), - // this has moved to liberty_attachments.is_primary - //'primary_attachment_id' => array( '`primary_attachment_id`', 'I4' ), - ), - 'liberty_action_log' => array( - 'log_action' => array( '`log_message`', 'VARCHAR(250)' ), - 'action_comment' => array( '`error_message`', 'VARCHAR(250)' ), - 'content_id' => array( '`content_id`', 'I4' ), - ), - 'liberty_thumbnail_queue' => array( - 'processor' => array( '`processor`', 'VARCHAR(250)' ), - 'processor_parameters' => array( '`processor_parameters`', 'VARCHAR(250)' ), - ), - 'liberty_content_permissions' => array( - 'object_id' => array( '`content_id`', 'I4' ), - 'is_revoked' => array( '`is_revoked`', 'VARCHAR(1)' ), - ), - )), - /* The installer can't add constraints after table creation yet so drop this constraint. - array( 'SQL' => array( - 'ALTER TABLE `'.BIT_DB_PREFIX.'liberty_content` ADD CONSTRAINT liberty_content_attachment_ref FOREIGN KEY (primary_attachment_id) REFERENCES `'.BIT_DB_PREFIX.'liberty_attachments` (attachment_id)' - )), - */ -)), - - -// drop the original thumbnail_queue table - comment for now since there is no real harm in leaving this table around for a bit longer -//array( 'DATADICT' => array( -// array( 'DROPTABLE' => array( -// 'liberty_thumbnail_queue' -// )), -//)), - -// we need to change some column properties in liberty_action_log -array( 'DATADICT' => array( - array( 'CREATE' => array( - // liberty_thumbnail_queue is being replaces with this - 'liberty_process_queue' => " - process_id I4 NOTNULL AUTO, - content_id I4 NOTNULL, - queue_date I8 NOTNULL, - begin_date I8, - end_date I8, - process_status C(64), - log_message XL, - processor C(250), - processor_parameters XL - CONSTRAINT ', CONSTRAINT `liberty_process_queue` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) ' - ", - )), - // rename original column - array( 'RENAMECOLUMN' => array( - 'liberty_action_log' => array( - '`log_message`' => "`temp_log` VARCHAR(250)", // set log_message NOTNULL DEFAULT '' - '`error_message`' => "`temp_error` VARCHAR(250)", // set error_message NOTNULL DEFAULT '' - '`content_id`' => "`temp_id` INT NOTNULL", // remove NOTNULL from content_id - ), - )), - // add new column - array( 'ALTER' => array( - 'liberty_action_log' => array( - 'log_message' => array( '`log_message`', "VARCHAR(250)" ), - 'error_message' => array( '`error_message`', "VARCHAR(250)" ), - 'content_id' => array( '`content_id`', 'INT' ), - ), - )), -)), -// copy all the data accross -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_action_log` SET `log_message` = `temp_log`", - // error messages are probably all set to NULL at this point - "UPDATE `".BIT_DB_PREFIX."liberty_action_log` SET `temp_error` = '' WHERE `temp_error` IS NULL", - "UPDATE `".BIT_DB_PREFIX."liberty_action_log` SET `error_message` = `temp_error`", - "UPDATE `".BIT_DB_PREFIX."liberty_action_log` SET `content_id` = `temp_id`", - )), -), -// drop original column -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'liberty_action_log' => array( '`temp_log`', '`temp_error`', '`temp_id`' ), - 'liberty_content_permissions' => array( '`object_type`' ), - )), -)), -// move hits and last_hit to a new table -array( 'QUERY' => - array( 'SQL92' => array( - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_hits` ( content_id, hits, last_hit ) SELECT content_id, hits, last_hit from `".BIT_DB_PREFIX."liberty_content`", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-999, 'Deleted')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-998, 'Spam')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-201, 'Suspended')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-100, 'Denied')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-40, 'Private')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-30, 'Password Protected')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-20, 'Group Protected')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-10, 'Hidden')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-5, 'Draft')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (-1, 'Pending Approval')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (50, 'Available')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (102, 'Commercial')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (200, 'Recommended')", - "INSERT INTO `".BIT_DB_PREFIX."liberty_content_status` (`content_status_id`,`content_status_name`) VALUES (999, 'Copy Protected')", - )), -), - - -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'liberty_content' => array( - '`last_hit`', - '`hits`', - ), - )), -)), - - -// content links -array( 'QUERY' => - array( 'MYSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_links` DROP PRIMARY KEY", - )), -), - -array( 'DATADICT' => array( - array( 'ALTER' => array( - 'liberty_content_links' => array( - 'to_title' => array( '`to_title`', 'VARCHAR(160)' ), - ), - )), - array( 'CREATEINDEX' => array( - 'liberty_content_links_title_idx' => array( 'liberty_content_links', '`to_title`', array() ), - 'process_id_idx' => array( 'liberty_process_queue', 'content_id', array() ), - 'liberty_att_meta_idx' => array( 'liberty_attachment_meta_data', 'attachment_id', array() ), - 'liberty_att_meta_type_idx' => array( 'liberty_attachment_meta_data', 'meta_type_id', array() ), - 'liberty_att_meta_title_idx' => array( 'liberty_attachment_meta_data', 'meta_title_id', array() ), - )), -)), - -// liberty_content_links php stuff comes in large PHP block below -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_content_links` SET to_title = (SELECT title FROM `".BIT_DB_PREFIX."liberty_content` lc WHERE `".BIT_DB_PREFIX."liberty_content_links`.`to_content_id`=lc.`content_id`)", - "DELETE FROM `".BIT_DB_PREFIX."liberty_content_links` WHERE to_title IS NULL", -# "ALTER TABLE liberty_content_links ALTER to_content_id DROP NOT NULL", - )), -), - -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_content` SET lang_code=language" - )), -), - -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'liberty_content' => array( '`language`' ), - )), -)), - -// generic history for all content -array( 'DATADICT' => array( - array( 'ALTER' => array ( - 'liberty_content_history' => array( - 'content_id' => array( '`content_id`', 'I4' ), - 'summary' => array( '`summary`', 'X' ), - ), - 'liberty_content' => array( - 'version' => array( '`version`', 'I4' ), - ), - )), -)), - -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_content_history` SET `content_id`=(SELECT `content_id` FROM `".BIT_DB_PREFIX."tiki_pages` wp WHERE wp.`page_id`=`".BIT_DB_PREFIX."liberty_content_history`.`page_id`)", - "UPDATE `".BIT_DB_PREFIX."liberty_content` SET version=(SELECT `version` from `".BIT_DB_PREFIX."tiki_pages` wp WHERE wp.`content_id`=`".BIT_DB_PREFIX."liberty_content`.`content_id`)", - "UPDATE `".BIT_DB_PREFIX."liberty_content_history` SET `summary`=`description`", - )), -), - -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'liberty_content_history' => array( '`page_id`', '`description`' ), - 'tiki_pages' => array( '`version`' ), - )), -)), - -// changes for materialized path support for comments -array( 'DATADICT' => array( - array( 'ALTER' => array ( - 'liberty_comments' => array( - 'root_id' => array( 'root_id', 'I4' ), - 'thread_forward_sequence' => '`thread_forward_sequence` C(250)', - 'thread_reverse_sequence' => '`thread_reverse_sequence` C(250)' , - // some other unrelated fields - 'anon_name' => '`anon_name` C(64)' , - ), - )), - - array( 'CREATEINDEX' => array( - 'thread_forward_idx' => array( 'liberty_comments', '`root_id`,`thread_forward_sequence`', array( 'UNIQUE' ) ), - 'thread_reverse_idx' => array( 'liberty_comments', '`root_id`,`thread_reverse_sequence`', array( 'UNIQUE' ) ), - )), -)), - -// straight from http://www.bitweaver.org/storage/comments_updater.txt -- not tested yet -array( 'PHP' => ' - #require_once( "../kernel/includes/setup_inc.php" ); - #require_once( WIKI_PKG_CLASS_PATH.'BitPage.php' ); - require_once( LIBERTY_PKG_CLASS_PATH.'LibertyBase.php'); - - global $gQueryUserId; - require_once( LIBERTY_PKG_CLASS_PATH.'LibertyComment.php' ); - $cmt = new LibertyComment(); - $max_records = 100000; - $allComments = $cmt->getList( - array( - "max_records" => $max_records, - "created_ge" => 0, - ) - ); - - if( !empty( $allComments ) ) { - - foreach ($allComments as $comment) { - //error_log( "x=" . serialize($comment) ); - # exit; - $comment_id = $comment["comment_id"]; - $parent_content_type = $comment["content_type_guid"]; - $content_title = $comment["content_title"]; - $content_id = $comment["content_id"]; - $parent_id = $comment["parent_id"]; - $created = $comment["created"]; - $last_modified = $comment["last_modified"]; - $title = $comment["title"]; - $user = $comment["creator_user"]; - $user_name = $comment["real_name"]; - $data = $comment["data"]; - $content_type_guid = $comment["content_type_guid"]; - - // assume not usable as not converted yet - $root_id = $comment["root_id"]; - - //make guess of parent_id -- refine later - $root_content_id_of_comment[$content_id] = $parent_id; - - $parent_content_id_of_comment[$content_id] = $parent_id; - $content_type_guid_of_comment[$content_id] = $content_type_guid; - $depth_of_comment[$content_id] = 1; - $comment_id_of_comment[$content_id] = $comment_id; - // leave alone comments with bogus data in them - if ($parent_id < 1) { - error_log("bad parent ID: $content_id for comment id: $comment_id with content id of: $content_id"); - $comment_status[$content_id] = 0; - } - if ($parent_id == $content_id) { - error_log("bad parent ID(loop): $content_id for comment id: $comment_id with content id of: $content_id"); - $comment_status[$content_id] = 0; - } - elseif ($content_id < 1) { - error_log("bad content ID for comment id: $comment_id with content id of: $content_id"); - $comment_status[$content_id] = 0; - } - else { - $comment_status[$content_id] = 1; - } - //echo "A comment: $comment_id content: $content_id parent: $parent_id root: $root_id title: $title\n"; - - } - -// error_log( serialize($content_type_guid_of_comment) ); - - //calc comment root and depth - $loop_done = 0; - while (!$loop_done) { - $c = 0; - foreach ($allComments as $comment) { - $content_id = $comment["content_id"]; - $comment_id = $comment["comment_id"]; - $parent_id = $comment["parent_id"]; - $title = $comment["title"]; - if (!$comment_status[$content_id]) { - continue; - } - $root_id = $root_content_id_of_comment[$content_id]; - $root_content_type = empty($content_type_guid_of_comment[$root_id]) ? "notcomment" : $content_type_guid_of_comment[$root_id]; - - if ($root_content_type == "bitcomment") { - // its a comment on a comment - // need to go back one more level - $root_content_id_of_comment[$content_id] = $parent_content_id_of_comment[$root_id]; - // prevent loops resulting from corrupted comment trees - if ($depth_of_comment[$content_id] < 20) { - $depth_of_comment[$content_id]++; - $c++; - } - } - } - - if ($c <= 0) { - $loop_done = 1; - } - } - - - error_log("depth set loop done"); - - function jc ($a, $b) { - global $root_table; - global $depth_of_comment; - global $comment_id_of_comment; - global $root_content_id_of_comment; - - $content_id_a = $a["content_id"]; - $content_id_b = $b["content_id"]; - - $parent_id_a = $a["parent_id"]; - $parent_id_b = $b["parent_id"]; - - $root_a = $root_content_id_of_comment[$content_id_a]; - $root_b = $root_content_id_of_comment[$content_id_b]; - - - $depth_a = $depth_of_comment[$content_id_a]; - $depth_b = $depth_of_comment[$content_id_b]; - - $id_a = $comment_id_of_comment[$content_id_a]; - $id_b = $comment_id_of_comment[$content_id_b]; - - $key_a = sprintf("%08d %08d %08d",$root_a,$depth_a,$parent_id_a); - $key_b = sprintf("%08d %08d %08d",$root_b,$depth_b,$parent_id_b);; - - if ($key_a == $key_b) { - return 0; - } - - return ($key_a < $key_b) ? -1: +1; - } - - usort($allComments, "jc"); - - foreach ($allComments as $comment) { - $content_id = $comment["content_id"]; - $comment_id = $comment["comment_id"]; - if (!$comment_status[$content_id]) { - continue; - } - $parent_content_type = $comment["content_type_guid"]; - $content_title = $comment["content_title"]; - $parent_id = $comment["parent_id"]; - $created = $comment["created"]; - $last_modified = $comment["last_modified"]; - $title = $comment["title"]; - $user = $comment["creator_user"]; - $user_name = $comment["real_name"]; - $data = $comment["data"]; - - $root_id = $root_content_id_of_comment[$content_id]; - $depth = $depth_of_comment[$content_id]; - - // we used to number sequentially, easier to just use comemnt ID - # $root_table_seq[$parent_id . "-" . $depth] = empty($root_table_seq[$parent_id . "-" . $depth]) ? 1: $root_table_seq[$parent_id . "-" . $depth] + 1; - $root_table_seq[$parent_id . "-" . $depth] = $comment_id; - - $root_table_seq3[$content_id] = $root_table_seq[$parent_id . "-" . $depth]; - - //echo "C comment $comment_id content: $content_id parent: $parent_id root: $root_id depth: $depth title: $title\n"; - //echo "update bit_liberty_comments set root_id=$root_id where comment_id=$comment_id;\n"; - $sql = "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `root_id` = ? where `comment_id` = ?"; - echo $sql . " ($root_id, $comment_id)\n"; - $result = $gBitSystem->mDb->query($sql, array($root_id, $comment_id)); - //echo "result=" . serialize($result) . "\n"; - - } - - - foreach ($allComments as $comment) { - $content_id = $comment["content_id"]; - $comment_id = $comment["comment_id"]; - if (!$comment_status[$content_id]) { - continue; - } - $parent_content_type = $comment["content_type_guid"]; - $content_title = $comment["content_title"]; - $parent_id = $comment["parent_id"]; - $created = $comment["created"]; - $last_modified = $comment["last_modified"]; - $title = $comment["title"]; - $user = $comment["creator_user"]; - $user_name = $comment["real_name"]; - $data = $comment["data"]; - - $root_id = $root_content_id_of_comment[$content_id]; - $depth = $depth_of_comment[$content_id]; - - $seq = sprintf("%09d",$root_table_seq3[$content_id]); - - $x = $parent_id; - while (!empty($root_table_seq3[$x])) { - $seq = sprintf("%09d",$root_table_seq3[$x]) . "." . $seq; - $x = $parent_content_id_of_comment[$x]; - } - - - $seq .= "."; - if (strlen($seq) > 25*10) { - echo "restricting depth: comment: $comment_id, content_id=$content_id\n"; - $seq = substr($seq,0,24*10) . sprintf("%09d",$comment_id) . "."; - } - - - # $seq_r .= "."; - - $seq_r = strtr($seq, "0123456789", "9876543210"); - - echo "D comment $comment_id content: $content_id parent: $parent_id root: $root_id depth: $depth title: $title\n"; - //echo " seq=$seq=\n"; - //echo " rseq=$seq_r=\n"; - - //echo "update bit_liberty_comments set thread_forward_sequence=$seq= where comment_id=$comment_id;\n"; - //echo "update bit_liberty_comments set thread_reverse_sequence=$seq_r= where comment_id=$comment_id;\n"; - $sql = "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `thread_forward_sequence` = ? where `comment_id` = ?"; - echo $sql . " ($seq, $comment_id)\n"; - $result = $gBitSystem->mDb->query($sql, array($seq, $comment_id)); - - $sql = "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `thread_reverse_sequence` = ? where `comment_id` = ?"; - echo $sql . " ($seq_r, $comment_id)\n"; - $result = $gBitSystem->mDb->query($sql, array($seq_r, $comment_id)); - } - - // get content links up to speed - require_once( LIBERTY_PKG_PATH."plugins/format.tikiwiki.php"); - - $bb = new BitBase; - // remove all existing links - $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_content_links` "; - $result = $bb->mDb->query($query, array()); - - - // get list of all wiki pages in tikiwiki format - $ci = 0; - $query = "SELECT `content_id`, `data` AS `edit`, `title` FROM `".BIT_DB_PREFIX."liberty_content` WHERE `format_guid`=?"; - if( $result = $bb->mDb->query($query, array( "tikiwiki" ) ) ) { - // generate links for each content item - while( $row = $result->fetchRow() ) { - $content_id = $row["content_id"]; -# $tp = new TikiWikiParser(); - $tp = new BitLinks(); - $tp->storeLinks( $row["edit"], $row ); - $ci++; - } - } - } -'), -array( 'DATADICT' => array( - array( 'RENAMECOLUMN' => array( - 'liberty_files' => array( - '`size`' => '`file_size` I4' - ), - 'liberty_structures' => array( - '`level`' => '`structure_level` I1 NOTNULL DEFAULT 1' - ), - 'liberty_content_history' => array( - '`comment`' => '`history_comment` C(200)' - ), - 'liberty_action_log' => array( - '`comment`' => '`action_comment` C(200)' - ), - )), -)), -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_action_log` SET `content_id`=( SELECT `content_id` FROM `".BIT_DB_PREFIX."tiki_pages` tp WHERE tp.`page_id`=`".BIT_DB_PREFIX."liberty_action_log`.`page_id` )", - )), -), -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'liberty_action_log' => array( '`page_id`' ), - )), - array( 'RENAMECOLUMN' => array( - 'liberty_action_log' => array( - '`action`' => '`log_action` C(255) NOTNULL', - ), - 'liberty_copyrights' => array( - '`year`' => '`copyright_year` I8', - ), - 'liberty_content_prefs' => array( - '`value`' => '`pref_value` C(250)', - '`user_id`'=> 'content_id I4', - ), - )), - array( 'CREATEINDEX' => array( - 'liberty_content_prefs_idx' => array( 'liberty_content_prefs', '`content_id`,`pref_name`', array() ), - )), -)), - -array( 'QUERY' => - array( 'MYSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_prefs` DROP PRIMARY KEY", - )), -), - - -// rename some liberty_content_prefs -array( 'QUERY' => - array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_country' WHERE `pref_name`='country'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_homepage' WHERE `pref_name`='homePage'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_double_click' WHERE `pref_name`='user_dbl'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_bread_crumb' WHERE `pref_name`='userbreadCrumb'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_information' WHERE `pref_name`='user_information'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='users_email_display' WHERE `pref_name`='email is public'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='messages_max_records' WHERE `pref_name`='mess_max_records'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='messages_min_priority' WHERE `pref_name`='minPrio'", - "UPDATE `".BIT_DB_PREFIX."liberty_content_prefs` SET `pref_name`='messages_alert' WHERE `pref_name`='message_alert'", - )), -), - - -// here we deal with the liberty_attachments upgrade -/* so far untested and basically serve as notes for what has to be done - * - * NOTE: First we need to create new attachments of the duplicates we have that - * we have in the liberty_attachments_map to ensure that every attachment only - * has one content_id associated with it - * - * - * - * Now we can start cleaning up the db -*/ -array( 'DATADICT' => array( - array( 'ALTER' => array( - 'liberty_attachments' => array( - 'content_id' => array( '`content_id`', 'I4' ), - 'is_primary' => array( '`is_primary`', 'CHAR(1)' ), - ), - )), -)), - -array( 'QUERY' => - array( 'SQL92' => array( - // the easy stuff first... - if the primary_attachment_id is set in liberty_content we use that to populate the new content_id column - "UPDATE `".BIT_DB_PREFIX."liberty_attachments` la SET `content_id` = ( SELECT `content_id` FROM `".BIT_DB_PREFIX."liberty_content` WHERE `primary_attachment_id` = la.`attachment_id` )", - - // set is_primary where it applies - "UPDATE `".BIT_DB_PREFIX."liberty_attachments` la INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`primary_attachment_id` = la.`attachment_id` ) SET `is_primary` = 'y'", - - // now we do the generic update - "UPDATE `".BIT_DB_PREFIX."liberty_attachments` la SET `content_id` = ( SELECT `content_id` FROM `".BIT_DB_PREFIX."liberty_attachments_map` WHERE `attachment_id` = la.`attachment_id` LIMIT 1 ) WHERE la.`content_id` <> NULL", - )), -), - -array( 'DATADICT' => array( - array( 'DROPTABLE' => array( - 'liberty_attachments_map' - )), - array( 'DROPCOLUMN' => array( - 'liberty_content' => array( 'primary_attachment_id' ), - )), -)), - - ), - ), - -'BONNIE' => array( - 'BWR1' => array( - -// Step 0 -array( 'QUERY' => - array( 'PGSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."tiki_files_pkey` RENAME TO `".BIT_DB_PREFIX."tiki_old_files_pkey`", - )), -), - -// Step 1 -array( 'DATADICT' => array( - array( 'DROPTABLE' => array( - 'tiki_content' - )), - array( 'RENAMETABLE' => array( - 'tiki_files' => 'tiki_old_files', - )), - array( 'CREATE' => array ( - 'tiki_plugins' => " - plugin_guid C(16) PRIMARY, - plugin_type C(16) NOTNULL, - is_active C(1) NOTNULL DEFAULT 'y', - plugin_description C(250), - maintainer_url C(250) - ", -// requires in PHP need liberty_content_types table -// since we are going from 1.8 to R2, we can get away with this here. - 'liberty_content_types' => " - content_type_guid C(16) PRIMARY, - content_description C(250) NOTNULL, - maintainer_url C(250), - handler_class C(128), - handler_package C(128), - handler_file C(128) - ", - - 'tiki_content' => " - content_id I4 PRIMARY, - user_id I4 NOTNULL, - modifier_user_id I4 NOTNULL, - created I8 NOTNULL, - last_modified I8 NOTNULL, - content_type_guid C(16) NOTNULL, - format_guid C(16) NOTNULL, - hits I4 NOTNULL DEFAULT 0, - language C(4), - title C(160), - ip C(39), - data XL - ", - - 'tiki_attachments' => " - attachment_id I4 PRIMARY, - attachment_plugin_guid C(16) NOTNULL, - content_id I4 NOTNULL, - foreign_id I4 NOTNULL, - user_id I4 NOTNULL, - pos I4, - hits I4, - error_code I4, - caption C(250) - CONSTRAINT ', CONSTRAINT `tiki_attachment_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."tiki_content`( `content_id` ) - , CONSTRAINT `tiki_attachment_type_ref` FOREIGN KEY (`attachment_plugin_guid`) REFERENCES `".BIT_DB_PREFIX."tiki_plugins`( `plugin_guid` )' - ", - - 'tiki_blobs' => " - blob_id I4 PRIMARY, - user_id I4 NOTNULL, - blob_size I8 NOTNULL, - blob_name C(250) NOTNULL, - blob_data_type C(100) NOTNULL, - blob_data B NOTNULL - ", - - 'tiki_files' => " - file_id I4 PRIMARY, - user_id I4 NOTNULL, - storage_path C(250), - size I4, - mime_type C(64) - ", - )), - array( 'RENAMECOLUMN' => array( - 'tiki_structures' => array( - '`page_ref_id`' => '`structure_id` I4 AUTO' - ), - 'tiki_link_cache' => array( - '`cacheId`' => '`cache_id` I4 AUTO' - ), - 'tiki_comments' => array( - '`threadId`' => '`comment_id` I4 AUTO', - '`parentId`' => '`parent_id` I4', - ) - )), - - array( 'ALTER' => array( - 'tiki_structures' => array( - 'user_id' => array( 'user_id', 'I4' ), - 'content_id' => array( 'content_id', 'I4' ), - 'root_structure_id' => array( 'root_structure_id', 'I4' ), - ), - 'tiki_comments' => array( - 'content_id' => array( 'content_id', 'I4' ), // , 'NOTNULL' ), - ), - - )), -)), - -// Step 2 -array( 'QUERY' => -array( 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."tiki_structures` SET user_id=1", - "INSERT INTO `".BIT_DB_PREFIX."tiki_preferences` ( `name`, `value`, `package` ) VALUES ( 'liberty_auto_display_attachment_thumbs', 'y', 'liberty' )", - )), -/* -array( 'PGSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."tiki_structures` ALTER user_id SET NOT NULL" - "ALTER TABLE `".BIT_DB_PREFIX."tiki_comments_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."tiki_content`( `content_id` ) - "ALTER TABLE `".BIT_DB_PREFIX."tiki_comments_parent_ref` FOREIGN KEY (`parent_id`) REFERENCES `".BIT_DB_PREFIX."tiki_content`( `content_id` )' - "ALTER TABLE `".BIT_DB_PREFIX."tiki_content` ADD CONSTRAINT `tiki_content_guid_ref` FOREIGN KEY (`format_guid`) REFERENCES ".BIT_DB_PREFIX."tiki_plugins( `plugin_guid` )" - "ALTER TABLE `".BIT_DB_PREFIX."tiki_content` ADD CONSTRAINT `tiki_content_type_ref` FOREIGN KEY (`content_type_guid`) REFERENCES `".BIT_DB_PREFIX."liberty_content_types`( `content_type_guid` )" ), -)), -*/ -), - -// STEP 2 -array( 'PHP' => ' - global $gBitSystem; - $gBitSystem->mDb->CreateSequence( "tiki_attachments_id_seq", 1 ); - $gBitSystem->mDb->CreateSequence( "tiki_content_id_seq", 1 ); - $gBitSystem->mDb->CreateSequence( "tiki_files_file_id_seq", 1 ); - $max = $gBitSystem->mDb->getOne( "SELECT MAX(`comment_id`) FROM `'.BIT_DB_PREFIX.'tiki_comments`" ); - $gBitSystem->mDb->CreateSequence( "tiki_comments_comment_id_seq", $max + 1 ); - $max = $gBitSystem->mDb->getOne( "SELECT MAX(`structure_id`) FROM `'.BIT_DB_PREFIX.'tiki_structures`" ); - $gBitSystem->mDb->CreateSequence( "tiki_structures_id_seq", $max + 1 ); - - $query = "SELECT `comment_id`, uu.`user_id`, uu.`user_id` AS `modifier_user_id`, `commentDate` AS `created`, `commentDate` AS `last_modified`, `hits`, `data`, `title`, `user_ip` AS `ip` - FROM `'.BIT_DB_PREFIX.'tiki_comments` tc INNER JOIN `'.BIT_DB_PREFIX.'users_users` uu ON( tc.`userName`=uu.`login` )"; - if( $rs = $gBitSystem->mDb->query( $query ) ) { - while( !$rs->EOF ) { - $commentId = $rs->fields["comment_id"]; unset( $rs->fields["comment_id"] ); - $conId = $gBitSystem->mDb->GenID( "tiki_content_id_seq" ); - $rs->fields["content_id"] = $conId; - $rs->fields["content_type_guid"] = BITCOMMENT_CONTENT_TYPE_GUID; - $rs->fields["format_guid"] = PLUGIN_GUID_TIKIWIKI; - $gBitSystem->mDb->associateInsert( "tiki_content", $rs->fields ); - $gBitSystem->mDb->query( "UPDATE `'.BIT_DB_PREFIX.'tiki_comments` SET `content_id`=? WHERE `comment_id`=?", array( $conId, $commentId ) ); - $rs->MoveNext(); - } - } - - -' ), - -// STEP 3 -array( 'DATADICT' => array( - array( 'DROPCOLUMN' => array( - 'tiki_comments' => array( '`userName`', '`commentDate`','`hits`','`data`','`title`','`user_ip`' ), - )), - array( 'CREATEINDEX' => array( - 'tiki_content_title_idx' => array( 'tiki_content', '`title`', array() ), - 'tiki_content_user_idx' => array( 'tiki_content', '`user_id`', array() ), - 'tiki_content_moduser_idx' => array( 'tiki_content', '`modifier_user_id`', array() ), - 'tiki_content_hits_idx' => array( 'tiki_content', '`hits`', array() ), - 'tiki_comments_content_idx' => array( 'tiki_comments', '`content_id`', array() ), - 'tiki_struct_user_idx' => array( 'tiki_structures', '`user_id`', array() ), - 'tiki_struct_root_idx' => array( 'tiki_structures', '`root_structure_id`', array() ), - 'tiki_struct_content_idx' => array( 'tiki_structures', '`content_id`', array() ), - )), -)), - ) -) - -); - -if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) { - $gBitSystem->registerUpgrade( LIBERTY_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] ); -} - - -?> diff --git a/admin/upgrades/2.1.0.php b/admin/upgrades/2.1.0.php deleted file mode 100644 index f21dbf2..0000000 --- a/admin/upgrades/2.1.0.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "This upgrade replaces unused meta tables with new ones. These meta tables are used to store meta data of uploaded files.", - 'post_upgrade' => NULL, -); -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'DATADICT' => array( - array( 'DROPTABLE' => array( - 'liberty_meta_content_map', - 'liberty_meta_data', - 'liberty_meta_types', - )), - array( 'CREATE' => array( - 'liberty_meta_titles' => " - meta_title_id I4 PRIMARY, - meta_title C(250) NOTNULL - ", - - 'liberty_meta_types' => " - meta_type_id I4 PRIMARY, - meta_type C(250) NOTNULL - ", - - 'liberty_attachment_meta_data' => " - attachment_id I4 PRIMARY NOTNULL, - meta_type_id I4 PRIMARY NOTNULL, - meta_title_id I4 PRIMARY NOTNULL, - meta_value XL - CONSTRAINT ' - , CONSTRAINT `lib_attachment_meta_id_ref` FOREIGN KEY (`attachment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_attachments` (`attachment_id`) - , CONSTRAINT `lib_attachment_meta_type_ref` FOREIGN KEY (`meta_type_id`) REFERENCES `".BIT_DB_PREFIX."liberty_meta_types` (`meta_type_id`) - , CONSTRAINT `lib_attachment_meta_title_ref` FOREIGN KEY (`meta_title_id`) REFERENCES `".BIT_DB_PREFIX."liberty_meta_titles` (`meta_title_id`) ' - ", - 'liberty_attachment_prefs' => " - attachment_id I4 PRIMARY, - pref_name C(40) PRIMARY, - pref_value C(250) - CONSTRAINT ', CONSTRAINT `lib_att_prefs_content_ref` FOREIGN KEY (`attachment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_attachments` (`attachment_id`)' - ", - )), - array( 'CREATEINDEX' => array( - 'lib_attachment_meta_idx' => array( 'liberty_attachment_meta_data', 'attachment_id', array() ), - 'lib_attachment_meta_type_idx' => array( 'liberty_attachment_meta_data', 'meta_type_id', array() ), - 'lib_attachment_meta_title_idx' => array( 'liberty_attachment_meta_data', 'meta_title_id', array() ), - )), - array( 'CREATESEQUENCE' => array( - 'liberty_meta_types_id_seq', - 'liberty_meta_titles_id_seq', - )), -)), - -array( 'PHP' => ' - // make sure plugins are up to date. - global $gLibertySystem; - $gLibertySystem->scanAllPlugins(); -' -) - -)); -?> diff --git a/admin/upgrades/2.1.1.php b/admin/upgrades/2.1.1.php deleted file mode 100644 index b131ef5..0000000 --- a/admin/upgrades/2.1.1.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "Minor fix to user_id column type in liberty_content_history.", - 'post_upgrade' => NULL, -); - -// all we are doing is change the column type of user_id for liberty_content_history. -// postgresql < 8.2 doesn't allow easy column type changing -// and therefore we need to undergo this annoying dance. -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'DATADICT' => array( - // rename original column - array( 'RENAMECOLUMN' => array( - 'liberty_content_history' => array( - '`user_id`' => "`temp_column` VARCHAR(40)", - ), - )), - // insert new column - array( 'ALTER' => array( - 'liberty_content_history' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ))), -)), - -// copy data into new column -array( 'QUERY' => - // postgres > 8.2 needs to have the type cast - array( - 'PGSQL' => array( "UPDATE `".BIT_DB_PREFIX."liberty_content_history` SET `user_id` = `temp_column`::integer" ), - 'SQL92' => array( "UPDATE `".BIT_DB_PREFIX."liberty_content_history` SET `user_id` = `temp_column`" ), - ), -), - -array( 'DATADICT' => array( - // drop old column - array( 'DROPCOLUMN' => array( - 'liberty_content_history' => array( '`temp_column`' ), - )), - // reconstruct constraints, sequences and indexes -)), - -)); -?> diff --git a/admin/upgrades/2.1.2.php b/admin/upgrades/2.1.2.php deleted file mode 100644 index 6b04264..0000000 --- a/admin/upgrades/2.1.2.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "Rename video conversion plugin from <em>flv</em> to <em>video</em> and some other minor cleanups in the database.", - 'post_upgrade' => NULL, -); - -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'QUERY' => - array( - // some specific config value renames - 'SQL92' => array( - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_name` = 'ffmpeg_mp3_lib' WHERE `config_name` = 'ffmpeg_mp3_param'", - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_name` = 'ffmpeg_path' WHERE `config_name` = 'mime_flv_ffmpeg_path'", - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_name` = 'mplayer_path' WHERE `config_name` = 'mime_audio_mplayer_path'", - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_name` = 'lame_path' WHERE `config_name` = 'mime_audio_lame_path'", - "DELETE FROM `".BIT_DB_PREFIX."kernel_config` WHERE `config_name` = 'mime_audio_ffmpeg_path'", - - // update liberty_attachments with new attachment GUID - "UPDATE `".BIT_DB_PREFIX."liberty_attachments` SET `attachment_plugin_guid` = 'mimevideo' WHERE `attachment_plugin_guid` = 'mimeflv'", - - // update kernel config names and values with new ones - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_name` = REPLACE( `config_name`, 'flv', 'video' ) WHERE `config_name` LIKE '%flv%'", - "UPDATE `".BIT_DB_PREFIX."kernel_config` SET `config_value` = REPLACE( `config_value`, 'flv', 'video' ) WHERE `config_value` LIKE '%flv%'", - ), - ), -), - -)); -?> diff --git a/admin/upgrades/2.1.3.php b/admin/upgrades/2.1.3.php deleted file mode 100644 index 3fce306..0000000 --- a/admin/upgrades/2.1.3.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "Minor fix to ip columns to support IPv6", - 'post_upgrade' => NULL, -); - -// Increase the size of the IP column to cope with IPv6 -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'QUERY' => - array( - 'PGSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content` ALTER `ip` TYPE VARCHAR(39)", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` ALTER `ip` TYPE VARCHAR(39)", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` ALTER `ip` TYPE VARCHAR(39)", - ), - 'OCI' => array( - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content` MODIFY (`ip` TYPE VARCHAR2(39))", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` MODIFY (`ip` TYPE VARCHAR2(39))", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` MODIFY (`ip` TYPE VARCHAR2(39))", - ), - 'MYSQL' => array( - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content` MODIFY `ip` VARCHAR(39)", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` MODIFY `ip` VARCHAR(39)", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` MODIFY `ip` VARCHAR(39)", - ), - ), -), - -)); -?> diff --git a/admin/upgrades/2.1.4.php b/admin/upgrades/2.1.4.php deleted file mode 100644 index 350245f..0000000 --- a/admin/upgrades/2.1.4.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "Update content type guid table to have singular and plural names, deprecate content_description", - 'post_upgrade' => NULL, -); - -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'DATADICT' => array( - // insert new column - array( 'ALTER' => array( - 'liberty_content_types' => array( - 'content_name' => array( '`content_name`', 'VARCHAR(250)' ), - 'content_name_plural' => array( '`content_name_plural`', 'VARCHAR(250)' ), - ))), -)), - -// copy data into new column -array( 'QUERY' => - array( - 'SQL92' => array( "UPDATE `".BIT_DB_PREFIX."liberty_content_types` SET `content_name` = `content_description`", - "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_types` ADD CONSTRAINT content_name_not_null CHECK(content_name IS NOT NULL)" ), - ), -), - -//drop the old content_description column -array( 'DATADICT' => array( - // drop old column - array( 'DROPCOLUMN' => array( - 'liberty_content_types' => array( '`content_description`' ), - )), -)), - -)); diff --git a/admin/upgrades/3.0.0.php b/admin/upgrades/3.0.0.php deleted file mode 100644 index 076da8c..0000000 --- a/admin/upgrades/3.0.0.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * @version $Header$ - */ -global $gBitInstaller; - -$infoHash = array( - 'package' => LIBERTY_PKG_NAME, - 'version' => str_replace( '.php', '', basename( __FILE__ )), - 'description' => "Update content type guid table to have singular and plural names, deprecate content_description", - 'post_upgrade' => NULL, -); - -$gBitInstaller->registerPackageUpgrade( $infoHash, array( - -array( 'DATADICT' => array( - // rename original column - array( 'RENAMECOLUMN' => array( - 'liberty_files' => array( - '`storage_path`' => "`file_name` VARCHAR(250)", - ), - )), -)), - -)); diff --git a/admin/upgrades/5.0.0.php b/admin/upgrades/5.0.0.php new file mode 100755 index 0000000..2f298fb --- /dev/null +++ b/admin/upgrades/5.0.0.php @@ -0,0 +1,12 @@ +<?php +/** + * @version $Header$ + */ +global $gBitInstaller; + +$infoHash = [ + 'package' => LIBERTY_PKG_NAME, + 'version' => str_replace( '.php', '', basename( __FILE__ ) ), + 'description' => "Set core package version number.", +]; +$gBitInstaller->registerPackageUpgrade( $infoHash, [] ); |
