r71085 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71084‎ | r71085 | r71086 >
Date:20:58, 14 August 2010
Author:demon
Status:reverted (Comments)
Tags:
Comment:
Partially complete MWReleases overhaul. Still needs UI work, add/edit functionality, lots of other things
Modified paths:
  • /trunk/extensions/MWReleases/ApiMWReleases.php (deleted) (history)
  • /trunk/extensions/MWReleases/MWReleases.alias.php (added) (history)
  • /trunk/extensions/MWReleases/MWReleases.i18n.php (modified) (history)
  • /trunk/extensions/MWReleases/MWReleases.php (modified) (history)
  • /trunk/extensions/MWReleases/MWReleases.sql (added) (history)
  • /trunk/extensions/MWReleases/api (added) (history)
  • /trunk/extensions/MWReleases/api/ApiMWReleases.php (added) (history)
  • /trunk/extensions/MWReleases/backend (added) (history)
  • /trunk/extensions/MWReleases/backend/Release.php (added) (history)
  • /trunk/extensions/MWReleases/backend/ReleaseRepo.php (added) (history)
  • /trunk/extensions/MWReleases/ui (added) (history)
  • /trunk/extensions/MWReleases/ui/SpecialDownloadMediawiki.php (added) (history)
  • /trunk/extensions/MWReleases/ui/SpecialReleaseManager.php (added) (history)

Diff [purge]

Index: trunk/extensions/MWReleases/ApiMWReleases.php
@@ -1,51 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Class definition for MWReleases API Module
6 - */
7 -
8 -class ApiMWReleases extends ApiBase {
9 -
10 - // Possible releases. Current is the latest stable,
11 - // Alpha is trunk, Beta is release candidates
12 - private $tags = array( 'current', 'alpha', 'beta' );
13 -
14 - public function __construct($main, $action) {
15 - parent :: __construct($main, $action);
16 - }
17 -
18 - public function execute() {
19 - $results = array();
20 - $releases = explode( "\n", wfMsgForContent( 'mwreleases-list' ) );
21 - foreach( $releases as $release ) {
22 - $release = trim( $release );
23 - if( substr( $release, 0, 1 ) == '#' ) {
24 - continue;
25 - }
26 - if( strpos( $release, ':' ) !== false ) {
27 - list( $status, $version ) = explode( ':', $release, 2 );
28 - $r = array( 'version' => $version );
29 - if( in_array( $status, $this->tags ) )
30 - $r[$status] = '';
31 - $results[] = $r;
32 - }
33 - }
34 - $this->getResult()->setIndexedTagName($results, 'release');
35 - $this->getResult()->addValue(null, $this->getModuleName(), $results);
36 - }
37 -
38 - public function getDescription() {
39 - return array (
40 - 'Get the list of current Mediawiki releases'
41 - );
42 - }
43 -
44 - protected function getExamples() {
45 - return array(
46 - 'api.php?action=mwreleases'
47 - );
48 - }
49 - public function getVersion() {
50 - return __CLASS__ . ': ' . MWRELEASES_VERSION;
51 - }
52 -}
Index: trunk/extensions/MWReleases/MWReleases.alias.php
@@ -0,0 +1,17 @@
 2+<?php
 3+/**
 4+ * Aliases for MWReleases
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$aliases = array();
 11+
 12+/**
 13+ * English
 14+ */
 15+$aliases['en'] = array(
 16+ 'ReleaseManager' => array( 'ReleaseManager' ),
 17+ 'DownloadMediawiki' => array( 'DownloadMediawiki' ),
 18+);
Property changes on: trunk/extensions/MWReleases/MWReleases.alias.php
___________________________________________________________________
Added: svn:eol-style
119 + native
Index: trunk/extensions/MWReleases/MWReleases.sql
@@ -0,0 +1,13 @@
 2+-- Schema for MWReleases
 3+
 4+CREATE TABLE /*_*/mwreleases (
 5+ mwr_id int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
 6+ mwr_name varchar(255) NOT NULL,
 7+ mwr_number varchar(32) NOT NULL,
 8+ mwr_reldate varbinary(32) DEFAULT NULL,
 9+ mwr_eoldate varbinary(32) DEFAULT NULL,
 10+ mwr_branch varchar(32) NOT NULL,
 11+ mwr_tag varchar(32) NOT NULL,
 12+ mwr_announcement varchar(255) DEFAULT NULL,
 13+ mwr_supported int(1) NOT NULL,
 14+) /*$wgDBTableOptions*/;
Property changes on: trunk/extensions/MWReleases/MWReleases.sql
___________________________________________________________________
Added: svn:eol-style
115 + native
Index: trunk/extensions/MWReleases/backend/ReleaseRepo.php
@@ -0,0 +1,91 @@
 2+<?php
 3+
 4+class ReleaseRepo {
 5+
 6+ private static $_i = null;
 7+ private $fullyLoaded = false;
 8+ private $releases, $supported = null;
 9+ const CACHE_KEY = 'mediawiki-release-list';
 10+
 11+ protected function __construct() {
 12+
 13+ }
 14+
 15+ public static function singleton() {
 16+ if( is_null( self::$_i ) ) {
 17+ self::$_i = new self();
 18+ }
 19+ return self::$_i;
 20+ }
 21+
 22+ protected function clearCache() {
 23+ global $wgMemc;
 24+ $wgMemc->delete( self::CACHE_KEY );
 25+ }
 26+
 27+ public function getLatestStableRelease() {
 28+ $this->load();
 29+ return reset( $this->releases );
 30+ }
 31+
 32+ public function getSupportedReleases() {
 33+ if( is_null( $this->supported ) ) {
 34+ $this->load();
 35+ $this->supported = array();
 36+ foreach( $this->releases as $rel ) {
 37+ if( $rel->isSupported() ) {
 38+ $this->supported[] = $rel;
 39+ }
 40+ }
 41+ }
 42+ return $this->supported;
 43+ }
 44+
 45+ public function releaseExists( $id ) {
 46+ $this->load();
 47+ return isset( $this->releases[ $id ] );
 48+ }
 49+
 50+ public function getReleaseForId( $id ) {
 51+ if( $this->releaseExists( $id ) ) {
 52+ return $this->releases[ $id ];
 53+ }
 54+ return null;
 55+ }
 56+
 57+ public function getAllReleases() {
 58+ $this->load();
 59+ return $this->releases;
 60+ }
 61+
 62+ private function load() {
 63+ if( !is_null( $this->releases ) ) {
 64+ return;
 65+ } else {
 66+ global $wgMemc;
 67+ $res = $wgMemc->get( self::CACHE_KEY );
 68+ if( $res ) {
 69+ $this->releases = $res;
 70+ } else {
 71+ $dbr = wfGetDB( DB_SLAVE );
 72+ $this->releases = array();
 73+ $res = $dbr->select( 'mwreleases', '*', array(), __METHOD__ );
 74+ foreach( $res as $row ) {
 75+ if( !isset( $this->releases[ $row->mwr_id ] ) ) {
 76+ $mw = MediawikiRelease::newFromRow( $row );
 77+ $this->releases[ $mw->getId() ] = $mw;
 78+ }
 79+ }
 80+ usort( $this->releases, array( $this, 'sortReleasesDesc' ) );
 81+ // cache for 30 days. This doesn't change often so we'll explicity
 82+ // flush when we've changed something
 83+ $wgMemc->set( self::CACHE_KEY, $this->releases, 60 * 60 * 24 * 30 );
 84+ }
 85+ $this->fullyLoaded = true;
 86+ }
 87+ }
 88+
 89+ private function sortReleasesDesc( $relA, $relB ) {
 90+ return version_compare( $relA->getNumber(), $relB->getNumber(), '<' );
 91+ }
 92+}
Property changes on: trunk/extensions/MWReleases/backend/ReleaseRepo.php
___________________________________________________________________
Added: svn:eol-style
193 + native
Index: trunk/extensions/MWReleases/backend/Release.php
@@ -0,0 +1,76 @@
 2+<?php
 3+
 4+interface Release {
 5+ const SUPPORT_TIL_EOL = 0;
 6+ const UNSUPPORTED = 1;
 7+ const SUPPORTED = 2;
 8+}
 9+
 10+class MediawikiRelease implements Release {
 11+
 12+ private $id, $name, $number, $reldate, $eoldate, $branch, $tag,
 13+ $announcement, $supported = null;
 14+
 15+ public static function newFromRow( $row ) {
 16+ $mw = new self();
 17+ foreach( self::getFieldNames() as $f ) {
 18+ $func = 'set' . ucfirst( $f );
 19+ $col = "mwr_$f";
 20+ $v = isset( $row->$col ) ? $row->$col : null;
 21+ $mw->$func( $v );
 22+ }
 23+ return $mw;
 24+ }
 25+
 26+ public static function getFieldNames() {
 27+ return array( 'id', 'name', 'number', 'reldate', 'eoldate', 'branch',
 28+ 'tag', 'announcement', 'supported' );
 29+ }
 30+
 31+ public function getId() { return $this->id; }
 32+ public function getName() { return $this->name; }
 33+ public function getNumber() { return $this->number; }
 34+ public function getReldate() { return $this->reldate; }
 35+ public function getEoldate() { return $this->eoldate; }
 36+ public function getBranch() { return $this->branch; }
 37+ public function getTag() { return $this->tag; }
 38+ public function getAnnouncement() { return $this->announcement; }
 39+ public function getSupported() { return intval( $this->supported ); }
 40+ public function setId( $i ) { $this->id = $i; }
 41+ public function setName( $n ) { $this->name = $n; }
 42+ public function setNumber( $n ) { $this->number = $n; }
 43+ public function setReldate( $d ) { $this->reldate = $d; }
 44+ public function setEoldate( $d ) { $this->eoldate = $d; }
 45+ public function setBranch( $b ) { $this->branch = $b; }
 46+ public function setTag( $t ) { $this->tag = $t; }
 47+ public function setAnnouncement( $a ) { $this->announcement = $a; }
 48+ public function setSupported( $s ) { $this->supported = $s; }
 49+
 50+ public function isSupported() {
 51+ switch( $this->supported ) {
 52+ case self::SUPPORT_TIL_EOL:
 53+ return wfTimestampNow() < wfTimestamp( TS_UNIX, $this->eoldate );
 54+ break;
 55+ case self::SUPPORTED:
 56+ return true;
 57+ case self::UNSUPPORTED:
 58+ default:
 59+ return false;
 60+ }
 61+ }
 62+
 63+ public function getBranchUrl() {
 64+ global $wgMWRSvnUrl;
 65+ return $wgMWRSvnUrl . 'branches/' . $this->branch . '/phase3/';
 66+ }
 67+
 68+ public function getTagUrl() {
 69+ global $wgMWRSvnUrl;
 70+ return $wgMWRSvnUrl . 'tags/' . $this->tag . '/phase3/';
 71+ }
 72+
 73+ public function delete() {
 74+ $dbw = wfGetDB( DB_MASTER );
 75+ $dbw->delete( 'mwreleases', array( 'mwr_id' => $this->getId() ), __METHOD__ );
 76+ }
 77+}
Property changes on: trunk/extensions/MWReleases/backend/Release.php
___________________________________________________________________
Added: svn:eol-style
178 + native
Index: trunk/extensions/MWReleases/api/ApiMWReleases.php
@@ -0,0 +1,104 @@
 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+ $params = $this->extractRequestParams();
 16+ $releases = $params['allreleases'] ?
 17+ ReleaseRepo::singleton()->getAllReleases() :
 18+ ReleaseRepo::singleton()->getSupportedReleases();
 19+
 20+ foreach( $releases as $release ) {
 21+ $r = array();
 22+ if( ReleaseRepo::singleton()->getLatestStableRelease()->getId()
 23+ == $release->getId() )
 24+ {
 25+ $r['latest'] = '';
 26+ }
 27+ foreach( $params['prop'] as $prop ) {
 28+ switch( $prop ) {
 29+ case 'name':
 30+ $r['name'] = $release->getName();
 31+ break;
 32+ case 'number':
 33+ $r['number'] = $release->getNumber();
 34+ break;
 35+ case 'reldate':
 36+ $r['reldate'] = $release->getReldate();
 37+ break;
 38+ case 'eoldate':
 39+ $r['eoldate'] = $release->getEoldate();
 40+ break;
 41+ case 'tagurl':
 42+ $r['tagurl'] = $release->getTagUrl();
 43+ break;
 44+ case 'branchurl':
 45+ $r['branchurl'] = $release->getBranchUrl();
 46+ break;
 47+ case 'announceurl':
 48+ $r['announceturl'] = $release->getAnnounceUrl();
 49+ break;
 50+ case 'supported':
 51+ if( $release->isSupported() ) {
 52+ $r['supported'] = '';
 53+ }
 54+ break;
 55+ }
 56+ }
 57+ $results[] = $r;
 58+ }
 59+ $this->getResult()->setIndexedTagName($results, 'release');
 60+ $this->getResult()->addValue(null, $this->getModuleName(), $results);
 61+ }
 62+
 63+ public function getAllowedParams() {
 64+ return array(
 65+ 'prop' => array(
 66+ ApiBase::PARAM_ISMULTI => true,
 67+ ApiBase::PARAM_TYPE => array (
 68+ 'name',
 69+ 'number',
 70+ 'reldate',
 71+ 'eoldate',
 72+ 'tagurl',
 73+ 'branchurl',
 74+ 'announceurl',
 75+ 'supported',
 76+ ),
 77+ ApiBase::PARAM_DFLT => 'number',
 78+ ),
 79+ 'allreleases' => false,
 80+ );
 81+ }
 82+
 83+ public function getParamDescription() {
 84+ return array(
 85+ 'prop' => 'Properties about the release',
 86+ 'allreleases' => 'Show all releases, not just currently supported ones',
 87+ );
 88+ }
 89+
 90+ public function getDescription() {
 91+ return array (
 92+ 'Get the list of current Mediawiki releases'
 93+ );
 94+ }
 95+
 96+ protected function getExamples() {
 97+ return array(
 98+ 'api.php?action=mwreleases&prop=tagurl|branchurl',
 99+ 'api.php?action=mwreleases&&allreleases=1&prop=name|reldate|eoldate'
 100+ );
 101+ }
 102+ public function getVersion() {
 103+ return __CLASS__ . ': ' . MWRELEASES_VERSION;
 104+ }
 105+}
Property changes on: trunk/extensions/MWReleases/api/ApiMWReleases.php
___________________________________________________________________
Added: svn:eol-style
1106 + native
Index: trunk/extensions/MWReleases/MWReleases.i18n.php
@@ -9,10 +9,23 @@
1010 * English
1111 */
1212 $messages['en'] = array(
13 - 'mwreleases-desc' => 'Adds a [[Mediawiki:Mwreleases-list|list]] of supported releases, accessible via the API',
14 - 'mwreleases-list' => '# List the current and other active supported MediaWiki releases like this:
15 -# current:1.15.1
16 -# supported:1.14.1'
 13+ 'mwr-desc' => 'Manages releases of the MediaWiki software',
 14+ 'releasemanager' => 'Mediawiki release manager',
 15+ 'releasemanager-header' => 'Welcome to the Mediawiki release manager. Use the options below to manage the releases',
 16+ 'releasemanager-add' => 'Add new release',
 17+ 'releasemanager-supported-til-eol' => 'Supported until EOL date, currently: $1', // $1 is yes/no
 18+ 'releasemanager-supported-overriden' => 'Support overridden, currently: $1', // $1 is yes/no
 19+ 'releasemanager-doesnotexist' => 'The specified release does not exist',
 20+ 'releasemanager-delete-confirm' => 'Are you sure you want to delete this release?',
 21+ 'downloadmediawiki' => 'Download Mediawiki',
 22+ 'mwr-field-name' => 'Name',
 23+ 'mwr-field-number' => 'Number',
 24+ 'mwr-field-eoldate' => 'End of life date',
 25+ 'mwr-field-reldate' => 'Release date',
 26+ 'mwr-field-announcement' => 'Announcement URL',
 27+ 'mwr-field-supported' => 'Supported flag',
 28+ 'mwr-field-tag' => 'Tag name',
 29+ 'mwr-field-branch' => 'Branch name',
1730 );
1831
1932 /** Message documentation (Message documentation)
@@ -22,398 +35,14 @@
2336 'mwreleases-desc' => '{{desc}}',
2437 );
2538
26 -/** Afrikaans (Afrikaans)
27 - * @author Naudefj
 39+/**
 40+ * Special pages aliases
2841 */
29 -$messages['af'] = array(
30 - 'mwreleases-desc' => "Voeg 'n [[Mediawiki:Mwreleases-list|lys]] van ondersteunde MediaWiki-weergawes by, toeganklik via die API",
31 -);
 42+$specialPagesAliases = array();
3243
33 -/** Arabic (العربية)
34 - * @author Meno25
 44+/**
 45+ * English
3546 */
36 -$messages['ar'] = array(
37 - 'mwreleases-desc' => 'يضيف [[Mediawiki:Mwreleases-list|قائمة]] بالإصدارات المدعومة, يمن الوصول إليها من ال API',
38 -);
39 -
40 -/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
41 - * @author EugeneZelenko
42 - */
43 -$messages['be-tarask'] = array(
44 - 'mwreleases-desc' => 'Дадае [[Mediawiki:Mwreleases-list|сьпіс]] вэрсіяў, якія падтрымліваюцца, даступны праз API',
45 -);
46 -
47 -/** Bulgarian (Български)
48 - * @author Turin
49 - */
50 -$messages['bg'] = array(
51 - 'mwreleases-desc' => 'Добавя [[Mediawiki:Mwreleases-list|списък]] на поддържаните версии, достъпни през API',
52 -);
53 -
54 -/** Breton (Brezhoneg)
55 - * @author Fulup
56 - */
57 -$messages['br'] = array(
58 - 'mwreleases-desc' => 'Ouzhpennañ a ra ur [[Mediawiki:Mwreleases-list|roll]] eus ar stummoù skoret, hegerz dre an API',
59 -);
60 -
61 -/** Bosnian (Bosanski)
62 - * @author CERminator
63 - */
64 -$messages['bs'] = array(
65 - 'mwreleases-desc' => 'Dodaje [[Mediawiki:Mwreleases-list|spisak]] podržanih izdanja, dostupnih preko API',
66 -);
67 -
68 -/** Czech (Česky)
69 - * @author Mormegil
70 - */
71 -$messages['cs'] = array(
72 - 'mwreleases-desc' => 'Poskytuje [[Mediawiki:Mwreleases-list|seznam]] podporovaných vydání, dostupný pomocí API',
73 -);
74 -
75 -/** German (Deutsch)
76 - * @author Metalhead64
77 - */
78 -$messages['de'] = array(
79 - 'mwreleases-desc' => 'Fügt eine [[Mediawiki:Mwreleases-list|Liste]] unterstützter Veröffentlichungen hinzu, die über die API erreichbar ist',
80 -);
81 -
82 -/** Zazaki (Zazaki)
83 - * @author Xoser
84 - */
85 -$messages['diq'] = array(
86 - 'mwreleases-desc' => 'Yew [[Mediawiki:Mwreleases-list|list]]eyê releaseyan de keno, pê API a beno',
87 -);
88 -
89 -/** Lower Sorbian (Dolnoserbski)
90 - * @author Michawiki
91 - */
92 -$messages['dsb'] = array(
93 - 'mwreleases-desc' => 'Pśidawa [[Mediawiki:Mwreleases-list|lisćinu]] pódpěranych wersijow, kótarež stoje pśez API k dispoziciji',
94 -);
95 -
96 -/** Greek (Ελληνικά)
97 - * @author Omnipaedista
98 - */
99 -$messages['el'] = array(
100 - 'mwreleases-desc' => 'Προσθέτει μία [[Mediawiki:Mwreleases-list|λίστα]] υποστηριζόμενων εκδόσεων, προσβάσιμων μέσω API',
101 -);
102 -
103 -/** Esperanto (Esperanto)
104 - * @author Yekrats
105 - */
106 -$messages['eo'] = array(
107 - 'mwreleases-desc' => 'Aldonas [[Mediawiki:Mwreleases-list|liston]] de subtenitaj eldonoj, atingeblaj per la API',
108 -);
109 -
110 -/** Spanish (Español)
111 - * @author Crazymadlover
112 - */
113 -$messages['es'] = array(
114 - 'mwreleases-desc' => 'Agregar una [[Mediawiki:Mwreleases-list|lista]] de versiones soportadas, accesibles a través de API',
115 -);
116 -
117 -/** Finnish (Suomi)
118 - * @author Crt
119 - */
120 -$messages['fi'] = array(
121 - 'mwreleases-desc' => 'Lisää tuetuista julkaisuista [[Mediawiki:Mwreleases-list|listan]], jota voi käyttää rajapinnan kautta.',
122 -);
123 -
124 -/** French (Français)
125 - * @author Crochet.david
126 - */
127 -$messages['fr'] = array(
128 - 'mwreleases-desc' => 'Ajoute une [[Mediawiki:Mwreleases-list|liste]] des versions supportées, accessible via l’API',
129 -);
130 -
131 -/** Franco-Provençal (Arpetan)
132 - * @author ChrisPtDe
133 - */
134 -$messages['frp'] = array(
135 - 'mwreleases-desc' => 'Apond una [[Mediawiki:Mwreleases-list|lista]] de les vèrsions recognues, accèssibla avouéc l’API.',
136 -);
137 -
138 -/** Galician (Galego)
139 - * @author Toliño
140 - */
141 -$messages['gl'] = array(
142 - 'mwreleases-desc' => 'Engade unha [[Mediawiki:Mwreleases-list|lista]] das versións soportadas, accesible a través da API',
143 -);
144 -
145 -/** Swiss German (Alemannisch)
146 - * @author Als-Holder
147 - */
148 -$messages['gsw'] = array(
149 - 'mwreleases-desc' => 'Fiegt e [[Mediawiki:Mwreleases-list|Lischt vu dr unterstitzte Usgabe]] yy, wu mer au mit API cha abruefe',
150 -);
151 -
152 -/** Hebrew (עברית)
153 - * @author Rotemliss
154 - * @author YaronSh
155 - */
156 -$messages['he'] = array(
157 - 'mwreleases-desc' => 'הוספת [[Mediawiki:Mwreleases-list|רשימה]] של גרסאות נתמכות, הזמינה באמצעות ה־API',
158 -);
159 -
160 -/** Hiligaynon (Ilonggo)
161 - * @author Tagimata
162 - */
163 -$messages['hil'] = array(
164 - 'mwreleases-desc' => 'Gadugang sang [[Mediawiki:Mwreleases-list|list]] sa mga gin paguha na, nga makita paagi sa API',
165 -);
166 -
167 -/** Upper Sorbian (Hornjoserbsce)
168 - * @author Michawiki
169 - */
170 -$messages['hsb'] = array(
171 - 'mwreleases-desc' => 'Přidawa [[Mediawiki:Mwreleases-list|lisćinu]] podpěranych wersijow, kotrež steja přez API k dispoziciji',
172 -);
173 -
174 -/** Hungarian (Magyar)
175 - * @author Glanthor Reviol
176 - */
177 -$messages['hu'] = array(
178 - 'mwreleases-desc' => 'Megjelenít egy [[Mediawiki:Mwreleases-list|listát]] a támogatott kiadásokról, elérhető az API-n keresztül',
179 -);
180 -
181 -/** Interlingua (Interlingua)
182 - * @author McDutchie
183 - */
184 -$messages['ia'] = array(
185 - 'mwreleases-desc' => 'Adde un [[Mediawiki:Mwreleases-list|lista]] de versiones supportate, accessibile via le API',
186 -);
187 -
188 -/** Indonesian (Bahasa Indonesia)
189 - * @author Bennylin
190 - */
191 -$messages['id'] = array(
192 - 'mwreleases-desc' => 'Menambahkan sebuah [[Mediawiki:Mwreleases-list|daftar]] keluaran yang didukung, dapat diakses melalui API',
193 -);
194 -
195 -/** Italian (Italiano)
196 - * @author Darth Kule
197 - */
198 -$messages['it'] = array(
199 - 'mwreleases-desc' => 'Aggiunge un [[Mediawiki:Mwreleases-list|elenco]] di versioni supportate, accessibile tramite API',
200 -);
201 -
202 -/** Japanese (日本語)
203 - * @author Fryed-peach
204 - */
205 -$messages['ja'] = array(
206 - 'mwreleases-desc' => 'サポートされているリリースの[[Mediawiki:Mwreleases-list|リスト]]を追加し、API からアクセス可能にする',
207 -);
208 -
209 -/** Korean (한국어)
210 - * @author Devunt
211 - * @author Kwj2772
212 - */
213 -$messages['ko'] = array(
214 - 'mwreleases-desc' => '지원하는 [[Mediawiki:Mwreleases-list|릴리즈 목록]]을 추가함, API로 접근 가능',
215 -);
216 -
217 -/** Colognian (Ripoarisch)
218 - * @author Purodha
219 - */
220 -$messages['ksh'] = array(
221 - 'mwreleases-desc' => 'Deiht en [[Mediawiki:Mwreleases-list|Leß met ongerschtöz Ußjabe]] en et Wiki dobei, di mer och mem <code lang="en">API</code> afroofe kann.',
222 -);
223 -
224 -/** Luxembourgish (Lëtzebuergesch)
225 - * @author Robby
226 - */
227 -$messages['lb'] = array(
228 - 'mwreleases-desc' => 'Setzt eng [[Mediawiki:Mwreleases-list|Lëscht]] vun ënnerstetzte Versiounen derbäi, déi iwwer den API zougänglech sinn',
229 -);
230 -
231 -/** Macedonian (Македонски)
232 - * @author Bjankuloski06
233 - */
234 -$messages['mk'] = array(
235 - 'mwreleases-desc' => 'Додава [[Mediawiki:Mwreleases-list|список]] на поддржани верзии, достапни преку API',
236 -);
237 -
238 -/** Malayalam (മലയാളം)
239 - * @author Praveenp
240 - */
241 -$messages['ml'] = array(
242 - 'mwreleases-desc' => 'എ.പി.ഐ. വഴി ലഭ്യമായ, പിന്തുണയുള്ള പുറത്തിറക്കലുകളുടെ [[Mediawiki:Mwreleases-list|പട്ടിക]] കൂട്ടിച്ചേർക്കുന്നു',
243 -);
244 -
245 -/** Dutch (Nederlands)
246 - * @author Siebrand
247 - */
248 -$messages['nl'] = array(
249 - 'mwreleases-desc' => 'Voegt een [[Mediawiki:Mwreleases-list|lijst]] van ondersteunde MediaWiki-versies toe, toegankelijk via de API',
250 -);
251 -
252 -/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
253 - * @author Laaknor
254 - */
255 -$messages['no'] = array(
256 - 'mwreleases-desc' => 'Legger til en [[Mediawiki:Mwreleases-list|liste]] over støttede versjoner, tilgjengelig via APIet',
257 -);
258 -
259 -/** Occitan (Occitan)
260 - * @author Cedric31
261 - */
262 -$messages['oc'] = array(
263 - 'mwreleases-desc' => 'Apond una [[Mediawiki:Mwreleases-list|lista]] de las versions suportadas, accessibla via l’API',
264 -);
265 -
266 -/** Polish (Polski)
267 - * @author Sp5uhe
268 - */
269 -$messages['pl'] = array(
270 - 'mwreleases-desc' => 'Dodaje [[Mediawiki:Mwreleases-list|spis]] obsługiwanych wydań, dostępnych poprzez API',
271 -);
272 -
273 -/** Piedmontese (Piemontèis)
274 - * @author Dragonòt
275 - */
276 -$messages['pms'] = array(
277 - 'mwreleases-desc' => 'A gionta na [[Mediawiki:Mwreleases-list|lista]] dle vërsion apogià, visibila via API',
278 -);
279 -
280 -/** Portuguese (Português)
281 - * @author Waldir
282 - */
283 -$messages['pt'] = array(
284 - 'mwreleases-desc' => 'Adiciona uma [[Mediawiki:Mwreleases-list|lista]] de versões suportadas, acessível através da API',
285 -);
286 -
287 -/** Brazilian Portuguese (Português do Brasil)
288 - * @author Eduardo.mps
289 - */
290 -$messages['pt-br'] = array(
291 - 'mwreleases-desc' => "Adiciona uma [[Mediawiki:Mwreleases-list|lista]] de 'releases' suportados, acessível via API",
292 -);
293 -
294 -/** Romanian (Română)
295 - * @author Stelistcristi
296 - */
297 -$messages['ro'] = array(
298 - 'mwreleases-desc' => 'Adăugați o [[Mediawiki:Mwreleases-list|listă]] cu lansările susținute, accesibile prin API',
299 -);
300 -
301 -/** Tarandíne (Tarandíne)
302 - * @author Joetaras
303 - */
304 -$messages['roa-tara'] = array(
305 - 'mwreleases-desc' => "Aggiunge 'na [[Mediawiki:Mwreleases-list|liste]] de versiune supportate, accessibbele ausanne le API",
306 -);
307 -
308 -/** Russian (Русский)
309 - * @author Александр Сигачёв
310 - */
311 -$messages['ru'] = array(
312 - 'mwreleases-desc' => 'Добавляет [[Mediawiki:Mwreleases-list|список]] поддерживаемых выпусков, доступных через API',
313 -);
314 -
315 -/** Yakut (Саха тыла)
316 - * @author HalanTul
317 - */
318 -$messages['sah'] = array(
319 - 'mwreleases-desc' => 'API көмөтүнэн аһыллар таһаарыылар [[Mediawiki:Mwreleases-list|тиһиктэрин]] эбэр',
320 -);
321 -
322 -/** Slovak (Slovenčina)
323 - * @author Helix84
324 - */
325 -$messages['sk'] = array(
326 - 'mwreleases-desc' => 'Pridáva [[Mediawiki:Mwreleases-list|zoznam]] podporovaných vydaní prístupných prostredníctvom API',
327 -);
328 -
329 -/** Slovenian (Slovenščina)
330 - * @author Dbc334
331 - */
332 -$messages['sl'] = array(
333 - 'mwreleases-desc' => 'Doda [[Mediawiki:Mwreleases-list|seznam]] podprtih izdaj, dostopnih preko programskega vmesnika',
334 -);
335 -
336 -/** Serbian Cyrillic ekavian (Српски (ћирилица))
337 - * @author Михајло Анђелковић
338 - */
339 -$messages['sr-ec'] = array(
340 - 'mwreleases-desc' => 'Додаје [[Mediawiki:Mwreleases-list|списак]] подржаних издања, доступних кроз API',
341 -);
342 -
343 -/** Serbian Latin ekavian (Srpski (latinica)) */
344 -$messages['sr-el'] = array(
345 - 'mwreleases-desc' => 'Dodaje [[Mediawiki:Mwreleases-list|spisak]] podržanih izdanja, dostupnih kroz API',
346 -);
347 -
348 -/** Sundanese (Basa Sunda)
349 - * @author Kandar
350 - */
351 -$messages['su'] = array(
352 - 'mwreleases-desc' => 'Nambahkeun [[Mediawiki:Mwreleases-list|béréndélan]] rilis nu dirojong, bisa dibuka ngaliwatan API-na',
353 -);
354 -
355 -/** Swedish (Svenska)
356 - * @author Per
357 - */
358 -$messages['sv'] = array(
359 - 'mwreleases-desc' => 'Lägger till en [[Mediawiki:Mwreleases-list|lista]] över verisioner, tilgängliga via APIet, som stöds',
360 -);
361 -
362 -/** Turkmen (Türkmençe)
363 - * @author Hanberke
364 - */
365 -$messages['tk'] = array(
366 - 'mwreleases-desc' => 'Goldanylýan wersiýalaryň [[Mediawiki:Mwreleases-list|sanawyny]] goşýar, API bilen baryp bolýar',
367 -);
368 -
369 -/** Tagalog (Tagalog)
370 - * @author AnakngAraw
371 - */
372 -$messages['tl'] = array(
373 - 'mwreleases-desc' => 'Nagdaragdag ng isang [[Mediawiki:Mwreleases-list|talaan]] ng tinatangkilik na mga labas, na mapupuntahan sa pamamagitan ng API',
374 -);
375 -
376 -/** Turkish (Türkçe)
377 - * @author Joseph
378 - */
379 -$messages['tr'] = array(
380 - 'mwreleases-desc' => 'Desteklenen sürümlerin bir [[Mediawiki:Mwreleases-list|listesini]] ekler, API ile erişilebilir',
381 -);
382 -
383 -/** Ukrainian (Українська)
384 - * @author Prima klasy4na
385 - */
386 -$messages['uk'] = array(
387 - 'mwreleases-desc' => 'Додає [[Mediawiki:Mwreleases-list|список]] підтримуваних релізів, доступних через API',
388 -);
389 -
390 -/** Vèneto (Vèneto)
391 - * @author Candalua
392 - */
393 -$messages['vec'] = array(
394 - 'mwreleases-desc' => 'Zonta un [[Mediawiki:Mwreleases-list|elenco]] de version suportà, acessibile tramite API',
395 -);
396 -
397 -/** Vietnamese (Tiếng Việt)
398 - * @author Minh Nguyen
399 - */
400 -$messages['vi'] = array(
401 - 'mwreleases-desc' => 'Thêm [[Mediawiki:Mwreleases-list|danh sách]] phiên bản được hỗ trợ, có thể truy cập qua API.',
402 -);
403 -
404 -/** Cantonese (粵語) */
405 -$messages['yue'] = array(
406 - 'mwreleases-desc' => '加入一個支援發佈嘅[[Mediawiki:Mwreleases-list|一覽]],可經API訪問',
407 -);
408 -
409 -/** Simplified Chinese (‪中文(简体)‬)
410 - * @author PhiLiP
411 - */
412 -$messages['zh-hans'] = array(
413 - 'mwreleases-desc' => '加入支持发布功能的[[Mediawiki:Mwreleases-list|列表]],可经API访问',
414 -);
415 -
416 -/** Traditional Chinese (‪中文(繁體)‬) */
417 -$messages['zh-hant'] = array(
418 - 'mwreleases-desc' => '加入一個支援發佈的[[Mediawiki:Mwreleases-list|列表]],可經API訪問',
419 -);
420 -
 47+$specialPagesAliases['en'] = array(
 48+ 'ReleaseManager' => array( 'ReleaseManager' ),
 49+);
\ No newline at end of file
Index: trunk/extensions/MWReleases/MWReleases.php
@@ -30,7 +30,7 @@
3131 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
3232 */
3333
34 -define( 'MWRELEASES_VERSION', '1.1' );
 34+define( 'MWRELEASES_VERSION', '2.0' );
3535
3636 $wgExtensionCredits['other'][] = array(
3737 'path' => __FILE__,
@@ -42,6 +42,39 @@
4343 );
4444
4545 $dir = dirname( __FILE__ ) . '/';
46 -$wgAutoloadClasses['ApiMWReleases'] = $dir . 'ApiMWReleases.php';
 46+
 47+// Classes
 48+$wgAutoloadClasses['ApiMWReleases'] = $dir . 'api/ApiMWReleases.php';
 49+$wgAutoloadClasses['ReleaseRepo'] = $dir . 'backend/ReleaseRepo.php';
 50+$wgAutoloadClasses['Release'] = $dir . 'backend/Release.php';
 51+$wgAutoloadClasses['MediawikiRelease'] = $dir . 'backend/Release.php';
 52+$wgAutoloadClasses['SpecialDownloadMediawiki'] = $dir . 'ui/SpecialDownloadMediawiki.php';
 53+$wgAutoloadClasses['SpecialReleaseManager'] = $dir . 'ui/SpecialReleaseManager.php';
 54+
 55+// i18n
4756 $wgExtensionMessagesFiles['MWReleases'] = $dir . 'MWReleases.i18n.php';
 57+$wgExtensionAliasesFiles['MWReleases'] = $dir . 'MWReleases.alias.php';
 58+
 59+// API
4860 $wgAPIModules['mwreleases'] = 'ApiMWReleases';
 61+
 62+// Special pages
 63+$wgSpecialPages['DownloadMediawiki'] = 'SpecialDownloadMediawiki';
 64+$wgSpecialPages['ReleaseManager'] = 'SpecialReleaseManager';
 65+
 66+// Hooks
 67+$wgHooks['LoadExtensionSchemaUpdates'][] = 'wfMWReleaseSchemaUpdates';
 68+
 69+/**
 70+ * Base SVN url
 71+ */
 72+$wgMWRSvnUrl = 'http://svn.wikimedia.org/svnroot/mediawiki/';
 73+$wgMWRDownloadUrl = 'http://download.wikimedia.org/mediawiki/';
 74+
 75+/**
 76+ * Schema hook
 77+ */
 78+function wfMWReleaseSchemaUpdates() {
 79+ global $wgExtNewTables;
 80+ $wgExtNewTables['mwreleases'] = dirname(__FILE__) . '/MWReleases.sql';
 81+}
\ No newline at end of file
Index: trunk/extensions/MWReleases/ui/SpecialDownloadMediawiki.php
@@ -0,0 +1,13 @@
 2+<?php
 3+
 4+class SpecialDownloadMediawiki extends SpecialPage {
 5+
 6+ public function __construct() {
 7+ parent::__construct( 'DownloadMediawiki' );
 8+ }
 9+
 10+ public function execute( $par ) {
 11+ $this->setHeaders();
 12+ $releases = ReleaseRepo::singleton()->getSupportedReleases();
 13+ }
 14+}
\ No newline at end of file
Property changes on: trunk/extensions/MWReleases/ui/SpecialDownloadMediawiki.php
___________________________________________________________________
Added: svn:eol-style
115 + native
Index: trunk/extensions/MWReleases/ui/SpecialReleaseManager.php
@@ -0,0 +1,139 @@
 2+<?php
 3+
 4+class SpecialReleaseManager extends SpecialPage {
 5+
 6+ private $rels, $out, $skin = null;
 7+
 8+ public function __construct() {
 9+ parent::__construct( 'ReleaseManager', 'release-manager' );
 10+ }
 11+
 12+ public function execute( $par ) {
 13+ global $wgUser, $wgRequest, $wgOut;
 14+
 15+ if( !$this->userCanExecute( $wgUser ) ) {
 16+ $this->displayRestrictionError();
 17+ return;
 18+ }
 19+
 20+ $this->setHeaders();
 21+ $this->rels = ReleaseRepo::singleton();
 22+ $this->out = $wgOut;
 23+ $this->skin = $wgUser->getSkin();
 24+
 25+ $params = explode( '/', $par );
 26+ switch( $params[0] ) {
 27+ case 'edit':
 28+ if( isset( $params[1] ) ) {
 29+ if( $wgRequest->wasPosted() ) $this->postEdit( $params[1], $wgRequest );
 30+ $this->showEdit( $params[1] );
 31+ }
 32+ break;
 33+ case 'delete':
 34+ if( isset( $params[1] ) ) {
 35+ if( $wgRequest->wasPosted() ) {
 36+ $this->postDelete( $params[1], $wgRequest );
 37+ } else {
 38+ $this->showDelete( $params[1] );
 39+ break;
 40+ }
 41+ }
 42+ case 'add':
 43+ if( $wgRequest->wasPosted() ) $this->postAdd( $wgRequest );
 44+ $this->showAdd();
 45+ break;
 46+ default:
 47+ $this->showList();
 48+ }
 49+
 50+ }
 51+
 52+ private function showList() {
 53+ $this->out->addWikiMsg( 'releasemanager-header' );
 54+ $h = Html::openElement( 'div', array( 'style' => 'text-align:center' ) ) .
 55+ $this->skin->link(
 56+ $this->getTitleFor( 'ReleaseManager', 'create' ),
 57+ wfMsg( 'releasemanager-add' ),
 58+ array( 'style' => 'font-size:175%' )
 59+ ) . Html::element( 'hr' ) . Html::closeElement( 'div' ) .
 60+ Html::openElement( 'table', array( 'class' => 'wikitable plainlinks sortable' ) ) .
 61+ Html::openElement( 'tr' );
 62+ foreach( MediawikiRelease::getFieldNames() as $field ) {
 63+ if( $field == 'id' ) continue;
 64+ $h .= Html::element( 'th', array(), wfMsg( "mwr-field-$field" ) );
 65+ }
 66+ $h .= Html::element( 'th', array(), 'edit/del' ) . Html::closeElement( 'tr' );
 67+ foreach( $this->rels->getAllReleases() as $rel ) {
 68+ $h .= $this->formatReleaseForTable( $rel );
 69+ }
 70+ $h .= Html::closeElement( 'table' );
 71+ $this->out->addHTML( $h );
 72+ }
 73+
 74+ private function formatReleaseForTable( MediawikiRelease $rel ) {
 75+ global $wgLang;
 76+ $branchUrl = $this->skin->makeExternalLink( $rel->getBranchUrl(), $rel->getBranch () );
 77+ $tagUrl = $this->skin->makeExternalLink( $rel->getTagUrl(), $rel->getTag() );
 78+ $announceUrl = $this->skin->makeExternalLink( $rel->getAnnouncement(), 'mediawiki-announce' );
 79+ $supported = $rel->isSupported() ? wfMsg( 'yes' ) : wfMsg( 'no' );
 80+ $flagStatus = $rel->getSupported() > Release::SUPPORT_TIL_EOL ?
 81+ wfMsg( 'releasemanager-supported-overriden', $supported ) :
 82+ wfMsg( 'releasemanager-supported-til-eol', $supported );
 83+ $editDel = $this->skin->link(
 84+ $this->getTitleFor( 'ReleaseManager', 'edit/' . $rel->getId() ),
 85+ wfMsg( 'edit' )
 86+ ) . ' / ' . $this->skin->link(
 87+ $this->getTitleFor( 'ReleaseManager', 'delete/' . $rel->getId() ),
 88+ wfMsg( 'delete' )
 89+ );
 90+ return Html::openElement( 'tr' ) .
 91+ Html::element( 'td', array(), $rel->getName() ) .
 92+ Html::element( 'td', array(), $rel->getNumber() ) .
 93+ Html::element( 'td', array(), 'broken'/* $wgLang->date( $rel->getReleaseDate() ) */ ) .
 94+ Html::element( 'td', array(), 'broken'/* $wgLang->date( $rel->getEOLDate() ) */ ) .
 95+ Html::rawElement( 'td', array(), $branchUrl ) .
 96+ Html::rawElement( 'td', array(), $tagUrl ) .
 97+ Html::rawElement( 'td', array(), $announceUrl ) .
 98+ Html::rawElement( 'td', array(), $flagStatus ) .
 99+ Html::rawElement( 'td', array(), $editDel ) .
 100+ Html::closeElement( 'tr' );
 101+ }
 102+
 103+ private function showAdd() {
 104+ }
 105+
 106+ private function postAdd( $req ) {
 107+ }
 108+
 109+ private function showEdit( $versionId ) {
 110+
 111+ }
 112+
 113+ private function postEdit( $versionId, $wgRequest ) {
 114+ }
 115+
 116+ private function showDelete( $versionId ) {
 117+ if( !$this->rels->releaseExists( $versionId ) ) {
 118+ $this->out->addWikiMsg( 'releasemanager-doesnotexist' );
 119+ return;
 120+ } else {
 121+ $submitUrl = $this->getTitleFor( 'ReleaseManager', "delete/$versionId" )->getFullUrl();
 122+ $this->out->addWikiMsg( 'releasemanager-delete-confirm' );
 123+ $h = Html::openElement( 'form', array( 'action' => $submitUrl,
 124+ 'method' => 'POST' ) ) .
 125+ Html::input( 'submit', wfMsg( 'submit' ), 'submit' ) .
 126+ Html::closeElement( 'form' );
 127+ $this->out->addHTML( $h );
 128+ }
 129+ }
 130+
 131+ private function postDelete( $versionId, $wgRequest ) {
 132+ $rel = $this->rels->getReleaseForId( $versionId );
 133+ if( !$rel ) {
 134+ $this->out->addWikiMsg( 'releasemanager-doesnotexist' );
 135+ return;
 136+ } else {
 137+ $rel->delete();
 138+ }
 139+ }
 140+}
\ No newline at end of file
Property changes on: trunk/extensions/MWReleases/ui/SpecialReleaseManager.php
___________________________________________________________________
Added: svn:eol-style
1141 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r71094Another followup to r71085...reedy22:20, 14 August 2010
r71131Revert back to pre r71085 rewrite. Extension has been obsoleteddemon16:57, 15 August 2010

Comments

#Comment by Reedy (talk | contribs)   22:09, 14 August 2010

Detected bug in an extension! Hook wfMWReleaseSchemaUpdates failed to return a value; should return true to continue hook processing or false to abort. Backtrace:

  1. 0 /home/reedy/mediawiki/trunk/phase3/maintenance/updaters.inc(937): wfRunHooks('LoadExtensionSc...')
  2. 1 /home/reedy/mediawiki/trunk/phase3/maintenance/update.php(44): do_all_updates(false, true)
  3. 2 {main}

Fixed in r71092

Status & tagging log