r23471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23470‎ | r23471 | r23472 >
Date:10:19, 27 June 2007
Author:raymond
Status:old
Tags:
Comment:
* (bug 10365) Localization of Special:Version
Let English licence information hard coded to avoid any possibility to suppress this important text
Sort extension functions, parser extension tags and parser extension tags alphabetically
Use table for software information too.

WTF needs/uses the hook 'SpecialVersionExtensionTypes'? Not documented anywhere in trunk.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialVersion.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/skins/monobook/handheld.css (modified) (history)
  • /trunk/phase3/skins/monobook/main.css (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialVersion.php
@@ -26,14 +26,13 @@
2727 function execute() {
2828 global $wgOut;
2929
30 - $wgOut->addHTML( '<div dir="ltr">' );
3130 $wgOut->addWikiText(
3231 $this->MediaWikiCredits() .
 32+ $this->systemInformation() .
3333 $this->extensionCredits() .
3434 $this->wgHooks()
3535 );
3636 $wgOut->addHTML( $this->IPInfo() );
37 - $wgOut->addHTML( '</div>' );
3837 }
3938
4039 /**#@+
@@ -46,11 +45,11 @@
4746 * @static
4847 */
4948 function MediaWikiCredits() {
50 - $version = self::getVersion();
51 - $dbr = wfGetDB( DB_SLAVE );
 49+ $ret = "<h2>" . wfMsgExt( 'version-licence', array( 'parseinline' ) ) . "</h2>\n";
5250
53 - $ret =
 51+ $ret .=
5452 "__NOTOC__
 53+ <div dir='ltr'>
5554 This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
5655 copyright (C) 2001-2007 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
5756 Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
@@ -70,11 +69,13 @@
7170 along with this program; if not, write to the Free Software
7271 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
7372 or [http://www.gnu.org/copyleft/gpl.html read it online]
 73+ </div>";
7474
75 - * [http://www.mediawiki.org/ MediaWiki]: $version
76 - * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ")
77 - * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion();
78 -
 75+ $translation = wfMsgExt( 'version-licence-text', array( 'parseline' ) );
 76+ if( !( wfEmptyMsg( 'version-licence-text', $translation ) || $translation == '-' || $translation == '' ) ) {
 77+ $ret .= "<h3>" . wfMsgExt( 'version-licence-header', array( 'parseinline' ) ) . "</h3>\n";
 78+ $ret .= $translation;
 79+ }
7980 return str_replace( "\t\t", '', $ret ) . "\n";
8081 }
8182
@@ -93,15 +94,15 @@
9495 return '';
9596
9697 $extensionTypes = array(
97 - 'specialpage' => 'Special pages',
98 - 'parserhook' => 'Parser hooks',
99 - 'variable' => 'Variables',
100 - 'other' => 'Other',
 98+ 'specialpage' => wfMsgExt( 'version-specialpages', array( 'parseinline' ) ),
 99+ 'parserhook' => wfMsgExt( 'version-parserhooks', array( 'parseinline' ) ),
 100+ 'variable' => wfMsgExt( 'version-variables', array( 'parseinline' ) ),
 101+ 'other' => wfMsgExt( 'version-other', array( 'parseinline' ) ),
101102 );
102103 wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
103104
104 - $out = "<h2>Extensions</h2>\n";
105 - $out .= wfOpenElement('table', array('id' => 'sv-ext') );
 105+ $out = "<h2>" . wfMsgExt( 'version-extensions', array( 'parseinline' ) ) . "</h2>\n";
 106+ $out .= Xml::openElement( 'table', array('id' => 'sv-ext', 'dir' => 'ltr' ) );
106107
107108 foreach ( $extensionTypes as $type => $text ) {
108109 if ( isset ( $wgExtensionCredits[$type] ) && count ( $wgExtensionCredits[$type] ) ) {
@@ -122,27 +123,27 @@
123124 }
124125
125126 if ( count( $wgExtensionFunctions ) ) {
126 - $out .= $this->openExtType('Extension functions');
 127+ $out .= $this->openExtType( wfMsgExt( 'version-extension-functions', array( 'parseinline' ) ) );
127128 $out .= '<tr><td colspan="3">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
128129 }
129130
130131 if ( $cnt = count( $tags = $wgParser->getTags() ) ) {
131132 for ( $i = 0; $i < $cnt; ++$i )
132133 $tags[$i] = "&lt;{$tags[$i]}&gt;";
133 - $out .= $this->openExtType('Parser extension tags');
 134+ $out .= $this->openExtType( wfMsgExt( 'version-parser-extensiontags', array( 'parseinline' ) ) );
134135 $out .= '<tr><td colspan="3">' . $this->listToText( $tags ). "</td></tr>\n";
135136 }
136137
137138 if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) {
138 - $out .= $this->openExtType('Parser function hooks');
 139+ $out .= $this->openExtType( wfMsgExt( 'version-parser-function-hooks', array( 'parseinline' ) ) );
139140 $out .= '<tr><td colspan="3">' . $this->listToText( $fhooks ) . "</td></tr>\n";
140141 }
141142
142143 if ( count( $wgSkinExtensionFunction ) ) {
143 - $out .= $this->openExtType('Skin extension functions');
 144+ $out .= $this->openExtType( wfMsgExt( 'version-skin-extension-functions', array( 'parseinline' ) ) );
144145 $out .= '<tr><td colspan="3">' . $this->listToText( $wgSkinExtensionFunction ) . "</td></tr>\n";
145146 }
146 - $out .= wfCloseElement( 'table' );
 147+ $out .= Xml::closeElement( 'table' );
147148 return $out;
148149 }
149150
@@ -181,32 +182,65 @@
182183 $myWgHooks = $wgHooks;
183184 ksort( $myWgHooks );
184185
185 - $ret = "<h2>Hooks</h2>\n"
186 - . wfOpenElement('table', array('id' => 'sv-hooks') )
187 - . "<tr><th>Hook name</th><th>Subscribed by</th></tr>\n";
 186+ $ret = "<h2>" . wfMsgExt( 'version-hooks', array( 'parseinline' ) ) . "</h2>\n";
 187+ $ret .= Xml::openElement( 'table', array( 'id' => 'sv-hooks', 'dir' => 'ltr' ) );
 188+ $ret .= "<tr>
 189+ <th>" . wfMsgExt( 'version-hook-name', array( 'parseinline' ) ) . "</th>
 190+ <th>" . wfMsgExt( 'version-hook-subscribedby', array( 'parseinline' ) ) . "</th>
 191+ </tr>\n";
188192
189193 foreach ($myWgHooks as $hook => $hooks)
190 - $ret .= "<tr><td>$hook</td><td>" . $this->listToText( $hooks ) . "</td></tr>\n";
 194+ $ret .= "<tr>
 195+ <td>$hook</td>
 196+ <td>" . $this->listToText( $hooks ) . "</td>
 197+ </tr>\n";
191198
192 - $ret .= '</table>';
 199+ $ret .= Xml::closeElement( 'table' );
193200 return $ret;
194201 } else
195202 return '';
196203 }
197204
 205+ function systemInformation() {
 206+ $version = self::getVersion();
 207+ $dbr = wfGetDB( DB_SLAVE );
 208+
 209+ $ret = "<h2>" . wfMsgExt( 'version-system', array( 'parseinline' ) ) . "</h2>\n";
 210+ $ret .= Xml::openElement( 'table', array( 'id' => 'sv-software', 'dir' => 'ltr' ) );
 211+ $ret .= "<tr>
 212+ <th>" . wfMsgExt( 'version-software', array( 'parseinline' ) ) . "</th>
 213+ <th>" . wfMsgExt( 'version-version', array( 'parseinline' ) ) . "</th>
 214+ </tr>
 215+ <tr>
 216+ <td>[http://www.mediawiki.org/ MediaWiki]:</td>
 217+ <td>$version</td>
 218+ </tr>
 219+ <tr>
 220+ <td>[http://www.php.net/ PHP]:</td>
 221+ <td>" . phpversion() . " (" . php_sapi_name() . ")</td>
 222+ </tr>
 223+ <tr>
 224+ <td>" . $dbr->getSoftwareLink() . ":</td>
 225+ <td>" . $dbr->getServerVersion() . "</td>
 226+ </tr>\n";
 227+ $ret .= Xml::closeElement( 'table' );
 228+
 229+ return $ret;
 230+ }
 231+
198232 private function openExtType($text, $name = null) {
199233 $opt = array( 'colspan' => 3 );
200234 $out = '';
201235
202236 if(!$this->firstExtOpened) {
203237 // Insert a spacing line
204 - $out .= '<tr class="sv-space">' . wfElement( 'td', $opt ) . "</tr>\n";
 238+ $out .= '<tr class="sv-space">' . Xml::tags( 'td', $opt, '' ) . "</tr>\n";
205239 }
206240 $this->firstExtOpened = false;
207241
208242 if($name) { $opt['id'] = "sv-$name"; }
209243
210 - $out .= "<tr>" . wfElement( 'th', $opt, $text) . "</tr>\n";
 244+ $out .= "<tr>" . Xml::tags( 'th', $opt, $text) . "</tr>\n";
211245 return $out;
212246 }
213247
@@ -226,42 +260,16 @@
227261 * @return string
228262 */
229263 function listToText( $list ) {
230 - $cnt = count( $list );
231264
232 - if ( $cnt == 1 ) {
233 - // Enforce always returning a string
234 - return (string)$this->arrayToString( $list[0] );
235 - } elseif ( $cnt == 0 ) {
 265+ if ( count( $list ) ) {
 266+ sort( $list );
 267+ return implode( ', ', $list );
 268+ } else {
236269 return '';
237 - } else {
238 - $t = array_slice( $list, 0, $cnt - 1 );
239 - $one = array_map( array( &$this, 'arrayToString' ), $t );
240 - $two = $this->arrayToString( $list[$cnt - 1] );
241 -
242 - return implode( ', ', $one ) . " and $two";
243270 }
244271 }
245272
246273 /**
247 - * @static
248 - *
249 - * @param mixed $list Will convert an array to string if given and return
250 - * the paramater unaltered otherwise
251 - * @return mixed
252 - */
253 - function arrayToString( $list ) {
254 - if( is_object( $list ) ) {
255 - $class = get_class( $list );
256 - return "($class)";
257 - } elseif ( ! is_array( $list ) ) {
258 - return $list;
259 - } else {
260 - $class = get_class( $list[0] );
261 - return "($class, {$list[1]})";
262 - }
263 - }
264 -
265 - /**
266274 * Retrieve the revision number of a Subversion working directory.
267275 *
268276 * @param string $dir
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1197,7 +1197,7 @@
11981198 * to ensure that client-side caches don't keep obsolete copies of global
11991199 * styles.
12001200 */
1201 -$wgStyleVersion = '77';
 1201+$wgStyleVersion = '78';
12021202
12031203
12041204 # Server-side caching:
Index: trunk/phase3/RELEASE-NOTES
@@ -109,6 +109,7 @@
110110 classes: mw-code, mw-css, mw-js)
111111 * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over
112112 usergroup assignment.
 113+* (bug 10365) Localization of Special:Version
113114
114115 == Bugfixes since 1.10 ==
115116
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -2292,6 +2292,46 @@
22932293 'lag-warn-normal' => 'Bearbeitungen der letzten $1 Sekunden werden in dieser Liste noch nicht angezeigt.',
22942294 'lag-warn-high' => 'Auf Grund hoher Datenbankauslastung werden die Bearbeitungen der letzten $1 Sekunden in dieser Liste noch nicht angezeigt.',
22952295
 2296+# Special:Version
 2297+'version-extensions' => 'Installierte Erweiterungen',
 2298+'version-specialpages' => 'Spezialseiten',
 2299+'version-parserhooks' => 'Parser-Hooks',
 2300+'version-variables' => 'Variablen',
 2301+'version-other' => 'Anderes',
 2302+'version-hooks' => "Schnittstellen ''(Hooks)''",
 2303+'version-licence' => 'Lizenz-Informationen',
 2304+'version-licence-header' => 'Unverbindliche Übersetzung:',
 2305+'version-licence-text' => "
 2306+ Dieses Wiki basiert auf '''[http://www.mediawiki.org/ MediaWiki]''',
 2307+ die Urheberrechte (C) 2001-2007 liegen bei Magnus Manske, Brion Vibber, Lee Daniel Crocker,
 2308+ Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
 2309+ Niklas Laxström, Domas Mituzas, Rob Church und anderen.
 2310+
 2311+ MediaWiki ist eine freie Software; Sie dürfen sie weiterverteilen und/oder verändern,
 2312+ sofern die Bedingungen der ''GNU General Public License'', veröffentlicht
 2313+ durch die ''Free Software Foundation'' in Lizenzversion 2 oder
 2314+ (nach Ihrer Wahl) jeder späteren Version, eingehalten werden.
 2315+
 2316+ MediaWiki wird verteilt in der Hoffnung, dass sie nutzbar ist,
 2317+ aber OHNE JEDE GARANTIE, es wird auch keine implizite GEBRAUCHSTAUGLICHKEIT
 2318+ oder TAUGLICHKEIT FÜR BESONDERE ZWECKE zugesagt.
 2319+ Siehe die ''GNU General Public License'' für weitere Details.
 2320+
 2321+ Sie sollten eine [{{SERVER}}{{SCRIPTPATH}}/COPYING Kopie der ''GNU General Public License'']
 2322+ zusammen mit dieser Software erhalten haben; falls diese fehlt, schreiben Sie an
 2323+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 2324+ oder [http://www.gnu.org/copyleft/gpl.html lesen Sie sie online].
 2325+", # See [[Special:Version]] for the original licence text in English.
 2326+'version-system' => 'System-Informationen',
 2327+'version-extension-functions' => 'Funktionsaufrufe',
 2328+'version-parser-extensiontags' => "Parser-Erweiterungen ''(tags)''",
 2329+'version-parser-function-hooks' => 'Parser-Funktionen',
 2330+'version-skin-extension-functions' => 'Skin extension functions',
 2331+'version-hook-name' => 'Schnittstellenname',
 2332+'version-hook-subscribedby' => 'aufgerufen durch',
 2333+'version-software' => 'Software',
 2334+'version-Version' => 'Version',
 2335+
22962336 );
22972337
22982338 ?>
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2908,6 +2908,26 @@
29092909 'lag-warn-high' => 'Due to high database server lag, changes newer than $1 seconds
29102910 may not be shown in this list.',
29112911
 2912+# Special:Version
 2913+'version-extensions' => 'Installed extensions',
 2914+'version-specialpages' => 'Special pages',
 2915+'version-parserhooks' => 'Parser hooks',
 2916+'version-variables' => 'Variables',
 2917+'version-other' => 'Other',
 2918+'version-hooks' => 'Hooks',
 2919+'version-licence' => 'Licence information',
 2920+'version-licence-header' => 'Translation without obligation:',
 2921+'version-licence-text' => '-', # See [[Special:Version]] for the original licence text in English.
 2922+'version-system' => 'System information',
 2923+'version-extension-functions' => 'Extension functions',
 2924+'version-parser-extensiontags' => 'Parser extension tags',
 2925+'version-parser-function-hooks' => 'Parser function hooks',
 2926+'version-skin-extension-functions' => 'Skin extension functions',
 2927+'version-hook-name' => 'Hook name',
 2928+'version-hook-subscribedby' => 'Subscribed by',
 2929+'version-software' => 'Software',
 2930+'version-version' => 'Version',
 2931+
29122932 );
29132933
29142934 ?>
Index: trunk/phase3/maintenance/language/messages.inc
@@ -2130,6 +2130,26 @@
21312131 'lag-warn-normal',
21322132 'lag-warn-high',
21332133 ),
 2134+ 'version' => array(
 2135+ 'version-extensions',
 2136+ 'version-specialpages',
 2137+ 'version-parserhooks',
 2138+ 'version-variables',
 2139+ 'version-other',
 2140+ 'version-hooks',
 2141+ 'version-licence',
 2142+ 'version-licence-header',
 2143+ 'version-licence-text',
 2144+ 'version-system',
 2145+ 'version-extension-functions',
 2146+ 'version-parser-extensiontags',
 2147+ 'version-parser-function-hooks',
 2148+ 'version-skin-extension-functions',
 2149+ 'version-hook-name',
 2150+ 'version-hook-subscribedby',
 2151+ 'version-software',
 2152+ 'version-version',
 2153+ ),
21342154 );
21352155 /** Comments for each block */
21362156 $wgBlockComments = array(
@@ -2296,6 +2316,7 @@
22972317 'sizeunits' => 'Size units',
22982318 'livepreview' => 'Live preview',
22992319 'lagwarning' => 'Friendlier slave lag warnings',
 2320+ 'version' => 'Special:Version',
23002321 );
23012322
23022323 /** Short comments for standalone messages */
@@ -2314,6 +2335,7 @@
23152336 'exif-orientation-7' => '0th row: right; 0th column: bottom',
23162337 'exif-orientation-8' => '0th row: left; 0th column: bottom',
23172338 'autoredircomment' => 'This should be changed to the new naming convention, but existed beforehand',
 2339+ 'version-version' => 'See [[Special:Version]] for the original licence text in English.',
23182340 );
23192341
23202342 /** Messages which contain dollar signs (which are not followed by numbers), and therefore should use a single apostrophe */
Index: trunk/phase3/skins/monobook/main.css
@@ -1539,17 +1539,18 @@
15401540
15411541 /** Special:Version */
15421542
1543 -table#sv-ext, table#sv-hooks {
 1543+table#sv-ext, table#sv-hooks, table#sv-software {
15441544 margin: 1em;
15451545 padding:0em;
 1546+ border-collapse: collapse;
