generateLocalAutoload.php: Abort for web requests
authorKevin Israel <pleasestand@live.com>
Fri, 14 Nov 2014 22:27:16 +0000 (17:27 -0500)
committerKevin Israel <pleasestand@live.com>
Fri, 14 Nov 2014 23:16:24 +0000 (18:16 -0500)
The Maintenance class already does this, though this script does not use it
for the obvious reason that when there is a missing or incorrect autoloader
entry, it may not be possible to initialize MediaWiki.

Hence it is necessary to do that explicitly in this script. Overwriting
autoload.php potentially could disrupt the operation of a production wiki
(the file is truncated when it is opened).

Change-Id: I05d5d4b7c30c4643e71ca5819783627688e15da7

maintenance/generateLocalAutoload.php

index 78e66b7..5e4cac6 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 
+if ( PHP_SAPI != 'cli' ) {
+       die( "This script can only be run from the command line.\n" );
+}
+
 require_once __DIR__ . '/../includes/utils/AutoloadGenerator.php';
 
 // Mediawiki installation directory