*/
$wgDebugComments = false;
+/**
+ * Print debug output to the terminal when running command line scripts.
+ */
+$wgDebugToCommandLine = false;
+
/**
* Write SQL queries to the debug log
*/
*/
$wgUploadMaintenance = false;
-/**
- * The location of the MediaWiki package repository to use.
- *
- * @since 1.17
- * @var string
- */
-$wgRepositoryApiLocation = 'http://www.mediawiki.org/w/api.php';
-
-/**
- * The location of the remote web interface for the selected repository.
- *
- * @since 1.17
- * @var string
- */
-$wgRepositoryLocation = 'http://www.mediawiki.org/wiki/Special:Repository';
-
-/**
- * List of package states to filter update detection and extension listing on.
- *
- * @since 1.17
- * @var array
- */
-$wgRepositoryPackageStates = array(
- //'dev',
- //'alpha',
- 'beta',
- //'rc',
- 'stable',
- //'deprecated',
-);
-
/**
* Allows running of selenium tests via maintenance/tests/RunSeleniumTests.php
*/
+++ /dev/null
-<?php
-
-/**
- * File holding the DistributionRepository class.
- *
- * @file DistributionRepository.php
- * @ingroup Deployment
- *
- * @author Jeroen De Dauw
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 'Not an entry point.' );
-}
-
-/**
- * Repository class for interaction with repositories provided by
- * the Distirbution extension and the MediaWiki API.
- *
- * @since 1.17
- *
- * @ingroup Deployment
- *
- * @author Jeroen De Dauw
- */
-class DistributionRepository extends PackageRepository {
-
- /**
- * Constructor.
- *
- * @param $location String: path to the api of the MediaWiki install providing the repository.
- *
- * @since 1.17
- */
- public function __construct( $location ) {
- parent::__construct( $location );
- }
-
- /**
- * @see PackageRepository::findExtenions
- *
- * @since 1.17
- *
- * @param $filterType String
- * @param $filterValue String
- *
- * @return array
- */
- public function findExtenions( $filterType, $filterValue ) {
- global $wgRepositoryPackageStates;
-
- $filterType = urlencode( $filterType );
- $filterValue = urlencode( $filterValue );
- $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-
- $response = Http::get(
- "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue&dststate=$states",
- 'default',
- array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
- );
-
- $extensions = array();
-
- if ( $response !== false ) {
- $response = FormatJson::decode( $response );
-
- if ( property_exists( $response, 'query' ) && property_exists( $response->query, 'extensions' ) ) {
- $extensions = $response->query->extensions;
- }
- }
-
- return $extensions;
- }
-
- /**
- * @see PackageRepository::extensionHasUpdate
- *
- * @since 1.17
- */
- public function extensionHasUpdate( $extensionName, $currentVersion ) {
- global $wgRepositoryPackageStates;
-
- $extensionName = urlencode( $extensionName );
- $currentVersion = urlencode( $currentVersion );
- $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-
- $response = Http::get(
- "$this->location?format=json&action=updates&extensions=$extensionName;$currentVersion&state=$states",
- 'default',
- array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
- );
-
- if ( $response === false ) {
- return false;
- }
-
- $response = FormatJson::decode( $response );
-
- if ( property_exists( $response, 'extensions' ) && property_exists( $response->extensions, $extensionName ) ) {
- return $response->extensions->$extensionName;
- }
-
- return false;
- }
-
- /**
- * @see PackageRepository::coreHasUpdate
- *
- * @since 1.17
- */
- public function coreHasUpdate( $currentVersion ) {
- global $wgRepositoryPackageStates;
-
- $currentVersion = urlencode( $currentVersion );
- $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-
- $response = Http::get(
- "$this->location?format=json&action=updates&mediawiki=$currentVersion&state=$states",
- 'default',
- array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
- );
-
- if ( $response === false ) {
- return false;
- }
-
- $response = FormatJson::decode( $response );
-
- if ( property_exists( $response, 'mediawiki' ) ) {
- return $response->mediawiki;
- }
-
- return false;
- }
-
- /**
- * @see PackageRepository::coreHasUpdate
- *
- * @since 1.17
- */
- public function getLatestCoreVersion() {
- // TODO: use $states
- //global $wgRepositoryPackageStates;
- //$states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-
- $response = Http::get(
- "$this->location?format=json&action=mwreleases",
- 'default',
- array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
- );
-
- if ( $response === false ) {
- return false;
- }
-
- $response = FormatJson::decode( $response );
-
- $current = false;
-
- if ( property_exists( $response, 'mwreleases' ) ) {
- foreach ( $response->mwreleases as $release ) {
- if ( property_exists( $release, 'current' ) && property_exists( $release, 'version') ) {
- $current = $release->version;
- }
- }
- }
-
- return $current;
- }
-
- /**
- * @see PackageRepository::installationHasUpdates
- *
- * @since 1.17
- */
- public function installationHasUpdates( $coreVersion, array $extensions ) {
- global $wgRepositoryPackageStates;
-
- $coreVersion = urlencode( $coreVersion );
- $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
-
- $extensionParams = array();
-
- if ( count( $extensions ) > 0 ) {
- foreach ( $extensions as $extensionName => $extensionVersion ) {
- $extensionParams[] = urlencode( $extensionName ) . ';' . urlencode( $extensionVersion );
- }
-
- $extensionParams = '&extensions=' . urlencode( implode( '|', $extensionParams ) );
- }
-
- $response = Http::get(
- "$this->location?format=json&action=updates&mediawiki=$coreVersion{$extensionParams}&state=$states",
- 'default',
- array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
- );
-
- if ( $response === false ) {
- return false;
- }
-
- $response = FormatJson::decode( $response );
-
- $updates = array();
-
- if ( property_exists( $response, 'mediawiki' ) ) {
- $updates['MediaWiki'] = $response->mediawiki;
- }
-
- if ( property_exists( $response, 'extensions' ) ) {
- foreach ( $extensions as $extensionName => $extensionVersion ) {
- if ( property_exists( $response->extensions, $extensionName ) ) {
- $updates[$extensionName] = $response->extensions->$extensionName;
- }
- }
- }
-
- return count( $updates ) > 0 ? $updates : false;
- }
-
-}
\ No newline at end of file
*/
function wfDebug( $text, $logonly = false ) {
global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
- global $wgDebugLogPrefix, $wgShowDebug;
+ global $wgDebugLogPrefix, $wgShowDebug, $wgCommandLineMode, $wgDebugToCommandLine;
static $recursion = 0;
static $cache = array(); // Cache of unoutputted messages
$text = wfDebugTimer() . $text;
+ if( $wgDebugToCommandLine && $wgCommandLineMode ) {
+ print $text;
+ return;
+ }
+
# Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
return;
}
return $ret;
}
-
-/**
- * Returns the PackageRepository object for interaction with the package repository.
- *
- * TODO: Make the repository type also configurable.
- *
- * @since 1.17
- *
- * @return PackageRepository
- */
-function wfGetRepository() {
- global $wgRepositoryApiLocation;
- static $repository = false;
-
- if ( $repository === false ) {
- $repository = new DistributionRepository( $wgRepositoryApiLocation );
- }
-
- return $repository;
-}
+++ /dev/null
-<?php
-
-/**
- * File holding the PackageRepository class.
- *
- * @file PackageRepository.php
- * @ingroup Deployment
- *
- * @author Jeroen De Dauw
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
- die( 'Not an entry point.' );
-}
-
-/**
- * Base repository class. Deriving classes handle interaction with
- * package repositories of the type they support.
- *
- * @since 1.17
- *
- * @ingroup Deployment
- *
- * @author Jeroen De Dauw
- */
-abstract class PackageRepository {
-
- /**
- * Base location of the repository.
- *
- * @since 1.17
- *
- * @var string
- */
- protected $location;
-
- /**
- * Returns a list of extensions matching the search criteria.
- *
- * @since 1.17
- *
- * @param $filterType String
- * @param $filterValue String
- *
- * @return array
- */
- public abstract function findExtenions( $filterType, $filterValue );
-
- /**
- * Checks if newer versions of an extension are available.
- *
- * @since 1.17
- *
- * @param $extensionName String
- * @param $currentVersion String
- *
- * @return Mixed: false when there is no update, object with info when there is.
- */
- public abstract function extensionHasUpdate( $extensionName, $currentVersion );
-
- /**
- * Checks if newer versions of MediaWiki is available.
- *
- * @since 1.17
- *
- * @param $currentVersion String
- *
- * @return Mixed: false when there is no update, object with info when there is.
- */
- public abstract function coreHasUpdate( $currentVersion );
-
- /**
- * Returns the latest MediaWiki release, or false when the request fails.
- *
- * @since 1.17
- *
- * @return Mixed: string or false
- */
- public abstract function getLatestCoreVersion();
-
- /**
- * Checks if there are any updates for this MediaWiki installation and extensions.
- *
- * @since 1.17
- *
- * @param $coreVersion String
- * @param $extensions Array
- *
- * @return Mixed: false when there is are updates, array with obecjts with info when there are.
- */
- public abstract function installationHasUpdates( $coreVersion, array $extensions );
-
- /**
- * Constructor.
- *
- * @param $location String
- *
- * @since 1.17
- */
- public function __construct( $location ) {
- $this->location = $location;
- }
-
- /**
- * Returns the repository location.
- *
- * @since 1.17
- *
- * @return string
- */
- public function getLocation() {
- return $this->location;
- }
-
-}
\ No newline at end of file
'config-env-bad' => 'The environment has been checked.
You cannot install MediaWiki.',
'config-env-php' => 'PHP $1 is installed.',
- 'config-env-latest-disabled' => 'External HTTP requests disabled, skipping version check',
- 'config-env-latest-ok' => 'You are installing the latest version of MediaWiki.',
- 'config-env-latest-new' => "'''Note:''' You are installing a development version of MediaWiki.",
- 'config-env-latest-can-not-check' => "'''Warning:''' The installer was unable to retrieve information about the latest MediaWiki release from [$1].",
- 'config-env-latest-old' => "'''Warning:''' You are installing an outdated version of MediaWiki.",
- 'config-env-latest-help' => 'You are installing version $1, but the latest version is $2.
-You are advised to use the latest release, which can be downloaded from [http://www.mediawiki.org/wiki/Download mediawiki.org]',
'config-unicode-using-utf8' => 'Using Brion Vibber\'s utf8_normalize.so for Unicode normalization.',
'config-unicode-using-intl' => 'Using the [http://pecl.php.net/intl intl PECL extension] for Unicode normalization.',
'config-unicode-pure-php-warning' => "'''Warning''': The [http://pecl.php.net/intl intl PECL extension] is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.
* @var array
*/
protected $envChecks = array(
- 'envCheckMediaWikiVersion',
'envCheckDB',
'envCheckRegisterGlobals',
'envCheckBrokenXML',
}
}
- /**
- * Check if we're installing the latest version.
- */
- protected function envCheckMediaWikiVersion() {
- global $wgVersion;
-
- if( !$this->getVar( '_ExternalHTTP' ) ) {
- $this->showMessage( 'config-env-latest-disabled' );
- return;
- }
-
- $repository = wfGetRepository();
- $currentVersion = $repository->getLatestCoreVersion();
-
- if ( $currentVersion === false ) {
- # For when the request is successful but there's e.g. some silly man in
- # the middle firewall blocking us, e.g. one of those annoying airport ones
- $this->showMessage( 'config-env-latest-can-not-check', $repository->getLocation() );
- return;
- }
-
- if( version_compare( $wgVersion, $currentVersion, '<' ) ) {
- $this->showMessage( 'config-env-latest-old' );
- // FIXME: this only works for the web installer!
- $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
- } elseif( version_compare( $wgVersion, $currentVersion, '>' ) ) {
- $this->showMessage( 'config-env-latest-new' );
- } else {
- $this->showMessage( 'config-env-latest-ok' );
- }
- }
-
/**
* Environment check for DB types.
*/