r55322 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55321‎ | r55322 | r55323 >
Date:12:17, 19 August 2009
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Quick and dirty extension to let us output currently supported versions of MW via the API. Intended for MW.org so the new installer can check for the latest version.
Modified paths:
  • /trunk/extensions/MWReleases (added) (history)
  • /trunk/extensions/MWReleases/ApiMWReleases.php (added) (history)
  • /trunk/extensions/MWReleases/MWReleases.i18n.php (added) (history)
  • /trunk/extensions/MWReleases/MWReleases.php (added) (history)

Diff [purge]

Index: trunk/extensions/MWReleases/ApiMWReleases.php
@@ -0,0 +1,40 @@
 2+<?php
 3+
 4+/**
 5+ * Class definition for MWReleases API Module
 6+ */
 7+
 8+class ApiMWReleases extends ApiBase {
 9+ public function __construct($main, $action) {
 10+ parent :: __construct($main, $action);
 11+ }
 12+
 13+ public function execute() {
 14+ $results = array();
 15+ $releases = explode( "\n", wfMsgForContent( 'mwreleases-list' ) );
 16+ foreach( $releases as $release ) {
 17+ list( $status, $version ) = explode( ':', $release );
 18+ $r = array( 'version' => $version );
 19+ if( $status == 'current' )
 20+ $r['current'] = '';
 21+ $results[] = $r;
 22+ }
 23+ $this->getResult()->setIndexedTagName($results, 'release');
 24+ $this->getResult()->addValue(null, $this->getModuleName(), $results);
 25+ }
 26+
 27+ public function getDescription() {
 28+ return array (
 29+ 'Get the list of current Mediawiki releases'
 30+ );
 31+ }
 32+
 33+ protected function getExamples() {
 34+ return array(
 35+ 'api.php?action=mwreleases'
 36+ );
 37+ }
 38+ public function getVersion() {
 39+ return __CLASS__ . ': ' . MWRELEASES_VERSION;
 40+ }
 41+}
\ No newline at end of file
Property changes on: trunk/extensions/MWReleases/ApiMWReleases.php
___________________________________________________________________
Name: svn:eol-style
142 + native
Index: trunk/extensions/MWReleases/MWReleases.i18n.php
@@ -0,0 +1,13 @@
 2+<?php
 3+
 4+/**
 5+ * Internationalization file for MWReleases
 6+ */
 7+$messages = array();
 8+
 9+/**
 10+ * English
 11+ */
 12+$messages['en'] = array(
 13+ 'mwreleases-desc' => 'Adds a [[Mediawiki:Mwreleases-list|list]] of supported releases, accessible via the API',
 14+);
Property changes on: trunk/extensions/MWReleases/MWReleases.i18n.php
___________________________________________________________________
Name: svn:eol-style
115 + native
Index: trunk/extensions/MWReleases/MWReleases.php
@@ -0,0 +1,47 @@
 2+<?php
 3+/**
 4+ * MWReleases - lets us maintain a list of releases that we support
 5+ * on Mediawiki.org, to be queried by the API. Goal is to have the
 6+ * installer and updater check MW.org for latest versions :)
 7+ *
 8+ * EXAMPLE MWRELEASES-LIST:
 9+ * <code>
 10+ * current:1.15.1
 11+ * supported:1.14.1
 12+ * supported:1.6.12
 13+ * </code>
 14+ *
 15+ * This program is free software; you can redistribute it and/or modify
 16+ * it under the terms of the GNU General Public License as published by
 17+ * the Free Software Foundation; either version 2 of the License, or
 18+ * (at your option) any later version.
 19+ *
 20+ * This program is distributed in the hope that it will be useful,
 21+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 22+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 23+ * GNU General Public License for more details.
 24+ *
 25+ * You should have received a copy of the GNU General Public License along
 26+ * with this program; if not, write to the Free Software Foundation, Inc.,
 27+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 28+ * http://www.gnu.org/copyleft/gpl.html
 29+ *
 30+ * @author Chad Horohoe
 31+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 32+ */
 33+
 34+define( 'MWRELEASES_VERSION', 1.0 );
 35+
 36+$wgExtensionCredits['other'][] = array(
 37+ 'path' => __FILE__,
 38+ 'name' => 'MWReleases',
 39+ 'url' => 'http://www.mediawiki.org/wiki/Extension:MWReleases',
 40+ 'author' => 'Chad Horohoe',
 41+ 'descriptionmsg' => 'mwreleases-desc',
 42+ 'version' => MWRELEASES_VERSION,
 43+);
 44+
 45+$dir = dirname( __FILE__ ) . '/';
 46+$wgAutoloadClasses['ApiMWReleases'] = $dir . 'ApiMWReleases.php';
 47+$wgExtensionMessagesFiles['MWReleases'] = $dir . 'MWReleases.i18n.php';
 48+$wgAPIModules['mwreleases'] = 'ApiMWReleases';
Property changes on: trunk/extensions/MWReleases/MWReleases.php
___________________________________________________________________
Name: svn:eol-style
149 + native

Comments

#Comment by Brion VIBBER (talk | contribs)   19:25, 29 September 2009

Fixed a couple minor things in r57067

#Comment by Tim Starling (talk | contribs)   05:05, 8 December 2009

What's wrong with action=raw?

#Comment by 😂 (talk | contribs)   11:20, 8 December 2009

No major compelling reason. Mainly that I can write an API module faster than I can look up all the parameters to action=raw.

Also, there was some mention of wanting to add a parser function to this extension so we can do things like updating version numbers in 1 place instead of all over the place, but that of course doesn't depend on the API module.

#Comment by Tim Starling (talk | contribs)   02:04, 9 December 2009

We already have templates on mediawiki.org for that, by adding this extension you're just adding an extra item to my release checklist, and adding some unnecessary code bloat for us to review. It seems to me that you could set up a page which includes all those templates in some nice HTML format, and then have the client side screen-scrape it. The client-side code would be basically the same size, and you'd get free squid caching into the bargain.

#Comment by 😂 (talk | contribs)   14:20, 9 December 2009

The plan was to eventually create less work. Instead of having to update all of those templates, the goal was to have to update only one list of versions.

Of course its not there, yet.

Status & tagging log