Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
create_search_index.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\auth\auth;
017 use phpbb\db\driver\driver_interface;
018 use phpbb\event\dispatcher;
019 use phpbb\config\config;
020 use phpbb\install\helper\container_factory;
021 use phpbb\language\language;
022 use phpbb\search\fulltext_native;
023 use phpbb\user;
024
025 class create_search_index extends \phpbb\install\task_base
026 {
027 /**
028 * @var auth
029 */
030 protected $auth;
031
032 /**
033 * @var config
034 */
035 protected $config;
036
037 /**
038 * @var driver_interface
039 */
040 protected $db;
041
042 /**
043 * @var dispatcher
044 */
045 protected $phpbb_dispatcher;
046
047 /**
048 * @var language
049 */
050 protected $language;
051
052 /**
053 * @var user
054 */
055 protected $user;
056
057 /**
058 * @var string phpBB root path
059 */
060 protected $phpbb_root_path;
061
062 /**
063 * @var string PHP file extension
064 */
065 protected $php_ext;
066
067 /**
068 * Constructor
069 *
070 * @param config $config phpBB config
071 * @param container_factory $container Installer's DI container
072 * @param string $phpbb_root_path phpBB root path
073 * @param string $php_ext PHP file extension
074 */
075 public function __construct(config $config, container_factory $container,
076 $phpbb_root_path, $php_ext)
077 {
078 $this->auth = $container->get('auth');
079 $this->config = $config;
080 $this->db = $container->get('dbal.conn');
081 $this->language = $container->get('language');
082 $this->phpbb_dispatcher = $container->get('dispatcher');
083 $this->user = $container->get('user');
084 $this->phpbb_root_path = $phpbb_root_path;
085 $this->php_ext = $php_ext;
086
087 parent::__construct(true);
088 }
089
090 /**
091 * {@inheritdoc}
092 */
093 public function run()
094 {
095 // Make sure fulltext native load update is set
096 $this->config->set('fulltext_native_load_upd', 1);
097
098 $error = false;
099 $search = new fulltext_native(
100 $error,
101 $this->phpbb_root_path,
102 $this->php_ext,
103 $this->auth,
104 $this->config,
105 $this->db,
106 $this->user,
107 $this->phpbb_dispatcher
108 );
109
110 $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
111 FROM ' . POSTS_TABLE;
112 $result = $this->db->sql_query($sql);
113
114 while ($row = $this->db->sql_fetchrow($result))
115 {
116 $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
117 }
118 $this->db->sql_freeresult($result);
119 }
120
121 /**
122 * {@inheritdoc}
123 */
124 static public function get_step_count()
125 {
126 return 1;
127 }
128
129 /**
130 * {@inheritdoc}
131 */
132 public function get_task_lang_name()
133 {
134 return 'TASK_CREATE_SEARCH_INDEX';
135 }
136 }
137