Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
— | — | @@ -875,26 +875,17 @@ |
876 | 876 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
877 | 877 | ); |
878 | 878 | |
879 | | - $bodyPage = Title::newFromText( |
880 | | - "Centralnotice-template-{$name}", NS_MEDIAWIKI ); |
881 | | - $curRev = Revision::newFromTitle( $bodyPage ); |
882 | | - $oldbody = $curRev ? $curRev->getText() : ''; |
883 | | - |
884 | 879 | $article->doEdit( $body, '', EDIT_FORCE_BOT ); |
885 | | - |
886 | | - $curRev = Revision::newFromTitle( $bodyPage ); |
887 | | - $newbody = $curRev ? $curRev->getText() : ''; |
888 | 880 | |
889 | | - //test for body changes |
890 | | - $contentChanged = 0; |
891 | | - if ($newbody !== $oldbody){ |
892 | | - $contentChanged = 1; |
893 | | - } |
894 | | - |
895 | 881 | $bannerId = SpecialNoticeTemplate::getTemplateId( $name ); |
896 | 882 | $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
897 | | - $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings, $contentChanged); |
898 | 883 | |
| 884 | + // If there are any difference between the old settings and the new settings, log them. |
| 885 | + $diffs = array_diff_assoc( $initialBannerSettings, $finalBannerSettings ); |
| 886 | + if ( $diffs ) { |
| 887 | + $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings ); |
| 888 | + } |
| 889 | + |
899 | 890 | return; |
900 | 891 | } |
901 | 892 | } |
— | — | @@ -1013,12 +1004,8 @@ |
1014 | 1005 | * @param $bannerId integer: ID of banner |
1015 | 1006 | * @param $beginSettings array of banner settings before changes (optional) |
1016 | 1007 | * @param $endSettings array of banner settings after changes (optional) |
1017 | | - * @param $beginContent banner content before changes (optional) |
1018 | | - * @param $endContent banner content after changes (optional) |
1019 | 1008 | */ |
1020 | | - function logBannerChange( $action, $bannerId, $beginSettings = array(), |
1021 | | - $endSettings = array(), $contentChanged = 0 ) |
1022 | | - { |
| 1009 | + function logBannerChange( $action, $bannerId, $beginSettings = array(), $endSettings = array() ) { |
1023 | 1010 | global $wgUser; |
1024 | 1011 | |
1025 | 1012 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -1028,8 +1015,7 @@ |
1029 | 1016 | 'tmplog_user_id' => $wgUser->getId(), |
1030 | 1017 | 'tmplog_action' => $action, |
1031 | 1018 | 'tmplog_template_id' => $bannerId, |
1032 | | - 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ), |
1033 | | - 'tmplog_content_change' => $contentChanged |
| 1019 | + 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ) |
1034 | 1020 | ); |
1035 | 1021 | |
1036 | 1022 | foreach ( $beginSettings as $key => $value ) { |