jenkins-bot has submitted this change and it was merged. Change subject: Extension registration ......................................................................
Extension registration Bug: T141911 Change-Id: I3275d8771818b85dff24c28e1039f14c29cdbcb7 --- D FundraiserUnsubscribe.php R FundraisingEmailUnsubscribe.i18n.php D FundraisingEmailUnsubscribe.php A FundraisingEmailUnsubscribe.php M SpecialFundraiserUnsubscribe.php A extension.json M i18n/qqq.json M includes/Logger.php M includes/MediaWikiTwig.php M includes/XmlTransactionProcessor.php M methods/FundraiserUnsubscribeSilverpop.php M methods/FundraiserUnsubscribeThankYou.php 12 files changed, 177 insertions(+), 228 deletions(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified diff --git a/FundraiserUnsubscribe.php b/FundraiserUnsubscribe.php deleted file mode 100644 index baa9189..0000000 --- a/FundraiserUnsubscribe.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php -/** - * Extension:FundraiserUnsubscribe. This extension allows a user to unsubscribe from a fundraising - * mailing list. - * - * -- License -- - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - */ - -// Alert the user that this is not a valid entry point to MediaWiki if they try to access the -// special pages file directly. -if ( !defined( 'MEDIAWIKI' ) ) { - echo <<<EOT -To install the FundraiserUnsubscribe extension, put the following line in LocalSettings.php: -require_once "$IP/extensions/FundraisingEmailUnsubscribe/FundraiserUnsubscribe.php"; -EOT; - exit( 1 ); -} - -$wgExtensionCredits['specialpage'][] = array( - 'path' => __FILE__, - 'name' => 'FundraiserUnsubscribe', - 'author' => array( 'Matt Walker' ), - 'url' => 'https://www.mediawiki.org/wiki/Extension:FundraiserUnsubscribe', - 'descriptionmsg' => 'fundraiserunsubscribe-desc', - 'version' => '2.0.0', -); - -// === Core Includes, Pages, and Autoload Registration === -$dir = __DIR__ . '/'; - -$wgMessagesDirs['FundraiserUnsubscribe'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['FundraiserUnsubscribe'] = $dir . 'FundraiserUnsubscribe.i18n.php'; - -$wgAutoloadClasses['SpecialFundraiserUnsubscribe'] = $dir . 'SpecialFundraiserUnsubscribe.php'; -$wgSpecialPages['FundraiserUnsubscribe'] = 'SpecialFundraiserUnsubscribe'; - -$wgAutoloadClasses['FundraiserUnsubscribePeclStompWrapper'] = $dir . 'includes/StompAdapter.php'; -$wgAutoloadClasses['FundraiserUnsubscribePhpStompWrapper'] = $dir . 'includes/StompAdapter.php'; -$wgAutoloadClasses['FundraiserUnsubscribeStompAdapter'] = $dir . 'includes/StompAdapter.php'; -$wgAutoloadClasses['IFundraiserUnsubscribeStompWrapper'] = $dir . 'includes/StompAdapter.php'; -$wgAutoloadClasses['Logger'] = $dir . 'includes/Logger.php'; -$wgAutoloadClasses['MediaWikiTwig'] = $dir . 'includes/MediaWikiTwig.php'; -$wgAutoloadClasses['MediaWikiTwigCallbacks'] = $dir . 'includes/MediaWikiTwig.php'; -$wgAutoloadClasses['XmlTransactionProcessor'] = $dir . 'includes/XmlTransactionProcessor.php'; - -// === Configuration Parameters === -/** @var $wgFundraiserUnsubscribeSessionKey Root key to use in the $_SESSION array. */ -$wgFundraiserUnsubscribeSessionKey = 'fr-unsub'; - -/** @var $wgFundraiserUnsubscribeCancelUri User is redirected here when they click 'cancel'. */ -$wgFundraiserUnsubscribeCancelUri = 'https://www.wikimediafoundation.org/'; - -/** @var $wgFundraiserUnsubscribeHelpEmail All messages that require an email address, ie for - * help/questions will include this email address. */ -$wgFundraiserUnsubscribeHelpEmail = '[email protected]'; - -/** @var $wgFundraiserUnsubscribeHashSecretKey Random secret HMAC key used for validating email addresses */ -$wgFundraiserUnsubscribeHashSecretKey = ''; - -/** - * Silverpop integration variables. - * - The username and password should have API access from the server IP. - * - Timeout is expressed in seconds and is for each API call. It is not cumulative. - * - URL is the API endpoint. See the Silverpop API Endpoints Appendix. - *{ - */ -$wgFundraiserUnsubscribeSilverpopUsername = null; -$wgFundraiserUnsubscribeSilverpopPassword = null; -$wgFundraiserUnsubscribeSilverpopTimeout = 5; -$wgFundraiserUnsubscribeSilverpopURL = null; -/**}*/ - -/** @var $wgFundraiserUnsubscribeLogFacility What syslog facility to use when logging */ -$wgFundraiserUnsubscribeLogFacility = LOG_USER; - -/** @var $wgFundraiserUnsubscribeLogXmlTransactions When TRUE the XMLTransaction class will log outbound data */ -$wgFundraiserUnsubscribeLogXmlTransactions = false; - - -// === Method Registration === -$mdir = $dir . 'methods'; -$wgAutoloadClasses['UnsubscribeMethod'] = $mdir . '/UnsubscribeMethod.php'; -$wgAutoloadClasses['FundraiserUnsubscribeThankYou'] = $mdir . '/FundraiserUnsubscribeThankYou.php'; -$wgAutoloadClasses['FundraiserUnsubscribeSilverpop'] = $mdir . '/FundraiserUnsubscribeSilverpop.php'; -$wgAutoloadClasses['IUnsubscribeValidator'] = $mdir . '/UnsubscribeMethod.php'; - -/** - * The $wgFundraiserUnsubscribeProcesses defines all valid unsubscribe 'p' processes and the classes - * that handle those processes. Each process must have a corresponding entry in the - * $wgFundraiserUnsubscribeVarMap array. - */ -$wgFundraiserUnsubscribeProcesses = array( - 'thankyou' => array( - 'FundraiserUnsubscribeThankYou', - ), - - 'silverpop' => array( - 'FundraiserUnsubscribeThankYou', - 'FundraiserUnsubscribeSilverpop', - ), -); - -/** - * $wgFundraiserUnsubscribeVarMap is a large, multidimesional array paired with the process array. - * The primary key is the process name passed in the 'p' parameter. - * - * A translation map can be as simple as a key/value pair, where the key is the class expected - * parameter name and the value is what is actually passed in the URI string. It can also be a - * key/array pair where once again the key is the expected parameter name; the array will be a - * lambda expression followed by any values required from the URI string. If you want to be really - * annoying, you can prepend a '!' to any variable in the list and it will be evaluated from a - * translated variable. - * - * If the class requires a variable that is not specified in the translation map, it is expected - * to be as-is in the URI string. - * - * This map does not fully describe all parameters to the special page -- nor should it. These are - * only specific to initial processing. - */ -$wgFundraiserUnsubscribeVarMap = array( - 'thankyou' => array( - 'email' => array( 'FundraiserUnsubscribeThankYou::decodeEmail', 'e' ), - 'contribution-id' => 'c', - 'hash' => 'h', - ), - - 'silverpop' => array( - 'email' => array( 'FundraiserUnsubscribeSilverpop::decodeEmail', 'e' ), - 'contribution-id' => 'c', - 'hash' => 'h', - - 'mailing-id' => 'm', - 'recipient-id' => 'r', - 'job-id' => 'j', - 'list-id' => 'l', - ), -); - -// === RESOURCE LOADER === -$wgResourceModules['fundraiserUnsubscribe.skinOverride'] = array( - 'styles' => 'skinOverride.css', - 'position' => 'top', - 'localBasePath' => $dir . 'modules', - 'remoteExtPath' => 'FundraisingEmailUnsubscribe/modules', -); - -// === LIBRARY CONFIGURATIONS === -// --- Twig --- -$wgTwigPath = '/usr/lib/twig/'; // Path to the Twig library -$wgTwigCachePath = '/tmp/twig'; // Where Twig should store it's compiled templates -$wgTwigCacheExpiry = 5 * 60; // Time, in seconds, for Twig to cache templates - -$wgTwigTemplatePath = $dir . 'templates/'; - -$wgAutoloadClasses['MediaWikiTwigLoader'] = $dir . 'includes/MediaWikiTwigLoader.php'; diff --git a/FundraiserUnsubscribe.i18n.php b/FundraisingEmailUnsubscribe.i18n.php similarity index 100% rename from FundraiserUnsubscribe.i18n.php rename to FundraisingEmailUnsubscribe.i18n.php diff --git a/FundraisingEmailUnsubscribe.php b/FundraisingEmailUnsubscribe.php deleted file mode 120000 index 8daa69a..0000000 --- a/FundraisingEmailUnsubscribe.php +++ /dev/null @@ -1 +0,0 @@ -FundraiserUnsubscribe.php \ No newline at end of file diff --git a/FundraisingEmailUnsubscribe.php b/FundraisingEmailUnsubscribe.php new file mode 100644 index 0000000..9280f36 --- /dev/null +++ b/FundraisingEmailUnsubscribe.php @@ -0,0 +1,34 @@ +<?php +/** + * Extension:FundraisingEmailUnsubscribe. This extension allows a user to unsubscribe from a fundraising + * mailing list. + * + * -- License -- + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ + +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'FundraisingEmailUnsubscribe' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + // Load the interface messages that are shared across multiple gateways + $wgMessagesDirs['FundraisingEmailUnsubscribe'][] = __DIR__ . '/i18n'; + $wgExtensionMessagesFiles['FundraisingEmailUnsubscribe'] = __DIR__ . '/FundraisingEmailUnsubscribe.i18n.php'; + return; +} else { + die( 'This version of the FundraisingEmailUnsubscribe extension requires MediaWiki 1.27+' ); +} diff --git a/SpecialFundraiserUnsubscribe.php b/SpecialFundraiserUnsubscribe.php index 53d8bb7..73e0c6a 100644 --- a/SpecialFundraiserUnsubscribe.php +++ b/SpecialFundraiserUnsubscribe.php @@ -11,14 +11,14 @@ * * URI Parameters * - The verification stage requires, at a minimum, the following two parameters: - * -- 'p' - The process, as listed in $wgFundraiserUnsubscribeProcess to execute + * -- 'p' - The process, as listed in $wgFundraisingEmailUnsubscribeProcess to execute * -- 'email' - The email address of the user, this may be mapped through - * $wgFundraiserUnsubscribeVarMap. + * $wgFundraisingEmailUnsubscribeVarMap. * * - The action stage requires: * -- 'token' - An edit token generated in the verification stage * -- 'execute' - Must evaluate to 'True' for the action to be taken. Otherwise it will redirect - * to the URL specified in $wgFundraiserUnsubscribeCancelURI: + * to the URL specified in $wgFundraisingEmailUnsubscribeCancelURI: * * -- License -- * This program is free software; you can redistribute it and/or modify @@ -63,14 +63,19 @@ * @param String $sub */ public function execute( $sub ) { - global $wgFundraiserUnsubscribeProcesses; - global $wgFundraiserUnsubscribeCancelUri; - global $wgFundraiserUnsubscribeHelpEmail; - global $wgTwigTemplatePath; + global $wgFundraisingEmailUnsubscribeProcesses; + global $wgFundraisingEmailUnsubscribeCancelUri; + global $wgFundraisingEmailUnsubscribeHelpEmail; + + $templateDir = __DIR__ . '/templates'; + + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + include_once( __DIR__ . '/vendor/autoload.php' ); + } // Initiate logging. Although we generate the ID every time, we will reset to a stashed ID // in loadSessionData() if it exists. - Logger::setBucket( 'FundraiserUnsubscribe' ); + Logger::setBucket( 'FundraisingEmailUnsubscribe' ); $this->mID = rand( 1e12, 9e12 ); Logger::setContext( $this->mID ); @@ -83,7 +88,7 @@ $this->mProcess = $this->getFilteredValue( static::KEY_PROCESS, static::FILT_PROCESS ); $execute = $this->getFilteredValue( static::KEY_EXECUTE, static::FILT_EXECUTE ); - if ( array_key_exists( $this->mProcess, $wgFundraiserUnsubscribeProcesses ) ) { + if ( array_key_exists( $this->mProcess, $wgFundraisingEmailUnsubscribeProcesses ) ) { // Stage 1: Asking if they really mean to do this. But we do have some setup to do first Logger::log( "Starting process '$this->mProcess' with URI variables: " . json_encode( $_GET + $_POST ) ); @@ -91,7 +96,7 @@ if ( $this->stashData() && $this->doVerify() ) { // Output page $outContent = $mwt->render( 'query.html', array( - 'help_email' => $wgFundraiserUnsubscribeHelpEmail, + 'help_email' => $wgFundraisingEmailUnsubscribeHelpEmail, 'uselang' => $this->getLanguage()->getCode(), 'email' => $this->mEmail, 'token' => $this->mID, @@ -99,7 +104,7 @@ } else { // yay; errors $outContent = $mwt->render( 'error.html', array( - 'help_email' => $wgFundraiserUnsubscribeHelpEmail, + 'help_email' => $wgFundraisingEmailUnsubscribeHelpEmail, ) ); $this->clearData(); } @@ -112,14 +117,14 @@ // Sadness, we lost a donation person Logger::log( 'Unsubscribe action success' ); $outContent = $mwt->render( 'unsubscribeSuccess.html', array( - 'help_email' => $wgFundraiserUnsubscribeHelpEmail, + 'help_email' => $wgFundraisingEmailUnsubscribeHelpEmail, ) ); $this->clearData(); } else { // Oh noes... errorz Logger::log( 'Unsubscribe action failed' ); $outContent = $mwt->render( 'error.html', array( - 'help_email' => $wgFundraiserUnsubscribeHelpEmail, + 'help_email' => $wgFundraisingEmailUnsubscribeHelpEmail, ) ); $this->clearData(); } @@ -127,14 +132,14 @@ // Apparently they decided not to cancel, redirect somewhere else Logger::log( 'User decided to cancel action!' ); $this->clearData(); - $this->getOutput()->redirect( $wgFundraiserUnsubscribeCancelUri ); + $this->getOutput()->redirect( $wgFundraisingEmailUnsubscribeCancelUri ); return; } } else { // Well, we had an unexpected error. That's nice... Logger::log( "Could not process '$this->mProcess' or execute pre-existing session." ); $outContent = $mwt->render( 'error.html', array( - 'help_email' => $wgFundraiserUnsubscribeHelpEmail, + 'help_email' => $wgFundraisingEmailUnsubscribeHelpEmail, ) ); $this->clearData(); } @@ -153,9 +158,9 @@ * @throws MWException */ private function instantiateObjects() { - global $wgFundraiserUnsubscribeProcesses; + global $wgFundraisingEmailUnsubscribeProcesses; - foreach ( $wgFundraiserUnsubscribeProcesses[$this->mProcess] as $className ) { + foreach ( $wgFundraisingEmailUnsubscribeProcesses[$this->mProcess] as $className ) { if ( class_exists( $className, true ) ) { $instance = new $className(); @@ -255,8 +260,8 @@ * @return bool Returns true if operation was a success. False if something was missing. */ private function stashData() { - global $wgFundraiserUnsubscribeVarMap; - global $wgFundraiserUnsubscribeSessionKey; + global $wgFundraisingEmailUnsubscribeVarMap; + global $wgFundraisingEmailUnsubscribeSessionKey; // This variable will store, at the end, all the parameters that passed through the // variable map. This helps us process annoyingly derived parameters. @@ -285,7 +290,7 @@ $expectedParams = array_merge( $classObj->getRequiredParameters(), $expectedParams ); // Now get the parameters from the URI; then filter - $paramMap = $wgFundraiserUnsubscribeVarMap[$this->mProcess]; + $paramMap = $wgFundraisingEmailUnsubscribeVarMap[$this->mProcess]; foreach ( $expectedParams as $paramName => $filtString ) { // Variable in the variable map? if ( array_key_exists( $paramName, $paramMap ) ) { // Yes @@ -365,15 +370,15 @@ return false; } - $_SESSION[$wgFundraiserUnsubscribeSessionKey]['process'] = $this->mProcess; - $_SESSION[$wgFundraiserUnsubscribeSessionKey]['email'] = $this->mEmail; - $_SESSION[$wgFundraiserUnsubscribeSessionKey]['id'] = $this->mID; + $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey]['process'] = $this->mProcess; + $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey]['email'] = $this->mEmail; + $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey]['id'] = $this->mID; foreach ( $this->mObjects as &$classObjArray ) { $classObj = $classObjArray['instance']; $params = $classObjArray['params']; - $_SESSION[$wgFundraiserUnsubscribeSessionKey]['class-data'][get_class( $classObj )] = $params; + $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey]['class-data'][get_class( $classObj )] = $params; } return true; @@ -474,8 +479,8 @@ * @return bool True if session could be successfully restored. */ private function loadSessionData() { - global $wgFundraiserUnsubscribeSessionKey; - $skey = $wgFundraiserUnsubscribeSessionKey; + global $wgFundraisingEmailUnsubscribeSessionKey; + $skey = $wgFundraisingEmailUnsubscribeSessionKey; // For ease of code; we're going to assume that if the session key exists, everything else // will as well. This might come back to bite me in the ass later... @@ -502,10 +507,10 @@ * Clears unsubscribe data from the session */ private function clearData() { - global $wgFundraiserUnsubscribeSessionKey; + global $wgFundraisingEmailUnsubscribeSessionKey; - if ( isset( $_SESSION[$wgFundraiserUnsubscribeSessionKey] ) ) { - unset( $_SESSION[$wgFundraiserUnsubscribeSessionKey] ); + if ( isset( $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey] ) ) { + unset( $_SESSION[$wgFundraisingEmailUnsubscribeSessionKey] ); } } diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..5b1c53c --- /dev/null +++ b/extension.json @@ -0,0 +1,92 @@ +{ + "name": "FundraisingEmailUnsubscribe", + "version": "2.1.0", + "author": [ + "Matt Walker" + ], + "url": "https://www.mediawiki.org/wiki/Extension:FundraiserUnsubscribe", + "descriptionmsg": "fundraiserunsubscribe-desc", + "type": "specialpage", + "SpecialPages": { + "FundraiserUnsubscribe": "SpecialFundraiserUnsubscribe" + }, + "MessagesDirs": { + "FundraisingEmailUnsubscribe": [ + "i18n" + ] + }, + "AutoloadClasses": { + "SpecialFundraiserUnsubscribe": "SpecialFundraiserUnsubscribe.php", + "FundraiserUnsubscribePeclStompWrapper": "includes/StompAdapter.php", + "FundraiserUnsubscribePhpStompWrapper": "includes/StompAdapter.php", + "FundraiserUnsubscribeStompAdapter": "includes/StompAdapter.php", + "IFundraiserUnsubscribeStompWrapper": "includes/StompAdapter.php", + "Logger": "includes/Logger.php", + "MediaWikiTwig": "includes/MediaWikiTwig.php", + "MediaWikiTwigCallbacks": "includes/MediaWikiTwig.php", + "XmlTransactionProcessor": "includes/XmlTransactionProcessor.php", + "UnsubscribeMethod": "methods/UnsubscribeMethod.php", + "FundraiserUnsubscribeThankYou": "methods/FundraiserUnsubscribeThankYou.php", + "FundraiserUnsubscribeSilverpop": "methods/FundraiserUnsubscribeSilverpop.php", + "IUnsubscribeValidator": "methods/UnsubscribeMethod.php", + "MediaWikiTwigLoader": "includes/MediaWikiTwigLoader.php" + }, + "ResourceModules": { + "fundraiserUnsubscribe.skinOverride": { + "styles": "skinOverride.css", + "position": "top" + } + }, + "ResourceFileModulePaths": { + "localBasePath": "modules", + "remoteExtPath": "FundraisingEmailUnsubscribe/modules" + }, + "config": { + "FundraisingEmailUnsubscribeSessionKey": "fr-unsub", + "FundraisingEmailUnsubscribeCancelUri": "https://www.wikimediafoundation.org/", + "FundraisingEmailUnsubscribeHelpEmail": "[email protected]", + "FundraisingEmailUnsubscribeHashSecretKey": "", + "FundraisingEmailUnsubscribeSilverpopUsername": null, + "FundraisingEmailUnsubscribeSilverpopPassword": null, + "FundraisingEmailUnsubscribeSilverpopTimeout": 5, + "FundraisingEmailUnsubscribeSilverpopURL": null, + "FundraisingEmailUnsubscribeLogFacility": 8, + "FundraisingEmailUnsubscribeLogXmlTransactions": false, + "FundraisingEmailUnsubscribeProcesses": { + "thankyou": [ + "FundraiserUnsubscribeThankYou" + ], + "silverpop": [ + "FundraiserUnsubscribeThankYou", + "FundraiserUnsubscribeSilverpop" + ] + }, + "FundraisingEmailUnsubscribeVarMap": { + "thankyou": { + "email": [ + "FundraiserUnsubscribeThankYou::decodeEmail", + "e" + ], + "contribution-id": "c", + "hash": "h" + }, + "silverpop": { + "email": [ + "FundraiserUnsubscribeSilverpop::decodeEmail", + "e" + ], + "contribution-id": "c", + "hash": "h", + "mailing-id": "m", + "recipient-id": "r", + "job-id": "j", + "list-id": "l" + } + }, + "TwigPath": "/usr/lib/twig/", + "TwigCachePath": "/tmp/twig", + "TwigCacheExpiry": 300, + "TwigTemplatePath": "templates" + }, + "manifest_version": 1 +} diff --git a/i18n/qqq.json b/i18n/qqq.json index 5ddff13..44e91e2 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -5,7 +5,7 @@ "Umherirrender" ] }, - "fundraiserunsubscribe-desc": "{{desc|name=Fundraiser Unsubscribe|url=https://www.mediawiki.org/wiki/Extension:FundraiserUnsubscribe}}", + "fundraiserunsubscribe-desc": "{{desc|name=Fundraising Email Unsubscribe|url=https://www.mediawiki.org/wiki/Extension:FundraiserUnsubscribe}}", "fundraiserunsubscribe": "Unsubscribe page title", "fundraiserunsubscribe-query": "Ask if the user wants to remove email address:$1 from the fundraising mail lists. Leave email as is; a different templating engine is being used.", "fundraiserunsubscribe-info": "Unused at this time.\n\nInformation on how the unsubscribe request will be processed.\n\nParameters:\n* $1 - email address", diff --git a/includes/Logger.php b/includes/Logger.php index 64eae3e..0792879 100644 --- a/includes/Logger.php +++ b/includes/Logger.php @@ -139,7 +139,7 @@ * @param $pri */ private function logString( $msgText, $pri, $label = null ) { - global $wgFundraiserUnsubscribeLogFacility; + global $wgFundraisingEmailUnsubscribeLogFacility; if ( static::$context != '' ) { $msg[] = '(' . static::$context . ')'; @@ -154,7 +154,7 @@ } $msg[] = $msgText; - openlog( static::$bucket, LOG_ODELAY, $wgFundraiserUnsubscribeLogFacility ); + openlog( static::$bucket, LOG_ODELAY, $wgFundraisingEmailUnsubscribeLogFacility ); syslog( $pri, implode( ' ', $msg ) ); closelog(); } diff --git a/includes/MediaWikiTwig.php b/includes/MediaWikiTwig.php index af23d5e..0d2c742 100644 --- a/includes/MediaWikiTwig.php +++ b/includes/MediaWikiTwig.php @@ -22,16 +22,6 @@ * @file */ -// Alert the user that this is not a valid entry point to MediaWiki if they try to access the -// special pages file directly. -if ( !defined( 'MEDIAWIKI' ) ) { - echo <<<EOT -To install the FundraiserUnsubscribe extension, put the following line in LocalSettings.php: -require_once( "\$IP/extensions/FundraiserUnsubscribe/FundraiserUnsubscribe.php" ); -EOT; - exit( 1 ); -} - // This is required here so tha the extension code that extends a Twig class below doesn't make PHP // barf. Not the most graceful thing in the world. But neither is needing Twig in the first place. global $wgTwigPath; diff --git a/includes/XmlTransactionProcessor.php b/includes/XmlTransactionProcessor.php index 5a7b2dc..cbf7f9a 100644 --- a/includes/XmlTransactionProcessor.php +++ b/includes/XmlTransactionProcessor.php @@ -82,7 +82,7 @@ * @return bool If true, the transaction was completely successful. */ public function doTransaction( $txnName, $callbackObj, $outParams = array() ) { - global $wgFundraiserUnsubscribeLogXmlTransactions; + global $wgFundraisingEmailUnsubscribeLogXmlTransactions; Logger::pushLabel( 'XMLTransaction' ); $retval = false; @@ -116,7 +116,7 @@ // Send it! Logger::log( "Sending transaction '$txnName'" ); - if ( $wgFundraiserUnsubscribeLogXmlTransactions ) { + if ( $wgFundraisingEmailUnsubscribeLogXmlTransactions ) { Logger::log( "Transaction content: " . $dom->saveXML() ); } $retData = $this->doHttpTransaction( $dom->saveXML(), $this->mTimeout ); diff --git a/methods/FundraiserUnsubscribeSilverpop.php b/methods/FundraiserUnsubscribeSilverpop.php index a1f3f0d..ca58c86 100644 --- a/methods/FundraiserUnsubscribeSilverpop.php +++ b/methods/FundraiserUnsubscribeSilverpop.php @@ -64,23 +64,23 @@ } public function unsubscribe( $requestID, $process, array $params ) { - global $wgFundraiserUnsubscribeSilverpopUsername, $wgFundraiserUnsubscribeSilverpopPassword; - global $wgFundraiserUnsubscribeSilverpopTimeout, $wgFundraiserUnsubscribeSilverpopURL; + global $wgFundraisingEmailUnsubscribeSilverpopUsername, $wgFundraisingEmailUnsubscribeSilverpopPassword; + global $wgFundraisingEmailUnsubscribeSilverpopTimeout, $wgFundraisingEmailUnsubscribeSilverpopURL; Logger::pushLabel( 'Silverpop' ); $retval = false; // Create transaction object $txnObj = new XmlTransactionProcessor(); - $txnObj->setEndpointURL( $wgFundraiserUnsubscribeSilverpopURL ); - $txnObj->setTimeout( $wgFundraiserUnsubscribeSilverpopTimeout ); + $txnObj->setEndpointURL( $wgFundraisingEmailUnsubscribeSilverpopURL ); + $txnObj->setTimeout( $wgFundraisingEmailUnsubscribeSilverpopTimeout ); $txnObj->setEnvelope( $this->remoteActionEnvelope ); $txnObj->setTransactionMap( $this->remoteActionMap ); // Do the transaction chain $outParamsLogin = array( - 'username' => $wgFundraiserUnsubscribeSilverpopUsername, - 'password' => $wgFundraiserUnsubscribeSilverpopPassword, + 'username' => $wgFundraisingEmailUnsubscribeSilverpopUsername, + 'password' => $wgFundraisingEmailUnsubscribeSilverpopPassword, ); if ( $txnObj->doTransaction( 'Login', $this, $outParamsLogin ) && @@ -116,7 +116,7 @@ DOMDocument $dom, XmlTransactionProcessor &$processObj ) { - global $wgFundraiserUnsubscribeSilverpopURL; + global $wgFundraisingEmailUnsubscribeSilverpopURL; $retval = false; @@ -150,7 +150,7 @@ } // Change the API endpoint URL to include the session ID - $url = $wgFundraiserUnsubscribeSilverpopURL . ';jsessionid=' . $sessionId; + $url = $wgFundraisingEmailUnsubscribeSilverpopURL . ';jsessionid=' . $sessionId; Logger::log( "Changing URL to: $url" ); $processObj->setEndpointURL( $url ); $retval = true; @@ -167,7 +167,7 @@ case 'Logout': // Remove the jsessionid from the API url. - $url = $wgFundraiserUnsubscribeSilverpopURL; + $url = $wgFundraisingEmailUnsubscribeSilverpopURL; Logger::log( "Changing URL to: $url" ); $processObj->setEndpointURL( $url ); $retval = true; diff --git a/methods/FundraiserUnsubscribeThankYou.php b/methods/FundraiserUnsubscribeThankYou.php index 509cc82..130521e 100644 --- a/methods/FundraiserUnsubscribeThankYou.php +++ b/methods/FundraiserUnsubscribeThankYou.php @@ -38,7 +38,7 @@ } public function validateRequest( array $params ) { - global $wgFundraiserUnsubscribeHashSecretKey; + global $wgFundraisingEmailUnsubscribeHashSecretKey; Logger::pushLabel( 'UnsubThankYou' ); @@ -47,7 +47,7 @@ $hash = strtolower( $params['hash'] ); // We can only verify the hash - $computedHash = hash( 'sha1', $contributionId . $email . $wgFundraiserUnsubscribeHashSecretKey ); + $computedHash = hash( 'sha1', $contributionId . $email . $wgFundraisingEmailUnsubscribeHashSecretKey ); if ( $computedHash != $hash ) { Logger::log( "Hash verification failed! Expected '$computedHash' got '$hash'.", LOG_NOTICE ); @@ -92,4 +92,4 @@ public static function decodeEmail( array $params ) { return rawurldecode( $params['e'] ); } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/303051 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3275d8771818b85dff24c28e1039f14c29cdbcb7 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/FundraisingEmailUnsubscribe Gerrit-Branch: master Gerrit-Owner: Awight <[email protected]> Gerrit-Reviewer: Ejegg <[email protected]> Gerrit-Reviewer: Reedy <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
