diff options
Diffstat (limited to 'phpBB/install')
| -rw-r--r-- | phpBB/install/database_update.php | 112 | ||||
| -rw-r--r-- | phpBB/install/install_convert.php | 2 | ||||
| -rw-r--r-- | phpBB/install/install_install.php | 1 | ||||
| -rw-r--r-- | phpBB/install/install_update.php | 11 | 
4 files changed, 124 insertions, 2 deletions
| diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..fec09f89db 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -685,7 +685,6 @@ function _add_modules($modules_to_install)  				WHERE module_class = '" . $db->sql_escape($module_data['class']) . "'  					AND parent_id = {$parent_id}  					AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} -				GROUP BY left_id  				ORDER BY left_id";  			$result = $db->sql_query($sql);  			$steps = (int) $db->sql_fetchfield('num_modules'); @@ -1684,6 +1683,117 @@ function change_database_data(&$no_updates, $version)  			}  			$db->sql_freeresult($result); +			// Install modules +			$modules_to_install = array( +				'post'					=> array( +					'base'		=> 'board', +					'class'		=> 'acp', +					'title'		=> 'ACP_POST_SETTINGS', +					'auth'		=> 'acl_a_board', +					'cat'		=> 'ACP_MESSAGES', +					'after'		=> array('message', 'ACP_MESSAGE_SETTINGS') +				), +			); + +			_add_modules($modules_to_install); + +			// add Bing Bot +			$sql = 'SELECT group_id, group_colour +				FROM ' . GROUPS_TABLE . " +				WHERE group_name = 'BOTS'"; +			$result = $db->sql_query($sql); +			$group_row = $db->sql_fetchrow($result); +			$db->sql_freeresult($result); + +			if (!$group_row) +			{ +				// default fallback, should never get here +				$group_row['group_id'] = 6; +				$group_row['group_colour'] = '9E8DA7'; +			} + +			if (!function_exists('user_add')) +			{ +				include($phpbb_root_path . 'includes/functions_user.' . $phpEx); +			} + +			$bot_name = 'Bing [Bot]'; +			$bot_agent = 'bingbot/'; +			$bot_ip = ''; + +			$user_row = array( +				'user_type'				=> USER_IGNORE, +				'group_id'				=> $group_row['group_id'], +				'username'				=> $bot_name, +				'user_regdate'			=> time(), +				'user_password'			=> '', +				'user_colour'			=> $group_row['group_colour'], +				'user_email'			=> '', +				'user_lang'				=> $config['default_lang'], +				'user_style'			=> $config['default_style'], +				'user_timezone'			=> 0, +				'user_dateformat'		=> $config['default_dateformat'], +				'user_allow_massemail'	=> 0, +			); + +			$user_id = user_add($user_row); + +			$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( +				'bot_active'	=> 1, +				'bot_name'		=> (string) $bot_name, +				'user_id'		=> (int) $user_id, +				'bot_agent'		=> (string) $bot_agent, +				'bot_ip'		=> (string) $bot_ip, +			)); + +			_sql($sql, $errored, $error_ary); +			// end Bing Bot addition + +			// Delete shadow topics pointing to not existing topics +			$batch_size = 500; + +			// Set of affected forums we have to resync +			$sync_forum_ids = array(); + +			do +			{ +				$sql_array = array( +					'SELECT'	=> 't1.topic_id, t1.forum_id', +					'FROM'		=> array( +						TOPICS_TABLE	=> 't1', +					), +					'LEFT_JOIN'	=> array( +						array( +							'FROM'	=> array(TOPICS_TABLE	=> 't2'), +							'ON'	=> 't1.topic_moved_id = t2.topic_id', +						), +					), +					'WHERE'		=> 't1.topic_moved_id <> 0 +								AND t2.topic_id IS NULL', +				); +				$sql = $db->sql_build_query('SELECT', $sql_array); +				$result = $db->sql_query_limit($sql, $batch_size); + +				$topic_ids = array(); +				while ($row = $db->sql_fetchrow($result)) +				{ +					$topic_ids[] = (int) $row['topic_id']; + +					$sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; +				} +				$db->sql_freeresult($result); + +				if (!empty($topic_ids)) +				{ +					$sql = 'DELETE FROM ' . TOPICS_TABLE . ' +						WHERE ' . $db->sql_in_set('topic_id', $topic_ids); +					$db->sql_query($sql); +				} +			} +			while (sizeof($topic_ids) == $batch_size); + +			// Sync the forums we have deleted shadow topics from. +			sync('forum', 'forum_id', $sync_forum_ids, true, true);  			$no_updates = false;  		break; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 06c3a8b4a6..8c3ffd61a8 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -685,7 +685,7 @@ class install_convert extends module  			// Thanks MySQL, for silently converting...  			case 'mysql':  			case 'mysql4': -				if (version_compare($src_db->sql_server_info(true), '4.1.3', '>=')) +				if (version_compare($src_db->sql_server_info(true, false), '4.1.3', '>='))  				{  					$convert->mysql_convert = true;  				} diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f4989b5bd7..4c22db07b2 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -2108,6 +2108,7 @@ class install_install extends module  		'Alta Vista [Bot]'			=> array('Scooter/', ''),  		'Ask Jeeves [Bot]'			=> array('Ask Jeeves', ''),  		'Baidu [Spider]'			=> array('Baiduspider+(', ''), +		'Bing [Bot]'                => array('bingbot/', ''),  		'Exabot [Bot]'				=> array('Exabot/', ''),  		'FAST Enterprise [Crawler]'	=> array('FAST Enterprise Crawler', ''),  		'FAST WebCrawler [Crawler]'	=> array('FAST-WebCrawler/', ''), diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index e717fe3dd4..6184cbbc33 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -192,6 +192,17 @@ class install_update extends module  			return;  		} +		// Check if the update files are actually meant to update from the current version +		if ($config['version'] != $this->update_info['version']['from']) +		{ +			$this->unequal_version = true; + +			$template->assign_vars(array( +				'S_ERROR'	=> true, +				'ERROR_MSG'	=> sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to']), +			)); +		} +  		// Check if the update files stored are for the latest version...  		if ($this->latest_version != $this->update_info['version']['to'])  		{ | 
