r66789 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66788‎ | r66789 | r66790 >
Date:11:35, 23 May 2010
Author:werdna
Status:deferred
Tags:
Comment:
Rename ActiveTaskForces to ActiveStrategy extension, and totally reimplement as a parser function instead of a special page.
Modified paths:
  • /trunk/extensions/StrategyWiki/ActiveStrategy (added) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.i18n.php (added) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.php (added) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy_body.php (added) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveTaskForces.i18n.php (deleted) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveTaskForces.php (deleted) (history)
  • /trunk/extensions/StrategyWiki/ActiveStrategy/ActiveTaskForces_body.php (deleted) (history)
  • /trunk/extensions/StrategyWiki/ActiveTaskForces (deleted) (history)

Diff [purge]

Index: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy_body.php
@@ -0,0 +1,74 @@
 2+<?php
 3+
 4+class ActiveStrategy {
 5+ static function getSQL() {
 6+ global $wgActiveStrategyPeriod;
 7+
 8+ $dbr = wfGetDB( DB_SLAVE );
 9+ $revisionTable = $dbr->tableName( 'revision' );
 10+ $pageTable = $dbr->tableName( 'page' );
 11+ $start = time() - $wgActiveStrategyPeriod;
 12+ $encPeriodStart = $dbr->addQuotes( $dbr->timestamp( $start ) );
 13+
 14+ $sql = <<<SQL
 15+ SELECT
 16+ page_namespace AS namespace,
 17+ substring_index(page_title, '/', 2) AS title,
 18+ COUNT(*) AS edits
 19+ FROM $revisionTable
 20+ JOIN $pageTable ON page_id = rev_page
 21+ WHERE
 22+ page_namespace = 0 AND
 23+ page_title LIKE 'Task_force/%' AND
 24+ rev_timestamp > $encPeriodStart
 25+ GROUP BY page_namespace, title
 26+SQL;
 27+ $sql = strtr( $sql, "\r\n\t", ' ' );
 28+ return $sql;
 29+ }
 30+
 31+ static function formatResult( $skin, $result ) {
 32+ global $wgContLang, $wgLang;
 33+
 34+ $title = Title::makeTitle( $result->namespace, $result->title );
 35+ $text = $wgContLang->convert( $title->getPrefixedText() );
 36+ $pageLink = $skin->linkKnown( $title, $text );
 37+ $members = 0;
 38+ $details = '';
 39+
 40+ $numberLink = $skin->linkKnown(
 41+ $title,
 42+ wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ),
 43+ $wgLang->formatNum( $result->edits ) ),
 44+ array(),
 45+ array( 'action' => 'history' )
 46+ );
 47+
 48+ $members = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
 49+ $wgLang->formatNum( $members ) );
 50+
 51+ $details = $wgLang->commaList( array( $numberLink, $members ) );
 52+
 53+ return wfSpecialList( $pageLink, $details );
 54+ }
 55+
 56+ static function getOutput() {
 57+ global $wgUser;
 58+
 59+ $html = '';
 60+ $sql = self::getSQL();
 61+ $db = wfGetDB( DB_MASTER );
 62+ $sk = $wgUser->getSkin();
 63+
 64+ $result = $db->query( $sql, __METHOD__ );
 65+
 66+ foreach( $result as $row ) {
 67+ $html .= Xml::tags( 'li', null, self::formatResult( $sk, $row ) );
 68+ }
 69+
 70+ $html = Xml::tags( 'ul', null, $html );
 71+
 72+ return $html;
 73+ }
 74+}
 75+
