| 1 | <?php |
| 2 | /** |
| 3 | * The web entry point for all %Action API queries, handled by ApiMain |
| 4 | * and ApiBase subclasses. |
| 5 | * |
| 6 | * @see ApiEntryPoint The corresponding entry point class |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 21 | * http://www.gnu.org/copyleft/gpl.html |
| 22 | * |
| 23 | * @file |
| 24 | * @ingroup entrypoint |
| 25 | * @ingroup API |
| 26 | */ |
| 27 | |
| 28 | use MediaWiki\Api\ApiEntryPoint; |
| 29 | use MediaWiki\Context\RequestContext; |
| 30 | use MediaWiki\EntryPointEnvironment; |
| 31 | use MediaWiki\MediaWikiServices; |
| 32 | |
| 33 | // So extensions (and other code) can check whether they're running in API mode |
| 34 | define( 'MW_API', true ); |
| 35 | define( 'MW_ENTRY_POINT', 'api' ); |
| 36 | |
| 37 | require __DIR__ . '/includes/WebStart.php'; |
| 38 | |
| 39 | // Construct entry point object and call doRun() to handle the request. |
| 40 | ( new ApiEntryPoint( |
| 41 | RequestContext::getMain(), |
| 42 | new EntryPointEnvironment(), |
| 43 | MediaWikiServices::getInstance() |
| 44 | ) )->run(); |