| 1 | <?php |
| 2 | /** |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 | * http://www.gnu.org/copyleft/gpl.html |
| 17 | * |
| 18 | * @file |
| 19 | */ |
| 20 | |
| 21 | namespace MediaWiki\ResourceLoader; |
| 22 | |
| 23 | use MediaWiki\MediaWikiEntryPoint; |
| 24 | use Profiler; |
| 25 | |
| 26 | /** |
| 27 | * Entry point implementation for @ref ResourceLoader, which serves static CSS/JavaScript |
| 28 | * via @ref MediaWiki\ResourceLoader\Module Module subclasses. |
| 29 | * |
| 30 | * @see load.php |
| 31 | * @ingroup ResourceLoader |
| 32 | * @ingroup entrypoint |
| 33 | */ |
| 34 | class ResourceLoaderEntryPoint extends MediaWikiEntryPoint { |
| 35 | |
| 36 | /** |
| 37 | * Main entry point |
| 38 | */ |
| 39 | public function execute() { |
| 40 | $services = $this->getServiceContainer(); |
| 41 | |
| 42 | // Disable ChronologyProtector so that we don't wait for unrelated MediaWiki |
| 43 | // writes when getting database connections for ResourceLoader. (T192611) |
| 44 | $services->getChronologyProtector()->setEnabled( false ); |
| 45 | |
| 46 | $resourceLoader = $services->getResourceLoader(); |
| 47 | $context = new Context( |
| 48 | $resourceLoader, |
| 49 | $this->getRequest(), |
| 50 | array_keys( $services->getSkinFactory()->getInstalledSkins() ) |
| 51 | ); |
| 52 | |
| 53 | // Respond to ResourceLoader request |
| 54 | $resourceLoader->respond( $context ); |
| 55 | |
| 56 | // Append any visible profiling data in a manner appropriate for the Content-Type |
| 57 | $profiler = Profiler::instance(); |
| 58 | $profiler->setAllowOutput(); |
| 59 | $profiler->logDataPageOutputOnly(); |
| 60 | } |
| 61 | |
| 62 | protected function doPrepareForOutput() { |
| 63 | // No-op. |
| 64 | // Do not call parent::doPrepareForOutput() to avoid |
| 65 | // commitMainTransaction() getting called. |
| 66 | } |
| 67 | } |