*/
abstract class Installer {
+ // This is the absolute minimum PHP version we can support
+ const MINIMUM_PHP_VERSION = '5.2.3';
+
/**
* @var array
*/
'url' => 'http://creativecommons.org/licenses/by-nc-sa/3.0/',
'icon' => '{$wgStylePath}/common/images/cc-by-nc-sa.png',
),
+ 'cc-0' => array(
+ 'url' => 'https://creativecommons.org/publicdomain/zero/1.0/',
+ 'icon' => '{$wgStylePath}/common/images/cc-0.png',
+ ),
'pd' => array(
'url' => 'http://creativecommons.org/licenses/publicdomain/',
'icon' => '{$wgStylePath}/common/images/public-domain.png',
* Constructor, always call this from child classes.
*/
public function __construct() {
- global $wgExtensionMessagesFiles, $wgUser, $wgHooks;
+ global $wgExtensionMessagesFiles, $wgUser;
// Disable the i18n cache and LoadBalancer
Language::getLocalisationCache()->disableBackend();
// Having a user with id = 0 safeguards us from DB access via User::loadOptions().
$wgUser = User::newFromId( 0 );
- // Set our custom <doclink> hook.
- $wgHooks['ParserFirstCallInit'][] = array( $this, 'registerDocLink' );
-
$this->settings = $this->internalDefaults;
foreach ( $this->defaultVarNames as $var ) {
* @return Status
*/
public function doEnvironmentChecks() {
- $this->showMessage( 'config-env-php', phpversion() );
-
- $good = true;
+ $phpVersion = phpversion();
+ if( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
+ $this->showMessage( 'config-env-php', $phpVersion );
+ $good = true;
+ } else {
+ $this->showMessage( 'config-env-php-toolow', $phpVersion, self::MINIMUM_PHP_VERSION );
+ $good = false;
+ }
- foreach ( $this->envChecks as $check ) {
- $status = $this->$check();
- if ( $status === false ) {
- $good = false;
+ if( $good ) {
+ foreach ( $this->envChecks as $check ) {
+ $status = $this->$check();
+ if ( $status === false ) {
+ $good = false;
+ }
}
}
* On POSIX systems return the primary group of the webserver we're running under.
* On other systems just returns null.
*
- * This is used to advice the user that he should chgrp his config/data/images directory as the
+ * This is used to advice the user that he should chgrp his mw-config/data/images directory as the
* webserver user before he can install.
*
* Public because SqliteInstaller needs it, and doesn't subclass Installer.
'ss_total_pages' => 0,
'ss_users' => 0,
'ss_admins' => 0,
- 'ss_images' => 0 ) );
+ 'ss_images' => 0 ),
+ __METHOD__, 'IGNORE' );
return Status::newGood();
}
$allNames = array();
foreach ( self::getDBTypes() as $name ) {
- $db = $this->getDBInstaller( $name );
- $readableName = wfMsg( 'config-type-' . $name );
-
- if ( $db->isCompiled() ) {
+ if ( $this->getDBInstaller( $name )->isCompiled() ) {
$compiledDBs[] = $name;
}
- $allNames[] = $readableName;
+ $allNames[] = wfMsg( 'config-type-' . $name );;
}
$this->setVar( '_CompiledDBs', $compiledDBs );
$test = new PhpRefCallBugTester;
$test->execute();
if ( !$test->ok ) {
- $this->showMessage( 'config-using531' );
+ $this->showMessage( 'config-using531', phpversion() );
return false;
}
}
return false;
}
wfSuppressWarnings();
- $regexd = preg_replace( '/[\x{0400}-\x{04FF}]/u', '', '-АБВГД-' );
+ $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
wfRestoreWarnings();
if ( $regexd != '--' ) {
$this->showMessage( 'config-pcre-no-utf8' );
$names = array( wfIsWindows() ? 'convert.exe' : 'convert' );
$convert = self::locateExecutableInDefaultPaths( $names, array( '$1 -version', 'ImageMagick' ) );
+ $this->setVar( 'wgImageMagickConvertCommand', '' );
if ( $convert ) {
$this->setVar( 'wgImageMagickConvertCommand', $convert );
$this->showMessage( 'config-imagemagick', $convert );
return false;
}
- $uri = preg_replace( '{^(.*)/config.*$}', '$1', $path );
+ $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
$this->setVar( 'wgScriptPath', $uri );
}
return false;
}
- /**
- * Register tag hook below.
- *
- * @todo Move this to WebInstaller with the two things below?
- *
- * @param $parser Parser
- */
- public function registerDocLink( Parser &$parser ) {
- $parser->setHook( 'doclink', array( $this, 'docLink' ) );
- return true;
- }
-
/**
* ParserOptions are constructed before we determined the language, so fix it
*/
$this->parserOptions->setUserLang( $lang->getCode() );
}
- /**
- * Extension tag hook for a documentation link.
- */
- public function docLink( $linkText, $attribs, $parser ) {
- $url = $this->getDocUrl( $attribs['href'] );
- return '<a href="' . htmlspecialchars( $url ) . '">' .
- htmlspecialchars( $linkText ) .
- '</a>';
- }
-
/**
* Overridden by WebInstaller to provide lastPage parameters.
*/
* but we're not opening that can of worms
* @see https://bugzilla.wikimedia.org/show_bug.cgi?id=26857
*/
+ global $wgAutoloadClasses;
require( "$IP/includes/DefaultSettings.php" );
foreach( $exts as $e ) {
- require( "$path/$e/$e.php" );
+ require_once( "$path/$e/$e.php" );
}
+ $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
+ $wgHooks['LoadExtensionSchemaUpdates'] : array();
+
+ // Unset everyone else's hooks. Lord knows what someone might be doing
+ // in ParserFirstCallInit (see bug 27171)
+ $GLOBALS['wgHooks'] = array( 'LoadExtensionSchemaUpdates' => $hooksWeWant );
+
return Status::newGood();
}
*
* @return Status
*/
- protected function generateSecretKey() {
+ public function generateSecretKey() {
return $this->generateSecret( 'wgSecretKey' );
}