[ 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\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 85 parent::__construct(true); 86 } 87 88 /** 89 * {@inheritdoc} 90 */ 91 public function run() 92 { 93 // Make sure fulltext native load update is set 94 $this->config->set('fulltext_native_load_upd', 1); 95 96 $error = false; 97 $search = new fulltext_native( 98 $error, 99 $this->phpbb_root_path, 100 $this->php_ext, 101 $this->auth, 102 $this->config, 103 $this->db, 104 $this->user, 105 $this->phpbb_dispatcher 106 ); 107 108 $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id 109 FROM ' . POSTS_TABLE; 110 $result = $this->db->sql_query($sql); 111 112 while ($row = $this->db->sql_fetchrow($result)) 113 { 114 $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']); 115 } 116 $this->db->sql_freeresult($result); 117 } 118 119 /** 120 * {@inheritdoc} 121 */ 122 static public function get_step_count() 123 { 124 return 1; 125 } 126 127 /** 128 * {@inheritdoc} 129 */ 130 public function get_task_lang_name() 131 { 132 return 'TASK_CREATE_SEARCH_INDEX'; 133 } 134 }
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 |