Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
— | — | @@ -865,11 +865,26 @@ |
866 | 866 | $article = new Article( |
867 | 867 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
868 | 868 | ); |
| 869 | + |
| 870 | + $bodyPage = Title::newFromText( |
| 871 | + "Centralnotice-template-{$name}", NS_MEDIAWIKI ); |
| 872 | + $curRev = Revision::newFromTitle( $bodyPage ); |
| 873 | + $oldbody = $curRev ? $curRev->getText() : ''; |
| 874 | + |
869 | 875 | $article->doEdit( $body, '', EDIT_FORCE_BOT ); |
870 | 876 | |
| 877 | + $curRev = Revision::newFromTitle( $bodyPage ); |
| 878 | + $newbody = $curRev ? $curRev->getText() : ''; |
| 879 | + |
| 880 | + //test for body changes |
| 881 | + $contentChanged = 0; |
| 882 | + if ($newbody !== $oldbody){ |
| 883 | + $contentChanged = 1; |
| 884 | + } |
| 885 | + |
871 | 886 | $bannerId = SpecialNoticeTemplate::getTemplateId( $name ); |
872 | 887 | $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name ); |
873 | | - $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings ); |
| 888 | + $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings, $contentChanged); |
874 | 889 | |
875 | 890 | return; |
876 | 891 | } |
— | — | @@ -993,7 +1008,7 @@ |
994 | 1009 | * @param $endContent banner content after changes (optional) |
995 | 1010 | */ |
996 | 1011 | function logBannerChange( $action, $bannerId, $beginSettings = array(), |
997 | | - $endSettings = array(), $beginContent = null, $endContent = null ) |
| 1012 | + $endSettings = array(), $contentChanged = 0 ) |
998 | 1013 | { |
999 | 1014 | global $wgUser; |
1000 | 1015 | |
— | — | @@ -1004,7 +1019,8 @@ |
1005 | 1020 | 'tmplog_user_id' => $wgUser->getId(), |
1006 | 1021 | 'tmplog_action' => $action, |
1007 | 1022 | 'tmplog_template_id' => $bannerId, |
1008 | | - 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ) |
| 1023 | + 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ), |
| 1024 | + 'tmplog_content_change' => $contentChanged |
1009 | 1025 | ); |
1010 | 1026 | |
1011 | 1027 | foreach ( $beginSettings as $key => $value ) { |
Index: trunk/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | * Sort the log list by timestamp |
138 | 138 | */ |
139 | 139 | function getIndexField() { |
140 | | - return 'notlog_timestamp'; |
| 140 | + return 'notlog_timestamp'; |
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | ); |
151 | 151 | } |
152 | 152 | |
153 | | - /** |
| 153 | + /** |
154 | 154 | * Generate the content of each table row (1 row = 1 log entry) |
155 | 155 | */ |
156 | 156 | function formatRow( $row ) { |
— | — | @@ -423,7 +423,7 @@ |
424 | 424 | |
425 | 425 | } |
426 | 426 | |
427 | | -class CentralNoticeBannerLogPager extends ReverseChronologicalPager { |
| 427 | +class CentralNoticeBannerLogPager extends CentralNoticeLogPager { |
428 | 428 | var $viewPage, $special; |
429 | 429 | |
430 | 430 | function __construct( $special ) { |
— | — | @@ -588,6 +588,7 @@ |
589 | 589 | $details .= $this->testBooleanChange( 'anon', $row ); |
590 | 590 | $details .= $this->testBooleanChange( 'account', $row ); |
591 | 591 | $details .= $this->testBooleanChange( 'fundraising', $row ); |
| 592 | + $details .= $this->testTextChange( 'landingpages', $row ); |
592 | 593 | if ( $row->tmplog_content_change ) { |
593 | 594 | // Show changes to banner content |
594 | 595 | $details .= wfMsg ( |
— | — | @@ -616,4 +617,22 @@ |
617 | 618 | } |
618 | 619 | return $result; |
619 | 620 | } |
| 621 | + |
| 622 | + private function testTextChange( $param, $row ) { |
| 623 | + $result = ''; |
| 624 | + $beginField = 'tmplog_begin_'.$param; |
| 625 | + $endField = 'tmplog_end_'.$param; |
| 626 | + if ( $row->$beginField !== $row->$endField ) { |
| 627 | + $result .= wfMsg ( |
| 628 | + 'centralnotice-log-label', |
| 629 | + wfMsg ( 'centralnotice-'.$param ), |
| 630 | + wfMsg ( |
| 631 | + 'centralnotice-changed', |
| 632 | + $row->$beginField, |
| 633 | + $row->$endField |
| 634 | + ) |
| 635 | + )."<br/>"; |
| 636 | + } |
| 637 | + return $result; |
| 638 | + } |
620 | 639 | } |