Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
add_bots.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\install\module\install_data\task;
015
016 use phpbb\install\exception\resource_limit_reached_exception;
017
018 class add_bots extends \phpbb\install\task_base
019 {
020 /**
021 * A list of the web-crawlers/bots we recognise by default
022 *
023 * Candidates but not included:
024 * 'Accoona [Bot]' 'Accoona-AI-Agent/'
025 * 'ASPseek [Crawler]' 'ASPseek/'
026 * 'Boitho [Crawler]' 'boitho.com-dc/'
027 * 'Bunnybot [Bot]' 'powered by www.buncat.de'
028 * 'Cosmix [Bot]' 'cfetch/'
029 * 'Crawler Search [Crawler]' '.Crawler-Search.de'
030 * 'Findexa [Crawler]' 'Findexa Crawler ('
031 * 'GBSpider [Spider]' 'GBSpider v'
032 * 'genie [Bot]' 'genieBot ('
033 * 'Hogsearch [Bot]' 'oegp v. 1.3.0'
034 * 'Insuranco [Bot]' 'InsurancoBot'
035 * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler'
036 * 'ISC Systems [Bot]' 'ISC Systems iRc Search'
037 * 'Jyxobot [Bot]' 'Jyxobot/'
038 * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/'
039 * 'LinkWalker' 'LinkWalker'
040 * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html'
041 * 'Naver [Bot]' 'nhnbot@naver.com)'
042 * 'NetResearchServer' 'NetResearchServer/'
043 * 'Nimble [Crawler]' 'NimbleCrawler'
044 * 'Ocelli [Bot]' 'Ocelli/'
045 * 'Onsearch [Bot]' 'onCHECK-Robot'
046 * 'Orange [Spider]' 'OrangeSpider'
047 * 'Sproose [Bot]' 'http://www.sproose.com/bot'
048 * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)'
049 * 'Tbot [Bot]' 'Tbot/'
050 * 'Thumbshots [Capture]' 'thumbshots-de-Bot'
051 * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/'
052 * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)'
053 * 'WissenOnline [Bot]' 'WissenOnline-Bot'
054 * 'WWWeasel [Bot]' 'WWWeasel Robot v'
055 * 'Xaldon [Spider]' 'Xaldon WebSpider'
056 *
057 * @var array
058 */
059 protected $bot_list = array(
060 'AdsBot [Google]' => array('AdsBot-Google', ''),
061 'Alexa [Bot]' => array('ia_archiver', ''),
062 'Alta Vista [Bot]' => array('Scooter/', ''),
063 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
064 'Baidu [Spider]' => array('Baiduspider', ''),
065 'Bing [Bot]' => array('bingbot/', ''),
066 'Exabot [Bot]' => array('Exabot', ''),
067 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
068 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
069 'Francis [Bot]' => array('http://www.neomo.de/', ''),
070 'Gigabot [Bot]' => array('Gigabot/', ''),
071 'Google Adsense [Bot]' => array('Mediapartners-Google', ''),
072 'Google Desktop' => array('Google Desktop', ''),
073 'Google Feedfetcher' => array('Feedfetcher-Google', ''),
074 'Google [Bot]' => array('Googlebot', ''),
075 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
076 'Heritrix [Crawler]' => array('heritrix/1.', ''),
077 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
078 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
079 'ichiro [Crawler]' => array('ichiro/', ''),
080 'Majestic-12 [Bot]' => array('MJ12bot/', ''),
081 'Metager [Bot]' => array('MetagerBot/', ''),
082 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
083 'MSN [Bot]' => array('msnbot/', ''),
084 'MSNbot Media' => array('msnbot-media/', ''),
085 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
086 'Online link [Validator]' => array('online link validator', ''),
087 'psbot [Picsearch]' => array('psbot/0', ''),
088 'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
089 'SEO Crawler' => array('SEO search Crawler/', ''),
090 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
091 'SEOSearch [Crawler]' => array('SEOsearch/', ''),
092 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
093 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
094 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
095 'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
096 'Voyager [Bot]' => array('voyager/', ''),
097 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
098 'W3C [Linkcheck]' => array('W3C-checklink/', ''),
099 '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 < sizeof($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 }
264