Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/178255

Change subject: Don't try to read globals from 
PurgePrivateVoteData::__construct()
......................................................................

Don't try to read globals from PurgePrivateVoteData::__construct()

Globals aren't loaded for Maintenance subclasses until well after the
instance is constructed.

I left the local variable in there in case someone wants to add a
command line option for it at some point (or if some magic is already
making one).

Change-Id: Ib0213e8f5e3f5ac866f42140e3c8be05fa39d753
---
M cli/purgePrivateVoteData.php
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll 
refs/changes/55/178255/1

diff --git a/cli/purgePrivateVoteData.php b/cli/purgePrivateVoteData.php
index 24c6665..2215005 100644
--- a/cli/purgePrivateVoteData.php
+++ b/cli/purgePrivateVoteData.php
@@ -34,17 +34,20 @@
 
 class PurgePrivateVoteData extends Maintenance {
 
-       private $mPurgeDays;
+       private $mPurgeDays = null;
 
        function __construct() {
-               global $wgSecurePollKeepPrivateInfoDays;
                parent::__construct();
                $this->mDescription = 'Script purge private data (IP, XFF, UA) 
from SecurePoll Votes';
                $this->setBatchSize( 200 );
-               $this->mPurgeDays = $wgSecurePollKeepPrivateInfoDays;
        }
 
        public function execute() {
+               global $wgSecurePollKeepPrivateInfoDays;
+
+               if ( $this->mPurgeDays === null ) {
+                       $this->mPurgeDays = $wgSecurePollKeepPrivateInfoDays;
+               }
 
                $electionsToPurge = array();
                $deleteSets = array();

-- 
To view, visit https://gerrit.wikimedia.org/r/178255
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0213e8f5e3f5ac866f42140e3c8be05fa39d753
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to