r66669 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66668‎ | r66669 | r66670 >
Date:23:57, 19 May 2010
Author:aaron
Status:ok
Tags:
Comment:
* Added stable-logentry-modify action
* Fixed stability logs in RC
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsLogs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -589,8 +589,9 @@
590590 $wgLogTypes[] = 'stable';
591591 $wgLogNames['stable'] = 'stable-logpage';
592592 $wgLogHeaders['stable'] = 'stable-logpagetext';
593 -$wgLogActions['stable/config'] = 'stable-logentry-config';
594 -$wgLogActions['stable/reset'] = 'stable-logentry-reset';
 593+$wgLogActionsHandlers['stable/config'] = 'FlaggedRevsLogs::stabilityLogText'; // customize
 594+$wgLogActionsHandlers['stable/modify'] = 'FlaggedRevsLogs::stabilityLogText'; // re-customize
 595+$wgLogActionsHandlers['stable/reset'] = 'FlaggedRevsLogs::stabilityLogText'; // reset
595596
596597 # AJAX functions
597598 $wgAjaxExportList[] = 'RevisionReview::AjaxReview';
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -205,8 +205,9 @@
206206 'rights-editor-autosum' => 'autopromoted',
207207 'rights-editor-revoke' => 'removed editor status from [[$1]]', # B/C
208208 'specialpages-group-quality' => 'Edit approval',
209 - 'stable-logentry-config' => 'configured publication settings for [[$1]]',
210 - 'stable-logentry-reset' => 'reset publication settings for [[$1]]',
 209+ 'stable-logentry-config' => 'set publication settings for $1',
 210+ 'stable-logentry-modify' => 'changed publication settings for $1',
 211+ 'stable-logentry-reset' => 'reset publication settings for $1',
211212 'stable-log-restriction' => 'Publish: require "$1" permission',
212213 'stable-logpage' => 'Stability log',
213214 'stable-logpagetext' => 'This is a log of changes to the [[{{MediaWiki:Validationpage}}|published version]] configuration of content pages.',
Index: trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php
@@ -310,7 +310,10 @@
311311 $settings = ''; // no level, expiry info
312312 } else {
313313 $params = $this->getLogParams();
314 - $log->addEntry( 'config', $this->page, $this->reason,
 314+ $action = ( $this->oldConfig === FlaggedRevs::getDefaultVisibilitySettings() )
 315+ ? 'config' // set a custom configuration
 316+ : 'modify'; // modified an existing custom configuration
 317+ $log->addEntry( $action, $this->page, $this->reason,
315318 FlaggedRevsLogs::collapseParams( $params ) );
316319 $type = "stable-logentry-config";
317320 // Settings message in text form (e.g. [x=a,y=b,z])
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1610,15 +1610,16 @@
16111611 }
16121612
16131613 public static function logLineLinks(
1614 - $type, $action, $title = null, $params, &$comment, &$rv, $ts
 1614+ $type, $action, $title, $params, &$comment, &$rv, $ts
16151615 ) {
16161616 if ( !$title ) {
1617 - return true; // nothing to do
 1617+ return true; // sanity check
 1618+ }
16181619 // Stability log
1619 - } else if ( $type == 'stable' ) {
 1620+ if ( $type == 'stable' && FlaggedRevsLogs::isStabilityAction( $action ) ) {
16201621 $rv .= FlaggedRevsLogs::stabilityLogLinks( $title, $ts, $params );
16211622 // Review log
1622 - } else if ( $type == 'review' && FlaggedRevsLogs::isReviewAction( $action ) ) {
 1623+ } elseif ( $type == 'review' && FlaggedRevsLogs::isReviewAction( $action ) ) {
16231624 $rv .= FlaggedRevsLogs::reviewLogLinks( $action, $title, $params );
16241625 }
16251626 return true;
Index: trunk/extensions/FlaggedRevs/FlaggedRevsLogs.php
@@ -3,13 +3,21 @@
44 class FlaggedRevsLogs {
55 /**
66 * $action is a valid review log action
7 - * @returns bool $action is a valid review log action
 7+ * @returns bool
88 */
99 public static function isReviewAction( $action ) {
1010 return preg_match( '/^(approve2?(-i|-a|-ia)?|unapprove2?)$/', $action );
1111 }
1212
1313 /**
 14+ * $action is a valid stability log action
 15+ * @returns bool
 16+ */
 17+ public static function isStabilityAction( $action ) {
 18+ return preg_match( '/^(config|modify|reset)$/', $action );
 19+ }
 20+
 21+ /**
1422 * $action is a valid review log deprecate action
1523 * @returns bool
1624 */
@@ -17,9 +25,33 @@
1826 return ( $action == 'unapprove' || $action == 'unapprove2' );
1927 }
2028
 29+ /**
 30+ * Add setting change description to log line
 31+ * @returns string
 32+ */
 33+ public static function stabilityLogText(
 34+ $type, $action, $title = null, $skin = null, $params = array()
 35+ ) {
 36+ if ( !$title ) {
 37+ return ''; // sanity check
 38+ }
 39+ $text = '';
 40+ if ( $skin ) {
 41+ $titleLink = $skin->link( $title, $title->getPrefixedText() );
 42+ $text = wfMsgHtml( "stable-logentry-{$action}", $titleLink );
 43+ } else { // for content (e.g. IRC...)
 44+ $text = wfMsgExt( "stable-logentry-{$action}",
 45+ array( 'parsemag', 'escape', 'replaceafter', 'content' ),
 46+ $title->getPrefixedText() );
 47+ }
 48+ $pars = self::expandParams( $params ); // list -> assoc array
 49+ $details = self::stabilitySettings( $pars, !$skin ); // list of setting values
 50+ $text .= " $details";
 51+ return $text;
 52+ }
 53+
2154 /**
22 - * (a) Add setting change description
23 - * (b) Add history page link
 55+ * Add history page link to log line
2456 *
2557 * @param Title $title
2658 * @param string $timestamp
@@ -28,8 +60,6 @@
2961 */
3062 public static function stabilityLogLinks( $title, $timestamp, $params ) {
3163 global $wgUser;
32 - $pars = self::expandParams( $params ); // list -> assoc array
33 - $settings = self::stabilitySettings( $pars, false ); // list of setting values
3464 # Add history link showing edits right before the config change
3565 $hist = $wgUser->getSkin()->link(
3666 $title,
@@ -38,7 +68,7 @@
3969 array( 'action' => 'history', 'offset' => $timestamp )
4070 );
4171 $hist = wfMsgHtml( 'parentheses', $hist );
42 - return "$settings $hist";
 72+ return $hist;
4373 }
4474
4575 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r66704MFT r66384-r66669aaron19:27, 20 May 2010

Status & tagging log