From 70b38c9cbee8076c808c448cdc1ce17a6cf37509 Mon Sep 17 00:00:00 2001 From: e107steved Date: Tue, 18 Dec 2007 20:41:06 +0000 Subject: [PATCH] Remove 0.6xx to 0.7 update files --- e107_plugins/content/content_update.php | 367 ------------------ e107_plugins/content/content_update_check.php | 82 ---- e107_plugins/forum/forum_update.php | 173 --------- e107_plugins/forum/forum_update_check.php | 73 ---- 4 files changed, 695 deletions(-) delete mode 100644 e107_plugins/content/content_update.php delete mode 100644 e107_plugins/content/content_update_check.php delete mode 100644 e107_plugins/forum/forum_update.php delete mode 100644 e107_plugins/forum/forum_update_check.php diff --git a/e107_plugins/content/content_update.php b/e107_plugins/content/content_update.php deleted file mode 100644 index 83b720414..000000000 --- a/e107_plugins/content/content_update.php +++ /dev/null @@ -1,367 +0,0 @@ -db_Select("plugin", "plugin_version", "plugin_path = 'content'")) -{ - $row = $sql->db_Fetch(); - $content_version = $row['plugin_version']; -} - -//create table if it doesn't exist -if(!$sql->db_Query("SHOW COLUMNS FROM ".MPREFIX."pcontent")) { - $query = "CREATE TABLE ".MPREFIX."pcontent ( - content_id int(10) unsigned NOT NULL auto_increment, - content_heading varchar(255) NOT NULL default '', - content_subheading varchar(255) NOT NULL default '', - content_summary text NOT NULL, - content_text longtext NOT NULL, - content_author varchar(255) NOT NULL default '', - content_icon varchar(255) NOT NULL default '', - content_file text NOT NULL, - content_image text NOT NULL, - content_parent varchar(50) NOT NULL default '', - content_comment tinyint(1) unsigned NOT NULL default '0', - content_rate tinyint(1) unsigned NOT NULL default '0', - content_pe tinyint(1) unsigned NOT NULL default '0', - content_refer text NOT NULL, - content_datestamp int(10) unsigned NOT NULL default '0', - content_enddate int(10) unsigned NOT NULL default '0', - content_class varchar(255) NOT NULL default '', - content_pref text NOT NULL, - content_order varchar(10) NOT NULL default '0', - content_score tinyint(3) unsigned NOT NULL default '0', - content_meta text NOT NULL, - content_layout varchar(255) NOT NULL default '', - PRIMARY KEY (content_id) - ) TYPE=MyISAM;"; - - $sql->db_Select_gen($query); -} - -$text = ""; -$main_convert = ""; -//main convert - -$newcontent = $sql -> db_Count($plugintable, "(*)", ""); -if($newcontent == 0){ - - unset($text); - - //possible database values - //content page: $content_parent == "1" && $content_type == "1" //added at 20051031 - //content page: $content_parent == "0" && $content_type == "1" - //review category: $content_parent == "0" && $content_type == "10" - //article category: $content_parent == "0" && $content_type == "6" - //review: $content_type == "3" || $content_type == "16" - //article: $content_type == "0" || $content_type == "15" - - // ##### STAGE 1 : ANALYSE OLD CONTENT -------------------------------------------------------- - if (!is_object($sql)){ $sql = new db; } - $totaloldcontentrows = $sql -> db_Count("content"); - $totaloldrowscat_article = $sql -> db_Count("content", "(*)", "WHERE content_parent = '0' AND content_type = '6'"); - $totaloldrowscat_review = $sql -> db_Count("content", "(*)", "WHERE content_parent = '0' AND content_type = '10'"); - $totaloldrowsitem_content = $sql -> db_Count("content", "(*)", "WHERE (content_parent = '0' || content_parent = '1') AND content_type = '1'"); - $totaloldrowsitem_review = $sql -> db_Count("content", "(*)", "WHERE content_type = '3' || content_type = '16'"); - $totaloldrowsitem_article = $sql -> db_Count("content", "(*)", "WHERE content_type = '0' || content_type = '15'"); - - if($totaloldrowsitem_content == 0 && $totaloldrowsitem_article == 0 && $totaloldrowsitem_review == 0){ - $totaloldrowsitem_content = "1"; - $totaloldrowsitem_article = "1"; - $totaloldrowsitem_review = "1"; - - //if no old records exist, create a few default categories - $main_convert = create_defaults(); - }else{ - - //analyse unknown rows - $unknown_array = $ac -> analyse_unknown(); - - if($totaloldcontentrows == 0){ - $totaloldrowsitem_content = "1"; - $totaloldrowsitem_article = "1"; - $totaloldrowsitem_review = "1"; - } - - //create mainparent - $content_mainarray = $ac -> create_mainparent("content", $totaloldrowsitem_content, "1"); - $article_mainarray = $ac -> create_mainparent("article", $totaloldrowsitem_article, "2"); - $review_mainarray = $ac -> create_mainparent("review", $totaloldrowsitem_review, "3"); - - //convert categories - $article_cat_array = $ac -> convert_category("article", "content_parent = '0' AND content_type = '6'", "2"); - $review_cat_array = $ac -> convert_category("review", "content_parent = '0' AND content_type = '10'", "3"); - - //convert rows - $content_array = $ac -> convert_row("content", "(content_parent = '0' || content_parent = '1') AND content_type = '1'", "1"); - $article_array = $ac -> convert_row("article", "content_type = '0' || content_type = '15'", "2"); - $review_array = $ac -> convert_row("review", "content_type = '3' || content_type = '16'", "3"); - - //convert comments - $ac -> convert_comments(); - - //convert rating - $ac -> convert_rating(); - - $conversion_analyses_rows_total = $totaloldcontentrows; - - $conversion_analyses_rows_converted = (count($article_cat_array[1]) + count($review_cat_array[1]) + count($content_array[2]) + count($article_array[2]) + count($review_array[2])); - - $conversion_analyses_rows_warning = (count($content_array[4]) + count($content_array[5]) + count($article_array[4]) + count($article_array[5]) + count($review_array[4]) + count($review_array[5])); - - $conversion_analyses_rows_failed = (count($article_cat_array[2]) + count($review_cat_array[2]) + count($content_array[3]) + count($article_array[3]) + count($review_array[3]) + count($unknown_array[1])); - - - //only output detailed information if developer mode is set - if ($pref['developer']) { - showlink(); - $SPACER = " "; - $text = " - "; - - //conversion analysis - $text .= " - - - - "; - - $text .= $SPACER; - - //old content table : analysis - $text .= " - - - - "; - - $text .= $SPACER; - - //unknown rows - if(count($unknown_array[0]) > 0){ - $text .= ""; - $text .= " - - - - "; - } - - $text .= " - - ".$SPACER." - - ".$ac -> results_conversion_mainparent($content_mainarray, $review_mainarray, $article_mainarray)." - - ".$SPACER." - - - ".$ac -> results_conversion_row("content", $content_array, $totaloldrowsitem_content)." - - ".$SPACER." - - - ".$ac -> results_conversion_category("review", $review_cat_array, $totaloldrowscat_review)." - ".$ac -> results_conversion_row("review", $review_array, $totaloldrowsitem_review)." - - ".$SPACER." - - - ".$ac -> results_conversion_category("article", $article_cat_array, $totaloldrowscat_article)." - ".$ac -> results_conversion_row("article", $article_array, $totaloldrowsitem_article)." - - ".$SPACER." - -
".CONTENT_ADMIN_CONVERSION_LAN_11." - ".CONTENT_ADMIN_CONVERSION_LAN_48." - -
".CONTENT_ADMIN_CONVERSION_LAN_16." - ".CONTENT_ADMIN_CONVERSION_LAN_48." - -
".CONTENT_ADMIN_CONVERSION_LAN_51."
".CONTENT_ICON_ERROR." ".count($unknown_array[0])." ".CONTENT_ADMIN_CONVERSION_LAN_51." - ".CONTENT_ADMIN_CONVERSION_LAN_48." - -
content : ".CONTENT_ADMIN_CONVERSION_LAN_27."
review : ".CONTENT_ADMIN_CONVERSION_LAN_27."
article : ".CONTENT_ADMIN_CONVERSION_LAN_27."
"; - - $main_convert = array($caption, $text); - } - - } -} - -$text = ""; -//update to 1.1 parent values to new style -$upgrade_1_1 = FALSE; -if($thiscount = $sql -> db_Select("pcontent", "*", "ORDER BY content_id ", "mode=no_where" )){ - while($row = $sql -> db_Fetch()){ - if( strpos($row['content_parent'], ".") && substr($row['content_parent'],0,1) != "0"){ - //if item with old parent value exists, you need to upgrade to 1.1 - $upgrade_1_1 = TRUE; - } - } -} -if($upgrade_1_1 === TRUE){ - $text .= $ac -> upgrade_1_1(); -} - -//upgrade to 1.2 table structure (add score, meta, layout fields) -$text .= $ac -> upgrade_1_2(); - -//upgrade to 1.21 (update content_author fields) -$text .= $ac -> upgrade_1_21(); - -//upgrade to 1.22 (update preference storage method) -$text .= $ac -> upgrade_1_22(); - -//upgrade to 1.23 (update preference storage method) -$text .= $ac -> upgrade_1_23(); - -//upgrade to 1.24 (update custom theme) -$text .= $ac -> upgrade_1_24(); - -//render message -if(isset($text)){ - //only output detailed information if developer mode is set - if ($pref['developer']) { - $caption = CONTENT_ADMIN_CONVERSION_LAN_63; - $ns -> tablerender($caption, $text); - } -} - -//render primary conversion results -if(is_array($main_convert)){ - if(isset($main_convert[1])){ - //only output detailed information if developer mode is set - if ($pref['developer']) { - $ns -> tablerender($main_convert[0], $main_convert[1]); - } - } -} - -//finally set the new content plugin version number -set_content_version(); - - - - -//create default mainparent category for content, review and article -function create_defaults() -{ - global $ns, $ac, $plugindir; - - $plugindir = e_PLUGIN."content/"; - - if(!is_object($ac)){ - require_once($plugindir."handlers/content_convert_class.php"); - $ac = new content_convert; - } - - $content_mainarray = $ac -> create_mainparent("content", "1", "1"); - $article_mainarray = $ac -> create_mainparent("article", "1", "2"); - $review_mainarray = $ac -> create_mainparent("review", "1", "3"); - - $main_convert = ''; - //only output detailed information if developer mode is set - if ($pref['developer']) { - showlink(); - - $text = ""; - $text .= $ac -> results_conversion_mainparent($content_mainarray, $review_mainarray, $article_mainarray); - $text .= "
"; - - $main_convert = array(CONTENT_ADMIN_CONVERSION_LAN_52, $text); - } - return $main_convert; -} - - - -//show link to start managing the content management plugin -function showlink() -{ - global $ns, $pref; - //only output detailed information if developer mode is set - if ($pref['developer']) { - $text = "
".CONTENT_ADMIN_CONVERSION_LAN_46."
"; - $caption = CONTENT_ADMIN_CONVERSION_LAN_47; - $ns -> tablerender($caption, $text); - } -} - - - -//update content plugin version number -function set_content_version() -{ - global $sql, $pref; - $new_version = "1.24"; - $sql->db_Update('plugin',"plugin_version = '{$new_version}' WHERE plugin_path='content'"); - $text = ''; - //only output detailed information if developer mode is set - if ($pref['developer']) { - $text = CONTENT_ADMIN_CONVERSION_LAN_62." $new_version
"; - } - return $text; -} - -?> \ No newline at end of file diff --git a/e107_plugins/content/content_update_check.php b/e107_plugins/content/content_update_check.php deleted file mode 100644 index 17b13787c..000000000 --- a/e107_plugins/content/content_update_check.php +++ /dev/null @@ -1,82 +0,0 @@ -db_Select("plugin", "plugin_version", "plugin_path = 'content'")){ - return FALSE; //needed - }else{ - $row = $sql->db_Fetch(); - - //if version < 1.23, return FALSE = needed - if($row['plugin_version'] < 1.24){ - return FALSE; //needed - } - - $newcontent = $sql -> db_Count("pcontent", "(*)", ""); - - //if no rows in new table && no old content table exists, return FALSE = needed - $exists = mysql_query("SELECT 1 FROM ".MPREFIX."content LIMIT 0"); - if($newcontent == 0 && !$exists){ - return FALSE; //needed - } - - //if parent value is old style, return FALSE = needed - if($newcontent > 0){ - if($thiscount = $sql -> db_Select("pcontent", "*", "ORDER BY content_id ", "mode=no_where" )){ - while($row = $sql -> db_Fetch()){ - if( strpos($row['content_parent'], ".") && substr($row['content_parent'],0,1) != "0"){ - //if item with old parent value exists, you need to upgrade to 1.1 - return FALSE; //needed - } - } - } - } - - //if added fields are not present, return FALSE = needed - $field1 = $sql->db_Field("pcontent",19); - $field2 = $sql->db_Field("pcontent",20); - $field3 = $sql->db_Field("pcontent",21); - if($field1 != "content_score" && $field2 != "content_meta" && $field3 != "content_layout"){ - return FALSE; //needed - } - - //else if passing all above checks, return TRUE = not needed - return TRUE; - } - } -} - -?> \ No newline at end of file diff --git a/e107_plugins/forum/forum_update.php b/e107_plugins/forum/forum_update.php deleted file mode 100644 index bfea2f6e4..000000000 --- a/e107_plugins/forum/forum_update.php +++ /dev/null @@ -1,173 +0,0 @@ -db_Select("plugin", "plugin_version", "plugin_name = 'Forum'")) -{ - $row = $sql->db_Fetch(); - $forum_version = $row['plugin_version']; -} - - -$forum_subs = FALSE; -$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum"); -$columns = mysql_num_fields($fields); -for ($i = 0; $i < $columns; $i++) -{ - if("forum_sub" == mysql_field_name($fields, $i)) - { - $forum_subs = TRUE; - } -} - -$text = ""; -if(!$forum_subs) -{ - $text .= forum_stage1(); - $text .= forum_stage2(); - $text .= forum_stage3(); - $text .= forum_stage4(); - $text .= forum_stage5(); - $text .= forum_stage6(); -} - -if($forum_version < 1.2) -{ - $text .= mods_to_userclass(); -} -$text .= set_forum_version(); - -$timeend = microtime(); -$diff = number_format(((substr($timeend, 0, 9)) + (substr($timeend, -10)) - (substr($timestart, 0, 9)) - (substr($timestart, -10))), 4); -$text .= "
script generation took $diff s"; - -if ($pref['developer']) { - $ns->tablerender('forum upgrade',$text); -} - -function forum_stage1() -{ - global $sql; - $ttab = MPREFIX.'forum_t'; - $sql->db_Select_gen("ALTER TABLE #forum_t ADD thread_edit_datestamp int(10) unsigned NOT NULL default '0'"); - $sql->db_Select_gen("ALTER TABLE #forum_t ADD thread_lastuser varchar(30) NOT NULL default ''"); - $sql->db_Select_gen("ALTER TABLE #forum_t ADD thread_total_replies int(10) unsigned NOT NULL default '0'"); - $sql->db_Select_gen("ALTER TABLE #forum ADD forum_postclass TINYINT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;"); - $sql->db_Select_gen("ALTER TABLE #forum ADD `forum_sub` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL AFTER `forum_parent` ;"); - return "Updated table structure
"; -} - -function forum_stage2() -{ - global $sql; - $ttab = MPREFIX.'forum_t'; -// $numrows = $sql->db_Update('forum_t', "thread_anon = SUBSTRING(thread_user,3) WHERE thread_user LIKE '0.%'"); - $numrows = $sql->db_Update('forum_t', "thread_user = CAT('0.', thread_anon) WHERE thread_user = '0'"); - return $ret."Updated anonymous post info ... $numrows rows updated
"; -} - -function forum_stage3() -{ - global $sql; - $sql->db_Select_gen("ALTER TABLE #forum_t CHANGE thread_user thread_user varchar(250) NOT NULL default ''"); - $sql->db_Select_gen("ALTER TABLE #forum_t DROP thread_anon"); - return "Updated thread_user & forum_anon field
"; -} - -function forum_stage4() -{ - global $sql, $forum; - $sql->db_Select_gen("SELECT thread_parent AS id, COUNT(*) AS amount FROM #forum_t WHERE thread_parent !=0 GROUP BY thread_parent"); - $threadArray = $sql->db_getList('ALL', FALSE, 0); - foreach($threadArray as $threads) - { - extract($threads); - $sql->db_Update("forum_t", "thread_total_replies=$amount WHERE thread_id=$id"); - } - - $ret = "Updated thread reply info...".count($threadArray). " threads updated.
"; - $forum = new e107forum; - $forum->forum_update_counts('all'); - return $ret."Updated forum thread count info.
"; -} - -function forum_stage5() -{ - global $sql, $forum; - $sql->db_Select_gen("ALTER TABLE #forum CHANGE forum_lastpost forum_lastpost_user varchar(200) NOT NULL default ''"); - $sql->db_Select_gen("ALTER TABLE #forum ADD forum_lastpost_info varchar(40) NOT NULL default '' AFTER forum_lastpost_user"); - set_time_limit(180); - $forum->update_lastpost('forum', 'all', TRUE); - return "Updated lastpost info
"; -} - -function forum_stage6() -{ - global $sql; - global $PLUGINS_DIRECTORY; - if(!$sql->db_Count('plugin','(*)',"WHERE plugin_name = 'Forum'")) - { - $sql->db_Insert('plugin',"0,'Forum','1.1','forum',1"); - return "Forum entry added to plugin table, set as installed.
"; - } - else - { - $sql->db_Update('plugin',"plugin_installflag = 1 WHERE plugin_name='Forum'"); - } - $sql->db_Update('links',"link_url='{$PLUGINS_DIRECTORY}forum/forum.php' WHERE link_name='Forum'"); - -} - -function mods_to_userclass() -{ - global $sql; - require_once(e_HANDLER."userclass_class.php"); - $_uc = new e_userclass; - if($sql->db_Select("forum", "forum_id, forum_moderators","forum_parent != 0")) - { - $fList = $sql->db_getList(); - foreach($fList as $row) - { - if(!is_numeric($row['forum_moderators'])) - { - $newclass = $_uc->class_create($row['forum_moderators'], "FORUM_MODS_"); - $sql->db_Update("forum", "forum_moderators = '{$newclass}' WHERE forum_id = '{$row['forum_id']}'"); - } - } - } - return "Forum moderators converted to userclasses
"; -} - -function set_forum_version() -{ - global $sql; - $new_version = "1.2"; - $sql->db_Update('plugin',"plugin_version = '{$new_version}' WHERE plugin_name='Forum'"); - return "Forum Version updated to version: $new_version
"; -} - -?> \ No newline at end of file diff --git a/e107_plugins/forum/forum_update_check.php b/e107_plugins/forum/forum_update_check.php deleted file mode 100644 index 490a05ce0..000000000 --- a/e107_plugins/forum/forum_update_check.php +++ /dev/null @@ -1,73 +0,0 @@ -db_Select("plugin", "plugin_version", "plugin_name = 'Forum'")) - { - $row = $sql->db_Fetch(); - if($row['plugin_version'] < 1.2) - { - return FALSE; - } - } - $fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum"); - if(!$fields) - { - return TRUE; - } - $columns = mysql_num_fields($fields); - for ($i = 0; $i < $columns; $i++) - { - if ("forum_lastpost_info" == mysql_field_name($fields, $i)) - { - $flist = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum_t"); - $cols = mysql_num_fields($flist); - for ($x = 0; $x < $cols; $x++) - { - if("thread_anon" == mysql_field_name($flist, $x)) - { - return FALSE; //needed - } - } - } - if("forum_sub" == mysql_field_name($fields, $i)) - { - return TRUE; //not needed - } - } - return FALSE; //needed - } -} - -?> - \ No newline at end of file