r96496 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96495‎ | r96496 | r96497 >
Date:21:02, 7 September 2011
Author:kaldari
Status:ok
Tags:
Comment:
follow up to r92922 - removing banner content change detection from the banner setting logging - this is now handled in the banner content log
Modified paths:
  • /trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php
@@ -875,26 +875,17 @@
876876 Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI )
877877 );
878878
879 - $bodyPage = Title::newFromText(
880 - "Centralnotice-template-{$name}", NS_MEDIAWIKI );
881 - $curRev = Revision::newFromTitle( $bodyPage );
882 - $oldbody = $curRev ? $curRev->getText() : '';
883 -
884879 $article->doEdit( $body, '', EDIT_FORCE_BOT );
885 -
886 - $curRev = Revision::newFromTitle( $bodyPage );
887 - $newbody = $curRev ? $curRev->getText() : '';
888880
889 - //test for body changes
890 - $contentChanged = 0;
891 - if ($newbody !== $oldbody){
892 - $contentChanged = 1;
893 - }
894 -
895881 $bannerId = SpecialNoticeTemplate::getTemplateId( $name );
896882 $finalBannerSettings = CentralNoticeDB::getBannerSettings( $name, true );
897 - $this->logBannerChange( 'modified', $bannerId, $initialBannerSettings, $finalBannerSettings, $contentChanged);
898883
 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+
899890 return;
900891 }
901892 }
@@ -1013,12 +1004,8 @@
10141005 * @param $bannerId integer: ID of banner
10151006 * @param $beginSettings array of banner settings before changes (optional)
10161007 * @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)
10191008 */
1020 - function logBannerChange( $action, $bannerId, $beginSettings = array(),
1021 - $endSettings = array(), $contentChanged = 0 )
1022 - {
 1009+ function logBannerChange( $action, $bannerId, $beginSettings = array(), $endSettings = array() ) {
10231010 global $wgUser;
10241011
10251012 $dbw = wfGetDB( DB_MASTER );
@@ -1028,8 +1015,7 @@
10291016 'tmplog_user_id' => $wgUser->getId(),
10301017 'tmplog_action' => $action,
10311018 'tmplog_template_id' => $bannerId,
1032 - 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId ),
1033 - 'tmplog_content_change' => $contentChanged
 1019+ 'tmplog_template_name' => SpecialNoticeTemplate::getBannerName( $bannerId )
10341020 );
10351021
10361022 foreach ( $beginSettings as $key => $value ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r98908MFT r95686, r95929, r96496awjrichards20:46, 4 October 2011
r100100MFT r92510, r92676, r96496, r97304, r99160, r99165, r99169, r99176, r99178, r...awjrichards23:56, 17 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92922Finishing banner settings logging. (specifically, changed content flag is now...khorn00:28, 23 July 2011

Status & tagging log