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 | * @license GPL-2.0-or-later |
| 12 | */ |
| 13 | class SuggestIndex extends ApiBase { |
| 14 | use ApiTrait; |
| 15 | |
| 16 | public function execute() { |
| 17 | // FIXME: This is horrible, no good, very bad hack. Only for testing, |
| 18 | // and probably should be eventually replaced with something more sane. |
| 19 | $updaterScript = "extensions/CirrusSearch/maintenance/UpdateSuggesterIndex.php"; |
| 20 | // detects between mediawiki-vagrant and mediawiki-docker-dev (mwcli/mwdd) |
| 21 | $php = '/usr/local/bin/mwscript'; |
| 22 | if ( !file_exists( $php ) ) { |
| 23 | $php = '/usr/bin/php'; |
| 24 | } |
| 25 | $this->getResult()->addValue( null, 'result', |
| 26 | wfShellExecWithStderr( "unset REQUEST_METHOD; $php $updaterScript --wiki " . WikiMap::getCurrentWikiId() ) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Mark as internal. This isn't meant to be used by normal api users |
| 32 | * @return bool |
| 33 | */ |
| 34 | public function isInternal() { |
| 35 | return true; |
| 36 | } |
| 37 | } |