1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

path changes (xml files)

This commit is contained in:
CaMer0n
2010-02-09 21:42:11 +00:00
parent e410adcd53
commit b31709f728
2 changed files with 117 additions and 116 deletions

View File

@@ -11,16 +11,16 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
| $Revision: 1.77 $ | $Revision: 1.78 $
| $Date: 2010-01-11 21:31:54 $ | $Date: 2010-02-09 21:42:11 $
| $Author: e107steved $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
/** /**
* @package e107 * @package e107
* @subpackage admin * @subpackage admin
* @version $Id: update_routines.php,v 1.77 2010-01-11 21:31:54 e107steved Exp $; * @version $Id: update_routines.php,v 1.78 2010-02-09 21:42:11 e107coders Exp $;
* *
* Update routines from older e107 versions to current. * Update routines from older e107 versions to current.
* *
@@ -206,7 +206,7 @@ function update_core_prefs($type='')
$accum = array(); $accum = array();
$just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed $just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed
foreach ($should as $k => $v) foreach ($should as $k => $v)
{ {
if ($k && !array_key_exists($k,$pref)) if ($k && !array_key_exists($k,$pref))
@@ -270,8 +270,8 @@ function update_706_to_800($type='')
// List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed) // List of DB tables newly required (defined in core_sql.php) (The existing dblog table gets renamed)
$new_tables = array('admin_log','audit_log', 'dblog','news_rewrite', 'core_media', 'mail_recipients', 'mail_content'); $new_tables = array('admin_log','audit_log', 'dblog','news_rewrite', 'core_media', 'mail_recipients', 'mail_content');
// List of core prefs that need to be converted from serialized to e107ArrayStorage. // List of core prefs that need to be converted from serialized to e107ArrayStorage.
$serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'"); $serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'");
@@ -284,38 +284,38 @@ function update_706_to_800($type='')
// List of changed DB tables from core plugins (defined in pluginname_sql.php file) // List of changed DB tables from core plugins (defined in pluginname_sql.php file)
// key = plugin directory name. Data = comma-separated list of tables to check // key = plugin directory name. Data = comma-separated list of tables to check
// (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster) // (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster)
$pluginChangedTables = array('linkwords' => 'linkwords', $pluginChangedTables = array('linkwords' => 'linkwords',
'featurebox' => 'featurebox', 'featurebox' => 'featurebox',
'links_page' => 'links_page', 'links_page' => 'links_page',
'poll' => 'polls', 'poll' => 'polls',
'content' => 'pcontent' 'content' => 'pcontent'
); );
$setCorePrefs = array( //modified prefs during upgrade. $setCorePrefs = array( //modified prefs during upgrade.
'adminstyle' => 'infopanel', 'adminstyle' => 'infopanel',
'admintheme' => 'jayya' 'admintheme' => 'jayya'
); );
$do_save = TRUE;
$do_save = TRUE;
foreach($setCorePrefs as $k=>$v) foreach($setCorePrefs as $k=>$v)
{ {
$pref[$k] = $v; $pref[$k] = $v;
} }
// List of changed menu locations. // List of changed menu locations.
$changeMenuPaths = array( $changeMenuPaths = array(
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'),
array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'),
array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'),
array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'),
array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'),
@@ -323,7 +323,7 @@ function update_706_to_800($type='')
array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'), array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'),
array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'), array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'),
array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu') array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu')
); );
// List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses // List of DB tables (key) and field (value) which need changing to accommodate IPV6 addresses
@@ -406,10 +406,10 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$pref['signup_option_customtitle'] = $pref['forum_user_customtitle']; $pref['signup_option_customtitle'] = $pref['forum_user_customtitle'];
unset($pref['forum_user_customtitle']); unset($pref['forum_user_customtitle']);
$mes->add(LAN_UPDATE_20.'customtitle', E_MESSAGE_SUCCESS); $mes->add(LAN_UPDATE_20.'customtitle', E_MESSAGE_SUCCESS);
$do_save = TRUE; $do_save = TRUE;
} }
// convert all serialized core prefs to e107 ArrayStorage; // convert all serialized core prefs to e107 ArrayStorage;
$serialz_qry = "SUBSTRING( e107_value,1,5)!='array' AND e107_value !='' "; $serialz_qry = "SUBSTRING( e107_value,1,5)!='array' AND e107_value !='' ";
$serialz_qry .= "AND e107_name IN (".implode(",",$serialized_prefs).") "; $serialz_qry .= "AND e107_name IN (".implode(",",$serialized_prefs).") ";
@@ -418,17 +418,17 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
while ($row = e107::getDb()->db_Fetch(MYSQL_ASSOC)) while ($row = e107::getDb()->db_Fetch(MYSQL_ASSOC))
{ {
$status = e107::getDb('sql2')->db_Update('core',"e107_value=\"".convert_serialized($row['e107_value'])."\" WHERE e107_name='".$row['e107_name']."'"); $status = e107::getDb('sql2')->db_Update('core',"e107_value=\"".convert_serialized($row['e107_value'])."\" WHERE e107_name='".$row['e107_name']."'");
$mes->add(LAN_UPDATE_22.$row['e107_name'], $status); $mes->add(LAN_UPDATE_22.$row['e107_name'], $status);
} }
} }
//TODO de-serialize the user_prefs also. //TODO de-serialize the user_prefs also.
// Move the maximum online counts from menu prefs to a separate pref - 'history' // Move the maximum online counts from menu prefs to a separate pref - 'history'
$menuConfig = e107::getConfig('menu'); $menuConfig = e107::getConfig('menu');
if ($menuConfig->get('most_members_online') || $menuConfig->get('most_guests_online') || $menuConfig->get('most_online_datestamp')) if ($menuConfig->get('most_members_online') || $menuConfig->get('most_guests_online') || $menuConfig->get('most_online_datestamp'))
{ {
$status = E_MESSAGE_SUCCESS; $status = E_MESSAGE_SUCCESS;
@@ -471,9 +471,9 @@ function update_706_to_800($type='')
// ++++++++ Modify Menu Paths +++++++. // ++++++++ Modify Menu Paths +++++++.
if(varset($changeMenuPaths)) if(varset($changeMenuPaths))
{ {
foreach($changeMenuPaths as $val) foreach($changeMenuPaths as $val)
{ {
$qry = "SELECT menu_path FROM `#menus` WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) LIMIT 1"; $qry = "SELECT menu_path FROM `#menus` WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) LIMIT 1";
@@ -482,13 +482,13 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' '); if ($just_check) return update_needed('Menu path changed required: '.$val['menu'].' ');
$updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) "; $updqry = "menu_path='".$val['newpath']."/' WHERE menu_name = '".$val['menu']."' AND (menu_path='".$val['oldpath']."' || menu_path='".$val['oldpath']."/' ) ";
$status = $sql->db_Update('menus', $updqry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update('menus', $updqry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25; $mes->add(LAN_UPDATE_23.'<b>'.$val['menu'].'</b> : '.$val['oldpath'].' => '.$val['newpath'], $status); // LAN_UPDATE_25;
// catch_error($sql); // catch_error($sql);
} }
} }
} }
// Leave this one here.. just in case.. // Leave this one here.. just in case..
//delete record for online_extended_menu (now only using one online menu) //delete record for online_extended_menu (now only using one online menu)
if($sql->db_Select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'")) if($sql->db_Select('menus', '*', "menu_path='online_extended_menu' || menu_path='online_extended_menu/'"))
{ {
@@ -500,7 +500,7 @@ function update_706_to_800($type='')
if($row['menu_location']!=0) if($row['menu_location']!=0)
{ {
$status = $sql->db_Update('menus', "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update('menus', "menu_name='online_menu', menu_path='online/' WHERE menu_path='online_extended_menu' || menu_path='online_extended_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status); $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
} }
else else
{ //else if the menu is not active { //else if the menu is not active
@@ -517,7 +517,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed(); if ($just_check) return update_needed();
$status = $sql->db_Update('menus', "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Update('menus', "menu_path='online/' WHERE menu_path='online_menu' || menu_path='online_menu/' ") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status); $mes->add(LAN_UPDATE_23."<b>online_menu</b> : online/", $status);
catch_error($sql); catch_error($sql);
} }
@@ -536,21 +536,21 @@ function update_706_to_800($type='')
{ {
// Flag error // Flag error
// $commentMessage = LAN_UPDAXXTE_34; // $commentMessage = LAN_UPDAXXTE_34;
$mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR); $mes->add(LAN_UPDATE_21."comments", E_MESSAGE_ERROR);
} }
else else
{ {
if (FALSE ===$sql->db_Update('comments',"comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)")) if (FALSE ===$sql->db_Update('comments',"comment_author_id=SUBSTRING_INDEX(`comment_author`,'.',1), comment_author_name=SUBSTRING(`comment_author` FROM POSITION('.' IN `comment_author`)+1)"))
{ {
// Flag error // Flag error
$mes->add(LAN_UPDATE_21.'comments', E_MESSAGE_ERROR); $mes->add(LAN_UPDATE_21.'comments', E_MESSAGE_ERROR);
} }
else else
{ // Delete superceded field - comment_author { // Delete superceded field - comment_author
if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`")) if (!$sql->db_Select_gen("ALTER TABLE `#comments` DROP COLUMN `comment_author`"))
{ {
// Flag error // Flag error
$mes->add(LAN_UPDATE_24.'comments - comment_author', E_MESSAGE_ERROR); $mes->add(LAN_UPDATE_24.'comments - comment_author', E_MESSAGE_ERROR);
} }
} }
} }
@@ -616,7 +616,7 @@ function update_706_to_800($type='')
} }
//TODO use generic function for this update. //TODO use generic function for this update.
if ($sql->db_Table_exists('download')) if ($sql->db_Table_exists('download'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'")) if ($sql->db_Query("SHOW FIELDS FROM ".MPREFIX."download LIKE 'download_url'"))
@@ -632,7 +632,7 @@ function update_706_to_800($type='')
} }
} }
//TODO use generic function for this update. //TODO use generic function for this update.
if ($sql->db_Table_exists('download_mirror')) if ($sql->db_Table_exists('download_mirror'))
{ // Need to extend field download_url varchar(255) NOT NULL default '' { // Need to extend field download_url varchar(255) NOT NULL default ''
if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'")) if ($sql->db_Select_gen("SHOW FIELDS FROM ".MPREFIX."download_mirror LIKE 'mirror_url'"))
@@ -675,7 +675,7 @@ function update_706_to_800($type='')
$updateMessages[] = LAN_UPDATE_43; //FIXME $updateMessages[] = LAN_UPDATE_43; //FIXME
} }
// Next bit will be needed only by the brave souls who used an early CVS - probably delete before release // Next bit will be needed only by the brave souls who used an early CVS - probably delete before release
if ($sql->db_Table_exists('rl_history') && !$sql->db_Table_exists('dblog')) if ($sql->db_Table_exists('rl_history') && !$sql->db_Table_exists('dblog'))
{ {
@@ -684,7 +684,7 @@ function update_706_to_800($type='')
$updateMessages[] = LAN_UPDATE_44; //FIXME $updateMessages[] = LAN_UPDATE_44; //FIXME
catch_error($sql); catch_error($sql);
} }
// New tables required (list at top. Definitions in core_sql.php) // New tables required (list at top. Definitions in core_sql.php)
foreach ($new_tables as $nt) foreach ($new_tables as $nt)
{ {
@@ -694,9 +694,9 @@ function update_706_to_800($type='')
// Get the definition // Get the definition
$defs = $db_parser->get_table_def($nt,e_ADMIN.'sql/core_sql.php'); $defs = $db_parser->get_table_def($nt,e_ADMIN.'sql/core_sql.php');
if (count($defs)) // **** Add in table here if (count($defs)) // **** Add in table here
{ {
$status = $sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen('CREATE TABLE `'.MPREFIX.$defs[0][1].'` ('.$defs[0][2].') TYPE='.$defs[0][3]) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
// $updateMessages[] = LAN_UPDATE_45.$defs[0][1]; // $updateMessages[] = LAN_UPDATE_45.$defs[0][1];
$mes->add(LAN_UPDATE_27.$defs[0][1], $status); //TODO - all update messages should work like this. But also need $updateMessages[] for admin log $mes->add(LAN_UPDATE_27.$defs[0][1], $status); //TODO - all update messages should work like this. But also need $updateMessages[] for admin log
// catch_error($sql); // catch_error($sql);
} }
@@ -718,12 +718,12 @@ function update_706_to_800($type='')
$req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions $req_fields = $db_parser->parse_field_defs($req_defs[0][2]); // Required definitions
if ($debugLevel) if ($debugLevel)
{ {
$mes->add("Required table structure: <br />".$db_parser->make_field_list($req_fields), E_MESSAGE_DEBUG); $mes->add("Required table structure: <br />".$db_parser->make_field_list($req_fields), E_MESSAGE_DEBUG);
} }
if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix
{ {
$mes->add("Couldn't get table structure: ".$ct, E_MESSAGE_DEBUG); $mes->add("Couldn't get table structure: ".$ct, E_MESSAGE_DEBUG);
} }
else else
{ {
@@ -731,28 +731,28 @@ function update_706_to_800($type='')
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if ($debugLevel) if ($debugLevel)
{ {
$mes->add("Actual table structure: <br />".$db_parser->make_field_list($actual_fields), E_MESSAGE_DEBUG); $mes->add("Actual table structure: <br />".$db_parser->make_field_list($actual_fields), E_MESSAGE_DEBUG);
} }
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
{ // Changes needed { // Changes needed
if ($just_check) return update_needed("Field changes rqd; table: ".$ct); if ($just_check) return update_needed("Field changes rqd; table: ".$ct);
// Do the changes here // Do the changes here
if ($debugLevel) if ($debugLevel)
{ {
$mes->add("List of changes found:<br />".$db_parser->make_changes_list($diffs), E_MESSAGE_DEBUG); $mes->add("List of changes found:<br />".$db_parser->make_changes_list($diffs), E_MESSAGE_DEBUG);
} }
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if ($debugLevel) if ($debugLevel)
{ {
$mes->add("Update Query used: ".$qry, E_MESSAGE_DEBUG); $mes->add("Update Query used: ".$qry, E_MESSAGE_DEBUG);
} }
$status = $sql->db_Select_gen($qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen($qry) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_21.$ct, $status); $mes->add(LAN_UPDATE_21.$ct, $status);
catch_error($sql); catch_error($sql);
} }
@@ -781,10 +781,10 @@ function update_706_to_800($type='')
if (E107_DBG_SQLDETAILS) if (E107_DBG_SQLDETAILS)
{ {
$message = "Required plugin table structure: <br />".$db_parser->make_field_list($req_fields); $message = "Required plugin table structure: <br />".$db_parser->make_field_list($req_fields);
$mes->add($message, E_MESSAGE_DEBUG); $mes->add($message, E_MESSAGE_DEBUG);
} }
if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix if ((($actual_defs = $db_parser->get_current_table($ct)) === FALSE) || !is_array($actual_defs)) // Adds current default prefix
{ {
@@ -795,10 +795,10 @@ function update_706_to_800($type='')
// echo $db_parser->make_table_list($actual_defs); // echo $db_parser->make_table_list($actual_defs);
$actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]); $actual_fields = $db_parser->parse_field_defs($actual_defs[0][2]);
if (E107_DBG_SQLDETAILS) if (E107_DBG_SQLDETAILS)
{ {
$message= "Actual table structure: <br />".$db_parser->make_field_list($actual_fields); $message= "Actual table structure: <br />".$db_parser->make_field_list($actual_fields);
$mes->add($message, E_MESSAGE_DEBUG); $mes->add($message, E_MESSAGE_DEBUG);
} }
$diffs = $db_parser->compare_field_lists($req_fields,$actual_fields); $diffs = $db_parser->compare_field_lists($req_fields,$actual_fields);
if (count($diffs[0])) if (count($diffs[0]))
@@ -806,15 +806,15 @@ function update_706_to_800($type='')
if (E107_DBG_SQLDETAILS) if (E107_DBG_SQLDETAILS)
{ {
$message = "List of changes found:<br />".$db_parser->make_changes_list($diffs); $message = "List of changes found:<br />".$db_parser->make_changes_list($diffs);
$mes->add($message, E_MESSAGE_DEBUG); $mes->add($message, E_MESSAGE_DEBUG);
} }
if ($just_check) return update_needed("Field changes rqd; plugin table: ".$ct); if ($just_check) return update_needed("Field changes rqd; plugin table: ".$ct);
// Do the changes here // Do the changes here
$qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]); $qry = 'ALTER TABLE '.MPREFIX.$ct.' '.implode(', ',$diffs[1]);
if (E107_DBG_SQLDETAILS) if (E107_DBG_SQLDETAILS)
{ {
$message = "Update Query used: ".$qry."<br />"; $message = "Update Query used: ".$qry."<br />";
$mes->add($message, E_MESSAGE_DEBUG); $mes->add($message, E_MESSAGE_DEBUG);
} }
$sql->db_Select_gen($qry); $sql->db_Select_gen($qry);
$updateMessages[] = LAN_UPDATE_51.$ct; //FIXME $updateMessages[] = LAN_UPDATE_51.$ct; //FIXME
@@ -832,7 +832,7 @@ function update_706_to_800($type='')
require_once(e_HANDLER.'plugin_class.php'); require_once(e_HANDLER.'plugin_class.php');
$ep = new e107plugin; $ep = new e107plugin;
$ep -> update_plugins_table(); $ep -> update_plugins_table();
// $_pdateMessages[] = LAN_UPDATE_XX24; // $_pdateMessages[] = LAN_UPDATE_XX24;
// catch_error($sql); // catch_error($sql);
} }
@@ -844,7 +844,7 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed("Delete table: ".$ot); if ($just_check) return update_needed("Delete table: ".$ot);
$status = $sql->db_Select_gen('DROP TABLE `'.MPREFIX.$ot.'`') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen('DROP TABLE `'.MPREFIX.$ot.'`') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_25.$ot, $status); $mes->add(LAN_UPDATE_25.$ot, $status);
} }
} }
@@ -861,7 +861,7 @@ function update_706_to_800($type='')
{ {
if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t); if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t);
$status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $status = $sql->db_Select_gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `{$f}` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add(LAN_UPDATE_26.$t.' - '.$f, $status); $mes->add(LAN_UPDATE_26.$t.' - '.$f, $status);
// catch_error($sql); // catch_error($sql);
} }
} }
@@ -885,9 +885,9 @@ function update_706_to_800($type='')
$accum[] = $p; $accum[] = $p;
} }
} }
//-- Media-manger import -------------------------------------------------- //-- Media-manger import --------------------------------------------------
$count = $sql->db_Select('core_media_cat'); $count = $sql->db_Select('core_media_cat');
if($count < 5) if($count < 5)
{ {
@@ -897,19 +897,19 @@ function update_706_to_800($type='')
(3, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253), (3, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253),
(4, 'download', 'Download Images', '', 253), (4, 'download', 'Download Images', '', 253),
(5, 'downloadthumb', 'Download Thumbnails', '', 253);"; (5, 'downloadthumb', 'Download Thumbnails', '', 253);";
mysql_query($query); mysql_query($query);
} }
core_media_import('news',e_IMAGE.'newspost_images'); core_media_import('news',e_IMAGE.'newspost_images');
core_media_import('page',e_IMAGE.'custom'); core_media_import('page',e_IMAGE.'custom');
core_media_import('download',e_FILE.'downloadimages'); core_media_import('download',e_FILE.'downloadimages');
core_media_import('downloadthumb',e_IMAGE.'downloadthumbs'); core_media_import('downloadthumb',e_IMAGE.'downloadthumbs');
// Any others should be done manually via Media Manager batch-import. // Any others should be done manually via Media Manager batch-import.
// ------------------------------------------------------------------ // ------------------------------------------------------------------
if ($do_save) if ($do_save)
{ {
@@ -917,8 +917,8 @@ function update_706_to_800($type='')
$mes->add(LAN_UPDATE_50); $mes->add(LAN_UPDATE_50);
$updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); // Note for admin log $updateMessages[] = LAN_UPDATE_50.implode(', ',$accum); // Note for admin log
} }
//FIXME grab message-stack from $mes for the log. //FIXME grab message-stack from $mes for the log.
if ($just_check) return TRUE; if ($just_check) return TRUE;
$admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update $admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update
@@ -928,39 +928,39 @@ function update_706_to_800($type='')
function core_media_import($cat,$epath) function core_media_import($cat,$epath)
{ {
if(!vartrue($cat)){ return;} if(!vartrue($cat)){ return;}
if(!is_readable($epath)) if(!is_readable($epath))
{ {
return; return;
} }
$fl = e107::getFile(); $fl = e107::getFile();
$tp = e107::getParser(); $tp = e107::getParser();
$sql = e107::getDb(); $sql = e107::getDb();
$mes = e107::getMessage(); $mes = e107::getMessage();
$fl->setFileInfo('all'); $fl->setFileInfo('all');
$img_array = $fl->get_files($epath,'','',2); $img_array = $fl->get_files($epath,'','',2);
if(!count($img_array)){ return;} if(!count($img_array)){ return;}
foreach($img_array as $f) foreach($img_array as $f)
{ {
$fullpath = $tp->createConstants($f['path'].$f['fname'],1); $fullpath = $tp->createConstants($f['path'].$f['fname'],1);
$insert = array( $insert = array(
'media_caption' => $f['fname'], 'media_caption' => $f['fname'],
'media_description' => '', 'media_description' => '',
'media_category' => $cat, 'media_category' => $cat,
'media_datestamp' => $f['modified'], 'media_datestamp' => $f['modified'],
'media_url' => $fullpath, 'media_url' => $fullpath,
'media_userclass' => 0, 'media_userclass' => 0,
'media_name' => $f['fname'], 'media_name' => $f['fname'],
'media_author' => USERID, 'media_author' => USERID,
'media_size' => $f['fsize'], 'media_size' => $f['fsize'],
'media_dimensions' => $f['img-width']." x ".$f['img-height'], 'media_dimensions' => $f['img-width']." x ".$f['img-height'],
'media_usedby' => '', 'media_usedby' => '',
'media_tags' => '', 'media_tags' => '',
'media_type' => $f['mime'] 'media_type' => $f['mime']
); );
@@ -968,10 +968,10 @@ function core_media_import($cat,$epath)
{ {
if($sql->db_Insert("core_media",$insert)) if($sql->db_Insert("core_media",$insert))
{ {
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS); $mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
} }
} }
} }
} }
@@ -1167,7 +1167,7 @@ function catch_error(&$target)
function get_default_prefs() function get_default_prefs()
{ {
$xmlArray = e107::getSingleton('xmlClass')->loadXMLfile(e_FILE."default_install.xml",'advanced'); $xmlArray = e107::getSingleton('xmlClass')->loadXMLfile(e_CORE."xml/default_install.xml",'advanced');
$pref = e107::getSingleton('xmlClass')->e107ImportPrefs($xmlArray,'core'); $pref = e107::getSingleton('xmlClass')->e107ImportPrefs($xmlArray,'core');
return $pref; return $pref;
} }

View File

@@ -9,16 +9,16 @@
* Installation file * Installation file
* *
* $Source: /cvs_backup/e107_0.8/install_.php,v $ * $Source: /cvs_backup/e107_0.8/install_.php,v $
* $Revision: 1.59 $ * $Revision: 1.60 $
* $Date: 2010-01-23 02:07:50 $ * $Date: 2010-02-09 21:42:11 $
* $Author: mcfly_e107 $ * $Author: e107coders $
* *
*/ */
/** /**
* @package e107 * @package e107
* @subpackage install * @subpackage install
* @version $Id: install_.php,v 1.59 2010-01-23 02:07:50 mcfly_e107 Exp $; * @version $Id: install_.php,v 1.60 2010-02-09 21:42:11 e107coders Exp $;
* *
* Installer base routine * Installer base routine
*/ */
@@ -37,17 +37,18 @@ $MySQLprefix = 'e107_';
$ADMIN_DIRECTORY = "e107_admin/"; $ADMIN_DIRECTORY = "e107_admin/";
$FILES_DIRECTORY = "e107_files/"; $FILES_DIRECTORY = "e107_files/";
$IMAGES_DIRECTORY = "e107_images/"; $IMAGES_DIRECTORY = "e107_images/";
//FIXME need another name
$MEDIA_DIRECTORY = "e107_media/"; $MEDIA_DIRECTORY = "e107_media/";
$THEMES_DIRECTORY = "e107_themes/"; $THEMES_DIRECTORY = "e107_themes/";
$PLUGINS_DIRECTORY = "e107_plugins/"; $PLUGINS_DIRECTORY = "e107_plugins/";
$HANDLERS_DIRECTORY = "e107_handlers/"; $HANDLERS_DIRECTORY = "e107_handlers/";
$LANGUAGES_DIRECTORY = "e107_languages/"; $LANGUAGES_DIRECTORY = "e107_languages/";
$HELP_DIRECTORY = "e107_docs/help/"; $HELP_DIRECTORY = "e107_docs/help/";
$CACHE_DIRECTORY = "e107_media/cache/"; $CACHE_DIRECTORY = "e107_system/cache/";
$DOWNLOADS_DIRECTORY = "e107_media/files/"; $DOWNLOADS_DIRECTORY = "e107_media/files/";
$UPLOADS_DIRECTORY = "e107_media/public/"; $UPLOADS_DIRECTORY = "e107_media/temp/";
$LOGS_DIRECTORY = "e107_files/logs"; $LOGS_DIRECTORY = "e107_files/logs";
$CORE_DIRECTORY = "e107_core/";
$SYSTEM_DIRECTORY = "e107_system/";
/* End configurable variables */ /* End configurable variables */
@@ -154,7 +155,7 @@ function check_class($whatever)
} }
$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'CACHE_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY', 'MEDIA_DIRECTORY', 'LOGS_DIRECTORY'); $e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'CACHE_DIRECTORY', 'DOWNLOADS_DIRECTORY', 'UPLOADS_DIRECTORY', 'MEDIA_DIRECTORY', 'LOGS_DIRECTORY', 'SYSTEM_DIRECTORY', 'CORE_DIRECTORY');
$e107 = e107::getInstance(); $e107 = e107::getInstance();
$e107->initInstall($e107_paths, realpath(dirname(__FILE__))); $e107->initInstall($e107_paths, realpath(dirname(__FILE__)));
unset($e107_paths); unset($e107_paths);
@@ -1042,7 +1043,7 @@ class e_install
$themeImportFile = array(); $themeImportFile = array();
$themeImportFile[0] = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install.xml"; $themeImportFile[0] = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install.xml";
$themeImportFile[1] = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install/install.xml"; $themeImportFile[1] = $this->e107->e107_dirs['THEMES_DIRECTORY'].$this->previous_steps['prefs']['sitetheme']."/install/install.xml";
$themeImportFile[3] = $this->e107->e107_dirs['FILES_DIRECTORY']. "default_install.xml"; $themeImportFile[3] = $this->e107->e107_dirs['CORE_DIRECTORY']. "xml/default_install.xml";
if(vartrue($this->previous_steps['generate_content'])) if(vartrue($this->previous_steps['generate_content']))
{ {
@@ -1057,7 +1058,7 @@ class e_install
} }
else else
{ {
$XMLImportfile = $this->e107->e107_dirs['FILES_DIRECTORY']. "default_install.xml"; $XMLImportfile = $this->e107->e107_dirs['CORE_DIRECTORY']. "xml/default_install.xml";
} }
@@ -1273,8 +1274,8 @@ class e_install
function check_writable_perms($list = 'must_write') function check_writable_perms($list = 'must_write')
{ {
$bad_files = array(); $bad_files = array();
$data['must_write'] = 'e107_config.php|{$MEDIA_DIRECTORY}temp/|{$MEDIA_DIRECTORY}logs/|{$MEDIA_DIRECTORY}images/'; $data['must_write'] = 'e107_config.php|{$MEDIA_DIRECTORY}|{$MEDIA_DIRECTORY}images/|{$SYSTEM_DIRECTORY}|{$SYSTEM_DIRECTORY}logs/';
$data['can_write'] = '{$CACHE_DIRECTORY}|{$UPLOADS_DIRECTORY}|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}'; $data['can_write'] = '{$CACHE_DIRECTORY}|{$UPLOADS_DIRECTORY}|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
if (!isset($data[$list])) return $bad_files; if (!isset($data[$list])) return $bad_files;
foreach ($this->e107->e107_dirs as $dir_name => $value) foreach ($this->e107->e107_dirs as $dir_name => $value)
{ {