Detect location of Maintenance.php in CLI script.

This commit is contained in:
Daniel Kraus
2014-06-04 13:57:23 +02:00
parent 6098342be3
commit e9d5218267

View File

@ -20,11 +20,31 @@
* MA 02110-1301, USA.
*/
// Include the maintenance base class from:
// Attempt to include the maintenance base class from:
// $wgScriptPath/maintenance/Maintenance.php
// Our script is normally located at:
// $wgScriptPath/extensions/LinkTitles/LinkTitles.cli.php
require_once( "/home/daniel/Documents/Kommunikation/Wiki/maintenance/Maintenance.php" );
$maintenanceScript = dirname( __FILE__ ) . "/../../maintenance/Maintenance.php";
if ( file_exists( $maintenanceScript ) ) {
require_once $maintenanceScript;
}
else
{
// Did not find the script where we expected it (maybe because we are a
// symlinked file -- __FILE__ resolves symbolic links).
$maintenanceScript = dirname( __FILE__ ) . "/Maintenance.php";
if ( file_exists( $maintenanceScript ) ) {
require_once $maintenanceScript;
}
else
{
die("FATAL: Could not locate Maintenance.php.\n" .
"You may want to create a symbolic link named Maintenance.php in this directory\n" .
"which points to <YOUR_MEDIAWIKI_ROOT_IN_FILESYSTEM>/extensions/Maintenance.php\n" .
"Ex.: ln -s /var/www/wiki/extensions/Maintenance.php\n\n");
}
};
require_once( dirname( __FILE__ ) . "/LinkTitles.body.php" );
class LinkTitlesCli extends Maintenance {