r92711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92710‎ | r92711 | r92712 >
Date:23:30, 20 July 2011
Author:awjrichards
Status:ok
Tags:
Comment:
MFT r91146
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/CentralNotice (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.sql (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/CentralNotice/special/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php
@@ -121,6 +121,9 @@
122122
123123 $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
124124 $wgAutoloadClasses['SpecialBannerAllocation'] = $specialDir . 'SpecialBannerAllocation.php';
 125+
 126+ $wgSpecialPages['CentralNoticeLogs'] = 'SpecialCentralNoticeLogs';
 127+ $wgAutoloadClasses['SpecialCentralNoticeLogs'] = $specialDir . 'SpecialCentralNoticeLogs.php';
125128 }
126129 }
127130
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php
___________________________________________________________________
Modified: svn:mergeinfo
128131 Merged /trunk/extensions/CentralNotice/CentralNotice.php:r91146
Index: branches/wmf/1.17wmf1/extensions/CentralNotice/special/SpecialCentralNotice.php
@@ -179,7 +179,8 @@
180180 $pages = array(
181181 'CentralNotice' => wfMsg( 'centralnotice-notices' ),
182182 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ),
183 - 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' )
 183+ 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' ),
 184+ 'CentralNoticeLogs' => wfMsg ( 'centralnotice-logs' )
184185 );
185186 $htmlOut = Xml::openElement( 'ul', array( 'id' => 'preftoc' ) );
186187 foreach ( $pages as $page => $msg ) {
@@ -1230,6 +1231,23 @@
12311232 }
12321233
12331234 $dbw->commit();
 1235+
 1236+ // Log the creation of the campaign
 1237+ $beginSettings = array();
 1238+ $endSettings = array(
 1239+ 'notlog_end_name' => $noticeName,
 1240+ 'notlog_end_projects' => implode( ", ", $projects ),
 1241+ 'notlog_end_languages' => implode( ", ", $project_languages ),
 1242+ 'notlog_end_countries' => implode( ", ", $geo_countries ),
 1243+ 'notlog_end_start' => $dbw->timestamp( $startTs ),
 1244+ 'notlog_end_end' => $dbw->timestamp( $endTs ),
 1245+ 'notlog_end_enabled' => $enabled,
 1246+ 'notlog_end_preferred' => 0,
 1247+ 'notlog_end_locked' => 0,
 1248+ 'notlog_end_geo' => $geotargeted
 1249+ );
 1250+ $this->logCampaignChange( 'created', $not_id, $beginSettings, $endSettings );
 1251+
12341252 return;
12351253 }
12361254 }
@@ -1256,6 +1274,10 @@
12571275 $res = $dbw->delete( 'cn_notices', array ( 'not_name' => $noticeName ) );
12581276 $res = $dbw->delete( 'cn_notice_languages', array ( 'nl_notice_id' => $noticeId ) );
12591277 $dbw->commit();
 1278+
 1279+ // Log the removal of the campaign
 1280+ $this->logCampaignChange( 'removed', $noticeId );
 1281+
12601282 return;
12611283 }
12621284 }
@@ -1775,6 +1797,36 @@
17761798 }
17771799 return $htmlOut;
17781800 }
 1801+
 1802+ /**
 1803+ * Log any changes related to a campaign
 1804+ * @param $action string: 'created', 'modified', or 'removed'
 1805+ * @param $campaign integer: id of campaign
 1806+ * @param $beginSettings array of campaign settings before changes (optional)
 1807+ * @param $endSettings array of campaign settings after changes (optional)
 1808+ * @param $beginAssignments array of banner assignments before changes (optional)
 1809+ * @param $endAssignments array of banner assignments after changes (optional)
 1810+ */
 1811+ function logCampaignChange( $action, $campaign, $beginSettings = array(),
 1812+ $endSettings = array(), $beginAssignments = array(), $endAssignments = array() )
 1813+ {
 1814+ global $wgUser;
 1815+
 1816+ $dbw = wfGetDB( DB_MASTER );
 1817+
 1818+ $log = array(
 1819+ 'notlog_timestamp' => $dbw->timestamp(),
 1820+ 'notlog_user_id' => $wgUser->getId(),
 1821+ 'notlog_action' => $action,
 1822+ 'notlog_not_id' => $campaign
 1823+ );
 1824+
 1825+ $log = array_merge($log, $beginSettings, $endSettings);
 1826+
 1827+ $res = $dbw->insert( 'cn_notice_log', $log );
 1828+ $log_id = $dbw->insertId();
 1829+ return $log_id;
 1830+ }
17791831 }
17801832
17811833 class CentralNoticePager extends TemplatePager {
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.sql
___________________________________________________________________
Modified: svn:mergeinfo
17821834 Merged /trunk/extensions/CentralNotice/CentralNotice.sql:r91146
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice
___________________________________________________________________
Modified: svn:mergeinfo
17831835 Merged /trunk/extensions/CentralNotice:r91146

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91146reverting r91105, now that old features have been deployedkaldari00:12, 30 June 2011

Status & tagging log