Property changes on: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy_body.php
___________________________________________________________________
Name: svn:eol-style
176 + native
Index: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.i18n.php
@@ -0,0 +1,230 @@
 2+<?php
 3+
 4+$messages = array();
 5+$messages['en'] = array(
 6+ 'activestrategy' => 'Active Strategy',
 7+ 'active-strategy-desc' => 'Shows number of edits to strategic planning pages',
 8+ 'active-strategy-intro' => 'Number of edits to task force pages in the last {{PLURAL:$1|$1 day|$1 days}}.',
 9+);
 10+
 11+/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
 12+ * @author EugeneZelenko
 13+ * @author Jim-by
 14+ */
 15+$messages['be-tarask'] = array(
 16+ 'activestrategy' => 'Актыўныя працоўныя групы',
 17+ 'active-strategy-desc' => 'Паказаць колькасьць рэдагаваньняў для старонак спэцыяльнай групы',
 18+ 'active-strategy-intro' => 'Колькасьць рэдагаваньняў старонак працоўнай групай за $1 {{PLURAL:$1|апошні дзень|апошнія дні|апошніх дзён}}.',
 19+);
 20+
 21+/** Breton (Brezhoneg)
 22+ * @author Fulup
 23+ * @author Y-M D
 24+ */
 25+$messages['br'] = array(
 26+ 'activestrategy' => 'Strolladoù labour oberient',
 27+ 'active-strategy-desc' => 'Diskwel a ra an niver a wezhioù eo bet kemmet pajennoù ar strollad labour',
 28+ 'active-strategy-intro' => 'Niver a gemm pajennoù evit ar strollad labour e-kerzh an {{PLURAL:$1|devezh ziwezhañ|$1 zevezh ziwezhañ}}.',
 29+);
 30+
 31+/** German (Deutsch)
 32+ * @author Kghbln
 33+ */
 34+$messages['de'] = array(
 35+ 'activestrategy' => 'Aktive Arbeitsgruppen',
 36+ 'active-strategy-desc' => 'Zeigt die Anzahl Bearbeitungen an Seiten von Arbeitsgruppen an',
 37+ 'active-strategy-intro' => 'Anzahl der Bearbeitungen auf den Seiten der Arbeitsgruppen während {{PLURAL:$1|des letzten Tages|der letzten $1 Tage}}.',
 38+);
 39+
 40+/** Lower Sorbian (Dolnoserbski)
 41+ * @author Michawiki
 42+ */
 43+$messages['dsb'] = array(
 44+ 'activestrategy' => 'Aktiwne źěłowe kupki',
 45+ 'active-strategy-desc' => 'Pokazujo licbu změnow na bokach źěłowych kupkow',
 46+ 'active-strategy-intro' => 'Licba změnow na źěłowych kupkach za {{PLURAL:$1|zachadny $1 źeń|zachadnej $1 dnja|zachadne $1 dny|zachadnych $1 dnjow}}.',
 47+);
 48+
 49+/** Spanish (Español)
 50+ * @author Ascánder
 51+ * @author Crazymadlover
 52+ */
 53+$messages['es'] = array(
 54+ 'activestrategy' => 'Fuerzas de trabajo activas',
 55+ 'active-strategy-desc' => 'Muestra el número de ediciones a las páginas de grupo de trabajo',
 56+ 'active-strategy-intro' => 'Número de ediciones a las páginas del grupo de trabajo en los últimos {{PLURAL:$1|$1 día|$1 días}}.',
 57+);
 58+
 59+/** French (Français)
 60+ * @author IAlex
 61+ * @author Peter17
 62+ */
 63+$messages['fr'] = array(
 64+ 'activestrategy' => 'Groupes de travail actifs',
 65+ 'active-strategy-desc' => 'Affiche le nombre de modifications des pages du groupe de travail',
 66+ 'active-strategy-intro' => 'Nombre de modifications des pages du groupe de travail au cours {{PLURAL:$1|du dernier jour|des $1 derniers jours}}.',
 67+);
 68+
 69+/** Galician (Galego)
 70+ * @author Toliño
 71+ */
 72+$messages['gl'] = array(
 73+ 'activestrategy' => 'Grupos de traballo activos',
 74+ 'active-strategy-desc' => 'Mostra o número de edicións nas páxinas do grupo de traballo',
 75+ 'active-strategy-intro' => 'Número de edicións das páxinas do grupo de traballo {{PLURAL:$1|no último día|nos últimos $1 días}}.',
 76+);
 77+
 78+/** Swiss German (Alemannisch)
 79+ * @author Als-Holder
 80+ */
 81+$messages['gsw'] = array(
 82+ 'activestrategy' => 'Aktivi Arbetsgruppe',
 83+ 'active-strategy-desc' => 'Zeigt d Aazahl vu Bearbeitige an Syte vu Arbetsgruppe aa',
 84+ 'active-strategy-intro' => 'Aazahl vu Bearbeitige an Arbetsgruppesyte {{PLURAL:$1|am letschte Tag|in dr letschte $1 Täg}}.',
 85+);
 86+
 87+/** Upper Sorbian (Hornjoserbsce)
 88+ * @author Michawiki
 89+ */
 90+$messages['hsb'] = array(
 91+ 'activestrategy' => 'Aktiwne dźěłarnički',
 92+ 'active-strategy-desc' => 'Pokazuje ličbu změnow na stronach dźěłarničkow',
 93+ 'active-strategy-intro' => 'Ličba změnow na stronach dźěłarničkow za {{PLURAL:$1|zańdźeny $1 dźeń|zańdźenej $1 dnjej|zańdźene $1 dny|zańdźenych $1 dnjow}}.',
 94+);
 95+
 96+/** Hungarian (Magyar)
 97+ * @author Glanthor Reviol
 98+ */
 99+$messages['hu'] = array(
 100+ 'activestrategy' => 'Aktív munkacsoportok',
 101+ 'active-strategy-desc' => 'Megjeleníti az egyes munkacsoport lapokon végzett szerkesztések számát',
 102+ 'active-strategy-intro' => 'Szerkesztések száma a munkacsoport lapokon az elmúlt $1 napban.',
 103+);
 104+
 105+/** Interlingua (Interlingua)
 106+ * @author McDutchie
 107+ */
 108+$messages['ia'] = array(
 109+ 'activestrategy' => 'Gruppos de labor active',
 110+ 'active-strategy-desc' => 'Monstra le numero de modificationes de paginas de gruppo de labor',
 111+ 'active-strategy-intro' => 'Numero de modificationes in paginas de gruppos de labor in le ultime {{PLURAL:$1|die|$1 dies}}.',
 112+);
 113+
 114+/** Japanese (日本語)
 115+ * @author Aotake
 116+ * @author 青子守歌
 117+ */
 118+$messages['ja'] = array(
 119+ 'activestrategy' => '活動中の特別チーム',
 120+ 'active-strategy-desc' => 'タスクフォースのページ数を表示',
 121+ 'active-strategy-intro' => '最近$1日間に特別チームのページに加えられた編集回数',
 122+);
 123+
 124+/** Korean (한국어)
 125+ * @author Kwj2772
 126+ */
 127+$messages['ko'] = array(
 128+ 'activestrategy' => '활동 중인 태스크 포스',
 129+ 'active-strategy-desc' => '태스크 포스 문서에 대한 편집 수를 표시',
 130+ 'active-strategy-intro' => '최근 $1일동안의 태스크 포스 문서에 대한 편집 횟수입니다.',
 131+);
 132+
 133+/** Luxembourgish (Lëtzebuergesch)
 134+ * @author Robby
 135+ */
 136+$messages['lb'] = array(
 137+ 'activestrategy' => 'Aktiv Aarbechtsgruppen',
 138+ 'active-strategy-desc' => "Weist d'Zuel vun den Ännerungen op Säite vun der Task Force",
 139+ 'active-strategy-intro' => 'Zuel vun den Ännerungen op Säite vum Aarbechtsgrupp {{PLURAL:$1|de leschten Dag|an de leschten $1 Deeg}}.',
 140+);
 141+
 142+/** Macedonian (Македонски)
 143+ * @author Bjankuloski06
 144+ */
 145+$messages['mk'] = array(
 146+ 'activestrategy' => 'Активни работни групи',
 147+ 'active-strategy-desc' => 'Прикажува број на уредувања на страници на работната група',
 148+ 'active-strategy-intro' => 'Број на уредувања на страници на работни групи во {{PLURAL:$1|изминатиот $1 ден|изминатите $1 дена}}.',
 149+);
 150+
 151+/** Malayalam (മലയാളം)
 152+ * @author Praveenp
 153+ */
 154+$messages['ml'] = array(
 155+ 'activestrategy' => 'സജീവ കർത്തവ്യ സേനകൾ',
 156+ 'active-strategy-desc' => 'കർത്തവ്യ സേനയുടെ താളുകളിലെ തിരുത്തലുകളുടെ എണ്ണം കാട്ടുക',
 157+ 'active-strategy-intro' => 'കർത്തവ്യ സേനയുടെ താളുകളിൽ കഴിഞ്ഞ {{PLURAL:$1|ഒരു ദിവസം|$1 ദിവസങ്ങൾക്കുള്ളിൽ}} നടന്ന തിരുത്തലുകളുടെ എണ്ണം.',
 158+);
 159+
 160+/** Dutch (Nederlands)
 161+ * @author Siebrand
 162+ */
 163+$messages['nl'] = array(
 164+ 'activestrategy' => 'Actieve taskforces',
 165+ 'active-strategy-desc' => "Geeft het aantal bewerkingen aan taskforcepagina's weer",
 166+ 'active-strategy-intro' => "Aantal bewerkingen aan taskforcepagina's in de afgelopen {{PLURAL:$1|dag|$1 dagen}}.",
 167+);
 168+
 169+/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
 170+ * @author Laaknor
 171+ */
 172+$messages['no'] = array(
 173+ 'activestrategy' => 'Aktive arbeidsgrupper',
 174+ 'active-strategy-desc' => 'Viser antall redigeringer på arbeidsgruppesider',
 175+ 'active-strategy-intro' => 'Antall redigeringer på arbeidsgruppesider {{PLURAL:$1|den siste $1 dag|de siste $1 dager}}.',
 176+);
 177+
 178+/** Occitan (Occitan)
 179+ * @author Cedric31
 180+ */
 181+$messages['oc'] = array(
 182+ 'activestrategy' => 'Gropes de trabalh actius',
 183+ 'active-strategy-intro' => 'Nombre de modificacions de las paginas del grop de trabalh al cors {{PLURAL:$1|del darrièr jorn|dels $1 darrièrs jorns}}.',
 184+);
 185+
 186+/** Piedmontese (Piemontèis)
 187+ * @author Borichèt
 188+ * @author Dragonòt
 189+ */
 190+$messages['pms'] = array(
 191+ 'activestrategy' => 'Echip ëd travaj ative',
 192+ 'active-strategy-desc' => 'Mostra ël nùmer ëd modìfiche a le pàgine dla partìa ëd travaj',
 193+ 'active-strategy-intro' => "Nùmer ëd modìfiche a le pàgine dl'echip ëd travaj ant {{PLURAL:$1|l'ùltim di|j'ùltim $1 di}}.",
 194+);
 195+
 196+/** Portuguese (Português)
 197+ * @author Hamilton Abreu
 198+ */
 199+$messages['pt'] = array(
 200+ 'activestrategy' => 'Grupos de trabalho activos',
 201+ 'active-strategy-desc' => 'Mostra o número de edições das páginas da equipa de trabalho',
 202+ 'active-strategy-intro' => 'Número de edições às páginas dos grupos de trabalho {{PLURAL:$1|no último dia|nos últimos $1 dias}}.',
 203+);
 204+
 205+/** Russian (Русский)
 206+ * @author Александр Сигачёв
 207+ */
 208+$messages['ru'] = array(
 209+ 'activestrategy' => 'Активные комиссии',
 210+ 'active-strategy-desc' => 'Показывает число правок на страницах целевых групп',
 211+ 'active-strategy-intro' => 'Количество правок страниц комиссий за {{PLURAL:$1|последний $1 день|последние $1 дня|последние $1 дней}}.',
 212+);
 213+
 214+/** Swedish (Svenska)
 215+ * @author Dafer45
 216+ */
 217+$messages['sv'] = array(
 218+ 'activestrategy' => 'Aktiva arbetsgrupper',
 219+ 'active-strategy-desc' => 'Visar antal redigeringar på arbetsgruppsidor',
 220+ 'active-strategy-intro' => 'Antal redigeringar av arbetsgruppsidor under senaste ((PLURALIS: $1 | $1 dagen | $1 dagarna)).',
 221+);
 222+
 223+/** Traditional Chinese (‪中文(繁體)‬)
 224+ * @author Horacewai2
 225+ */
 226+$messages['zh-hant'] = array(
 227+ 'activestrategy' => '積極工作隊',
 228+ 'active-strategy-desc' => '以數字顯示工作隊的編輯頁面',
 229+ 'active-strategy-intro' => '此頁面編輯數 (在過去{{PLURAL:$1|$1日|$1日}})',
 230+);
 231+
