1 | <?php |
||
20 | class tool implements tool_interface |
||
21 | { |
||
22 | /** @var \phpbb\cache\driver\driver_interface */ |
||
23 | protected $cache; |
||
24 | |||
25 | /** @var \phpbb\config\config */ |
||
26 | protected $config; |
||
27 | |||
28 | /** @var \phpbb\db\driver\driver_interface */ |
||
29 | protected $db; |
||
30 | |||
31 | /** @var log */ |
||
32 | protected $log; |
||
33 | |||
34 | /** @var \phpbb\user */ |
||
35 | protected $user; |
||
36 | |||
37 | /** |
||
38 | * tool constructor |
||
39 | * |
||
40 | * @param \phpbb\cache\driver\driver_interface $cache |
||
41 | * @param \phpbb\config\config $config |
||
42 | * @param \phpbb\db\driver\driver_interface $db |
||
43 | * @param \phpbb\log\log_interface $log |
||
44 | * @param \phpbb\user $user |
||
45 | */ |
||
46 | public function __construct(cache $cache, config $config, db $db, log $log, user $user) |
||
54 | |||
55 | /** |
||
56 | * Perform table SQL query and return any messages |
||
57 | * |
||
58 | * @param string $operation OPTIMIZE, REPAIR, or CHECK |
||
59 | * @param array $tables Array of all tables to be processed |
||
60 | * @param int $disable_board The users option to disable the board during run time |
||
61 | * @return array Any errors or status information, otherwise the array of tables processed |
||
62 | * @access public |
||
63 | */ |
||
64 | public function run($operation, $tables, $disable_board = 0) |
||
92 | |||
93 | /** |
||
94 | * Set disable board config state |
||
95 | * |
||
96 | * @param int $disable The users option to disable the board during run time |
||
97 | * @param int $disabled The current disabled state |
||
98 | * @return int The original disabled state of the board |
||
99 | * @access public |
||
100 | */ |
||
101 | public function disable_board($disable, $disabled) |
||
110 | |||
111 | /** |
||
112 | * Is the database using MySQL |
||
113 | * |
||
114 | * @return bool True if MySQL, false otherwise |
||
115 | * @access public |
||
116 | */ |
||
117 | public function is_mysql() |
||
121 | |||
122 | /** |
||
123 | * Is requested operation to optimize, repair or check tables |
||
124 | * |
||
125 | * @param string $operation The name of the operation |
||
126 | * @return bool True if valid operation, false otherwise |
||
127 | * @access public |
||
128 | */ |
||
129 | public function is_valid_operation($operation) |
||
133 | |||
134 | /** |
||
135 | * Only allow tables using MyISAM, InnoDB or Archive storage engines |
||
136 | * |
||
137 | * @param string $engine The name of the engine |
||
138 | * @return bool True if valid engine, false otherwise |
||
139 | * @access public |
||
140 | */ |
||
141 | public function is_valid_engine($engine) |
||
145 | |||
146 | /** |
||
147 | * Is the storage engine InnoDB |
||
148 | * |
||
149 | * @param string $engine The name of the engine |
||
150 | * @return bool True if InnoDB engine, false otherwise |
||
151 | * @access public |
||
152 | */ |
||
153 | public function is_innodb($engine) |
||
157 | |||
158 | /** |
||
159 | * Extend execution limits to mitigate timeouts |
||
160 | * |
||
161 | * @access protected |
||
162 | */ |
||
163 | protected function extend_execution_limits() |
||
168 | } |
||
169 |