Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -589,8 +589,9 @@ |
590 | 590 | $wgLogTypes[] = 'stable'; |
591 | 591 | $wgLogNames['stable'] = 'stable-logpage'; |
592 | 592 | $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 |
595 | 596 | |
596 | 597 | # AJAX functions |
597 | 598 | $wgAjaxExportList[] = 'RevisionReview::AjaxReview'; |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -205,8 +205,9 @@ |
206 | 206 | 'rights-editor-autosum' => 'autopromoted', |
207 | 207 | 'rights-editor-revoke' => 'removed editor status from [[$1]]', # B/C |
208 | 208 | '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', |
211 | 212 | 'stable-log-restriction' => 'Publish: require "$1" permission', |
212 | 213 | 'stable-logpage' => 'Stability log', |
213 | 214 | '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 @@ |
311 | 311 | $settings = ''; // no level, expiry info |
312 | 312 | } else { |
313 | 313 | $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, |
315 | 318 | FlaggedRevsLogs::collapseParams( $params ) ); |
316 | 319 | $type = "stable-logentry-config"; |
317 | 320 | // Settings message in text form (e.g. [x=a,y=b,z]) |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1610,15 +1610,16 @@ |
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | public static function logLineLinks( |
1614 | | - $type, $action, $title = null, $params, &$comment, &$rv, $ts |
| 1614 | + $type, $action, $title, $params, &$comment, &$rv, $ts |
1615 | 1615 | ) { |
1616 | 1616 | if ( !$title ) { |
1617 | | - return true; // nothing to do |
| 1617 | + return true; // sanity check |
| 1618 | + } |
1618 | 1619 | // Stability log |
1619 | | - } else if ( $type == 'stable' ) { |
| 1620 | + if ( $type == 'stable' && FlaggedRevsLogs::isStabilityAction( $action ) ) { |
1620 | 1621 | $rv .= FlaggedRevsLogs::stabilityLogLinks( $title, $ts, $params ); |
1621 | 1622 | // Review log |
1622 | | - } else if ( $type == 'review' && FlaggedRevsLogs::isReviewAction( $action ) ) { |
| 1623 | + } elseif ( $type == 'review' && FlaggedRevsLogs::isReviewAction( $action ) ) { |
1623 | 1624 | $rv .= FlaggedRevsLogs::reviewLogLinks( $action, $title, $params ); |
1624 | 1625 | } |
1625 | 1626 | return true; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsLogs.php |
— | — | @@ -3,13 +3,21 @@ |
4 | 4 | class FlaggedRevsLogs { |
5 | 5 | /** |
6 | 6 | * $action is a valid review log action |
7 | | - * @returns bool $action is a valid review log action |
| 7 | + * @returns bool |
8 | 8 | */ |
9 | 9 | public static function isReviewAction( $action ) { |
10 | 10 | return preg_match( '/^(approve2?(-i|-a|-ia)?|unapprove2?)$/', $action ); |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
| 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 | + /** |
14 | 22 | * $action is a valid review log deprecate action |
15 | 23 | * @returns bool |
16 | 24 | */ |
— | — | @@ -17,9 +25,33 @@ |
18 | 26 | return ( $action == 'unapprove' || $action == 'unapprove2' ); |
19 | 27 | } |
20 | 28 | |
| 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 | + |
21 | 54 | /** |
22 | | - * (a) Add setting change description |
23 | | - * (b) Add history page link |
| 55 | + * Add history page link to log line |
24 | 56 | * |
25 | 57 | * @param Title $title |
26 | 58 | * @param string $timestamp |
— | — | @@ -28,8 +60,6 @@ |
29 | 61 | */ |
30 | 62 | public static function stabilityLogLinks( $title, $timestamp, $params ) { |
31 | 63 | global $wgUser; |
32 | | - $pars = self::expandParams( $params ); // list -> assoc array |
33 | | - $settings = self::stabilitySettings( $pars, false ); // list of setting values |
34 | 64 | # Add history link showing edits right before the config change |
35 | 65 | $hist = $wgUser->getSkin()->link( |
36 | 66 | $title, |
— | — | @@ -38,7 +68,7 @@ |
39 | 69 | array( 'action' => 'history', 'offset' => $timestamp ) |
40 | 70 | ); |
41 | 71 | $hist = wfMsgHtml( 'parentheses', $hist ); |
42 | | - return "$settings $hist"; |
| 72 | + return $hist; |
43 | 73 | } |
44 | 74 | |
45 | 75 | /** |