[ Index ] |
PHP Cross Reference of phpBB-3.3.14-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\auth\auth; 17 use phpbb\db\driver\driver_interface; 18 use phpbb\event\dispatcher; 19 use phpbb\config\config; 20 use phpbb\install\helper\container_factory; 21 use phpbb\language\language; 22 use phpbb\search\fulltext_native; 23 use phpbb\user; 24 25 class create_search_index extends \phpbb\install\task_base 26 { 27 /** 28 * @var auth 29 */ 30 protected $auth; 31 32 /** 33 * @var config 34 */ 35 protected $config; 36 37 /** 38 * @var driver_interface 39 */ 40 protected $db; 41 42 /** 43 * @var dispatcher 44 */ 45 protected $phpbb_dispatcher; 46 47 /** 48 * @var language 49 */ 50 protected $language; 51 52 /** 53 * @var user 54 */ 55 protected $user; 56 57 /** 58 * @var string phpBB root path 59 */ 60 protected $phpbb_root_path; 61 62 /** 63 * @var string PHP file extension 64 */ 65 protected $php_ext; 66 67 /** 68 * Constructor 69 * 70 * @param config $config phpBB config 71 * @param container_factory $container Installer's DI container 72 * @param string $phpbb_root_path phpBB root path 73 * @param string $php_ext PHP file extension 74 */ 75 public function __construct(config $config, container_factory $container, 76 $phpbb_root_path, $php_ext) 77 { 78 $this->auth = $container->get('auth'); 79 $this->config = $config; 80 $this->db = $container->get('dbal.conn'); 81 $this->language = $container->get('language'); 82 $this->phpbb_dispatcher = $container->get('dispatcher'); 83 $this->user = $container->get('user'); 84 $this->phpbb_root_path = $phpbb_root_path; 85 $this->php_ext = $php_ext; 86 87 parent::__construct(true); 88 } 89 90 /** 91 * {@inheritdoc} 92 */ 93 public function run() 94 { 95 // Make sure fulltext native load update is set 96 $this->config->set('fulltext_native_load_upd', 1); 97 98 $error = false; 99 $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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |