mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Remove 0.6xx to 0.7 update files
This commit is contained in:
@@ -1,367 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content_update.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-03-13 16:51:05 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$rs = new form;
|
||||
|
||||
global $ns, $sql, $pref;
|
||||
|
||||
$plugindir = e_PLUGIN."content/";
|
||||
$plugintable = "pcontent"; //name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)
|
||||
|
||||
require_once($plugindir."handlers/content_defines.php");
|
||||
require_once($plugindir."handlers/content_class.php");
|
||||
$aa = new content;
|
||||
require_once($plugindir."handlers/content_convert_class.php");
|
||||
$ac = new content_convert;
|
||||
|
||||
include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php");
|
||||
|
||||
if($sql->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 = "<tr><td $stylespacer colspan='2'> </td></tr>";
|
||||
$text = "
|
||||
<table class='fborder' style='width:95%; padding:0px;'>";
|
||||
|
||||
//conversion analysis
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader' style='width:5%; white-space:nowrap; vertical-align:top;'>".CONTENT_ADMIN_CONVERSION_LAN_11."</td>
|
||||
<td class='forumheader3'>
|
||||
<a style='cursor: pointer; cursor: hand' onclick=\"expandit('analysisconvert');\">".CONTENT_ADMIN_CONVERSION_LAN_48."</a>
|
||||
<div id='analysisconvert' style='display: none;'>
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_12.": ".$conversion_analyses_rows_total."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_13.": ".$conversion_analyses_rows_converted."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_14.": ".$conversion_analyses_rows_warning."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_15.": ".$conversion_analyses_rows_failed."<br />
|
||||
</div>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$text .= $SPACER;
|
||||
|
||||
//old content table : analysis
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader' style='width:5%; white-space:nowrap; vertical-align:top;'>".CONTENT_ADMIN_CONVERSION_LAN_16."</td>
|
||||
<td class='forumheader3'>
|
||||
<a style='cursor: pointer; cursor: hand' onclick=\"expandit('analysisold');\">".CONTENT_ADMIN_CONVERSION_LAN_48."</a>
|
||||
<div id='analysisold' style='display: none;'>
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_17.": ".$totaloldcontentrows."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_0." ".CONTENT_ADMIN_CONVERSION_LAN_6.": ".$totaloldrowsitem_content."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_1." ".CONTENT_ADMIN_CONVERSION_LAN_4.": ".$totaloldrowscat_review."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_1." ".CONTENT_ADMIN_CONVERSION_LAN_6.": ".$totaloldrowsitem_review."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_2." ".CONTENT_ADMIN_CONVERSION_LAN_4.": ".$totaloldrowscat_article."<br />
|
||||
".CONTENT_ADMIN_CONVERSION_LAN_2." ".CONTENT_ADMIN_CONVERSION_LAN_6.": ".$totaloldrowsitem_article."<br />";
|
||||
|
||||
$knownrows = $totaloldrowscat_article + $totaloldrowscat_review + $totaloldrowsitem_content + $totaloldrowsitem_review + $totaloldrowsitem_article;
|
||||
if($totaloldcontentrows > $knownrows ){
|
||||
$text .= CONTENT_ADMIN_CONVERSION_LAN_18.": ".($totaloldcontentrows - $knownrows)."<br />";
|
||||
}else{
|
||||
$text .= CONTENT_ADMIN_CONVERSION_LAN_19."<br />";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$text .= $SPACER;
|
||||
|
||||
//unknown rows
|
||||
if(count($unknown_array[0]) > 0){
|
||||
$text .= "<tr><td class='fcaption' colspan='2'>".CONTENT_ADMIN_CONVERSION_LAN_51."</td></tr>";
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:5%; white-space:nowrap; vertical-align:top;'>".CONTENT_ICON_ERROR." ".count($unknown_array[0])." ".CONTENT_ADMIN_CONVERSION_LAN_51."</td>
|
||||
<td class='forumheader3'>
|
||||
<a style='cursor: pointer; cursor: hand' onclick=\"expandit('unknownrows');\">".CONTENT_ADMIN_CONVERSION_LAN_48."</a>
|
||||
<div id='unknownrows' style='display: none;'>
|
||||
<table style='width:100%; border:0;'>";
|
||||
for($i=0;$i<count($unknown_array[0]);$i++){
|
||||
$text .= "<tr><td style='width:25%; white-space:nowrap;'>".CONTENT_ICON_ERROR." ".$unknown_array[0][$i]."</td><td>".$unknown_array[2][$i]." ".$rs -> form_hidden("unknownrows[]", $unknown_array[1][$i])."</td></tr>";
|
||||
}
|
||||
$text .= "
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
|
||||
".$SPACER."
|
||||
|
||||
".$ac -> results_conversion_mainparent($content_mainarray, $review_mainarray, $article_mainarray)."
|
||||
|
||||
".$SPACER."
|
||||
|
||||
<tr><td class='fcaption' colspan='2'>content : ".CONTENT_ADMIN_CONVERSION_LAN_27."</td></tr>
|
||||
".$ac -> results_conversion_row("content", $content_array, $totaloldrowsitem_content)."
|
||||
|
||||
".$SPACER."
|
||||
|
||||
<tr><td class='fcaption' colspan='2'>review : ".CONTENT_ADMIN_CONVERSION_LAN_27."</td></tr>
|
||||
".$ac -> results_conversion_category("review", $review_cat_array, $totaloldrowscat_review)."
|
||||
".$ac -> results_conversion_row("review", $review_array, $totaloldrowsitem_review)."
|
||||
|
||||
".$SPACER."
|
||||
|
||||
<tr><td class='fcaption' colspan='2'>article : ".CONTENT_ADMIN_CONVERSION_LAN_27."</td></tr>
|
||||
".$ac -> results_conversion_category("article", $article_cat_array, $totaloldrowscat_article)."
|
||||
".$ac -> results_conversion_row("article", $article_array, $totaloldrowsitem_article)."
|
||||
|
||||
".$SPACER."
|
||||
|
||||
</table>";
|
||||
|
||||
$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 = "<table class='fborder' style='width:95%; padding:0px;'>";
|
||||
$text .= $ac -> results_conversion_mainparent($content_mainarray, $review_mainarray, $article_mainarray);
|
||||
$text .= "</table>";
|
||||
|
||||
$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 = "<div style='text-align:center'>".CONTENT_ADMIN_CONVERSION_LAN_46."</div>";
|
||||
$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 <br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/content_update_check.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-03-13 16:51:05 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$dbupdatep['content_07'] = LAN_UPDATE_8." .617 content ".LAN_UPDATE_9." .7 content";
|
||||
function update_content_07($type='')
|
||||
{
|
||||
global $sql, $mySQLdefaultdb;
|
||||
if($type == 'do')
|
||||
{
|
||||
if(!isset($_POST['updateall']))
|
||||
{
|
||||
include_once(e_PLUGIN.'content/content_update.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// FALSE = needed, TRUE = not needed.
|
||||
|
||||
//if not installed, return FALSE = needed
|
||||
if(!$sql->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_update.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:14 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
require_once(e_PLUGIN.'forum/forum_class.php');
|
||||
global $ns;
|
||||
$forum = new e107forum;
|
||||
|
||||
$timestart = microtime();
|
||||
$ttab = MPREFIX.'forum_t';
|
||||
|
||||
|
||||
if($sql->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 .= "<br />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 <br />";
|
||||
}
|
||||
|
||||
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<br />";
|
||||
}
|
||||
|
||||
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<br />";
|
||||
}
|
||||
|
||||
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.<br />";
|
||||
$forum = new e107forum;
|
||||
$forum->forum_update_counts('all');
|
||||
return $ret."Updated forum thread count info. <br />";
|
||||
}
|
||||
|
||||
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 <br />";
|
||||
}
|
||||
|
||||
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.<br />";
|
||||
}
|
||||
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 <br />";
|
||||
}
|
||||
|
||||
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 <br />";
|
||||
}
|
||||
|
||||
?>
|
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_update_check.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:14 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$dbupdatep['forum_07'] = LAN_UPDATE_8." .617 forums ".LAN_UPDATE_9." .7 forums";
|
||||
function update_forum_07($type)
|
||||
{
|
||||
global $sql, $mySQLdefaultdb;
|
||||
if($type == 'do')
|
||||
{
|
||||
if(!isset($_POST['updateall']))
|
||||
{
|
||||
include_once(e_PLUGIN.'forum/forum_update.php');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// FALSE = needed, TRUE = not needed.
|
||||
if($sql->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
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user