Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
— | — | @@ -769,7 +769,7 @@ |
770 | 770 | $article = new Article( |
771 | 771 | Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI ) |
772 | 772 | ); |
773 | | - $article->doDeleteArticle( 'CentralNotice Automated Removal' ); |
| 773 | + $article->doDeleteArticle( 'CentralNotice automated removal' ); |
774 | 774 | } |
775 | 775 | } |
776 | 776 | |
— | — | @@ -850,7 +850,7 @@ |
851 | 851 | return; |
852 | 852 | } |
853 | 853 | |
854 | | - $initialBannerSettings = CentralNoticeDB::getBannerSettings( $name ); |
| 854 | + $initialBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
855 | 855 | |
856 | 856 | $dbr = wfGetDB( DB_SLAVE ); |
857 | 857 | $res = $dbr->select( 'cn_templates', 'tmp_name', |
— | — | @@ -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 | | - $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name ); |
897 | | - $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings, $contentChanged); |
| 882 | + $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name, true ); |
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 ) { |
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialNoticeTemplate.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1037 | 1023 | Merged /trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php:r95515-98907 |