15461547 }
15471548
1548 -#sv-ext td, #sv-hooks td,
1549 -#sv-ext th, #sv-hooks th {
 1549+#sv-ext td, #sv-hooks td, #sv-software td,
 1550+#sv-ext th, #sv-hooks th, #sv-software th {
15501551 border: 1px solid #A0A0A0;
15511552 padding: 0 0.15em 0 0.15em;
15521553 }
1553 -#sv-ext th, #sv-hooks th {
 1554+#sv-ext th, #sv-hooks th, #sv-software th {
15541555 background-color: #F0F0F0;
15551556 color: black;
15561557 padding: 0 0.15em 0 0.15em;
Index: trunk/phase3/skins/monobook/handheld.css
@@ -1245,17 +1245,18 @@
12461246
12471247 /** Special:Version */
12481248
1249 -table#sv-ext, table#sv-hooks {
 1249+table#sv-ext, table#sv-hooks, table#sv-software {
12501250 margin: 1em;
12511251 padding:0em;
 1252+ border-collapse: collapse;
12521253 }
12531254
1254 -#sv-ext td, #sv-hooks td,
1255 -#sv-ext th, #sv-hooks th {
 1255+#sv-ext td, #sv-hooks td, #sv-software td
 1256+#sv-ext th, #sv-hooks th, #sv-software th {
12561257 border: 1px solid #A0A0A0;
12571258 padding: 0 0.15em 0 0.15em;
12581259 }
1259 -#sv-ext th, #sv-hooks th {
 1260+#sv-ext th, #sv-hooks th, #sv-software th {
12601261 background-color: #F0F0F0;
12611262 color: black;
12621263 padding: 0 0.15em 0 0.15em;
@@ -1299,4 +1300,4 @@
13001301 /* Kill big bulky stuff that will clog up the screen */
13011302 display: none;
13021303 }
1303 -}
\ No newline at end of file
 1304+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r23475Revert r23471, r23474: restore Special:Version to working, non-ugly state...brion13:55, 27 June 2007
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007
r30349* (bug 10365) Localization of Special:Version...raymond14:38, 31 January 2008

Status & tagging log