Property changes on: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.i18n.php
___________________________________________________________________
Name: svn:eol-style
1232 + native
Index: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.php
@@ -0,0 +1,24 @@
 2+<?php
 3+
 4+/* Registration */
 5+$wgExtensionCredits['specialpage'][] = array(
 6+ 'path' => __FILE__,
 7+ 'name' => 'ActiveStrategy',
 8+ 'author' => array( 'Tim Starling', 'Andrew Garrett' ),
 9+ 'url' => 'http://www.mediawiki.org/wiki/Extension:ActiveStrategy',
 10+ 'descriptionmsg' => 'active-strategy-desc',
 11+);
 12+
 13+$dir = dirname( __FILE__ ) . '/';
 14+
 15+$wgHooks['ParserFirstCallInit'][] = 'ActiveStrategyPF::setup';
 16+
 17+$wgExtensionMessagesFiles['ActiveStrategy'] = $dir . 'ActiveStrategy.i18n.php';
 18+
 19+$wgAutoloadClasses['ActiveStrategy'] = $dir . 'ActiveStrategy_body.php';
 20+$wgAutoloadClasses['ActiveStrategyPF'] = $dir."ParserFunctions.php";
 21+
 22+/**
 23+ * Period for edit counts, in seconds
 24+ */
 25+$wgActiveStrategyPeriod = 7 * 86400;
Property changes on: trunk/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy.php
___________________________________________________________________
Name: svn:eol-style
126 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r66810Follow-up r66789: Update for translatewikiraymond21:25, 23 May 2010
r66811Follow-up r66789: Update for translatewikiraymond21:29, 23 May 2010

Status & tagging log