From 0022d5ba4def810373fdfbf5a36b3c9b878de20b Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 6 Dec 2010 15:32:32 +0000 Subject: [PATCH] Remove "checking for latest version" feature from the new installer. Originally a proof-of-concept, and I'm not satisfied with its state of completion enough to include it for 1.17. Reverts r71107, r71110, r71111, r71115, r71564, r65863, r57624, probably some others. --- includes/DefaultSettings.php | 36 +---- includes/DistributionRepository.php | 221 -------------------------- includes/GlobalFunctions.php | 27 +--- includes/PackageRepository.php | 115 -------------- includes/installer/Installer.i18n.php | 7 - includes/installer/Installer.php | 33 ---- 6 files changed, 11 insertions(+), 428 deletions(-) delete mode 100644 includes/DistributionRepository.php delete mode 100644 includes/PackageRepository.php diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7d3588e667..7dd3b6911d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3733,6 +3733,11 @@ $wgDebugRawPage = false; */ $wgDebugComments = false; +/** + * Print debug output to the terminal when running command line scripts. + */ +$wgDebugToCommandLine = false; + /** * Write SQL queries to the debug log */ @@ -5226,37 +5231,6 @@ $wgPoolCounterConf = null; */ $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 */ diff --git a/includes/DistributionRepository.php b/includes/DistributionRepository.php deleted file mode 100644 index 8aabb51165..0000000000 --- a/includes/DistributionRepository.php +++ /dev/null @@ -1,221 +0,0 @@ -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 diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8319c369f2..385d7b0c84 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -305,12 +305,17 @@ function wfUrlencode( $s ) { */ 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; @@ -3582,23 +3587,3 @@ function wfArrayMap( $function, $input ) { } 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; -} diff --git a/includes/PackageRepository.php b/includes/PackageRepository.php deleted file mode 100644 index a92c10649b..0000000000 --- a/includes/PackageRepository.php +++ /dev/null @@ -1,115 +0,0 @@ -location = $location; - } - - /** - * Returns the repository location. - * - * @since 1.17 - * - * @return string - */ - public function getLocation() { - return $this->location; - } - -} \ No newline at end of file diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index d9f76fe368..2fc6a2cd13 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -80,13 +80,6 @@ You can install MediaWiki.', // FIXME: take span out of message. '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. diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index c21a77e3eb..80e8974890 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -82,7 +82,6 @@ abstract class Installer { * @var array */ protected $envChecks = array( - 'envCheckMediaWikiVersion', 'envCheckDB', 'envCheckRegisterGlobals', 'envCheckBrokenXML', @@ -358,38 +357,6 @@ abstract class Installer { } } - /** - * 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. */ -- 2.20.1