forked from wikimedia/mediawiki-extensions-PageForms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
41 lines (33 loc) · 1.1 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
if ( PHP_SAPI !== 'cli' ) {
die( 'Not an entry point' );
}
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'MediaWiki is not available for the test environment' );
}
function registerAutoloaderPath( $identifier, $path ) {
print "\nUsing the {$identifier} vendor autoloader ...\n\n";
return require $path;
}
function runTestAutoLoader() {
$mwVendorPath = __DIR__ . '/../../../vendor/autoload.php';
$localVendorPath = __DIR__ . '/../vendor/autoload.php';
if ( is_readable( $localVendorPath ) ) {
$autoLoader = registerAutoloaderPath( 'local', $localVendorPath );
} elseif ( is_readable( $mwVendorPath ) ) {
$autoLoader = registerAutoloaderPath( 'MediaWiki', $mwVendorPath );
} else {
print "\No vendor autoloader ...\n\n";
}
if ( !$autoLoader instanceof \Composer\Autoload\ClassLoader ) {
// For now return true as long as PF is not compatible with Composer
// of course if it is installed via
// https://packagist.org/packages/mediawiki/page-forms
// we have no problems
return true;
}
return true;
}
if ( !runTestAutoLoader() ) {
die( 'The required test autoloader was not accessible' );
}