r77883 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77882‎ | r77883 | r77884 >
Date:15:32, 6 December 2010
Author:demon
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/DistributionRepository.php (deleted) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/PackageRepository.php (deleted) (history)
  • /trunk/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DistributionRepository.php
@@ -1,221 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * File holding the DistributionRepository class.
6 - *
7 - * @file DistributionRepository.php
8 - * @ingroup Deployment
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Repository class for interaction with repositories provided by
19 - * the Distirbution extension and the MediaWiki API.
20 - *
21 - * @since 1.17
22 - *
23 - * @ingroup Deployment
24 - *
25 - * @author Jeroen De Dauw
26 - */
27 -class DistributionRepository extends PackageRepository {
28 -
29 - /**
30 - * Constructor.
31 - *
32 - * @param $location String: path to the api of the MediaWiki install providing the repository.
33 - *
34 - * @since 1.17
35 - */
36 - public function __construct( $location ) {
37 - parent::__construct( $location );
38 - }
39 -
40 - /**
41 - * @see PackageRepository::findExtenions
42 - *
43 - * @since 1.17
44 - *
45 - * @param $filterType String
46 - * @param $filterValue String
47 - *
48 - * @return array
49 - */
50 - public function findExtenions( $filterType, $filterValue ) {
51 - global $wgRepositoryPackageStates;
52 -
53 - $filterType = urlencode( $filterType );
54 - $filterValue = urlencode( $filterValue );
55 - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
56 -
57 - $response = Http::get(
58 - "$this->location?format=json&action=query&list=extensions&dstfilter=$filterType&dstvalue=$filterValue&dststate=$states",
59 - 'default',
60 - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
61 - );
62 -
63 - $extensions = array();
64 -
65 - if ( $response !== false ) {
66 - $response = FormatJson::decode( $response );
67 -
68 - if ( property_exists( $response, 'query' ) && property_exists( $response->query, 'extensions' ) ) {
69 - $extensions = $response->query->extensions;
70 - }
71 - }
72 -
73 - return $extensions;
74 - }
75 -
76 - /**
77 - * @see PackageRepository::extensionHasUpdate
78 - *
79 - * @since 1.17
80 - */
81 - public function extensionHasUpdate( $extensionName, $currentVersion ) {
82 - global $wgRepositoryPackageStates;
83 -
84 - $extensionName = urlencode( $extensionName );
85 - $currentVersion = urlencode( $currentVersion );
86 - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
87 -
88 - $response = Http::get(
89 - "$this->location?format=json&action=updates&extensions=$extensionName;$currentVersion&state=$states",
90 - 'default',
91 - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
92 - );
93 -
94 - if ( $response === false ) {
95 - return false;
96 - }
97 -
98 - $response = FormatJson::decode( $response );
99 -
100 - if ( property_exists( $response, 'extensions' ) && property_exists( $response->extensions, $extensionName ) ) {
101 - return $response->extensions->$extensionName;
102 - }
103 -
104 - return false;
105 - }
106 -
107 - /**
108 - * @see PackageRepository::coreHasUpdate
109 - *
110 - * @since 1.17
111 - */
112 - public function coreHasUpdate( $currentVersion ) {
113 - global $wgRepositoryPackageStates;
114 -
115 - $currentVersion = urlencode( $currentVersion );
116 - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
117 -
118 - $response = Http::get(
119 - "$this->location?format=json&action=updates&mediawiki=$currentVersion&state=$states",
120 - 'default',
121 - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
122 - );
123 -
124 - if ( $response === false ) {
125 - return false;
126 - }
127 -
128 - $response = FormatJson::decode( $response );
129 -
130 - if ( property_exists( $response, 'mediawiki' ) ) {
131 - return $response->mediawiki;
132 - }
133 -
134 - return false;
135 - }
136 -
137 - /**
138 - * @see PackageRepository::coreHasUpdate
139 - *
140 - * @since 1.17
141 - */
142 - public function getLatestCoreVersion() {
143 - // TODO: use $states
144 - //global $wgRepositoryPackageStates;
145 - //$states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
146 -
147 - $response = Http::get(
148 - "$this->location?format=json&action=mwreleases",
149 - 'default',
150 - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
151 - );
152 -
153 - if ( $response === false ) {
154 - return false;
155 - }
156 -
157 - $response = FormatJson::decode( $response );
158 -
159 - $current = false;
160 -
161 - if ( property_exists( $response, 'mwreleases' ) ) {
162 - foreach ( $response->mwreleases as $release ) {
163 - if ( property_exists( $release, 'current' ) && property_exists( $release, 'version') ) {
164 - $current = $release->version;
165 - }
166 - }
167 - }
168 -
169 - return $current;
170 - }
171 -
172 - /**
173 - * @see PackageRepository::installationHasUpdates
174 - *
175 - * @since 1.17
176 - */
177 - public function installationHasUpdates( $coreVersion, array $extensions ) {
178 - global $wgRepositoryPackageStates;
179 -
180 - $coreVersion = urlencode( $coreVersion );
181 - $states = urlencode( implode( '|', $wgRepositoryPackageStates ) );
182 -
183 - $extensionParams = array();
184 -
185 - if ( count( $extensions ) > 0 ) {
186 - foreach ( $extensions as $extensionName => $extensionVersion ) {
187 - $extensionParams[] = urlencode( $extensionName ) . ';' . urlencode( $extensionVersion );
188 - }
189 -
190 - $extensionParams = '&extensions=' . urlencode( implode( '|', $extensionParams ) );
191 - }
192 -
193 - $response = Http::get(
194 - "$this->location?format=json&action=updates&mediawiki=$coreVersion{$extensionParams}&state=$states",
195 - 'default',
196 - array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
197 - );
198 -
199 - if ( $response === false ) {
200 - return false;
201 - }
202 -
203 - $response = FormatJson::decode( $response );
204 -
205 - $updates = array();
206 -
207 - if ( property_exists( $response, 'mediawiki' ) ) {
208 - $updates['MediaWiki'] = $response->mediawiki;
209 - }
210 -
211 - if ( property_exists( $response, 'extensions' ) ) {
212 - foreach ( $extensions as $extensionName => $extensionVersion ) {
213 - if ( property_exists( $response->extensions, $extensionName ) ) {
214 - $updates[$extensionName] = $response->extensions->$extensionName;
215 - }
216 - }
217 - }
218 -
219 - return count( $updates ) > 0 ? $updates : false;
220 - }
221 -
222 -}
\ No newline at end of file
Index: trunk/phase3/includes/PackageRepository.php
@@ -1,115 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * File holding the PackageRepository class.
6 - *
7 - * @file PackageRepository.php
8 - * @ingroup Deployment
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Base repository class. Deriving classes handle interaction with
19 - * package repositories of the type they support.
20 - *
21 - * @since 1.17
22 - *
23 - * @ingroup Deployment
24 - *
25 - * @author Jeroen De Dauw
26 - */
27 -abstract class PackageRepository {
28 -
29 - /**
30 - * Base location of the repository.
31 - *
32 - * @since 1.17
33 - *
34 - * @var string
35 - */
36 - protected $location;
37 -
38 - /**
39 - * Returns a list of extensions matching the search criteria.
40 - *
41 - * @since 1.17
42 - *
43 - * @param $filterType String
44 - * @param $filterValue String
45 - *
46 - * @return array
47 - */
48 - public abstract function findExtenions( $filterType, $filterValue );
49 -
50 - /**
51 - * Checks if newer versions of an extension are available.
52 - *
53 - * @since 1.17
54 - *
55 - * @param $extensionName String
56 - * @param $currentVersion String
57 - *
58 - * @return Mixed: false when there is no update, object with info when there is.
59 - */
60 - public abstract function extensionHasUpdate( $extensionName, $currentVersion );
61 -
62 - /**
63 - * Checks if newer versions of MediaWiki is available.
64 - *
65 - * @since 1.17
66 - *
67 - * @param $currentVersion String
68 - *
69 - * @return Mixed: false when there is no update, object with info when there is.
70 - */
71 - public abstract function coreHasUpdate( $currentVersion );
72 -
73 - /**
74 - * Returns the latest MediaWiki release, or false when the request fails.
75 - *
76 - * @since 1.17
77 - *
78 - * @return Mixed: string or false
79 - */
80 - public abstract function getLatestCoreVersion();
81 -
82 - /**
83 - * Checks if there are any updates for this MediaWiki installation and extensions.
84 - *
85 - * @since 1.17
86 - *
87 - * @param $coreVersion String
88 - * @param $extensions Array
89 - *
90 - * @return Mixed: false when there is are updates, array with obecjts with info when there are.
91 - */
92 - public abstract function installationHasUpdates( $coreVersion, array $extensions );
93 -
94 - /**
95 - * Constructor.
96 - *
97 - * @param $location String
98 - *
99 - * @since 1.17
100 - */
101 - public function __construct( $location ) {
102 - $this->location = $location;
103 - }
104 -
105 - /**
106 - * Returns the repository location.
107 - *
108 - * @since 1.17
109 - *
110 - * @return string
111 - */
112 - public function getLocation() {
113 - return $this->location;
114 - }
115 -
116 -}
\ No newline at end of file
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -305,12 +305,17 @@
306306 */
307307 function wfDebug( $text, $logonly = false ) {
308308 global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
309 - global $wgDebugLogPrefix, $wgShowDebug;
 309+ global $wgDebugLogPrefix, $wgShowDebug, $wgCommandLineMode, $wgDebugToCommandLine;
310310 static $recursion = 0;
311311
312312 static $cache = array(); // Cache of unoutputted messages
313313 $text = wfDebugTimer() . $text;
314314
 315+ if( $wgDebugToCommandLine && $wgCommandLineMode ) {
 316+ print $text;
 317+ return;
 318+ }
 319+
315320 # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
316321 if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
317322 return;
@@ -3582,23 +3587,3 @@
35833588 }
35843589 return $ret;
35853590 }
3586 -
3587 -/**
3588 - * Returns the PackageRepository object for interaction with the package repository.
3589 - *
3590 - * TODO: Make the repository type also configurable.
3591 - *
3592 - * @since 1.17
3593 - *
3594 - * @return PackageRepository
3595 - */
3596 -function wfGetRepository() {
3597 - global $wgRepositoryApiLocation;
3598 - static $repository = false;
3599 -
3600 - if ( $repository === false ) {
3601 - $repository = new DistributionRepository( $wgRepositoryApiLocation );
3602 - }
3603 -
3604 - return $repository;
3605 -}
Index: trunk/phase3/includes/installer/Installer.php
@@ -82,7 +82,6 @@
8383 * @var array
8484 */
8585 protected $envChecks = array(
86 - 'envCheckMediaWikiVersion',
8786 'envCheckDB',
8887 'envCheckRegisterGlobals',
8988 'envCheckBrokenXML',
@@ -359,38 +358,6 @@
360359 }
361360
362361 /**
363 - * Check if we're installing the latest version.
364 - */
365 - protected function envCheckMediaWikiVersion() {
366 - global $wgVersion;
367 -
368 - if( !$this->getVar( '_ExternalHTTP' ) ) {
369 - $this->showMessage( 'config-env-latest-disabled' );
370 - return;
371 - }
372 -
373 - $repository = wfGetRepository();
374 - $currentVersion = $repository->getLatestCoreVersion();
375 -
376 - if ( $currentVersion === false ) {
377 - # For when the request is successful but there's e.g. some silly man in
378 - # the middle firewall blocking us, e.g. one of those annoying airport ones
379 - $this->showMessage( 'config-env-latest-can-not-check', $repository->getLocation() );
380 - return;
381 - }
382 -
383 - if( version_compare( $wgVersion, $currentVersion, '<' ) ) {
384 - $this->showMessage( 'config-env-latest-old' );
385 - // FIXME: this only works for the web installer!
386 - $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
387 - } elseif( version_compare( $wgVersion, $currentVersion, '>' ) ) {
388 - $this->showMessage( 'config-env-latest-new' );
389 - } else {
390 - $this->showMessage( 'config-env-latest-ok' );
391 - }
392 - }
393 -
394 - /**
395362 * Environment check for DB types.
396363 */
397364 protected function envCheckDB() {
Index: trunk/phase3/includes/installer/Installer.i18n.php
@@ -80,13 +80,6 @@
8181 'config-env-bad' => 'The environment has been checked.
8282 You cannot install MediaWiki.',
8383 'config-env-php' => 'PHP $1 is installed.',
84 - 'config-env-latest-disabled' => 'External HTTP requests disabled, skipping version check',
85 - 'config-env-latest-ok' => 'You are installing the latest version of MediaWiki.',
86 - 'config-env-latest-new' => "'''Note:''' You are installing a development version of MediaWiki.",
87 - 'config-env-latest-can-not-check' => "'''Warning:''' The installer was unable to retrieve information about the latest MediaWiki release from [$1].",
88 - 'config-env-latest-old' => "'''Warning:''' You are installing an outdated version of MediaWiki.",
89 - 'config-env-latest-help' => 'You are installing version $1, but the latest version is $2.
90 -You are advised to use the latest release, which can be downloaded from [http://www.mediawiki.org/wiki/Download mediawiki.org]',
9184 'config-unicode-using-utf8' => 'Using Brion Vibber\'s utf8_normalize.so for Unicode normalization.',
9285 'config-unicode-using-intl' => 'Using the [http://pecl.php.net/intl intl PECL extension] for Unicode normalization.',
9386 '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.
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3734,6 +3734,11 @@
37353735 $wgDebugComments = false;
37363736
37373737 /**
 3738+ * Print debug output to the terminal when running command line scripts.
 3739+ */
 3740+$wgDebugToCommandLine = false;
 3741+
 3742+/**
37383743 * Write SQL queries to the debug log
37393744 */
37403745 $wgDebugDumpSql = false;
@@ -5227,37 +5232,6 @@
52285233 $wgUploadMaintenance = false;
52295234
52305235 /**
5231 - * The location of the MediaWiki package repository to use.
5232 - *
5233 - * @since 1.17
5234 - * @var string
5235 - */
5236 -$wgRepositoryApiLocation = 'http://www.mediawiki.org/w/api.php';
5237 -
5238 -/**
5239 - * The location of the remote web interface for the selected repository.
5240 - *
5241 - * @since 1.17
5242 - * @var string
5243 - */
5244 -$wgRepositoryLocation = 'http://www.mediawiki.org/wiki/Special:Repository';
5245 -
5246 -/**
5247 - * List of package states to filter update detection and extension listing on.
5248 - *
5249 - * @since 1.17
5250 - * @var array
5251 - */
5252 -$wgRepositoryPackageStates = array(
5253 - //'dev',
5254 - //'alpha',
5255 - 'beta',
5256 - //'rc',
5257 - 'stable',
5258 - //'deprecated',
5259 -);
5260 -
5261 -/**
52625236 * Allows running of selenium tests via maintenance/tests/RunSeleniumTests.php
52635237 */
52645238 $wgEnableSelenium = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r77884Cleanup r77883, contained unrelated debugging changedemon15:34, 6 December 2010
r77949Followup r77883, rm the _ExternalHTTP stuff as well; cleans up IC msgs as welldemon02:07, 7 December 2010
r78119Follow up to r77883jeroendedauw09:31, 9 December 2010
r78120Follow up to r77883 - added stuff back to Deployment extensionjeroendedauw09:37, 9 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57624Have installer check for latest version and show info if not latestdemon19:39, 10 October 2009
r65863Note if we can't check the latest MediaWiki release from mediawiki.org...avar16:01, 3 May 2010
r71107Moved in repository interaction classes from Deployment so it's possible to u...jeroendedauw09:40, 15 August 2010
r71110Follow up to r71107 - added forgotten global function and corrected @since an...jeroendedauw09:49, 15 August 2010
r71111Follow up to r71107 - moved forgotten global variablesjeroendedauw10:02, 15 August 2010
r71115Modified the environment check of the core installer to check the current Med...jeroendedauw10:51, 15 August 2010
r71564Follow up to r71110, use of static var instead of global var, as suggested by...jeroendedauw14:58, 24 August 2010

Status & tagging log