[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\install\module\install_data\task; 15 16 use phpbb\install\exception\resource_limit_reached_exception; 17 18 class add_bots extends \phpbb\install\task_base 19 { 20 /** 21 * A list of the web-crawlers/bots we recognise by default 22 * 23 * Candidates but not included: 24 * 'Accoona [Bot]' 'Accoona-AI-Agent/' 25 * 'ASPseek [Crawler]' 'ASPseek/' 26 * 'Boitho [Crawler]' 'boitho.com-dc/' 27 * 'Bunnybot [Bot]' 'powered by www.buncat.de' 28 * 'Cosmix [Bot]' 'cfetch/' 29 * 'Crawler Search [Crawler]' '.Crawler-Search.de' 30 * 'Findexa [Crawler]' 'Findexa Crawler (' 31 * 'GBSpider [Spider]' 'GBSpider v' 32 * 'genie [Bot]' 'genieBot (' 33 * 'Hogsearch [Bot]' 'oegp v. 1.3.0' 34 * 'Insuranco [Bot]' 'InsurancoBot' 35 * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler' 36 * 'ISC Systems [Bot]' 'ISC Systems iRc Search' 37 * 'Jyxobot [Bot]' 'Jyxobot/' 38 * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/' 39 * 'LinkWalker' 'LinkWalker' 40 * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html' 41 * 'Naver [Bot]' 'nhnbot@naver.com)' 42 * 'NetResearchServer' 'NetResearchServer/' 43 * 'Nimble [Crawler]' 'NimbleCrawler' 44 * 'Ocelli [Bot]' 'Ocelli/' 45 * 'Onsearch [Bot]' 'onCHECK-Robot' 46 * 'Orange [Spider]' 'OrangeSpider' 47 * 'Sproose [Bot]' 'http://www.sproose.com/bot' 48 * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)' 49 * 'Tbot [Bot]' 'Tbot/' 50 * 'Thumbshots [Capture]' 'thumbshots-de-Bot' 51 * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/' 52 * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)' 53 * 'WissenOnline [Bot]' 'WissenOnline-Bot' 54 * 'WWWeasel [Bot]' 'WWWeasel Robot v' 55 * 'Xaldon [Spider]' 'Xaldon WebSpider' 56 * 57 * @var array 58 */ 59 protected $bot_list = array( 60 'AdsBot [Google]' => array('AdsBot-Google', ''), 61 'Alexa [Bot]' => array('ia_archiver', ''), 62 'Alta Vista [Bot]' => array('Scooter/', ''), 63 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), 64 'Baidu [Spider]' => array('Baiduspider', ''), 65 'Bing [Bot]' => array('bingbot/', ''), 66 'Exabot [Bot]' => array('Exabot', ''), 67 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), 68 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), 69 'Francis [Bot]' => array('http://www.neomo.de/', ''), 70 'Gigabot [Bot]' => array('Gigabot/', ''), 71 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), 72 'Google Desktop' => array('Google Desktop', ''), 73 'Google Feedfetcher' => array('Feedfetcher-Google', ''), 74 'Google [Bot]' => array('Googlebot', ''), 75 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), 76 'Heritrix [Crawler]' => array('heritrix/1.', ''), 77 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), 78 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), 79 'ichiro [Crawler]' => array('ichiro/', ''), 80 'Majestic-12 [Bot]' => array('MJ12bot/', ''), 81 'Metager [Bot]' => array('MetagerBot/', ''), 82 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), 83 'MSN [Bot]' => array('msnbot/', ''), 84 'MSNbot Media' => array('msnbot-media/', ''), 85 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), 86 'Online link [Validator]' => array('online link validator', ''), 87 'psbot [Picsearch]' => array('psbot/0', ''), 88 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), 89 'SEO Crawler' => array('SEO search Crawler/', ''), 90 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), 91 'SEOSearch [Crawler]' => array('SEOsearch/', ''), 92 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), 93 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), 94 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), 95 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), 96 'Voyager [Bot]' => array('voyager/', ''), 97 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), 98 'W3C [Linkcheck]' => array('W3C-checklink/', ''), 99 'W3C [Validator]' => array('W3C_Validator', ''), 100 'YaCy [Bot]' => array('yacybot', ''), 101 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), 102 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), 103 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), 104 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), 105 ); 106 107 /** 108 * @var \phpbb\db\driver\driver_interface 109 */ 110 protected $db; 111 112 /** 113 * @var \phpbb\install\helper\config 114 */ 115 protected $install_config; 116 117 /** 118 * @var \phpbb\install\helper\iohandler\iohandler_interface 119 */ 120 protected $io_handler; 121 122 /** 123 * @var \phpbb\language\language 124 */ 125 protected $language; 126 127 /** 128 * @var string 129 */ 130 protected $phpbb_root_path; 131 132 /** 133 * @var string 134 */ 135 protected $php_ext; 136 137 /** 138 * Constructor 139 * 140 * @param \phpbb\install\helper\config $install_config Installer's config 141 * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer 142 * @param \phpbb\install\helper\container_factory $container Installer's DI container 143 * @param \phpbb\language\language $language Language provider 144 * @param string $phpbb_root_path Relative path to phpBB root 145 * @param string $php_ext PHP extension 146 */ 147 public function __construct(\phpbb\install\helper\config $install_config, 148 \phpbb\install\helper\iohandler\iohandler_interface $iohandler, 149 \phpbb\install\helper\container_factory $container, 150 \phpbb\language\language $language, 151 $phpbb_root_path, 152 $php_ext) 153 { 154 parent::__construct(true); 155 156 $this->db = $container->get('dbal.conn'); 157 $this->install_config = $install_config; 158 $this->io_handler = $iohandler; 159 $this->language = $language; 160 $this->phpbb_root_path = $phpbb_root_path; 161 $this->php_ext = $php_ext; 162 } 163 164 /** 165 * {@inheritdoc} 166 */ 167 public function run() 168 { 169 $this->db->sql_return_on_error(true); 170 171 $sql = 'SELECT group_id 172 FROM ' . GROUPS_TABLE . " 173 WHERE group_name = 'BOTS'"; 174 $result = $this->db->sql_query($sql); 175 $group_id = (int) $this->db->sql_fetchfield('group_id'); 176 $this->db->sql_freeresult($result); 177 178 if (!$group_id) 179 { 180 // If we reach this point then something has gone very wrong 181 $this->io_handler->add_error_message('NO_GROUP'); 182 } 183 184 $i = $this->install_config->get('add_bot_index', 0); 185 $bot_list = array_slice($this->bot_list, $i); 186 187 foreach ($bot_list as $bot_name => $bot_ary) 188 { 189 $user_row = array( 190 'user_type' => USER_IGNORE, 191 'group_id' => $group_id, 192 'username' => $bot_name, 193 'user_regdate' => time(), 194 'user_password' => '', 195 'user_colour' => '9E8DA7', 196 'user_email' => '', 197 'user_lang' => $this->install_config->get('default_lang'), 198 'user_style' => 1, 199 'user_timezone' => 'UTC', 200 'user_dateformat' => $this->language->lang('default_dateformat'), 201 'user_allow_massemail' => 0, 202 'user_allow_pm' => 0, 203 ); 204 205 if (!function_exists('user_add')) 206 { 207 include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); 208 } 209 210 $user_id = user_add($user_row); 211 212 if (!$user_id) 213 { 214 // If we can't insert this user then continue to the next one to avoid inconsistent data 215 $this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT'); 216 217 $i++; 218 continue; 219 } 220 221 $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array( 222 'bot_active' => 1, 223 'bot_name' => (string) $bot_name, 224 'user_id' => (int) $user_id, 225 'bot_agent' => (string) $bot_ary[0], 226 'bot_ip' => (string) $bot_ary[1], 227 )); 228 229 $this->db->sql_query($sql); 230 231 $i++; 232 233 // Stop execution if resource limit is reached 234 if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) 235 { 236 break; 237 } 238 } 239 240 $this->install_config->set('add_bot_index', $i); 241 242 if ($i < count($this->bot_list)) 243 { 244 throw new resource_limit_reached_exception(); 245 } 246 } 247 248 /** 249 * {@inheritdoc} 250 */ 251 static public function get_step_count() 252 { 253 return 1; 254 } 255 256 /** 257 * {@inheritdoc} 258 */ 259 public function get_task_lang_name() 260 { 261 return 'TASK_ADD_BOTS'; 262 } 263 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |