r72501 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72500‎ | r72501 | r72502 >
Date:17:26, 6 September 2010
Author:siebrand
Status:deferred
Tags:
Comment:
Remove old style meta message groups for MediaWiki extensions and Wikia MediaWiki extensions in favour of YAML style aggregate group definitions.
Modified paths:
  • /trunk/extensions/Translate/groups/MediaWiki/ExtensionsAgg.yaml (modified) (history)
  • /trunk/extensions/Translate/groups/MediaWikiExtensions.php (modified) (history)
  • /trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/groups/MediaWiki/ExtensionsAgg.yaml
@@ -1,5 +1,5 @@
22 BASIC:
3 - id: ext-0-all1
 3+ id: ext-0-all
44 label: MediaWiki extensions
55 display: ext
66 meta: yes
Index: trunk/extensions/Translate/groups/Wikia/WikiaExtensions.php
@@ -24,84 +24,4 @@
2525 $this->definitionFile = $dir . '/extensions.txt';
2626 $this->path = "$wgTranslateGroupRoot/wikia/";
2727 }
28 -
29 - protected function addAllMeta() {
30 - global $wgTranslateAC, $wgTranslateEC;
31 -
32 - $meta = array(
33 - 'wikia-0-all' => 'AllWikiaExtensionsGroup',
34 - );
35 -
36 - foreach ( $meta as $id => $g ) {
37 - $wgTranslateAC[$id] = $g;
38 - $wgTranslateEC[] = $id;
39 - }
40 - }
4128 }
42 -
43 -/**
44 - * Adds a message group containing all supported Wikia extensions in the
45 - * Wikia Subversion repository and the Wikimedia Subversion.
46 - *
47 - * @todo Migrate to yaml configuration
48 - */
49 -class AllWikiaExtensionsGroup extends AllMediawikiExtensionsGroup {
50 - protected $description = '{{int:translate-group-desc-wikiaextensions}}';
51 - protected $label = 'Extensions used by Wikia'; // currently using 1.14.0
52 - protected $id = 'wikia-0-all';
53 - protected $meta = true;
54 - protected $type = 'wikia';
55 - protected $classes = null;
56 -
57 - protected $wikiaextensions = array(
58 - 'ext-antibot',
59 - 'ext-categorytree',
60 - 'ext-charinsert',
61 - 'ext-checkuser',
62 - 'ext-cite',
63 - 'ext-confirmedit',
64 - 'ext-dismissablesitenotice',
65 - 'ext-dplforum',
66 - 'ext-editcount',
67 - 'ext-findspam',
68 - 'ext-googlemaps',
69 - 'ext-imagemap',
70 - 'ext-importfreeimages',
71 - 'ext-inputbox',
72 - 'ext-lookupuser',
73 - 'ext-multiupload',
74 - 'ext-parserfunctions',
75 - 'ext-poem',
76 - 'ext-randomimage',
77 - 'ext-spamblacklist',
78 - 'ext-stringfunctions',
79 - 'ext-timeline',
80 - 'ext-torblock',
81 - 'ext-wikihiero',
82 - );
83 -
84 - protected function init() {
85 - if ( $this->classes === null ) {
86 - $this->classes = array();
87 -
88 - $classes = MessageGroups::singleton()->getGroups();
89 -
90 - // Add regular MediaWiki extensions
91 - foreach ( $this->wikiaextensions as $key ) {
92 - $this->classes[$key] = $classes[$key];
93 - }
94 -
95 - // Add extensions that have a wikia- prefix
96 - foreach ( $classes as $index => $class ) {
97 - if ( ( strpos( $index, 'wikia-' ) === 0 ) && !$class->isMeta() && $class->exists() ) {
98 - $this->classes[$index] = $classes[$index];
99 - $this->wikiaextensions[] = $index;
100 - }
101 - }
102 - }
103 - }
104 -
105 - public function wikiaextensions() {
106 - return $this->wikiaextensions;
107 - }
108 -}
Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php
@@ -184,23 +184,8 @@
185185 $wgTranslateAC[$id] = array( $this, 'factory' );
186186 $wgTranslateEC[] = $id;
187187 }
188 -
189 - $this->addAllMeta();
190188 }
191189
192 - protected function addAllMeta() {
193 - global $wgTranslateAC, $wgTranslateEC;
194 -
195 - $meta = array(
196 - 'ext-0-all' => 'AllMediawikiExtensionsGroup',
197 - );
198 -
199 - foreach ( $meta as $id => $g ) {
200 - $wgTranslateAC[$id] = $g;
201 - $wgTranslateEC[] = $id;
202 - }
203 - }
204 -
205190 public function factory( $id ) {
206191 $info = $this->groups[$id];
207192 $group = ExtensionMessageGroup::factory( $info['name'], $id );
@@ -230,81 +215,3 @@
231216 return $group;
232217 }
233218 }
234 -
235 -/**
236 - * Adds a message group containing all supported %MediaWiki extensions in the
237 - * Wikimedia Subversion repository.
238 - * @deprecated Replaced by AggregateMessageGroup and yaml configuration.
239 - */
240 -class AllMediawikiExtensionsGroup extends MessageGroupOld {
241 - protected $label = 'MediaWiki extensions';
242 - protected $id = 'ext-0-all';
243 - protected $meta = true;
244 - protected $type = 'mediawiki';
245 - protected $classes = null;
246 - protected $description = '{{int:translate-group-desc-mediawikiextensions}}';
247 -
248 - // Don't add the (mw ext) thingie
249 - public function getLabel() { return $this->label; }
250 -
251 - protected function init() {
252 - if ( $this->classes === null ) {
253 - $this->classes = MessageGroups::singleton()->getGroups();
254 - foreach ( $this->classes as $index => $class ) {
255 - if ( ( strpos( $class->getId(), 'ext-' ) !== 0 ) || $class->isMeta() || !$class->exists() ) {
256 - unset( $this->classes[$index] );
257 - }
258 - }
259 - }
260 - }
261 -
262 - public function load( $code ) {
263 - $this->init();
264 - $array = array();
265 - foreach ( $this->classes as $class ) {
266 - // Use wfArrayMerge because of string keys
267 - $array = wfArrayMerge( $array, $class->load( $code ) );
268 - }
269 - return $array;
270 - }
271 -
272 - public function getMessage( $key, $code ) {
273 - $this->init();
274 - $msg = null;
275 - foreach ( $this->classes as $class ) {
276 - $msg = $class->getMessage( $key, $code );
277 - if ( $msg !== null ) return $msg;
278 - }
279 - return null;
280 - }
281 -
282 - function getDefinitions() {
283 - $this->init();
284 - $array = array();
285 - foreach ( $this->classes as $class ) {
286 - // Use wfArrayMerge because of string keys
287 - $array = wfArrayMerge( $array, $class->getDefinitions() );
288 - }
289 - return $array;
290 - }
291 -
292 - function getBools() {
293 - $this->init();
294 - $bools = parent::getBools();
295 - foreach ( $this->classes as $class ) {
296 - $newbools = ( $class->getBools() );
297 - if ( count( $newbools['optional'] ) || count( $newbools['ignored'] ) ) {
298 - $bools = array_merge_recursive( $bools, $class->getBools() );
299 - }
300 - }
301 - return $bools;
302 - }
303 -
304 - public function exists() {
305 - $this->init();
306 - foreach ( $this->classes as $class ) {
307 - if ( $class->exists() ) return true;
308 - }
309 - return false;
310 - }
311 -}

Follow-up revisions

RevisionCommit summaryAuthorDate
r72520Remove autoload for which was removed in r72501.siebrand07:52, 7 September 2010

Status & tagging log