Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
SuggestIndex | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
execute | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
isInternal | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace CirrusSearch\Api; |
4 | |
5 | use MediaWiki\Api\ApiBase; |
6 | use MediaWiki\WikiMap\WikiMap; |
7 | |
8 | /** |
9 | * Update ElasticSearch suggestion index |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or |
14 | * (at your option) any later version. |
15 | * |
16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License along |
22 | * with this program; if not, write to the Free Software Foundation, Inc., |
23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 | * http://www.gnu.org/copyleft/gpl.html |
25 | */ |
26 | class SuggestIndex extends ApiBase { |
27 | use ApiTrait; |
28 | |
29 | public function execute() { |
30 | // FIXME: This is horrible, no good, very bad hack. Only for testing, |
31 | // and probably should be eventually replaced with something more sane. |
32 | $updaterScript = "extensions/CirrusSearch/maintenance/UpdateSuggesterIndex.php"; |
33 | // detects between mediawiki-vagrant and mediawiki-docker-dev (mwcli/mwdd) |
34 | $php = '/usr/local/bin/mwscript'; |
35 | if ( !file_exists( $php ) ) { |
36 | $php = '/usr/bin/php'; |
37 | } |
38 | $this->getResult()->addValue( null, 'result', |
39 | wfShellExecWithStderr( "unset REQUEST_METHOD; $php $updaterScript --wiki " . WikiMap::getCurrentWikiId() ) |
40 | ); |
41 | } |
42 | |
43 | /** |
44 | * Mark as internal. This isn't meant to be used by normal api users |
45 | * @return bool |
46 | */ |
47 | public function isInternal() { |
48 | return true; |
49 | } |
50 | } |