aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-11-26 17:22:32 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-11-26 17:22:32 +0000
commit12fb5f6aa2286eb3e1be384ba61c66131088d4a1 (patch)
tree9c47eedfd40b2d2e5d9b559b821f4966dafe72a7 /phpBB/install/database_update.php
parent4d6f84c3208c0d941d3b786a1c60682e9c20193f (diff)
downloadforums-12fb5f6aa2286eb3e1be384ba61c66131088d4a1.tar
forums-12fb5f6aa2286eb3e1be384ba61c66131088d4a1.tar.gz
forums-12fb5f6aa2286eb3e1be384ba61c66131088d4a1.tar.bz2
forums-12fb5f6aa2286eb3e1be384ba61c66131088d4a1.tar.xz
forums-12fb5f6aa2286eb3e1be384ba61c66131088d4a1.zip
- fixed bug within the user_add function
- fixed some updater bugs git-svn-id: file:///svn/phpbb/trunk@6663 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php177
1 files changed, 173 insertions, 4 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index c741c7ddb6..ea736bf4c4 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-$updates_to_version = '3.0.B4-dev';
+$updates_to_version = '3.0.B4';
if (defined('IN_PHPBB') && defined('IN_INSTALL'))
{
@@ -58,6 +58,7 @@ require($phpbb_root_path . 'includes/functions.' . $phpEx);
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
+require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
$cache = new cache();
$db = new $sql_db();
@@ -476,6 +477,8 @@ switch ($current_version)
_sql($sql, $errored, $error_ary);
}
+ add_bots();
+
// No need to change here. Before this line, no break should appear
break;
@@ -501,13 +504,12 @@ $errored = $no_updates = false;
flush();
-
-/* update the version
+// update the version
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$updates_to_version'
WHERE config_name = 'version'";
_sql($sql, $errored, $error_ary);
-*/
+
/* Optimize/vacuum analyze the tables where appropriate
// this should be done for each version in future along with
@@ -987,4 +989,171 @@ function sql_column_change($dbms, $table_name, $column_name, $column_data)
}
}
+/**
+* Add search robots to the database
+*/
+function add_bots()
+{
+ global $db, $config, $phpbb_root_path, $phpEx;
+
+ $sql = 'SELECT *
+ FROM ' . CONFIG_TABLE;
+ $result = $db->sql_query($sql);
+
+ $config = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $config[$row['config_name']] = $row['config_value'];
+ }
+ $db->sql_freeresult($result);
+
+ // Obtain any submitted data
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = 'BOTS'";
+ $result = $db->sql_query($sql);
+ $group_id = (int) $db->sql_fetchfield('group_id');
+ $db->sql_freeresult($result);
+
+ if (!$group_id)
+ {
+ return;
+ }
+
+ // First of all, remove the old bots...
+ $sql = 'SELECT bot_id
+ FROM ' . BOTS_TABLE . "
+ WHERE bot_name IN ('Alexa', 'Fastcrawler', 'Googlebot', 'Inktomi')";
+ $result = $db->sql_query($sql);
+
+ $bot_ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $bot_ids[] = $row['bot_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($bot_ids))
+ {
+ // We need to delete the relevant user, usergroup and bot entries ...
+ $sql_id = ' IN (' . implode(', ', $bot_ids) . ')';
+
+ $sql = 'SELECT bot_name, user_id
+ FROM ' . BOTS_TABLE . "
+ WHERE bot_id $sql_id";
+ $result = $db->sql_query($sql);
+
+ $user_id_ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $user_id_ary[] = (int) $row['user_id'];
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'DELETE FROM ' . BOTS_TABLE . "
+ WHERE bot_id $sql_id";
+ $db->sql_query($sql);
+
+ $_tables = array(USERS_TABLE, USER_GROUP_TABLE);
+ foreach ($_tables as $table)
+ {
+ $sql = "DELETE FROM $table
+ WHERE " . $db->sql_in_set('user_id', $user_id_ary);
+ $db->sql_query($sql);
+ }
+ }
+
+ if (!function_exists('user_add'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
+
+ global $errored, $error_ary;
+
+ $bot_list = array(
+ 'AdsBot [Google]' => array('AdsBot-Google', ''),
+ 'Alexa [Bot]' => array('ia_archiver', ''),
+ 'Alta Vista [Bot]' => array('Scooter/', ''),
+ 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
+ 'Baidu [Spider]' => array('Baiduspider+(', ''),
+ 'Exabot [Bot]' => array('Exabot/', ''),
+ 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
+ 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
+ 'Francis [Bot]' => array('http://www.neomo.de/', ''),
+ 'Gigabot [Bot]' => array('Gigabot/', ''),
+ 'Google Adsense [Bot]' => array('Mediapartners-Google/', ''),
+ 'Google Desktop' => array('Google Desktop', ''),
+ 'Google Feedfetcher' => array('Feedfetcher-Google', ''),
+ 'Google [Bot]' => array('Googlebot', ''),
+ 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
+ 'Heritrix [Crawler]' => array('heritrix/1.', ''),
+ 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
+ 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
+ 'ichiro [Crawler]' => array('ichiro/2', ''),
+ 'Majestic-12 [Bot]' => array('MJ12bot/', ''),
+ 'Metager [Bot]' => array('MetagerBot/', ''),
+ 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
+ 'MSN [Bot]' => array('msnbot/', ''),
+ 'MSNbot Media' => array('msnbot-media/', ''),
+ 'NG-Search [Bot]' => array('NG-Search/', ''),
+ 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
+ 'Nutch/CVS [Bot]' => array('NutchCVS/', ''),
+ 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''),
+ 'Online link [Validator]' => array('online link validator', ''),
+ 'psbot [Picsearch]' => array('psbot/0', ''),
+ 'Seekport [Bot]' => array('Seekbot/', ''),
+ 'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
+ 'SEO Crawler' => array('SEO search Crawler/', ''),
+ 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
+ 'SEOSearch [Crawler]' => array('SEOsearch/', ''),
+ 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
+ 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
+ 'Synoo [Bot]' => array('SynooBot/', ''),
+ 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
+ 'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
+ 'Voyager [Bot]' => array('voyager/1.0', ''),
+ 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
+ 'W3C [Linkcheck]' => array('W3C-checklink/', ''),
+ 'W3C [Validator]' => array('W3C_*Validator', ''),
+ 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
+ 'Yacy [Bot]' => array('yacybot', ''),
+ 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
+ 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
+ 'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
+ 'YahooSeeker [Bot]' => array('YahooSeeker/', ''),
+ );
+
+ foreach ($bot_list as $bot_name => $bot_ary)
+ {
+ $user_row = array(
+ 'user_type' => USER_IGNORE,
+ 'group_id' => $group_id,
+ 'username' => $bot_name,
+ 'user_regdate' => time(),
+ 'user_password' => '',
+ 'user_colour' => '9E8DA7',
+ 'user_email' => '',
+ 'user_lang' => $config['default_lang'],
+ 'user_style' => 1,
+ 'user_timezone' => 0,
+ 'user_dateformat' => $config['default_dateformat'],
+ );
+
+ $user_id = user_add($user_row);
+
+ if ($user_id)
+ {
+ $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'bot_active' => 1,
+ 'bot_name' => $bot_name,
+ 'user_id' => $user_id,
+ 'bot_agent' => $bot_ary[0],
+ 'bot_ip' => $bot_ary[1],
+ ));
+
+ _sql($sql, $errored, $error_ary);
+ }
+ }
+}
+
?> \ No newline at end of file