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 |
1 | 42 | + 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 |
1 | 15 | + 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 |
1 | 49 | + native |