[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Fix broken API edit after notifyPublishers change

2017-12-28 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400610 )

Change subject: Fix broken API edit after notifyPublishers change
..

Fix broken API edit after notifyPublishers change

Change-Id: I3123919ae1d6ec0cc183d69cf9847aa789006d11
---
M includes/content/NewsletterDataUpdate.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/10/400610/1

diff --git a/includes/content/NewsletterDataUpdate.php 
b/includes/content/NewsletterDataUpdate.php
index 76a61ee..cb60d42 100644
--- a/includes/content/NewsletterDataUpdate.php
+++ b/includes/content/NewsletterDataUpdate.php
@@ -130,8 +130,8 @@
}
// Adds the new publishers to subscription list
$store->addSubscription( $newsletter, $added );
-   $this->newsletter->notifyPublishers(
-   $added, $user, 
Newsletter::NEWSLETTER_PUBLISHERS_ADDED
+   $newsletter->notifyPublishers(
+   $added, $this->user, 
Newsletter::NEWSLETTER_PUBLISHERS_ADDED
);
}
 
@@ -140,8 +140,8 @@
foreach ( $removed as $ruId ) {
$store->removePublisher( $newsletter, 
User::newFromId( $ruId ) );
}
-   $this->newsletter->notifyPublishers(
-   $removed, $user, 
Newsletter::NEWSLETTER_PUBLISHERS_REMOVED
+   $newsletter->notifyPublishers(
+   $removed, $this->user, 
Newsletter::NEWSLETTER_PUBLISHERS_REMOVED
);
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3123919ae1d6ec0cc183d69cf9847aa789006d11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Add a unit test to check newsletter creation validation

2017-12-23 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/35 )

Change subject: Add a unit test to check newsletter creation validation
..

Add a unit test to check newsletter creation validation

Bug: T183632
Change-Id: I91f1414facf08b0ef3fc50984096532c3371bbf3
---
M tests/specials/SpecialNewsletterCreateTest.php
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/95/35/1

diff --git a/tests/specials/SpecialNewsletterCreateTest.php 
b/tests/specials/SpecialNewsletterCreateTest.php
index a928437..adbc2a3 100644
--- a/tests/specials/SpecialNewsletterCreateTest.php
+++ b/tests/specials/SpecialNewsletterCreateTest.php
@@ -19,4 +19,22 @@
$this->executeSpecialPage( '', null, null, $user->getUser() );
$this->assertTrue( true );
}
+
+   public function testCreateNewsletterValidationTest() {
+   $input = [
+   'name' => 'Test Newsletter',
+   'description' => 'Test description',
+   'mainpage' => Title::newFromText('TestPage' 
)->getBaseText()
+   ];
+
+   // Mock the submission of this text
+   $res = $this->newSpecialPage()->onSubmit( $input );
+
+   // The description is too small
+   $this->assertEquals(
+   $res->getMessage()->getKey(), 
'newsletter-create-short-description-error'
+   );
+
+   //@TODO mock bad main page, mock existing main page, etc
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91f1414facf08b0ef3fc50984096532c3371bbf3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Refactor newsletter create-udpate codebase

2017-10-21 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385796 )

Change subject: Refactor newsletter create-udpate codebase
..

Refactor newsletter create-udpate codebase

* Avoid code repition
* Cut down huge ugly functions

Bug: T178743

Change-Id: I067c52036cb20b7a35f7530b1aac0807b2e6ecdb
---
M includes/Newsletter.php
M includes/NewsletterEditPage.php
M includes/content/NewsletterDataUpdate.php
3 files changed, 88 insertions(+), 65 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/96/385796/1

diff --git a/includes/Newsletter.php b/includes/Newsletter.php
index 7c19753..c9bebcb 100644
--- a/includes/Newsletter.php
+++ b/includes/Newsletter.php
@@ -248,4 +248,25 @@
public function canRestore( User $user ) {
return $this->isPublisher( $user ) || $user->isAllowed( 
'newsletter-restore' );
}
+
+   /**
+* Notify new publishers
+*
+* @param array $added
+* @param User $addedBy
+*
+*/
+   public function notifyNewPublishers( array $added, User $addedBy ) {
+   EchoEvent::create(
+   [
+   'type' => 'newsletter-newpublisher',
+   'extra' => [
+   'newsletter-name' => $this->getName(),
+   'new-publishers-id' => $added,
+   'newsletter-id' => $this->getId()
+   ],
+   'agent' => $addedBy
+   ]
+   );
+   }
 }
diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index 8cb8793..d39a25c 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -96,6 +96,7 @@
 * @param int $undoId
 * @param int $oldId
 * @return HTMLForm
+* @throws BadRequestError
 */
protected function getManageForm( $revId, $undoId, $oldId ) {
$publishers = UserArray::newFromIDs( 
$this->newsletter->getPublishers() );
@@ -416,17 +417,7 @@
}
 
if ( $added ) {
-   EchoEvent::create(
-   [
-   'type' => 'newsletter-newpublisher',
-   'extra' => [
-   'newsletter-name' => 
$this->newsletter->getName(),
-   'new-publishers-id' => $added,
-   'newsletter-id' => $newsletterId
-   ],
-   'agent' => $user
-   ]
-   );
+   $this->newsletter->notifyNewPublishers( $added, $user );
}
 
foreach ( $removed as $ruId ) {
diff --git a/includes/content/NewsletterDataUpdate.php 
b/includes/content/NewsletterDataUpdate.php
index 945f00f..61c84d8 100644
--- a/includes/content/NewsletterDataUpdate.php
+++ b/includes/content/NewsletterDataUpdate.php
@@ -26,64 +26,85 @@
$this->title = $title;
}
 
-   function doUpdate() {
-   $logger = LoggerFactory::getInstance( 'newsletter' );
+   private function getNewsletterLogger() {
+   return LoggerFactory::getInstance( 'newsletter' );
+   }
 
+   protected function getNewslettersWithNewsletterMainPage( 
$newNewsletterName ) {
+   $dbr = wfGetDB( DB_REPLICA );
+   return $dbr->selectRowCount(
+   'nl_newsletters',
+   [ 'nl_name', 'nl_main_page_id', 'nl_active' ],
+   $dbr->makeList( [
+   'nl_name' => $newNewsletterName,
+   $dbr->makeList(
+   [
+   'nl_main_page_id' => 
$this->content->getMainPage()->getArticleID(),
+   'nl_active' => 1
+   ], LIST_AND )
+   ], LIST_OR )
+   );
+   }
+
+   protected function createANewNewsletterWithData( NewsletterStore 
$store, $formData ) {
+   $newNewsletterName = $formData['Name'];
+   if ( $this->getNewslettersWithNewsletterMainPage( 
$newNewsletterName ) ) {
+   return false;
+   }
+
+   $validator = new NewsletterValidator( $formData );
+   $validation = $validator->validate( true );
+
+   if ( !$validation->isGood() ) {
+   // Invalid input was entered
+   return $validation;
+  

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Reword wiki main page form input box description

2017-10-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384323 )

Change subject: Reword wiki main page form input box description
..

Reword wiki main page form input box description

Bug: T166002
Change-Id: I20dd28d62b606a58addf889eaf0fc3bcd2c1d63d
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/23/384323/1

diff --git a/i18n/en.json b/i18n/en.json
index 4c20de3..82a7060 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,7 +11,7 @@
"newsletter-extension-desc": "Enables users to publish and subscribe to 
newsletters",
"newsletter-name": "Name of newsletter",
"newsletter-desc": "Description",
-   "newsletter-title": "Wiki page to be linked as Main page",
+   "newsletter-title": "Wiki page with information about the newsletter",
"newsletter-exist-error": "A newsletter with the name \"$1\" already 
exists. Please try again with another name.",
"newsletter-create-error": "An error occured while trying to create a 
new newsletter. Please try again.",
"newsletter-oldrev-undo-error-title": "Sorry, this operation is not 
permitted.",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I20dd28d62b606a58addf889eaf0fc3bcd2c1d63d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Add notificaiton on removing a publisher

2017-10-14 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384262 )

Change subject: Add notificaiton on removing a publisher
..

Add notificaiton on removing a publisher

New shiny notificaiton which would redirect to the newsletter page
when a publisher gets removed

Bug:T174667
Change-Id: I6b8d65d5264fd906d527db6c4a58a0d7628d3c68
---
M Newsletter.hooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
R includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php
A includes/Echo/EchoNewsletterPublisherRemovedPresentationModel.php
M includes/NewsletterEditPage.php
M includes/content/NewsletterDataUpdate.php
8 files changed, 79 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/62/384262/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index bd6bc32..7061434 100644
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -53,12 +53,27 @@
'user-locators' => [
[ 'EchoUserLocator::locateFromEventExtra', [ 
'new-publishers-id' ] ]
],
-   'presentation-model' => 
'EchoNewsletterPublisherPresentationModel',
+   'presentation-model' => 
'EchoNewsletterPublisherAddedPresentationModel',
'title-message' => 
'newsletter-notification-new-publisher-title',
'title-params' => [ 'newsletter-name', 'agent' ],
'flyout-message' => 
'newsletter-notification-new-publisher-flyout',
'flyout-params' => [ 'newsletter-name', 'agent' ],
];
+$notifications['newsletter-delpublisher'] = [
+'category' => 'newsletter',
+'primary-link' => [
+'message' => 'newsletter-notification-link-text-del-publisher',
+'destination' => 'newsletter'
+],
+'user-locators' => [
+[ 'EchoUserLocator::locateFromEventExtra', [ 
'del-publishers-id' ] ]
+],
+'presentation-model' => 
'EchoNewsletterPublisherRemovedPresentationModel',
+'title-message' => 'newsletter-notification-del-publisher-title',
+'title-params' => [ 'newsletter-name', 'agent' ],
+'flyout-message' => 'newsletter-notification-del-publisher-flyout',
+'flyout-params' => [ 'newsletter-name', 'agent' ],
+];
$notifications['newsletter-subscribed'] = [
'category' => 'newsletter',
'primary-link' => [
diff --git a/extension.json b/extension.json
index c84eddb..9cc0597 100644
--- a/extension.json
+++ b/extension.json
@@ -90,7 +90,8 @@
"EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php",
"BaseNewsletterPresentationModel": 
"includes/Echo/BaseNewsletterPresentationModel.php",
"EchoNewsletterPresentationModel": 
"includes/Echo/EchoNewsletterPresentationModel.php",
-   "EchoNewsletterPublisherPresentationModel": 
"includes/Echo/EchoNewsletterPublisherPresentationModel.php",
+   "EchoNewsletterPublisherAddedPresentationModel": 
"includes/Echo/EchoNewsletterPublisherAddedPresentationModel.php",
+   "EchoNewsletterPublisherRemovedPresentationModel": 
"includes/Echo/EchoNewsletterPublisherRemovedPresentationModel.php",
"EchoNewsletterUnsubscribedPresentationModel": 
"includes/Echo/EchoNewsletterUnsubscribedPresentationModel.php",
"EchoNewsletterSubscribedPresentationModel": 
"includes/Echo/EchoNewsletterSubscribedPresentationModel.php"
},
diff --git a/i18n/en.json b/i18n/en.json
index 4c20de3..03e20b0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,8 @@
"Thomas Arrow",
"Glaisher",
"Divadsn",
-   "Addshore"
+   "Addshore",
+   "Tony Thomas"
]
},
"newsletter-extension-desc": "Enables users to publish and subscribe to 
newsletters",
@@ -139,6 +140,7 @@
"apihelp-newslettermanage-example-2": "Remove publisher with a user ID 
of 5 from newsletter with ID 2.",
"notification-header-newsletter-announce": "$1 {{GENDER:$2|has 
announced}} a new issue of $3.",
"notification-header-newsletter-newpublisher": "{{GENDER:$2|You}} have 
been {{GENDER:$3|added}} as a publisher of \"$1\" newsletter.",
+   "notification-header-newsletter-delpublisher": "{{GENDER:$2|You}} have 
been {{GENDER:$3|removed}} as a publisher of \"$1\" newsletter.",
"notification-body-newsletter-announce": "$1",
"newsletter-list-intro": "This is a list of newsletters registered to 
this wiki. Subscribe to a newsletter to receive a notification when a

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Typo in calling $this->newsletter->getSubscribersCount()

2017-08-30 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374888 )

Change subject: Typo in calling $this->newsletter->getSubscribersCount()
..

Typo in calling $this->newsletter->getSubscribersCount()

Bug: T174605
Bug: T174604
Change-Id: If9d5915f9afc00d8efb331c132b59de790b020e9
---
M includes/specials/SpecialNewsletter.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/88/374888/1

diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index 2b77eea..9442fb6 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -328,7 +328,7 @@
$out->addHTML(
$this->msg( 'newsletter-announce-success' )
->rawParams( $this->getEscapedName() )
-   ->numParams( 
$this->newsletter->getSubscriberCount() )
+   ->numParams( 
$this->newsletter->getSubscribersCount() )
->parseAsBlock()
);
$out->addReturnTo( Title::makeTitleSafe( NS_NEWSLETTER, 
$this->newsletter->getName() ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9d5915f9afc00d8efb331c132b59de790b020e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Check if all publishers listed on API data are valid

2017-08-13 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371763 )

Change subject: Check if all publishers listed on API data are valid
..

Check if all publishers listed on API data are valid

Bug: 371761
Change-Id: I5e8edb70f88641245e73ff44607dcd5501e741f3
---
M includes/content/NewsletterContent.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/63/371763/1

diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index 9119822..6b4d4c6 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -60,7 +60,9 @@
}
 
foreach ( $this->publishers as $publisher ) {
-   if ( !User::newFromName( $publisher ) ) {
+   if ( !User::newFromName( $publisher )->getId() ) {
+   // User object always returns even when the 
user is not found in the database
+   // This check will make sure we block bad 
usernames here.
return false;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e8edb70f88641245e73ff44607dcd5501e741f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Remove unused API class ApiNewsletterManage

2017-08-13 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371762 )

Change subject: Remove unused API class ApiNewsletterManage
..

Remove unused API class ApiNewsletterManage

We use ContentHandler (default page edit) API now

Bug: T173282
Change-Id: Ie986f66f755927d4978edabcab2aba2ee39f5f57
---
M extension.json
M i18n/en.json
M i18n/qqq.json
D includes/api/ApiNewsletterManage.php
4 files changed, 1 insertion(+), 103 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/62/371762/1

diff --git a/extension.json b/extension.json
index 6d6e59a..c84eddb 100644
--- a/extension.json
+++ b/extension.json
@@ -41,8 +41,7 @@
"Newsletter": "SpecialNewsletter"
},
"APIModules": {
-   "newslettersubscribe": "ApiNewsletterSubscribe",
-   "newslettermanage": "ApiNewsletterManage"
+   "newslettersubscribe": "ApiNewsletterSubscribe"
},
"MessagesDirs": {
"Newsletter": [
@@ -83,7 +82,6 @@
"SpecialNewsletters": 
"includes/specials/SpecialNewsletters.php",
"SpecialNewsletterCreate": 
"includes/specials/SpecialNewsletterCreate.php",
"NewsletterTablePager": 
"includes/specials/pagers/NewsletterTablePager.php",
-   "ApiNewsletterManage": "includes/api/ApiNewsletterManage.php",
"ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
"NewsletterContent": "includes/content/NewsletterContent.php",
"NewsletterContentHandler": 
"includes/content/NewsletterContentHandler.php",
diff --git a/i18n/en.json b/i18n/en.json
index c12678a..4c20de3 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -173,6 +173,5 @@
"newsletter-api-error-notfound": "Newsletter does not exist",
"newsletter-api-error-nopermissions": "You do not have permission to 
manage newsletters.",
"newsletter-api-error-invalidpublisher-registered": "Publisher is not a 
registered user.",
-   "newsletter-api-error-managefailure": "Manage action: $1 failed.",
"newsletter-api-error-subscribe-notloggedin": "You must be logged-in to 
subscribe to newsletters."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index d8e47e8..acfff15 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -180,6 +180,5 @@
"newsletter-api-error-notfound": "Error message to be displayed in the 
API when a newsletter is not found.",
"newsletter-api-error-nopermissions": "Error message to be displayed in 
the API when the requesting user does not have the required permissions.",
"newsletter-api-error-invalidpublisher-registered": "Error message to 
be displayed in the API when a given publisher is not a registered account.",
-   "newsletter-api-error-managefailure": "Error message to be displayed in 
the API when the requested manage action has failed.",
"newsletter-api-error-subscribe-notloggedin": "Error message to be 
displayed in the API when a request is made to subscribe to a newsletter by an 
anonymous user.."
 }
diff --git a/includes/api/ApiNewsletterManage.php 
b/includes/api/ApiNewsletterManage.php
deleted file mode 100644
index 2e680a5..000
--- a/includes/api/ApiNewsletterManage.php
+++ /dev/null
@@ -1,98 +0,0 @@
-getUser();
-
-   $params = $this->extractRequestParams();
-   $newsletter = Newsletter::newFromID( $params['id'] );
-
-   if ( !$newsletter ) {
-   $this->dieWithError( 'newsletter-api-error-notfound', 
'notfound' );
-   }
-
-   if ( !$newsletter->canManage( $user ) ) {
-   $this->dieWithError( 
'newsletter-api-error-nopermissions', 'nopermissions' );
-   }
-
-   $publisher = User::newFromId( $params['publisher'] );
-   if ( !$publisher || $publisher->getId() === 0 ) {
-   $this->dieWithError( 
'newsletter-api-error-invalidpublisher-registered', 'invalidpublisher' );
-   }
-
-   $store = NewsletterStore::getDefaultInstance();
-
-   $success = false;
-   $action = $params['do'];
-   if ( $action === 'addpublisher' ) {
-   $success = $store->addPublisher( $newsletter, 
$publisher );
-   } elseif ( $action === 'removepublisher' ) {
-   $success = $store->removePublisher( $newsletter, 
$publisher );
-   }
-
-   if ( !$success ) {
-   $this->dieWithError(
-   new Message( 
'newsletter-api-error-managefailure', [ $action ] ),
-   'managefailure'
-   );
-   }
-
-   // Success
-   $this->getResult()->addValue( null, $this->getModuleName(),
-

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Fix: Fatal on invalid username on API POST to Newsletter Edi...

2017-08-13 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371761 )

Change subject: Fix: Fatal on invalid username on API POST to Newsletter 
EditPage
..

Fix: Fatal on invalid username on API POST to Newsletter EditPage

Was causing: PHP Catchable fatal error:  Argument 1 passed to
LogFormatter::makeUserLink() must be an instance of User, boolean given,
called in /var/www/core/extensions/Newsletter/includes/logging/
NewsletterLogFormatter.php on line 23

Bug: T169412
Change-Id: I4693eef929d4ef00e87d288aa5d4a8514188685d
---
M includes/logging/NewsletterLogFormatter.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/61/371761/1

diff --git a/includes/logging/NewsletterLogFormatter.php 
b/includes/logging/NewsletterLogFormatter.php
index 6878252..4025f07 100644
--- a/includes/logging/NewsletterLogFormatter.php
+++ b/includes/logging/NewsletterLogFormatter.php
@@ -20,8 +20,10 @@
$params = parent::getMessageParameters();
if ( $this->entry->getTarget()->inNamespace( NS_USER ) ) {
$user = User::newFromName( 
$this->entry->getTarget()->getText() );
-   $params[2] = Message::rawParam( $this->makeUserLink( 
$user ) );
-   $params[6] = $user->getName();
+   if ( $user ) {
+   $params[2] = Message::rawParam( 
$this->makeUserLink( $user ) );
+   $params[6] = $user->getName();
+   }
}
 
if ( $this->entry->getSubtype() === 'issue-added' && isset( 
$params[5] ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4693eef929d4ef00e87d288aa5d4a8514188685d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Unskip tests now that we have Tablepager fixed

2017-05-23 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355227 )

Change subject: Unskip tests now that we have Tablepager fixed
..

Unskip tests now that we have Tablepager fixed

Change-Id: If32c2c231d3f3d7f6f3849b4825be895415ee48f
---
M tests/specials/SpecialNewslettersTest.php
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/27/355227/1

diff --git a/tests/specials/SpecialNewslettersTest.php 
b/tests/specials/SpecialNewslettersTest.php
index a0a5410..373ea51 100644
--- a/tests/specials/SpecialNewslettersTest.php
+++ b/tests/specials/SpecialNewslettersTest.php
@@ -15,8 +15,6 @@
}
 
public function testSpecialPageDoesNotFatal() {
-   $this->markTestSkipped( 'Unit tests do not support SELF JOIN on 
temporary unit test 
-   tables' );
$user = new TestUser( 'BlooBlaa' );
$req = new FauxRequest( [ 'filter' => 'subscribed' ] );
$this->executeSpecialPage( '', $req, null, $user->getUser() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If32c2c231d3f3d7f6f3849b4825be895415ee48f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Show contents from revision on Newsletter undo options

2017-05-23 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355226 )

Change subject: Show contents from revision on Newsletter undo options
..

Show contents from revision on Newsletter undo options

A bit hacky, but it would load in the description, mainpage and publishers
from previous revision in question.

Bug: T162066
Change-Id: I7020399eb6cc2bb593d1ecfce154ef2d09def4fe
---
M includes/NewsletterEditPage.php
1 file changed, 28 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/26/355226/1

diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index 8cd0cc8..2a7f335 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -43,7 +43,15 @@
->params( $this->newsletter->getName() )
);
 
-   $this->getManageForm()->show();
+   if ( $this->context->getRequest()->getVal( 'undoafter' 
) ) {
+   $oldRevision= Revision::newFromId(
+   $this->context->getRequest()->getVal( 
'undoafter' )
+   );
+   $this->getManageForm( $oldRevision )->show();
+   } else {
+   // Just load in the manage form
+   $this->getManageForm()->show();
+   }
} else {
$permErrors = $this->getPermissionErrors();
if ( count( $permErrors ) ) {
@@ -85,7 +93,11 @@
return htmlspecialchars( $this->newsletter->getName() );
}
 
-   protected function getManageForm() {
+   /**
+* @param Revision|null $oldRevision
+* @return HTMLForm
+*/
+   protected function getManageForm( Revision $oldRevision = null ) {
$publishers = UserArray::newFromIDs( 
$this->newsletter->getPublishers() );
$publishersNames = [];
 
@@ -93,29 +105,38 @@
foreach ( $publishers as $publisher ) {
$publishersNames[] = $publisher->getName();
}
+
$fields['MainPage'] = [
'type' => 'title',
'label-message' => 'newsletter-manage-title',
-   'default' =>  $mainTitle->getPrefixedText(),
+   'default' =>  $oldRevision ?
+   
$oldRevision->getContent()->getMainPage()->getPrefixedText() :
+   $mainTitle->getPrefixedText(),
'required' => true,
];
$fields['Description'] = [
'type' => 'textarea',
'label-message' => 'newsletter-manage-description',
'rows' => 6,
-   'default' => $this->newsletter->getDescription(),
+   'default' => $oldRevision ? 
$oldRevision->getContent()->getDescription() :
+   $this->newsletter->getDescription(),
'required' => true,
];
$fields['Publishers'] = [
'type' => 'usersmultiselect',
'label-message' => 'newsletter-manage-publishers',
-   'default' => $publishersNames,
'exists' => true,
+   'default' => $oldRevision ? 
$oldRevision->getContent()->getPublishers() :
+   $publishersNames,
];
$fields['Summary'] = [
'type' => 'text',
'label-message' => 'newsletter-manage-summary',
'required' => false,
+   'default' => $oldRevision ? $this->context->msg( 
'undo-summary' )
+   ->params( $oldRevision->getId(), 
$oldRevision->getUserText() )
+   ->inContentLanguage()->text() :
+   null,
];
$fields['Confirm'] = [
'type' => 'hidden',
@@ -346,8 +367,8 @@
// wants to be removed from the publishers group
$user = $this->user;
if ( !$confirmed
-   && $this->newsletter->isPublisher( $user )
-   && !in_array( $user->getId(), $newPublishersIds )
+&& $this->newsletter->isPublisher( $user )
+&& !in_array( $user->getId(), $newPublishersIds )
) {
return Status::newFatal( 
'newsletter-manage-remove-self-publisher' );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/355226
T

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Use in the 'nl_subscriber_count' to compute subscriber count

2017-05-21 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355006 )

Change subject: Use in the 'nl_subscriber_count' to compute subscriber count
..

Use in the 'nl_subscriber_count' to compute subscriber count

* Also removed unused NewsletterDb::getNewslettersFromResult()

Bug: T159083
Change-Id: I58f226b58681a797b7351ea704959682cd9f80a6
---
M includes/Newsletter.php
M includes/NewsletterDb.php
M includes/NewsletterStore.php
M includes/content/NewsletterContent.php
4 files changed, 33 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/06/355006/1

diff --git a/includes/Newsletter.php b/includes/Newsletter.php
index c86301f..820f1ad 100644
--- a/includes/Newsletter.php
+++ b/includes/Newsletter.php
@@ -117,9 +117,8 @@
/**
 * @return int
 */
-   public function getSubscriberCount() {
-   $this->loadSubscribers();
-   return count( $this->subscribers );
+   public function getSubscribersCount() {
+   return 
NewsletterStore::getDefaultInstance()->getNewsletterSubscribersCount( $this->id 
);
}
 
/**
diff --git a/includes/NewsletterDb.php b/includes/NewsletterDb.php
index eea58d0..74d55c2 100644
--- a/includes/NewsletterDb.php
+++ b/includes/NewsletterDb.php
@@ -359,6 +359,28 @@
return array_map( 'intval', $result );
}
 
+
+   /**
+* @param $id
+* @return array
+*/
+   public function getNewsletterSubscribersCount( $id ) {
+   Assert::parameterType( 'integer', $id, '$id' );
+
+   $dbr = $this->lb->getConnection( DB_SLAVE );
+
+   $result = $dbr->selectField(
+   'nl_newsletters',
+   'nl_subscriber_count',
+   [ 'nl_id' => $id ],
+   __METHOD__
+   );
+
+   $this->lb->reuseConnection( $dbr );
+
+   return -(int)$result;
+   }
+
/**
 * @param int $id
 *
@@ -400,20 +422,6 @@
 
$this->lb->reuseConnection( $dbr );
return $res;
-   }
-
-   /**
-* @param ResultWrapper $result
-*
-* @return Newsletter[]
-*/
-   private function getNewslettersFromResult( ResultWrapper $result ) {
-   $newsletters = [];
-   foreach ( $result as $row ) {
-   $newsletters[] = $this->getNewsletterFromRow( $row );
-   }
-
-   return $newsletters;
}
 
/**
diff --git a/includes/NewsletterStore.php b/includes/NewsletterStore.php
index 30dbfd9..c2121d4 100644
--- a/includes/NewsletterStore.php
+++ b/includes/NewsletterStore.php
@@ -190,6 +190,14 @@
}
 
/**
+* @param $id
+* @return array
+*/
+   public function getNewsletterSubscribersCount( $id ) {
+   return $this->db->getNewsletterSubscribersCount( $id );
+   }
+
+   /**
 * @param int $id
 *
 * @return int[]
diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index 4da1bff..67d2aac 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -150,7 +150,7 @@
'type' => 'info',
'label-message' => 
'newsletter-view-subscriber-count',
'default' => !$this->newsletter ? 0 : 
$options->getUserLangObj()->formatNum(
-   
$this->newsletter->getSubscriberCount() ),
+   
$this->newsletter->getSubscribersCount() ),
],
];
$publishersArray = $this->getPublishersFromJSONData( 
$this->publishers );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58f226b58681a797b7351ea704959682cd9f80a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Addnewsletter queries should go into a single transaction

2017-05-21 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354930 )

Change subject: Addnewsletter queries should go into a single transaction
..

Addnewsletter queries should go into a single transaction

* Announce issue page should check if title exists

Bug: T159081
Change-Id: I1b46a4450c6d3dfcdbbc5536694b21e6f28be568
---
M includes/NewsletterDb.php
M includes/specials/SpecialNewsletter.php
2 files changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/30/354930/1

diff --git a/includes/NewsletterDb.php b/includes/NewsletterDb.php
index eea58d0..bbe5aef 100644
--- a/includes/NewsletterDb.php
+++ b/includes/NewsletterDb.php
@@ -443,6 +443,7 @@
// Note: the writeDb is used as this is used in the next insert
$dbw = $this->lb->getConnection( DB_MASTER );
 
+   $dbw->begin( __METHOD__ );
$lastIssueId = (int)$dbw->selectField(
'nl_issues',
'MAX(nli_issue_id)',
@@ -463,7 +464,9 @@
],
__METHOD__
);
+   $dbw->commit( __METHOD__ );
} catch ( DBQueryError $ex ) {
+   $dbw->rollback( __METHOD__ );
$success = false;
}
 
diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index a2e0dc2..9bfcf00 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -300,6 +300,7 @@
$fields = [
'issuepage' => [
'type' => 'title',
+   'exists' => true,
'name' => 'issuepage',
'creatable' => true,
'required' => true,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b46a4450c6d3dfcdbbc5536694b21e6f28be568
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Actually get the Newsletter name by using $this->newsletter

2017-05-21 Thread 01tonythomas (Code Review)
01tonythomas has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354920 )

Change subject: Actually get the Newsletter name by using $this->newsletter
..


Actually get the Newsletter name by using $this->newsletter

Before, $this->getName() is called, but that does not exist.
Now, calling $this->newsletter->getName() actually gets the name

Bug: T159081
Change-Id: Idd01eaf8b0d364dd72659d6bf4c9201e61b77fa4
---
M includes/NewsletterEditPage.php
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index ac7f5d8..8cd0cc8 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -40,7 +40,7 @@
 
$this->out->setPageTitle(
$this->context->msg( 'newsletter-manage' )
-   ->params( $this->getName() )
+   ->params( $this->newsletter->getName() )
);
 
$this->getManageForm()->show();
@@ -135,7 +135,7 @@
$form->setAction( $this->title->getLocalURL( 'action=submit' ) 
);
$form->addHeaderText(
$this->context->msg( 'newsletter-manage-text' )
-   ->params( $this->getName() )->parse()
+   ->params( $this->newsletter->getName() 
)->parse()
);
$form->setId( 'newsletter-manage-form' );
$form->setSubmitID( 'newsletter-manage-button' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd01eaf8b0d364dd72659d6bf4c9201e61b77fa4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: MtDu 
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: [WIP] Sort by the 'most popular' newsletters

2017-05-21 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354905 )

Change subject: [WIP] Sort by the 'most popular' newsletters
..

[WIP] Sort by the 'most popular' newsletters

Bug: T131607
Change-Id: I51d63df8efb4e036606f648f2e6ddf18d37fd565
---
M Newsletter.hooks.php
M includes/specials/pagers/NewsletterTablePager.php
A sql/nl_newsletter-add-nl_active_subscriber_name.sql
A sql/nl_newsletter-drop-nl-active_name.sql
4 files changed, 20 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/05/354905/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 32dd5e5..5ac4dbf 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -117,6 +117,10 @@
__DIR__ . '/sql/nl_newsletters-add-unique.sql' );
$updater->addExtensionField( 'nl_newsletters', 
'nl_subscriber_count',
__DIR__ . 
'/sql/nl_newsletters-add-subscriber_count.sql' );
+   $updater->dropExtensionIndex( 'nl_newsletters', 
'nl_main_page_active',
+   __DIR__ . '/sql/nl_newsletter-drop-nl-active_name.sql' 
);
+   $updater->addExtensionIndex( 'nl_newsletters', 
'nl_active_subscriber_name',
+   __DIR__ . 
'/sql/nl_newsletter-add-nl_active_subscriber_name.sql' );
 
return true;
}
diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 7623d1d..b9ec995 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -28,6 +28,7 @@
if ( $readDb !== null ) {
$this->mDb = $readDb;
}
+   $this->mExtraSortFields = [ 'nl_name' ];
parent::__construct( $context );
}
 
@@ -51,7 +52,7 @@
private function getSubscribedQuery( $offset, $limit, $descending ) {
// XXX Hacky
$oldIndex = $this->mIndexField;
-   $this->mIndexField = 'nl_name';
+   $this->mIndexField = 'nl_subscriber_count';
$this->mode = 'subscribed';
list( $tables, $fields, $conds, $fname, $options, $join_conds ) 
=
$this->buildQueryInfo( $offset, $limit, $descending );
@@ -65,7 +66,7 @@
private function getUnsubscribedQuery( $offset, $limit, $descending ) {
// XXX Hacky
$oldIndex = $this->mIndexField;
-   $this->mIndexField = 'nl_name';
+   $this->mIndexField = 'nl_subscriber_count';
$this->mode = 'unsubscribed';
list( $tables, $fields, $conds, $fname, $options, $join_conds ) 
=
$this->buildQueryInfo( $offset, $limit, $descending );
@@ -122,14 +123,16 @@
'nl_name',
'nl_desc',
'nl_id',
-   'subscribers' => "( SELECT COUNT(*) FROM 
$tblSubscriptions WHERE nls_newsletter_id = nl_id )",
-   'nls_subscriber_id'
+   'subscribers' => "nl_subscriber_count",
+   'nls_subscriber_id'
],
];
$info['conds'] = [ 'nl_active' => 1 ];
 
if ( $this->mode == "unsubscribed" ) {
-   $info['fields']['sort'] = $this->mDb->buildConcat( [ 
'"U"', 'nl_name' ] );
+   $info['fields']['sort'] = $this->mDb->buildConcat(
+   [ '"U"', 'nl_subscriber_count', 'nl_name' ]
+   );
$info['join_conds'] = [
'nl_subscriptions' => [
'LEFT OUTER JOIN',
@@ -141,7 +144,9 @@
];
$info['conds']['nls_subscriber_id'] = null;
} elseif ( $this->mode == "subscribed" ) {
-   $info['fields']['sort'] = $this->mDb->buildConcat( [ 
'"S"', 'nl_name' ] );
+   $info['fields']['sort'] = $this->mDb->buildConcat(
+   [ '"S"', 'nl_subscriber_count', 'nl_name' ]
+   );
$info['join_conds'] = [
'nl_subscriptions' => [
'INNER JOIN',
@@ -233,7 +238,7 @@
}
 
public function getDefaultSort() {
-   $this->mDefaultDirection = IndexPager::DIR_ASCENDING;
+   $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
return 'sort';
}
 
diff --git a/sql/nl_newsletter-add-nl_active_subscriber_name.sql 
b/sql/nl_newsletter-add-nl_active_subscriber_name.sql
new fi

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Add in 'nl_subscribers_count' column to 'nl_newsletters' table

2017-05-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354756 )

Change subject: Add in 'nl_subscribers_count' column to 'nl_newsletters' table
..

Add in 'nl_subscribers_count' column to 'nl_newsletters' table

* Would save costly queries on Special:Newsletters
* Can help later in sorting via subscribers count too

Bug: T131607
Change-Id: I3842e5a83c8cd09459d5a4156758bf6292c097e9
---
M Newsletter.hooks.php
M includes/NewsletterDb.php
A maintenance/updateSubscribersCount.php
A sql/nl_newsletters-add-subscriber_count.sql
4 files changed, 78 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/56/354756/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 48cb1c0..32dd5e5 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -115,6 +115,8 @@
__DIR__ . '/sql/nl_main_page_id-drop-index.sql' );
$updater->addExtensionIndex( 'nl_newsletters', 
'nl_main_page_active',
__DIR__ . '/sql/nl_newsletters-add-unique.sql' );
+   $updater->addExtensionField( 'nl_newsletters', 
'nl_subscriber_count',
+   __DIR__ . 
'/sql/nl_newsletters-add-subscriber_count.sql' );
 
return true;
}
diff --git a/includes/NewsletterDb.php b/includes/NewsletterDb.php
index bc523bd..eea58d0 100644
--- a/includes/NewsletterDb.php
+++ b/includes/NewsletterDb.php
@@ -32,8 +32,20 @@
];
}
$dbw = $this->lb->getConnection( DB_MASTER );
+   $dbw->begin( __METHOD__ );
$dbw->insert( 'nl_subscriptions', $rowData, __METHOD__, [ 
'IGNORE' ] );
$success = (bool)$dbw->affectedRows();
+
+   if ( $success ) {
+   $dbw->update(
+   'nl_newsletters',
+   [ 'nl_subscriber_count=nl_subscriber_count+1' ],
+   [ 'nl_id' => $newsletter->getId() ],
+   __METHOD__
+   );
+   }
+
+   $dbw->commit();
$this->lb->reuseConnection( $dbw );
 
return $success;
@@ -52,8 +64,19 @@
];
 
$dbw = $this->lb->getConnection( DB_MASTER );
+   $dbw->begin( __METHOD__ );
$dbw->delete( 'nl_subscriptions', $rowData, __METHOD__ );
$success = (bool)$dbw->affectedRows();
+   if ( $success ) {
+   $dbw->update(
+   'nl_newsletters',
+   [ 'nl_subscriber_count=nl_subscriber_count-1' ],
+   [ 'nl_id' => $newsletter->getId() ],
+   __METHOD__
+   );
+   }
+
+   $dbw->commit();
$this->lb->reuseConnection( $dbw );
 
return $success;
diff --git a/maintenance/updateSubscribersCount.php 
b/maintenance/updateSubscribersCount.php
new file mode 100644
index 000..fffaee4
--- /dev/null
+++ b/maintenance/updateSubscribersCount.php
@@ -0,0 +1,50 @@
+addDescription(
+   "Regenerate nl_subscribers_count in nl_newsletters from 
nl_subscriptions table" );
+   $this->requireExtension( 'Newsletter' );
+   }
+
+   public function execute() {
+   $dbw = $this->getDB( DB_MASTER );
+   $offset = 0;
+   while ( true ) {
+   $res =
+   $dbw->select( [ 'nl_newsletters', 
'nl_subscriptions' ],
+   [ 'nl_id', 'subscriber_count' => 
'COUNT(nls_subscriber_id)' ],
+   'nl_id > ' . $dbw->addQuotes( $offset ),
+   __METHOD__,
+   [ 'GROUP BY' => 'nl_id', 'LIMIT' => 50, 
'ORDER BY' => 'nl_id' ],
+   [ 'nl_subscriptions' => [ 'LEFT JOIN', 
'nls_newsletter_id=nl_id' ] ] );
+
+   if ( $res->numRows() === 0 ) {
+   break;
+   }
+
+   foreach ( $res as $row ) {
+   $dbw->update( 'nl_newsletters', [ 
'nl_subscriber_count' => $row->subscriber_count ],
+   [ 'nl_id' => $row->nl_id ], __METHOD__ 
);
+   }
+
+   $this->output( "Updated " . $res->numRows() . " rows 
\n" );
+
+   wfWaitForSlaves();
+
+   // We need to get the last element and add to offset.
+   $offset = $row->nl_id;
+   }
+
+   $this->output( "Done!\n" );
+   }
+}
+
+$maintClass = "updateSubs

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: use UserArray::newFromNames instead of manually doing this

2017-05-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354751 )

Change subject: use UserArray::newFromNames instead of manually doing this
..

use UserArray::newFromNames instead of manually doing this

Bug: T159083
Change-Id: If9ebf8862e3dc3c711494090a6f9cb420aa518f0
---
M includes/content/NewsletterContent.php
1 file changed, 1 insertion(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/51/354751/1

diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index 92e8573..4da1bff 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -107,17 +107,7 @@
return false;
}
 
-   /** @var User[] $publishers */
-   $publishers = [];
-
-   foreach ( $publishersList as $publisherName ) {
-   $user = User::newFromName( $publisherName );
-   if ( $user && $user->getId() ) {
-   $publishers[] = $user->getId();
-   }
-   }
-
-   return UserArray::newFromIDs( $publishers );
+   return UserArray::newFromNames( $publishersList );
}
 
public function onSuccess() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9ebf8862e3dc3c711494090a6f9cb420aa518f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Reduce the database query load by caching all newsletters lo...

2017-05-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354749 )

Change subject: Reduce the database query load by caching all newsletters 
locally
..

Reduce the database query load by caching all newsletters locally

Bug: T159083
Change-Id: I69c969b7963b3d1edc40dbb056c5658fff9f4f6d
---
M includes/specials/pagers/NewsletterTablePager.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/49/354749/1

diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 70b9d11..f7b22bb 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -20,6 +20,8 @@
 */
private $option;
 
+   private $newslettersArray;
+
public function __construct( IContextSource $context = null, Database 
$readDb = null ) {
if ( $readDb !== null ) {
$this->mDb = $readDb;
@@ -42,6 +44,13 @@
}
 
return $this->fieldNames;
+   }
+
+   public function preprocessResults( $result ) {
+   foreach ( $result as $res ) {
+   $this->newslettersArray[$res->nl_id] = 
Newsletter::newFromID( (int)$res->nl_id );
+   }
+   parent::preprocessResults( $result ); // TODO: Change the 
autogenerated stub
}
 
public function getQueryInfo() {
@@ -83,7 +92,7 @@
 
$linkRenderer = 
MediaWikiServices::getInstance()->getLinkRenderer();
$id = $this->mCurrentRow->nl_id;
-   $newsletter = Newsletter::newFromID( (int)$id );
+   $newsletter = $this->newslettersArray[(int)$id];
switch ( $field ) {
case 'nl_name':
$title = Title::makeTitleSafe( NS_NEWSLETTER, 
$newsletter->getName() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69c969b7963b3d1edc40dbb056c5658fff9f4f6d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Remove bogus DISTINCT nl_id on already UNIQUE nl_id field

2017-05-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354636 )

Change subject: Remove bogus DISTINCT nl_id on already UNIQUE nl_id field
..

Remove bogus DISTINCT nl_id on already UNIQUE nl_id field

Bug: T159083
Change-Id: I626a945c6af7a066c622019b679a6e6491391f54
---
M includes/specials/pagers/NewsletterTablePager.php
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/36/354636/1

diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 70b9d11..be2b669 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -57,8 +57,7 @@
'nl_desc',
'nl_id',
'subscribers' => "( SELECT COUNT(*) FROM 
$tblSubscriptions WHERE nls_newsletter_id = nl_id )",
-   ],
-   'options' => [ 'DISTINCT nl_id' ],
+   ]
];
 
$info['conds'] = [ 'nl_active = 1' ];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I626a945c6af7a066c622019b679a6e6491391f54
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Remove bogus comments

2017-05-19 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354555 )

Change subject: Remove bogus comments
..

Remove bogus comments

Change-Id: Ia07b567c667effd6c972ca07fb8e75d63424fbf4
---
M Newsletter.hooks.php
M includes/content/NewsletterContent.php
2 files changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index a1abc6d..54a64b1 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -312,6 +312,7 @@
 * @param User $user the User object representing the user whois 
performing the edit.
 * @param $minoredit bool whether the edit was marked as minor by the 
user.
 * @return bool
+* @throws ThrottledError
 */
public static function onEditFilterMergedContent( IContextSource 
$context, Content $content,
  Status $status, 
$summary, User $user, $minoredit ) {
diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index 1188af3..4039492 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -447,7 +447,6 @@
 * updates (relevant mostly for LinksUpdate).
 * @param ParserOutput $parserOutput ParserOutput representing the 
rendered version of the page after the edit.
 * @return DataUpdate[]
-* @throws ThrottledError
 *
 * @see Content::getSecondaryDataUpdates()
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia07b567c667effd6c972ca07fb8e75d63424fbf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Throttle check should happen before hitting doUpdate()

2017-05-19 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354552 )

Change subject: Throttle check should happen before hitting doUpdate()
..

Throttle check should happen before hitting doUpdate()

Change-Id: I32aed8bfa233c4894cd2755f80f8eefe57834ac4
---
M includes/content/NewsletterContent.php
M includes/content/NewsletterDataUpdate.php
2 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/52/354552/1

diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index 4039492..e165b9b 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -447,6 +447,7 @@
 * updates (relevant mostly for LinksUpdate).
 * @param ParserOutput $parserOutput ParserOutput representing the 
rendered version of the page after the edit.
 * @return DataUpdate[]
+* @throws ThrottledError
 *
 * @see Content::getSecondaryDataUpdates()
 */
@@ -454,6 +455,11 @@
 ParserOutput $parserOutput = 
null
) {
global $wgUser;
+   if ( $wgUser->pingLimiter( 'newsletter' ) ) {
+   // Default user access level for creating a newsletter 
is quite low
+   // so add a throttle here to prevent abuse (eg. mass 
vandalism spree)
+   throw new ThrottledError;
+   }
// @todo This user object might not be the right one in some 
cases.
// but that should be pretty rare in the context of newsletters.
$mwUpdate = new NewsletterDataUpdate( $this, $title, $wgUser );
diff --git a/includes/content/NewsletterDataUpdate.php 
b/includes/content/NewsletterDataUpdate.php
index 1d157d7..6831b9f 100644
--- a/includes/content/NewsletterDataUpdate.php
+++ b/includes/content/NewsletterDataUpdate.php
@@ -63,11 +63,6 @@
return;
}
}
-   if ( $this->user->pingLimiter( 'newsletter' ) ) {
-   // Default user access level for creating a 
newsletter is quite low
-   // so add a throttle here to prevent abuse (eg. 
mass vandalism spree)
-   throw new ThrottledError;
-   }
$title = Title::makeTitleSafe( NS_NEWSLETTER, 
$this->name );
$newsletter = new Newsletter( 0,
$title->getText(),
@@ -78,10 +73,10 @@
if ( $newsletterCreated ) {
$newsletter->subscribe( $this->user );
$store->addPublisher( $newsletter, $this->user 
);
-   return Status::newGood();
+   return;
} else {
// Couldn't insert to the DB..
-   return Status::newFatal( 
'newsletter-create-error' );
+   $logger->warning( 'newsletter-create-error' );
}
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32aed8bfa233c4894cd2755f80f8eefe57834ac4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Disable page navigations on Special:Newsletter

2017-05-14 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353768 )

Change subject: Disable page navigations on Special:Newsletter
..

Disable page navigations on Special:Newsletter

Bug: T165234
Change-Id: Ifb1d69ff1a320169df1c7333ddb95627cd5a819a
---
M includes/specials/pagers/NewsletterTablePager.php
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/68/353768/1

diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 70b9d11..c310982 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -168,4 +168,8 @@
$this->option = $value;
}
 
+   public function isNavigationBarShown() {
+   return false;
+   }
+
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb1d69ff1a320169df1c7333ddb95627cd5a819a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Sync DB tables manually on a newsletter edit over API

2017-04-02 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/346055 )

Change subject: Sync DB tables manually on a newsletter edit over API
..

Sync DB tables manually on a newsletter edit over API

SecondaryDataUpdates hook is implemented in the extension to keep
the Newsletter content values in sync with the newsletter and its
subsribers table.

TODO:
* Uniqueness of MainPage is not implemented for an APIEdit. Might
lead to inconsistency later ?

Bug: T160854
Change-Id: I2f631e336b0219958c917242078d88ec94a95ae5
---
M Newsletter.hooks.php
M extension.json
2 files changed, 80 insertions(+), 0 deletions(-)


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

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 71db636..d79cfc5 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -304,4 +304,81 @@
}
return true;
}
+
+   /**
+* @param Title $title Title of the page that is being edited.
+* @param Content $oldContent Content object representing the page's 
content before the edit.
+* @param bool $recursive bool indicating whether DataUpdates should 
trigger recursive
+* updates (relevant mostly for LinksUpdate).
+* @param ParserOutput $parserOutput ParserOutput representing the 
rendered version of the page
+   after the edit.
+* @param &$updates: a list of DataUpdate objects, to be modified or 
replaced by
+   the hook handler.
+* @return bool
+*/
+   public static function onSecondaryDataUpdates( Title $title, Content 
$oldContent = null,
+   
  $recursive = true, ParserOutput $parserOutput = null, 
&$updates ) {
+   if ( $title->inNamespace( NS_NEWSLETTER ) && 
$title->hasContentModel( 'NewsletterContent' ) ) {
+   $newsletter = Newsletter::newFromName( 
$title->getText() );
+   if ( $newsletter ) {
+   $newsletterId = $newsletter->getId();
+   $newsletterArticle = 
Article::newFromID($title->getArticleID());
+   $newsletterArticleContent = 
$newsletterArticle->getPage()->getContent();
+
+   $editedDescription = 
$newsletterArticleContent->getDescription();
+   $editedPublishersList = 
$newsletterArticleContent->getPublishers();
+   $editedMainPage = 
$newsletterArticleContent->getMainPage();
+
+   $store = NewsletterStore::getDefaultInstance();
+
+   if ( $newsletter->getDescription() != 
$editedDescription ) {
+   $store->updateDescription( 
$newsletterId, $editedDescription );
+   }
+
+   $updatedMainPageId = Title::newFromText( 
$editedMainPage )->getArticleID();
+   if ( $newsletter->getPageId() != 
$updatedMainPageId ) {
+   $store->updateMainPage($newsletterId, 
$updatedMainPageId);
+   }
+   if ( $editedPublishersList ) {
+   /** @var User[] $newPublishers */
+   $newPublishers = array_map( 
'User::newFromName', $editedPublishersList );
+
+   $oldPublishersIds = 
$newsletter->getPublishers();
+   $newPublishersIds = array();
+
+   foreach ( $newPublishers as $user ) {
+   $newPublishersIds[] = 
$user->getId();
+   }
+
+   // Do the actual modifications now
+   $added = array_diff( $newPublishersIds, 
$oldPublishersIds );
+   $removed = array_diff( 
$oldPublishersIds, $newPublishersIds );
+
+   // @todo Do this in a batch..
+   foreach ( $added as $auId ) {
+   $store->addPublisher( 
$newsletter, User::newFromId( $auId ) );
+   }
+   global $wgUser;
+
+   if ( $added ) {
+   EchoEvent::create(
+   array(
+   'type' => 
'newsletter-newpublisher',
+   'extra' =

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Check if $removed was set, before calling in the removeSubsc...

2016-12-25 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/329198 )

Change subject: Check if $removed was set, before calling in the 
removeSubscriptions()
..

Check if $removed was set, before calling in the removeSubscriptions()

Bug: T154118

Change-Id: I3fcb07e9bfac1173e348683c76889107e64c5d57
---
M includes/specials/SpecialNewsletter.php
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/98/329198/1

diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index 07f329e..811ddc5 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -531,8 +531,9 @@
 
$store = NewsletterStore::getDefaultInstance();
$store->addSubscription( $this->newsletter, $added );
-   $store->removeSubscription( $this->newsletter, $removed );
-
+   if ( $removed ) {
+   $store->removeSubscription( $this->newsletter, $removed 
);
+   }
$out = $this->getOutput();
// Now report to the user
if ( $added || $removed ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fcb07e9bfac1173e348683c76889107e64c5d57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Fix: Fatal on change of newsletter main page

2016-12-21 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/328568 )

Change subject: Fix: Fatal on change of newsletter main page
..

Fix: Fatal on change of newsletter main page

Bug: T153892
Change-Id: I6834e35ba9ec0ebd27e23ff374747552b97335e5
---
M includes/NewsletterStore.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/68/328568/1

diff --git a/includes/NewsletterStore.php b/includes/NewsletterStore.php
index 1605601..51b5936 100644
--- a/includes/NewsletterStore.php
+++ b/includes/NewsletterStore.php
@@ -249,7 +249,7 @@
 * @throws MWException
 */
public function newsletterExistsForMainPage( $mainPageId ) {
-   return $this->db->newsletterExistsWithName( $mainPageId );
+   return $this->db->newsletterExistsForMainPage( $mainPageId );
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6834e35ba9ec0ebd27e23ff374747552b97335e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Decode values correctly on Newsletter content fixing fatal

2016-12-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326249 )

Change subject: Decode values correctly on Newsletter content fixing fatal
..

Decode values correctly on Newsletter content fixing fatal

Bug: T152833
Change-Id: I46a2fbebd351a8831644470f02db2cad86079ff1
---
M includes/content/NewsletterContent.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/49/326249/1

diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
index ad0a257..3acb546 100644
--- a/includes/content/NewsletterContent.php
+++ b/includes/content/NewsletterContent.php
@@ -125,6 +125,9 @@
 
protected function fillParserOutput( Title $title, $revId, 
ParserOptions $options, $generateHtml, ParserOutput &$output ) {
if ( $generateHtml ) {
+   //Make sure things are decoded at this point
+   $this->decode();
+
$this->newsletter = Newsletter::newFromName( 
$title->getText() );
$user = $options->getUser();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46a2fbebd351a8831644470f02db2cad86079ff1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Correct return of ArticleDelete hook implmentation

2016-11-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Correct return of ArticleDelete hook implmentation
..

Correct return of ArticleDelete hook implmentation

Bug: T150399
Change-Id: I59bd64b51a87963c98de4289c41bbfe22db7c8eb
---
M Newsletter.hooks.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/65/320765/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 4536962..2c8ebe7 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -198,14 +198,15 @@
$success = NewsletterStore::getDefaultInstance()
->deleteNewsletter( $newsletter, $reason );
if ( $success ) {
-   return $status->newGood();
+   $status->newGood();
} else {
// Show error message and allow resubmitting in 
case of failure
-   return $status->newFatal(
+   $status->newFatal(
$wgOut->msg( 
'newsletter-delete-failure' )->rawParams( $newsletter->getName() )
);
}
+   return false;
}
-   return true;
+   return false;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I59bd64b51a87963c98de4289c41bbfe22db7c8eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Adding myself as an author to Newsletter extension

2016-11-06 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Adding myself as an author to Newsletter extension
..

Adding myself as an author to Newsletter extension

Time to be responsible for all the havoc due to ContentHandler
migration

Change-Id: I8392cbfe4e203757d75040ce06639c394f0806d1
---
M extension.json
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/08/320108/1

diff --git a/extension.json b/extension.json
index 6876d65..4c7e503 100644
--- a/extension.json
+++ b/extension.json
@@ -3,7 +3,8 @@
"version": "1.2.0",
"author": [
"Siebrand Mazeland",
-   "Tina Johnson"
+   "Tina Johnson",
+   "Tony Thomas"
],
"url": "https://www.mediawiki.org/wiki/Extension:Newsletter";,
"descriptionmsg": "newsletter-extension-desc",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8392cbfe4e203757d75040ce06639c394f0806d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: On deleting the main page, remove the newsletter from DB too

2016-11-06 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: On deleting the main page, remove the newsletter from DB too
..

On deleting the main page, remove the newsletter from DB too

Change-Id: Id38bc798a1e6cca411e8d75b334ce39b298d498d
---
M Newsletter.hooks.php
M extension.json
2 files changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/90/320090/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index d765bf1..4536962 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -174,4 +174,38 @@
$editPage->edit();
return false;
}
+
+   /**
+* @param WikiPage $wikiPage
+* @param User $user
+* @param string $reason
+* @param string $error
+* @param Status $status
+* @param $suppress
+* @return bool
+* @throws PermissionsError
+*/
+   public static function onArticleDelete( &$wikiPage, &$user, &$reason, 
&$error, Status &$status, $suppress) {
+   global $wgOut;
+   if ( !$wikiPage->getTitle()->inNamespace( NS_NEWSLETTER ) ) {
+   return true;
+   }
+   $newsletter = Newsletter::newFromName( 
$wikiPage->getTitle()->getText() );
+   if ( $newsletter ) {
+   if ( !$newsletter->canDelete( $user ) ) {
+   throw new PermissionsError( 'newsletter-delete' 
);
+   }
+   $success = NewsletterStore::getDefaultInstance()
+   ->deleteNewsletter( $newsletter, $reason );
+   if ( $success ) {
+   return $status->newGood();
+   } else {
+   // Show error message and allow resubmitting in 
case of failure
+   return $status->newFatal(
+   $wgOut->msg( 
'newsletter-delete-failure' )->rawParams( $newsletter->getName() )
+   );
+   }
+   }
+   return true;
+   }
 }
diff --git a/extension.json b/extension.json
index 6876d65..2e1c8af 100644
--- a/extension.json
+++ b/extension.json
@@ -157,6 +157,9 @@
],
"CustomEditor": [
"NewsletterHooks::onCustomEditor"
+   ],
+   "ArticleDelete": [
+   "NewsletterHooks::onArticleDelete"
]
},
"namespaces": [

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id38bc798a1e6cca411e8d75b334ce39b298d498d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: on Creating a newsletter via Special:CreateNewsletter save i...

2016-11-06 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: on Creating a newsletter via Special:CreateNewsletter save it 
correctly
..

on Creating a newsletter via Special:CreateNewsletter save it correctly

Bug: T150075
Change-Id: I178d5a01c0ad835ec6abae17072bf80ec0ccb32d
---
M includes/specials/SpecialNewsletterCreate.php
1 file changed, 18 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/89/320089/1

diff --git a/includes/specials/SpecialNewsletterCreate.php 
b/includes/specials/SpecialNewsletterCreate.php
index 84005fa..cd952fe 100644
--- a/includes/specials/SpecialNewsletterCreate.php
+++ b/includes/specials/SpecialNewsletterCreate.php
@@ -126,9 +126,23 @@
$newsletterCreated = $store->addNewsletter( $this->newsletter );
 
if ( $newsletterCreated ) {
-   $this->onPostCreation( $user );
-
-   return Status::newGood();
+   $title = Title::makeTitleSafe( NS_NEWSLETTER, trim( 
$data['Name'] ) );
+   $editSummaryMsg = $this->msg( 
'newsletter-create-editsummary' );
+   $result = NewsletterContentHandler::edit(
+   $title,
+   $data['Description'],
+   $input['mainpage'],
+   array( $user->getName() ),
+   $editSummaryMsg->inContentLanguage()->plain(),
+   $this->getContext()
+   );
+   if ( $result->isGood() ) {
+   $this->onPostCreation( $user );
+   return Status::newGood();
+   } else {
+   // The content creation was unsuccessful, lets 
rollback the newsletter from db
+   $store->rollBackNewsletterAddition( 
$this->newsletter );
+   }
}
 
// Couldn't insert to the DB..
@@ -147,7 +161,7 @@
}
 
public function onSuccess() {
-   $this->getOutput()->addWikiMsg( 
'newsletter-create-confirmation', $this->newsletter->getId() );
+   $this->getOutput()->addWikiMsg( 
'newsletter-create-confirmation', $this->newsletter->getName() );
}
 
public function doesWrites() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I178d5a01c0ad835ec6abae17072bf80ec0ccb32d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Remove unused $user passed to NewsletterEditPage

2016-11-05 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Remove unused $user passed to NewsletterEditPage
..

Remove unused $user passed to NewsletterEditPage

Bug: T138462
Change-Id: I684095e229a0b16e471d7b729e929725ee2a199b
---
M Newsletter.hooks.php
M includes/NewsletterEditPage.php
2 files changed, 3 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/98/319998/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 193808e..d765bf1 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -158,7 +158,6 @@
 * @throws ReadOnlyError
 */
public static function onCustomEditor( Article $article, User $user ) {
-   $out = $article->getContext()->getOutput();
if ( !$article->getTitle()->inNamespace( NS_NEWSLETTER ) ) {
return true;
}
@@ -166,9 +165,8 @@
$newsletter = Newsletter::newFromName( 
$article->getTitle()->getText() );
if ( $newsletter ) {
// A newsletter exists in that title, lets redirect to 
manage page
-   $editPage = new NewsletterEditPage( 
$article->getContext(), $newsletter, $user );
+   $editPage = new NewsletterEditPage( 
$article->getContext(), $newsletter );
$editPage->edit();
-
return false;
}
 
diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index aab3708..95f1b7f 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -8,13 +8,12 @@
 
protected $newsletter;
 
-   public function __construct( IContextSource $context, Newsletter 
$newsletter = null, User $user = null) {
+   public function __construct( IContextSource $context, Newsletter 
$newsletter = null) {
$this->context = $context;
$this->user = $context->getUser();
$this->title = $context->getTitle();
$this->out = $context->getOutput();
$this->newsletter = $newsletter;
-   $this->user = $user;
}
 
public function edit() {
@@ -22,6 +21,7 @@
throw new ReadOnlyError;
}
$this->createNew = !$this->title->exists();
+
if ( !$this->createNew ) {
// A newsletter exists, lets open the edit page
if ( $this->user->isBlocked() ) {
@@ -48,14 +48,6 @@
$this->out->setPageTitle( $this->context->msg( 
'newslettercreate', $this->title->getPrefixedText() )->text() );
$this->getForm()->show();
}
-
-   // TODO more things here
-   // block
-   // ratelimit
-   // check existing
-   // add subtitle link
-   // intro
-   // form
}
 
protected function getPermissionErrors() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I684095e229a0b16e471d7b729e929725ee2a199b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Add in NewsletterDiffEngine to explore history

2016-10-31 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add in NewsletterDiffEngine to explore history
..

Add in NewsletterDiffEngine to explore history

Bug: T138462
Change-Id: I2dcc79762f8e129996e8f5f5dd6c568b0144102e
---
M Newsletter.hooks.php
M extension.json
M includes/NewsletterEditPage.php
A includes/content/NewsletterDiffEngine.php
4 files changed, 69 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/07/319007/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 193808e..2410d69 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -166,10 +166,9 @@
$newsletter = Newsletter::newFromName( 
$article->getTitle()->getText() );
if ( $newsletter ) {
// A newsletter exists in that title, lets redirect to 
manage page
-   $editPage = new NewsletterEditPage( 
$article->getContext(), $newsletter, $user );
-   $editPage->edit();
-
-   return false;
+   $title = SpecialPage::getTitleFor( 'Newsletter', 
$newsletter->getId() . '/' .
+   'manage' );
+   $out->redirect( $title->getFullURL() );
}
 
$editPage = new NewsletterEditPage( $article->getContext() );
diff --git a/extension.json b/extension.json
index 740310f..6876d65 100644
--- a/extension.json
+++ b/extension.json
@@ -83,6 +83,7 @@
"ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
"NewsletterContent": "includes/content/NewsletterContent.php",
"NewsletterContentHandler": 
"includes/content/NewsletterContentHandler.php",
+   "NewsletterDiffEngine": 
"includes/content/NewsletterDiffEngine.php",
"NewsletterDeletionUpdate": 
"includes/content/NewsletterDeletionUpdate.php",
"EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php",
"EchoNewsletterFormatter": 
"includes/Echo/EchoNewsletterFormatter.php",
diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index aab3708..4a35ac6 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -10,11 +10,10 @@
 
public function __construct( IContextSource $context, Newsletter 
$newsletter = null, User $user = null) {
$this->context = $context;
-   $this->user = $context->getUser();
+   $this->user = $user ? : $context->getUser();
$this->title = $context->getTitle();
$this->out = $context->getOutput();
$this->newsletter = $newsletter;
-   $this->user = $user;
}
 
public function edit() {
diff --git a/includes/content/NewsletterDiffEngine.php 
b/includes/content/NewsletterDiffEngine.php
new file mode 100644
index 000..939c81d
--- /dev/null
+++ b/includes/content/NewsletterDiffEngine.php
@@ -0,0 +1,64 @@
+generateTextDiffBody(
+   $old->getDescription(), $new->getDescription()
+   );
+
+   if ( $descDiff ) {
+   if ( trim( $descDiff ) !== '' ) {
+   $output .= Html::openElement( 'tr' );
+   $output .= Html::openElement( 'td',
+   [ 'colspan' => 4, 'id' => 
'mw-newsletter-diffdescheader' ] );
+   $output .= Html::element( 'h4', [],
+   $this->msg( 
'newsletter-diff-descheader' )->text() );
+   $output .= Html::closeElement( 'td' );
+   $output .= Html::closeElement( 'tr' );
+   $output .= $descDiff;
+   }
+   }
+
+   $mainPageDiff = $this->generateTextDiffBody(
+   $old->getMainPage(), $new->getMainPage()
+   );
+
+   if ( $mainPageDiff ) {
+   if( trim( $mainPageDiff ) !== '' ) {
+   $output .= Html::openElement( 'tr' );
+   $output .= Html::openElement( 'td',
+   [ 'colspan' => 4, 'id' => 
'mw-newsletter-diffmainpageheader' ] );
+   $output .= Html::element( 'h4', [],
+   $this->msg( 
'newsletter-diff-mainpageheader' )->text() );
+   $output .= Html::closeElement( 'td' );
+   $output .= Html::closeElement( 'tr' );
+   $output .= $mainPageDiff;
+   }
+   }
+
+   $publishersDiff = $this->generat

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Lift IP throttling for Amrita University in meta wiki

2016-10-01 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Lift IP throttling for Amrita University in meta wiki
..

Lift IP throttling for Amrita University in meta wiki

Change-Id: I1334b58ae96946eae12a164fb4e415a182961b30
---
M wmf-config/throttle.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/48/313648/1

diff --git a/wmf-config/throttle.php b/wmf-config/throttle.php
index 4c73f5a..f465569 100644
--- a/wmf-config/throttle.php
+++ b/wmf-config/throttle.php
@@ -79,7 +79,7 @@
'from' => '2016-09-07T00:00 +5:30',
'to' => '2016-10-03T00:00 +5:30',
'IP' => '182.19.48.18',
-   'dbname' => 'labswiki',
+   'dbname' => [ 'labswiki', 'metawiki' ],
'value' => 60 //50 expected
 ];
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1334b58ae96946eae12a164fb4e415a182961b30
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...PdfBook[master]: Don't call deprecated Article::fetchContent() in PdfBook

2016-09-24 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Don't call deprecated Article::fetchContent() in PdfBook
..

Don't call deprecated Article::fetchContent() in PdfBook

Bug: T146195
Change-Id: Icf36c6b93577a2f30e2e434b3eb5a57d8faa5191
---
M PdfBook.hooks.php
1 file changed, 18 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PdfBook 
refs/changes/41/312641/1

diff --git a/PdfBook.hooks.php b/PdfBook.hooks.php
index 18a2e3c..4f93683 100644
--- a/PdfBook.hooks.php
+++ b/PdfBook.hooks.php
@@ -5,13 +5,14 @@
/**
 * Perform the export operation
 */
-   public static function onUnknownAction( $action, $article ) {
+   public static function onUnknownAction( $action, Article $article ) {
global $wgOut, $wgUser, $wgParser, $wgRequest;
global $wgServer, $wgArticlePath, $wgScriptPath, $wgUploadPath, 
$wgUploadDirectory, $wgScript;
 
if( $action == 'pdfbook' ) {
-
$title = $article->getTitle();
+   $page = new WikiPage( $title );
+   $pageContent = $page->getContent();
$opt = ParserOptions::newFromUser( $wgUser );
 
// Log the export
@@ -56,10 +57,15 @@
while ( $row = $db->fetchRow( $result ) 
) $articles[] = Title::newFromID( $row[0] );
}
else {
-   $text = $article->fetchContent();
-   $text = $wgParser->preprocess( $text, 
$title, $opt );
-   if ( preg_match_all( 
"/^\\*\\s*\\[{2}\\s*([^\\|\\]]+)\\s*.*?\\]{2}/m", $text, $links ) )
-   foreach ( $links[1] as $link ) 
$articles[] = Title::newFromText( $link );
+   if ( $pageContent instanceof 
TextContent ) {
+   $text = 
$pageContent->getNativeData();
+   $text = $wgParser->preprocess( 
$text, $title, $opt );
+   if ( preg_match_all( 
"/^\\*\\s*\\[{2}\\s*([^\\|\\]]+)\\s*.*?\\]{2}/m", $text, $links ) ) {
+   foreach ( $links[1] as 
$link ) {
+   $articles[] = 
Title::newFromText( $link );
+   }
+   }
+   }
}
}
 
@@ -74,9 +80,12 @@
foreach( $articles as $title ) {
$ttext = $title->getPrefixedText();
if( !in_array( $ttext, $exclude ) ) {
-   $article = new Article( $title );
-   $text= $article->fetchContent();
-   $text= preg_replace( 
"//s", "@@" . "@@$1@@" . "@@", $text ); # preserve HTML comments
+   $page = new WikiPage( $title );
+   $pageContent = $page->getContent();
+   if ( $pageContent instanceof 
TextContent ) {
+   $text = 
$pageContent->getNativeData();
+   $text = preg_replace( 
"//s", "@@" . "@@$1@@" . "@@", $text ); # preserve HTML comments
+   }
if( $format != 'single' ) $text .= 
"__NOTOC__";
$opt->setEditSection( false );# 
remove section-edit links
$out = $wgParser->parse( $text, 
$title, $opt, true, true );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf36c6b93577a2f30e2e434b3eb5a57d8faa5191
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PdfBook
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...PdfBook[master]: Convert Extension:PdfBook to use extension registration

2016-09-24 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Extension:PdfBook to use extension registration
..

Convert Extension:PdfBook to use extension registration

Bug: T146535
Change-Id: Ie40297c9e02acf7e6a011f26db43b6aa39ab42a0
---
A extension.json
1 file changed, 39 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PdfBook 
refs/changes/40/312640/1

diff --git a/extension.json b/extension.json
new file mode 100644
index 000..06b349f
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,39 @@
+{
+   "name": "PdfBook",
+   "version": "1.1.0, 2014-04-01",
+   "author": "[http://www.organicdesign.co.nz/nad User:Nad]",
+   "url": "http://www.mediawiki.org/wiki/Extension:PdfBook";,
+   "descriptionmsg": "pdfbook-desc",
+   "type": "parserhook",
+   "LogTypes": [
+   "pdf"
+   ],
+   "LogNames": {
+   "pdf": "pdflogpage"
+   },
+   "LogHeaders": {
+   "pdf": "pdflogpagetext"
+   },
+   "LogActions": {
+   "pdf/book": "pdflogentry"
+   },
+   "MessagesDirs": {
+   "PdfBook": [
+   "i18n"
+   ]
+   },
+   "AutoloadClasses": {
+   "PdfBookHooks": "PdfBook.hooks.php"
+   },
+   "Hooks": {
+   "UnknownAction": "PdfBookHooks::onUnknownAction",
+   "SkinTemplateTabs": "PdfBookHooks::onSkinTemplateTabs",
+   "SkinTemplateNavigation": 
"PdfBookHooks::onSkinTemplateNavigation"
+   },
+   "config": {
+   "PdfBookTab": {
+   "value": false
+   }
+   },
+   "manifest_version": 2
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie40297c9e02acf7e6a011f26db43b6aa39ab42a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PdfBook
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Show up NewsletterEditPage for editing Newsletter contet

2016-09-11 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Show up NewsletterEditPage for editing Newsletter contet
..

Show up NewsletterEditPage for editing Newsletter contet

Gradually, we need to kill the 'manage' Special Page functionalities

Bug: T138462
Change-Id: I4c8c7b9a65dd628d1889bc5c837df50ae8334d59
---
M Newsletter.hooks.php
M i18n/en.json
M i18n/qqq.json
M includes/NewsletterEditPage.php
M includes/NewsletterValidator.php
5 files changed, 277 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/49/309849/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 1fcaaee..69e9e43 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -166,9 +166,10 @@
$newsletter = Newsletter::newFromName( 
$article->getTitle()->getText() );
if ( $newsletter ) {
// A newsletter exists in that title, lets redirect to 
manage page
-   $title = SpecialPage::getTitleFor( 'Newsletter', 
$newsletter->getId() . '/' .
-   'manage' );
-   $wgOut->redirect( $title->getFullURL() );
+   $editPage = new NewsletterEditPage( 
$article->getContext(), $newsletter, $user );
+   $editPage->edit();
+
+   return false;
}
 
$editPage = new NewsletterEditPage( $article->getContext() );
diff --git a/i18n/en.json b/i18n/en.json
index f089464..37f4f91 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -67,6 +67,7 @@
"newsletter-manage-remove-self-publisher": "Are you sure that you want 
to remove yourself from the publishers?",
"newsletter-manage-newsletter-success": "The newsletter have been 
modified.",
"newsletter-manage-newsletter-nochanges": "No changes were made to the 
existing newsletter.",
+   "newsletter-manage-summary": "Summary of the change:",
"newsletter-delete": "Delete newsletter",
"newsletter-delete-text": "This interface can be used to delete the 
\"$1\" newsletter. Please confirm that you intend to do this. This 
action cannot be undone.",
"newsletter-delete-reason": "Reason",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index ed510ab..2849c90 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -74,6 +74,7 @@
"newsletter-manage-remove-self-publisher": "Confirmation message shown 
on Special:Newsletter's manage form if the user removes themselves from the 
publishers' list.",
"newsletter-manage-newsletter-success": "Success message shown on 
Special:Newsletter's manage form when the publishers have been modfied.",
"newsletter-manage-newsletter-nochanges": "Message shown on 
Special:Newsletter if no changes were made to the existing publishers' list.",
+   "newsletter-manage-summary": "Edit summary for updating fields in 
Special:Newsletter's manage form",
"newsletter-delete": "Header message shown on 
Special:Newsletter//delete.\n\nSee also:\n* 
{{msg-mw|newsletter-view}}\n*{{msg-mw|newsletter-subscribe}}",
"newsletter-delete-text": "Introductory message shown on 
Special:Newsletter//delete.\n\nParameters:\n* $1 - Name of the newsletter 
for the specified id.",
"newsletter-delete-reason": "Label of text field on 
Special:Newsletter//delete\n{{Identical|Reason}}",
diff --git a/includes/NewsletterEditPage.php b/includes/NewsletterEditPage.php
index 7036bb7..dc81c4a 100644
--- a/includes/NewsletterEditPage.php
+++ b/includes/NewsletterEditPage.php
@@ -8,28 +8,46 @@
 
protected $newsletter;
 
-   public function __construct( IContextSource $context ) {
+   public function __construct( IContextSource $context, Newsletter 
$newsletter = null, User $user = null) {
$this->context = $context;
$this->user = $context->getUser();
$this->title = $context->getTitle();
$this->out = $context->getOutput();
+   $this->newsletter = $newsletter;
+   $this->user = $user;
}
 
public function edit() {
if ( wfReadOnly() ) {
throw new ReadOnlyError;
}
-
$this->createNew = !$this->title->exists();
+   if ( !$this->createNew ) {
+   // A newsletter exists, lets open the edit page
+   if ( $this->user->isBlocked() ) {
+   throw new UserBlockedError( 
$this->user->getBlock() );
+   }
 
-   $permErrors = $this->getPermissionErrors();
-   if ( count( $permErrors ) ) {
-   $this->out->showPermissionsErrorPage( $permErrors );
-   return;
+   if ( !$this->newsletter->canMana

[MediaWiki-commits] [Gerrit] mediawiki...Mailgun[REL1_27]: Blank the configuration variables in extension.json

2016-08-28 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Blank the configuration variables in extension.json
..

Blank the configuration variables in extension.json

Bug: T138275
Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
(cherry picked from commit 88a8019da34dbccf43ec6b2b7cdc4894cfcbe07c)
---
M MailgunHooks.php
M extension.json
2 files changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/39/307239/1

diff --git a/MailgunHooks.php b/MailgunHooks.php
index 44a40ff..ef86270 100644
--- a/MailgunHooks.php
+++ b/MailgunHooks.php
@@ -33,14 +33,22 @@
 * @param string $subject
 * @param string $body
 * @return bool
+* @throws Exception
 */
public static function onAlternateUserMailer(
array $headers, array $to, MailAddress $from, $subject, $body
) {
$conf = RequestContext::getMain()->getConfig();
$client = new \Http\Adapter\Guzzle6\Client();
-   $mailgunTransport = new \Mailgun\Mailgun( $conf->get( 
'MailgunAPIKey' ), $client );
-   $message = $mailgunTransport->BatchMessage( $conf->get( 
'MailgunDomain' ) );
+
+   $mailgunAPIKey = $conf->get( 'MailgunAPIKey' );
+   $mailgunDomain = $conf->get( 'MailgunDomain' );
+   if ( $mailgunAPIKey == "" or $mailgunDomain == "" ) {
+   throw new MWException( "Please update your 
LocalSettings.php with the correct Mailgun API configurations" );
+   }
+
+   $mailgunTransport = new \Mailgun\Mailgun( $mailgunAPIKey, 
$client );
+   $message = $mailgunTransport->BatchMessage( $mailgunDomain );
 
$message->setFromAddress( $from );
$message->setSubject( $subject );
diff --git a/extension.json b/extension.json
index 0c7ace4..7418840 100644
--- a/extension.json
+++ b/extension.json
@@ -23,8 +23,8 @@
},
"load_composer_autoloader": true,
"config": {
-   "MailgunAPIKey": "key-asdfasdfasdf",
-   "MailgunDomain": "example.in"
+   "MailgunAPIKey": "",
+   "MailgunDomain": ""
},
"manifest_version": 1
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: REL1_27
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Mailgun[REL1_27]: Make messages RFC 5322 compliant

2016-08-28 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Make messages RFC 5322 compliant
..

Make messages RFC 5322 compliant

Looks like the problem was with adding all the headers again using the
addCustomHeaders function by Mailgun. We need only the Return-Path from
$headers, and that needs to be set with setReplyToAddress()

Working with bouncehandler too, as the headers are appended correctly.

Bug: T130493
Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
(cherry picked from commit 0553cb6d949fd8e558b9ad698a99f8e3285474bc)
---
M MailgunHooks.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/38/307238/1

diff --git a/MailgunHooks.php b/MailgunHooks.php
index 61ba017..44a40ff 100644
--- a/MailgunHooks.php
+++ b/MailgunHooks.php
@@ -45,10 +45,10 @@
$message->setFromAddress( $from );
$message->setSubject( $subject );
$message->setTextBody( $body );
+   $message->setReplyToAddress( $headers['Return-Path'] );
 
-   foreach( $headers as $headerName => $headerValue ) {
-   $message->addCustomHeader( $headerName, $headerValue );
-   }
+   $message->addCustomHeader( "X-Mailer", $headers['X-Mailer'] );
+   $message->addCustomHeader( "List-Unsubscribe", 
$headers['List-Unsubscribe'] );
 
foreach( $to as $recip ) {
try {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: REL1_27
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Mailgun[REL1_27]: Add Mailgun.php shim, after extension registration

2016-08-28 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add Mailgun.php shim, after extension registration
..

Add Mailgun.php shim, after extension registration

Change-Id: I7db41fd83b9fe1f59d391c113e9aa3067d82f641
(cherry picked from commit 785ef0c2b9c5e74390a7fa0daf0dfeb262c5bf7d)
---
A Mailgun.php
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/37/307237/1

diff --git a/Mailgun.php b/Mailgun.php
new file mode 100644
index 000..22a4a9b
--- /dev/null
+++ b/Mailgun.php
@@ -0,0 +1,13 @@
+https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   ); */
+   return;
+} else {
+   die( 'This version of the Mailgun extension requires MediaWiki 1.25+' );
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7db41fd83b9fe1f59d391c113e9aa3067d82f641
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: REL1_27
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Introduce ContentHandler on the Newsletter CustomEditpage

2016-08-14 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Introduce ContentHandler on the Newsletter CustomEditpage
..

Introduce ContentHandler on the Newsletter CustomEditpage

* Added in the contenthandler model for Newsletter namespace
* action=edit, now creates a Newsletter with the Newsletter Contentmodel

Bug: T138462
Change-Id: I89809a4ec1b524148199ff5d11ee4e96ae716919
---
M Newsletter.hooks.php
M extension.json
M includes/Newsletter.php
M includes/NewsletterDb.php
M includes/NewsletterEditPage.php
M includes/NewsletterStore.php
A includes/content/NewsletterContent.php
A includes/content/NewsletterContentHandler.php
8 files changed, 605 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/92/304692/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 0f4f747..0076798 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -129,6 +129,31 @@
return true;
}
 
+   /**
+* @param EditPage $editPage
+*/
+   public static function onAlternateEdit( EditPage $editPage ) {
+   global $wgOut;
+   $title = $editPage->getTitle();
+
+   if ( $title->inNamespace( NS_NEWSLETTER ) ) {
+   if ( $title->hasContentModel( 'NewsletterContent' )  ) {
+   $newsletter = Newsletter::newFromName( 
$title->getText() );
+   if ( $newsletter ) {
+   $title = SpecialPage::getTitleFor( 
'Newsletter', $newsletter->getId() . '/' .
+   'manage' );
+   $wgOut->redirect( $title->getFullURL() 
);
+   }
+   }
+   }
+   }
+
+   /**
+* @param Article $article
+* @param User $user
+* @return bool
+* @throws ReadOnlyError
+*/
public static function onCustomEditor( Article $article, User $user ) {
if ( !$article->getTitle()->inNamespace( NS_NEWSLETTER ) ) {
return true;
@@ -136,7 +161,6 @@
 
$editPage = new NewsletterEditPage( $article->getContext() );
$editPage->edit();
-
return false;
}
 }
diff --git a/extension.json b/extension.json
index 775f2ee..383e95d 100644
--- a/extension.json
+++ b/extension.json
@@ -63,6 +63,9 @@
"ExtensionMessagesFiles": {
"NewsletterAlias": "Newsletter.alias.php"
},
+   "ContentHandlers": {
+   "NewsletterContent": "NewsletterContentHandler"
+   },
"AutoloadClasses": {
"Newsletter": "includes/Newsletter.php",
"NewsletterDb": "includes/NewsletterDb.php",
@@ -78,6 +81,8 @@
"NewsletterTablePager": 
"includes/specials/pagers/NewsletterTablePager.php",
"ApiNewsletterManage": "includes/api/ApiNewsletterManage.php",
"ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
+   "NewsletterContent": "includes/content/NewsletterContent.php",
+   "NewsletterContentHandler": 
"includes/content/NewsletterContentHandler.php",
"EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php",
"EchoNewsletterFormatter": 
"includes/Echo/EchoNewsletterFormatter.php",
"BaseNewsletterPresentationModel": 
"includes/Echo/BaseNewsletterPresentationModel.php",
@@ -145,6 +150,9 @@
"UserMergeAccountFields": [
"NewsletterHooks::onUserMergeAccountFields"
],
+   "AlternateEdit": [
+   "NewsletterHooks::onAlternateEdit"
+   ],
"CustomEditor": [
"NewsletterHooks::onCustomEditor"
]
@@ -154,7 +162,8 @@
"id": 5500,
"constant": "NS_NEWSLETTER",
"name": "Newsletter",
-   "protection": "newsletter-create"
+   "protection": "newsletter-create",
+   "defaultcontentmodel": "NewsletterContent"
},
{
"id": 5501,
diff --git a/includes/Newsletter.php b/includes/Newsletter.php
index 26dbd74..a630511 100644
--- a/includes/Newsletter.php
+++ b/includes/Newsletter.php
@@ -62,6 +62,16 @@
}
 
/**
+* Fetch a new newsletter instance from given name
+*
+* @param string $name
+* @return Newsletter|null
+*/
+   public static function newFromName( $name ) {
+   return 
NewsletterStore::getDefaultInstance()->getNewsletterFromName( $name );
+   }

[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Make action=edit in a Newsletter namespace invoke Special:Ne...

2016-08-09 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Make action=edit in a Newsletter namespace invoke 
Special:Newsletter
..

Make action=edit in a Newsletter namespace invoke Special:Newsletter

Bug: T138462
Change-Id: Ibf2b6835d4427ed29c556573fb52ff593623950e
---
M Newsletter.hooks.php
M extension.json
M includes/specials/SpecialNewsletterCreate.php
3 files changed, 27 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/84/303984/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index c4853e6..5f63b7f 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -128,4 +128,12 @@
 
return true;
}
+
+   public static function onCustomEditor( Article $article, User $user ) {
+   global $wgOut;
+
+   $query = "newsletter=" . $article->getTitle()->getText();
+   $title = SpecialPage::getTitleFor( 'CreateNewsletter' 
)->getFullURL($query);
+   $wgOut->redirect( $title );
+   }
 }
diff --git a/extension.json b/extension.json
index f6959e5..5abad1b 100644
--- a/extension.json
+++ b/extension.json
@@ -143,7 +143,23 @@
],
"UserMergeAccountFields": [
"NewsletterHooks::onUserMergeAccountFields"
+   ],
+   "CustomEditor": [
+   "NewsletterHooks::onCustomEditor"
]
},
+   "namespaces": [
+   {
+   "id": 5500,
+   "constant": "NS_NEWSLETTER",
+   "name": "Newsletter",
+   "protection": "newsletter-create"
+   },
+   {
+   "id": 5501,
+   "constant": "NS_NEWSLETTER_TALK",
+   "name": "Newsletter_talk"
+   }
+   ],
"manifest_version": 1
 }
diff --git a/includes/specials/SpecialNewsletterCreate.php 
b/includes/specials/SpecialNewsletterCreate.php
index afd6e54..565ef20 100644
--- a/includes/specials/SpecialNewsletterCreate.php
+++ b/includes/specials/SpecialNewsletterCreate.php
@@ -39,12 +39,14 @@
 * @return array
 */
protected function getFormFields() {
+   $newsletterName = $this->getRequest()->getVal( 'newsletter' ) ? 
: '';
return array(
'name' => array(
'type' => 'text',
'required' => true,
'label-message' => 'newsletter-name',
-   'maxlength' => 120
+   'maxlength' => 120,
+   'default' => $newsletterName
),
'mainpage' => array(
'type' => 'title',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf2b6835d4427ed29c556573fb52ff593623950e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...BounceHandler[master]: Check if the user is subscribed initially, before unsubscribing

2016-08-06 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Check if the user is subscribed initially, before unsubscribing
..

Check if the user is subscribed initially, before unsubscribing

Bug: T142134
Change-Id: If88687125c999403671cfea80267574c53dd7314
---
M includes/BounceHandlerActions.php
1 file changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/45/303345/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index ad0bf8f..db11992 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -83,11 +83,32 @@
);
 
if ( $totalBounces >= $this->bounceRecordLimit ) {
-   $this->unSubscribeUser( $failedUser, 
$emailHeaders );
+   $bounceUserId = $failedUser['rawUserId'];
+   if ( $this->checkIfUserIsSubscribed( 
(int)$bounceUserId ) ) {
+   $this->unSubscribeUser( $failedUser, 
$emailHeaders );
+   }
}
}
 
return true;
+   }
+
+   protected function checkIfUserIsSubscribed( $userId ) {
+   $user = User::newFromId( $userId );
+
+   // Handle the central account email status (if applicable)
+   if ( class_exists( 'CentralAuthUser') ) {
+   $caUser = CentralAuthUser::getInstance( $user );
+   if ( $caUser->isAttached() ) {
+   if ( $caUser->getEmailAuthenticationTimestamp() 
) {
+   return true;
+   }
+   }
+   } else {
+   return $user->getEmailAuthenticationTimestamp();
+   }
+
+   return false;
}
 
/**
@@ -138,9 +159,10 @@
public function unSubscribeUser( array $failedUser, $emailHeaders ) {
//Un-subscribe the user
$originalEmail = $failedUser['rawEmail'];
-   $bounceUserId = $failedUser['rawUserId'];
+   $bounceUserId = (int)$failedUser['rawUserId'];
 
$user = User::newFromId( $bounceUserId );
+
// Handle the central account email status (if applicable)
if ( class_exists( 'CentralAuthUser') ) {
$caUser = CentralAuthUser::getInstance( $user );
@@ -157,12 +179,15 @@
} else {
// Invalidate the email-id of a local user
$user->setEmailAuthenticationTimestamp( null );
+   $user->invalidateEmail();
$user->saveSettings();
+
$this->createEchoNotification( $bounceUserId, 
$originalEmail );
wfDebugLog( 'BounceHandler',
"Un-subscribed {$user->getName()} 
<$originalEmail> for exceeding Bounce limit 
$this->bounceRecordLimit.\nProcessed Headers:\n" .
$this->formatHeaders( $emailHeaders ). 
"\nBounced Email: \n$this->emailRaw"
);
+
RequestContext::getMain()->getStats()->increment( 
'bouncehandler.unsub.local' );
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If88687125c999403671cfea80267574c53dd7314
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [WIP] Convert Newsletter to use contenthandler - change (mediawiki...Newsletter)

2016-06-23 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: [WIP] Convert Newsletter to use contenthandler
..

[WIP] Convert Newsletter to use contenthandler

TODO:
* Newsletters should be in a single namespace
* This should be connected with the Special:Newsletters somehow
* Implement a custom DiffEngine to edit

Bug: T138462
Change-Id: I2d7b5bfcd8dc0ed91f70e8a7d98e1566fce7a284
---
M extension.json
M i18n/en.json
A includes/content/NewsletterContent.php
A includes/content/NewsletterContentHandler.php
M includes/specials/SpecialNewsletterCreate.php
5 files changed, 149 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/70/295670/1

diff --git a/extension.json b/extension.json
index f6959e5..e608e57 100644
--- a/extension.json
+++ b/extension.json
@@ -63,6 +63,9 @@
"ExtensionMessagesFiles": {
"NewsletterAlias": "Newsletter.alias.php"
},
+   "ContentHandlers": {
+   "NewsletterContent": "NewsletterContentHandler"
+   },
"AutoloadClasses": {
"Newsletter": "includes/Newsletter.php",
"NewsletterDb": "includes/NewsletterDb.php",
@@ -77,6 +80,8 @@
"NewsletterTablePager": 
"includes/specials/pagers/NewsletterTablePager.php",
"ApiNewsletterManage": "includes/api/ApiNewsletterManage.php",
"ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
+   "NewsletterContent": "includes/content/NewsletterContent.php",
+   "NewsletterContentHandler": 
"includes/content/NewsletterContentHandler.php",
"EchoNewsletterUserLocator": 
"includes/Echo/EchoNewsletterUserLocator.php",
"EchoNewsletterFormatter": 
"includes/Echo/EchoNewsletterFormatter.php",
"BaseNewsletterPresentationModel": 
"includes/Echo/BaseNewsletterPresentationModel.php",
diff --git a/i18n/en.json b/i18n/en.json
index f089464..c50e87f 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -153,5 +153,8 @@
"log-action-filter-newsletter-publisher-removed": "Publisher removal",
"log-action-filter-newsletter-newsletter-added": "Newsletter creation",
"log-action-filter-newsletter-newsletter-removed": "Newsletter 
deletion",
-   "log-action-filter-newsletter-issue-added": "New issue announcements"
+   "log-action-filter-newsletter-issue-added": "New issue announcements",
+   "newsletter-create-editsummary": "Create new newsletter",
+   "newsletter-ch-tojsonerror": "The newsletter could not be encoded for 
storage.",
+   "newsletter-ch-apierror": "Editing the Newsletter through the API 
failed with error code $1"
 }
diff --git a/includes/content/NewsletterContent.php 
b/includes/content/NewsletterContent.php
new file mode 100644
index 000..f43f965
--- /dev/null
+++ b/includes/content/NewsletterContent.php
@@ -0,0 +1,53 @@
+decode();
+
+   if ( !is_string( $this->description ) || !is_object( 
$this->mainPage ) ) {
+   return false;
+   }
+
+   return true;
+   }
+
+   /**
+* Decode the JSON encoded args
+*/
+   protected function decode() {
+   if ( $this->decoded ) {
+   return;
+   }
+   $jsonParse = $this->getData();
+   $data = $jsonParse->isGood() ? $jsonParse->getValue() : null;
+   if ( $data ) {
+   $this->description = isset( $data->description ) ? 
$data->description : null;
+   $this->mainPage = isset( $data->mainpage ) ? 
$data->mainpage : null;
+   }
+   $this->decoded = true;
+   }
+
+   public function onSuccess() {
+   // No-op: We have already redirected.
+   }
+}
\ No newline at end of file
diff --git a/includes/content/NewsletterContentHandler.php 
b/includes/content/NewsletterContentHandler.php
new file mode 100644
index 000..1da7447
--- /dev/null
+++ b/includes/content/NewsletterContentHandler.php
@@ -0,0 +1,76 @@
+checkFormat( $format );
+   $content = new NewsletterContent( $text );
+   if ( !$content->isValid() ) {
+   throw new MWContentSerializationException( 'The 
delivery list content is invalid.' );
+   }
+   return $content;
+   }
+
+   /**
+* @return string
+*/
+   protected function getContentClass() {
+   return 'NewsletterContent';
+   }
+
+   /**
+* @param Title $title
+* @param $description
+* @param $mainPage
+* @param $summary
+* @param IContextSource $context
+* @return Status
+*/
+   public static function edit( Title $title, $description, $mainPage, 
$summary,
+

[MediaWiki-commits] [Gerrit] Log changes to Newsletter description - change (mediawiki...Newsletter)

2016-06-22 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Log changes to Newsletter description
..

Log changes to Newsletter description

Logging all the basic things including who did the change etc. Please
note that we are logging the entire description, without any trim.

Bug: T132018
Change-Id: I97c4c04135e3cbc58d162e75bcee9dc9df376e64
---
M i18n/en.json
M i18n/qqq.json
M includes/NewsletterStore.php
M includes/logging/NewsletterLogger.php
M includes/specials/SpecialNewsletter.php
5 files changed, 23 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/03/295503/1

diff --git a/i18n/en.json b/i18n/en.json
index f089464..bcb5e45 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -148,6 +148,8 @@
"logentry-newsletter-newsletter-added": "$1 {{GENDER:$2|created}} 
newsletter $4",
"logentry-newsletter-newsletter-removed": "$1 {{GENDER:$2|deleted}} 
newsletter $4",
"logentry-newsletter-issue-added": "$1 {{GENDER:$2|published}} a new 
issue of $4 newsletter at $6",
+   "logentry-newsletter-newsletter-modified": "$1 {{GENDER:$2|changed}} 
the description of $4 newsletter to: $5",
+   "log-newsletter-original-description" : "description was: $1",
"log-action-filter-newsletter": "Type of action:",
"log-action-filter-newsletter-publisher-added": "Publisher addition",
"log-action-filter-newsletter-publisher-removed": "Publisher removal",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index ed510ab..4f39762 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -155,6 +155,8 @@
"logentry-newsletter-newsletter-added": "{{logentry}}\n\nAdditional 
parameters:\n* $4 - the newsletter affected by the action",
"logentry-newsletter-newsletter-removed": "{{logentry}}\n\nAdditional 
parameters:\n* $4 - the newsletter affected by the action",
"logentry-newsletter-issue-added": "{{logentry}}\n\nAdditional 
parameters:\n* $4 - the newsletter affected by the action\n* $5 - ID of the 
issue (unused) \n* $6 - link to the issue page",
+   "logentry-newsletter-newsletter-modified": "{{logentry}}\n\nAdditional 
parameters:\n* $4 - the newsletter affected by the action\n* $5 - the updated 
description.",
+   "log-newsletter-original-description": "Denote the original description 
of a newsletter in [[Special:Log]] comment.\n\nParameters:\n* $1 - the original 
description before updation.",
"log-action-filter-newsletter": 
"{{doc-log-action-filter-type|newsletter}}",
"log-action-filter-newsletter-publisher-added": 
"{{doc-log-action-filter-action|newsletter|publisher-added}}",
"log-action-filter-newsletter-publisher-removed": 
"{{doc-log-action-filter-action|newsletter|publisher-removed}}",
diff --git a/includes/NewsletterStore.php b/includes/NewsletterStore.php
index 1605fb8..e235c7a 100644
--- a/includes/NewsletterStore.php
+++ b/includes/NewsletterStore.php
@@ -101,12 +101,15 @@
}
 
/**
+* @param User $user
 * @param int $id
 * @param string $description
 *
 * @return bool success of the action
 */
-   public function updateDescription( $id, $description ) {
+   public function updateDescription( User $user, $id, $description ) {
+   $newsletter = Newsletter::newFromID( $id );
+   $this->logger->logNewsletterModified( $user, $newsletter, 
$description );
return $this->db->updateDescription( $id, $description );
}
 
diff --git a/includes/logging/NewsletterLogger.php 
b/includes/logging/NewsletterLogger.php
index 5a798fb..bfa00e7 100644
--- a/includes/logging/NewsletterLogger.php
+++ b/includes/logging/NewsletterLogger.php
@@ -66,4 +66,18 @@
$log->publish( $log->insert() );
}
 
+   public function logNewsletterModified( User $user, Newsletter 
$newsletter, $description ) {
+   $log = new ManualLogEntry( 'newsletter',  'newsletter-modified' 
);
+   $log->setPerformer( $user );
+   $log->setTarget( SpecialPage::getTitleFor( 'Newsletter', 
$newsletter->getId() ) );
+   $log->setParameters( [
+   '4:newsletter-link:nl_id' => 
"{$newsletter->getId()}:{$newsletter->getName()}",
+   '5::nl_description_modified' => $description,
+   ] );
+   $log->setComment( wfMessage( 
'log-newsletter-original-description', $newsletter->getDescription() )
+   ->inContentLanguage()->text() );
+   $log->setRelations( [ 'nl_id' => $newsletter->getId() ] );
+   $log->publish( $log->insert() );
+   }
+
 }
diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index 345773c..338ecd0 100644
--- a/includes/specials/SpecialNewsletter.php
+

[MediaWiki-commits] [Gerrit] Remove the configuration variables from extension.json - change (mediawiki...Mailgun)

2016-06-22 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Remove the configuration variables from extension.json
..

Remove the configuration variables from extension.json

Bug: T138275
Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
---
M extension.json
1 file changed, 0 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/67/295467/1

diff --git a/extension.json b/extension.json
index 0c7ace4..f522a71 100644
--- a/extension.json
+++ b/extension.json
@@ -22,9 +22,5 @@
]
},
"load_composer_autoloader": true,
-   "config": {
-   "MailgunAPIKey": "key-asdfasdfasdf",
-   "MailgunDomain": "example.in"
-   },
"manifest_version": 1
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09516c6612f7c842c5b7b941d27b661935772081
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make messages RFC 5322 compliant - change (mediawiki...Mailgun)

2016-05-19 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Make messages RFC 5322 compliant
..

Make messages RFC 5322 compliant

Looks like the problem was with adding all the headers again using the
addCustomHeaders function by Mailgun. We need only the Return-Path from
$headers, and that needs to be set with setReplyToAddress()

Working with bouncehandler too, as the headers are appended correctly.

Bug: T130493
Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
---
M MailgunHooks.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/14/289614/1

diff --git a/MailgunHooks.php b/MailgunHooks.php
index 61ba017..34bf722 100644
--- a/MailgunHooks.php
+++ b/MailgunHooks.php
@@ -45,10 +45,12 @@
$message->setFromAddress( $from );
$message->setSubject( $subject );
$message->setTextBody( $body );
+   
+   // Make it work with extensions changing the return path
+   $message->setReplyToAddress( $headers['Return-Path'] );
 
-   foreach( $headers as $headerName => $headerValue ) {
-   $message->addCustomHeader( $headerName, $headerValue );
-   }
+   $message->addCustomHeader( "X-Mailer", $headers['X-Mailer'] );
+   $message->addCustomHeader( "List-Unsubscribe", 
$headers['List-Unsubscribe'] );
 
foreach( $to as $recip ) {
try {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99e7ba0526c47a541a14f5ab1b31bd645713a324
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Save a Namespace-Title pair of Newsletter, fixing fatal erro... - change (mediawiki...Newsletter)

2016-05-12 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Save a Namespace-Title pair of Newsletter, fixing fatal error 
later
..

Save a Namespace-Title pair of Newsletter, fixing fatal error later

The Namespace-Title pair would help to generate a red link when the
original Newsletter main page gets deleted. It currently fatals due
to $getPrefixedText() being called on none.

TODO: This would'nt work on existing rows in the db, as they we are
not populating it. Since we are only on beta, this is gonna work.

Bug: T119058
Change-Id: I1910fa63f011287cef57e4675a4fb0cfc42bae25
---
M Newsletter.hooks.php
M includes/Newsletter.php
M includes/NewsletterDb.php
M includes/specials/SpecialNewsletter.php
M includes/specials/SpecialNewsletterCreate.php
A sql/nl_newsletters-add-title.sql
6 files changed, 44 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/99/288399/1

diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index c4853e6..ad519ac 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -86,6 +86,7 @@
$updater->addExtensionTable( 'nl_subscriptions', __DIR__ . 
'/sql/nl_subscriptions.sql' );
$updater->addExtensionTable( 'nl_publishers', __DIR__ . 
'/sql/nl_publishers.sql' );
$updater->addExtensionField( 'nl_newsletters', 'nl_active', 
__DIR__ . '/sql/nl_newsletters-add-active.sql' );
+   $updater->addExtensionField( 'nl_newsletters', 
'nl_main_page_title', __DIR__ . '/sql/nl_newsletters-add-title.sql' );
 
return true;
}
diff --git a/includes/Newsletter.php b/includes/Newsletter.php
index 26dbd74..a58c53b 100644
--- a/includes/Newsletter.php
+++ b/includes/Newsletter.php
@@ -29,6 +29,11 @@
private $pageId;
 
/**
+* @var string
+*/
+   private $pageTitle;
+
+   /**
 * @var array
 */
private $publishers;
@@ -44,11 +49,12 @@
 * @param string $description
 * @param int $pageId
 */
-   public function __construct( $id, $name, $description, $pageId ) {
+   public function __construct( $id, $name, $description, $pageId, 
$pageTitle ) {
$this->id = (int)$id;
$this->name = $name;
$this->description = $description;
$this->pageId = (int)$pageId;
+   $this->pageTitle = $pageTitle;
}
 
/**
@@ -97,6 +103,13 @@
}
 
/**
+* @return string
+*/
+   public function getPageTitle() {
+   return $this->pageTitle;
+   }
+
+   /**
 * @return array
 */
public function getSubscribers() {
diff --git a/includes/NewsletterDb.php b/includes/NewsletterDb.php
index cac547a..42e637d 100644
--- a/includes/NewsletterDb.php
+++ b/includes/NewsletterDb.php
@@ -110,6 +110,7 @@
'nl_name' => $newsletter->getName(),
'nl_desc' => $newsletter->getDescription(),
'nl_main_page_id' => $newsletter->getPageId(),
+   'nl_main_page_title' => $newsletter->getPageTitle(),
);
 
$dbw = $this->lb->getConnection( DB_MASTER );
@@ -250,7 +251,7 @@
$dbr = $this->lb->getConnection( DB_SLAVE );
$res = $dbr->select(
'nl_newsletters',
-   array( 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' 
),
+   array( 'nl_id', 'nl_name', 'nl_desc', 
'nl_main_page_id', 'nl_main_page_title' ),
array( 'nl_id' => $id, 'nl_active' => 1 ),
__METHOD__
);
@@ -318,7 +319,7 @@
 
$res = $dbr->select(
'nl_newsletters',
-   array( 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' 
),
+   array( 'nl_id', 'nl_name', 'nl_desc', 
'nl_main_page_id', 'nl_main_page_title' ),
array( 'nl_main_page_id' => $id, 'nl_active' => 1 ),
__METHOD__
);
@@ -337,7 +338,7 @@
 
$res = $dbr->select(
array( 'nl_publishers', 'nl_newsletters' ),
-   array( 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' 
),
+   array( 'nl_id', 'nl_name', 'nl_desc', 
'nl_main_page_id', 'nl_main_page_title' ),
array( 'nlp_publisher_id' => $user->getId(), 
'nl_active' => 1 ),
__METHOD__,
array(),
@@ -356,7 +357,7 @@
 
$res = $dbr->select(
array( 'nl_newsletters' ),
-   array( 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' 
),
+   array( 'nl_id'

[MediaWiki-commits] [Gerrit] Add Mailgun.php shim, after extension registration - change (mediawiki...Mailgun)

2016-04-26 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add Mailgun.php shim, after extension registration
..

Add Mailgun.php shim, after extension registration

Change-Id: I7db41fd83b9fe1f59d391c113e9aa3067d82f641
---
A Mailgun.php
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/14/285414/1

diff --git a/Mailgun.php b/Mailgun.php
new file mode 100644
index 000..4a1ecbb
--- /dev/null
+++ b/Mailgun.php
@@ -0,0 +1,15 @@
+https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   ); */
+   return;
+} else {
+   die( 'This version of the Mailgun extension requires MediaWiki 1.25+' );
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7db41fd83b9fe1f59d391c113e9aa3067d82f641
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add newsletter description to log messages - change (mediawiki...Newsletter)

2016-04-19 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add newsletter description to log messages
..

Add newsletter description to log messages

Bug: T132018
Change-Id: I48f3c0942dec6ad000f5d3474ade0feaea483276
---
M i18n/en.json
M includes/logging/NewsletterLogger.php
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/37/284137/1

diff --git a/i18n/en.json b/i18n/en.json
index b11bf48..00a9f22 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -141,7 +141,7 @@
"log-description-newsletter": "This is a log of changes made to 
newsletters.",
"logentry-newsletter-publisher-added": "$1 {{GENDER:$2|added}} 
{{GENDER:$6|$3}} as a publisher on newsletter $4",
"logentry-newsletter-publisher-removed": "$1 {{GENDER:$2|removed}} 
{{GENDER:$6|$3}} as a publisher on newsletter $4",
-   "logentry-newsletter-newsletter-added": "$1 {{GENDER:$2|created}} 
newsletter $4",
+   "logentry-newsletter-newsletter-added": "$1 {{GENDER:$2|created}} 
newsletter $4 ( description was: $5 )",
"logentry-newsletter-newsletter-removed": "$1 {{GENDER:$2|deleted}} 
newsletter $4",
"logentry-newsletter-issue-added": "$1 {{GENDER:$2|published}} a new 
issue of newsletter $4"
 }
diff --git a/includes/logging/NewsletterLogger.php 
b/includes/logging/NewsletterLogger.php
index 75f4f1e..f982217 100644
--- a/includes/logging/NewsletterLogger.php
+++ b/includes/logging/NewsletterLogger.php
@@ -35,7 +35,8 @@
$log->setPerformer( RequestContext::getMain()->getUser() );
$log->setTarget( SpecialPage::getTitleFor( 'Newsletter', $id ) 
);
$log->setParameters( [
-   '4:newsletter-link:nl_id' => 
"$id:{$newsletter->getName()}"
+   '4:newsletter-link:nl_id' => 
"$id:{$newsletter->getName()}",
+   '5::nl_desc' => $newsletter->getDescription()
] );
$log->setRelations( [ 'nl_id' => $id ] );
$log->publish( $log->insert() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48f3c0942dec6ad000f5d3474ade0feaea483276
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add table prefix to sub-queries in NewsletterTablePager - change (mediawiki...Newsletter)

2016-04-19 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add table prefix to sub-queries in NewsletterTablePager
..

Add table prefix to sub-queries in NewsletterTablePager

Bug: T132019
Change-Id: I596daa75694d8a4a23ae6893d7f7a14b95c86e63
---
M includes/specials/pagers/NewsletterTablePager.php
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/36/284136/1

diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 4c5abf5..e80ec57 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -45,13 +45,15 @@
//TODO we could probably just retrieve all subscribers IDs as a 
string here.
 
$userId = $this->getUser()->getId();
+   $tbl_subscriptions = $this->mDb->tableName( 'nl_subscriptions' 
);
+
$info = array(
'tables' => array( 'nl_newsletters' ),
'fields' => array(
'nl_name',
'nl_desc',
'nl_id',
-   'subscribers' => '( SELECT COUNT(*) FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )',
+   'subscribers' => "( SELECT COUNT(*) FROM 
$tbl_subscriptions WHERE nls_newsletter_id = nl_id )",
),
'options' => array( 'DISTINCT nl_id' ),
);
@@ -59,15 +61,15 @@
$info['conds'] = array( 'nl_active = 1' );
if ( $this->option == 'subscribed' ) {
$info['conds'][] = ( $this->mDb->addQuotes( $userId ) .
-   ' IN (SELECT nls_subscriber_id FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )' );
+   " IN (SELECT nls_subscriber_id FROM 
$tbl_subscriptions WHERE nls_newsletter_id = nl_id )" );
} elseif ( $this->option == 'unsubscribed' ) {
$info['conds'][] = ( $this->mDb->addQuotes( $userId ) .
-   ' NOT IN (SELECT nls_subscriber_id FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )' );
+   " NOT IN (SELECT nls_subscriber_id FROM 
$tbl_subscriptions WHERE nls_newsletter_id = nl_id )" );
}
 
if ( $this->getUser()->isLoggedIn() ) {
$info['fields']['current_user_subscribed'] = 
$this->mDb->addQuotes( $userId ) .
-   ' IN (SELECT nls_subscriber_id FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )';
+   " IN (SELECT nls_subscriber_id FROM 
$tbl_subscriptions WHERE nls_newsletter_id = nl_id )";
}
 
return $info;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I596daa75694d8a4a23ae6893d7f7a14b95c86e63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Convert Special:WithoutInterwiki to HTMLForm - change (mediawiki/core)

2016-04-17 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Special:WithoutInterwiki to HTMLForm
..

Convert Special:WithoutInterwiki to HTMLForm

TODO: Should be eventually converted to OOUI

Bug: T117721
Change-Id: I56b6b78b53d2531ebdb9cd0f903a4ce475dbc56b
---
M includes/specials/SpecialWithoutinterwiki.php
1 file changed, 19 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/283848/1

diff --git a/includes/specials/SpecialWithoutinterwiki.php 
b/includes/specials/SpecialWithoutinterwiki.php
index e2052b9..049cd28 100644
--- a/includes/specials/SpecialWithoutinterwiki.php
+++ b/includes/specials/SpecialWithoutinterwiki.php
@@ -49,20 +49,25 @@
$prefix = $this->prefix;
$t = $this->getPageTitle();
 
-   return Html::openElement( 'form', [ 'method' => 'get', 'action' 
=> wfScript() ] ) . "\n" .
-   Html::openElement( 'fieldset' ) . "\n" .
-   Html::element( 'legend', null, $this->msg( 
'withoutinterwiki-legend' )->text() ) . "\n" .
-   Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
-   Xml::inputLabel(
-   $this->msg( 'allpagesprefix' )->text(),
-   'prefix',
-   'wiprefix',
-   20,
-   $prefix
-   ) . "\n" .
-   Xml::submitButton( $this->msg( 
'withoutinterwiki-submit' )->text() ) . "\n" .
-   Html::closeElement( 'fieldset' ) . "\n" .
-   Html::closeElement( 'form' );
+   $formDescriptor = array(
+   'prefix' => array(
+   'label-message' => 'allpagesprefix',
+   'name' => 'prefix',
+   'id' => 'wiprefix',
+   'type' => 'text',
+   'size' => 20,
+   'default' => $prefix
+   )
+   );
+
+   $htmlForm = HTMLForm::factory( 'table', $formDescriptor, 
$this->getContext() );
+   $htmlForm->addHiddenField( 'title', $t->getPrefixedText() )
+   ->setWrapperLegendMsg( 'withoutinterwiki-legend' )
+   ->setSubmitTextMsg( 'withoutinterwiki-submit' )
+   ->setMethod( 'get' )
+   ->setAction( wfScript() )
+   ->prepareForm()
+   ->displayForm( false );
}
 
function sortDescending() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56b6b78b53d2531ebdb9cd0f903a4ce475dbc56b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Convert Special:AbuseFilter/hitory to HTMLForm - change (mediawiki...AbuseFilter)

2016-04-14 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Special:AbuseFilter/hitory to HTMLForm
..

Convert Special:AbuseFilter/hitory to HTMLForm

Bug: T132284
Change-Id: I14b98e92fa9e5ad2401c046bbaacd4a98daa5cc0
---
M Views/AbuseFilterViewHistory.php
1 file changed, 15 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/90/283390/1

diff --git a/Views/AbuseFilterViewHistory.php b/Views/AbuseFilterViewHistory.php
index 4909540..de3b69b 100644
--- a/Views/AbuseFilterViewHistory.php
+++ b/Views/AbuseFilterViewHistory.php
@@ -49,24 +49,22 @@
);
}
 
-   // Add filtering of changes et al.
-   $fields['abusefilter-history-select-user'] = Xml::input( 
'user', 45, $user );
-
-   $filterForm = Xml::buildForm( $fields, 
'abusefilter-history-select-submit' );
-   $filterForm .= "\n" . Html::hidden(
-   'title',
-   $this->getTitle( "history/$filter" 
)->getPrefixedDBkey()
-   );
-   $filterForm = Xml::tags( 'form',
-   array(
-   'action' => $this->getTitle( "history/$filter" 
)->getLocalURL(),
-   'method' => 'get'
-   ),
-   $filterForm
+   $formDescriptor = array(
+   'user' => array(
+   'type' => 'user',
+   'name' => 'user',
+   'default' => $user,
+   'size' => '45',
+   'label-message' => 
'abusefilter-history-select-user'
+   )
);
-   $filterForm = Xml::fieldset( $this->msg( 
'abusefilter-history-select-legend' )
-   ->text(), $filterForm );
-   $out->addHTML( $filterForm );
+
+   $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() 
);
+   $htmlForm->setSubmitTextMsg( 
'abusefilter-history-select-submit' );
+   $htmlForm->setWrapperLegendMsg( 
'abusefilter-history-select-legend' );
+   $htmlForm->setAction( $this->getTitle( "history/$filter" 
)->getLocalURL() );
+   $htmlForm->setMethod( 'get' );
+   $htmlForm->prepareForm()->displayForm( false );
 
$pager = new AbuseFilterHistoryPager( $filter, $this, $user );
$table = $pager->getBody();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14b98e92fa9e5ad2401c046bbaacd4a98daa5cc0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Convert Special:AbuseFilter/import to HTMLForm - change (mediawiki...AbuseFilter)

2016-04-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Special:AbuseFilter/import to HTMLForm
..

Convert Special:AbuseFilter/import to HTMLForm

Bug: T132284
Change-Id: Ife1ed3af19a4b4b506948763e4d92efc3a14a5bf
---
M Views/AbuseFilterViewImport.php
1 file changed, 11 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/26/282526/1

diff --git a/Views/AbuseFilterViewImport.php b/Views/AbuseFilterViewImport.php
index 27bb4c7..c09b68f 100644
--- a/Views/AbuseFilterViewImport.php
+++ b/Views/AbuseFilterViewImport.php
@@ -7,18 +7,18 @@
$out->addWikiMsg( 'abusefilter-edit-notallowed' );
return;
}
-
-   $out->addWikiMsg( 'abusefilter-import-intro' );
-
-   $html = Xml::textarea( 'wpImportText', '', 40, 20 );
-   $html .= Xml::submitButton(
-   $this->msg( 'abusefilter-import-submit' )->text(),
-   array( 'accesskey' => 's' )
-   );
$url = SpecialPage::getTitleFor( 'AbuseFilter', 'new' 
)->getFullURL();
 
-   $html = Xml::tags( 'form', array( 'method' => 'post', 'action' 
=> $url ), $html );
-
-   $out->addHTML( $html );
+   $formDescriptor = array(
+   'wpImportText' => array(
+   'type' => 'textarea',
+   'name' => 'wpImportText',
+   'cols' => 200,
+   )
+   );
+   $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() 
);
+   $htmlForm->setSubmitTextMsg( 'abusefilter-import-submit' );
+   $htmlForm->setAction( $url );
+   $htmlForm->show();
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife1ed3af19a4b4b506948763e4d92efc3a14a5bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Convert Special:AbuseFilter to OOUI - change (mediawiki...AbuseFilter)

2016-04-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Special:AbuseFilter to OOUI
..

Convert Special:AbuseFilter to OOUI

Bug: T132284
Change-Id: Ie8bc13fd8602d94f53e574efb00f9908f0029ffd
---
M Views/AbuseFilterViewExamine.php
1 file changed, 24 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/22/282522/1

diff --git a/Views/AbuseFilterViewExamine.php b/Views/AbuseFilterViewExamine.php
index 04c25be..13a7e79 100644
--- a/Views/AbuseFilterViewExamine.php
+++ b/Views/AbuseFilterViewExamine.php
@@ -28,32 +28,32 @@
}
 
function showSearch() {
-   // Add selector
-   $selector = '';
-
-   $selectFields = array(); # Same fields as in Test
-   $selectFields['abusefilter-test-user'] = Xml::input( 
'wpSearchUser', 45, $this->mSearchUser );
-   $selectFields['abusefilter-test-period-start'] =
-   Xml::input( 'wpSearchPeriodStart', 45, 
$this->mSearchPeriodStart );
-   $selectFields['abusefilter-test-period-end'] =
-   Xml::input( 'wpSearchPeriodEnd', 45, 
$this->mSearchPeriodEnd );
-
-   $selector .= Xml::buildForm( $selectFields, 
'abusefilter-examine-submit' );
-   $selector .= Html::hidden( 'submit', 1 );
-   $selector .= Html::hidden( 'title', $this->getTitle( 'examine' 
)->getPrefixedDBkey() );
-   $selector = Xml::tags( 'form',
-   array(
-   'action' => $this->getTitle( 'examine' 
)->getLocalURL(),
-   'method' => 'get'
+   $formDescriptor = array(
+   'abusefilter-test-user' => array(
+   'label-message' => 'abusefilter-test-user',
+   'type' => 'user',
+   'name' => 'wpSearchUser',
+   'default' => $this->mSearchUser,
),
-   $selector
+   'abusefilter-test-period-start' => array(
+   'label-message' => 
'abusefilter-test-period-start',
+   'type' => 'user',
+   'name' => 'wpSearchPeriodStart',
+   'default' => $this->mSearchPeriodStart,
+   ),
+   'abusefilter-test-period-end' => array(
+   'label-message' => 
'abusefilter-test-period-end',
+   'type' => 'user',
+   'name' => 'wpSearchPeriodEnd',
+   'default' => $this->mSearchPeriodEnd,
+   ),
);
-   $selector = Xml::fieldset(
-   $this->msg( 'abusefilter-examine-legend' )->text(),
-   $selector
-   );
-   $this->getOutput()->addHTML( $selector );
-
+   $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() 
);
+   $htmlForm->setWrapperLegendMsg( 'abusefilter-examine-legend' );
+   $htmlForm->addHiddenField( 'submit', 1 );
+   $htmlForm->setSubmitTextMsg( 'abusefilter-examine-submit' );
+   $htmlForm->setMethod( 'get' );
+   $htmlForm->prepareForm()->displayForm( false );
if ( $this->mSubmit ) {
$this->showResults();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8bc13fd8602d94f53e574efb00f9908f0029ffd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Convert Special:AbuseLog to HTMLForm from XML Form - change (mediawiki...AbuseFilter)

2016-04-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Convert Special:AbuseLog to HTMLForm from XML Form
..

Convert Special:AbuseLog to HTMLForm from XML Form

Bug: T132287
Change-Id: I614cd9b962b7b672e43dd35b14700c72f3425c1f
---
M special/SpecialAbuseLog.php
1 file changed, 35 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/16/282516/1

diff --git a/special/SpecialAbuseLog.php b/special/SpecialAbuseLog.php
index 753abee..8dd1a6d 100644
--- a/special/SpecialAbuseLog.php
+++ b/special/SpecialAbuseLog.php
@@ -96,34 +96,48 @@
function searchForm() {
global $wgAbuseFilterIsCentral;
 
-   $output = Xml::element( 'legend', null, $this->msg( 
'abusefilter-log-search' )->text() );
-   $fields = array();
-
-   // Search conditions
-   $fields['abusefilter-log-search-user'] =
-   Xml::input( 'wpSearchUser', 45, $this->mSearchUser );
+   $formDescriptor = array(
+   'abusefilter-log-search-user' => array(
+   'section' => 'search',
+   'label-message' => 
'abusefilter-log-search-user',
+   'type' => 'user',
+   'name' => 'wpSearchUser',
+   'value' => $this->mSearchUser
+   ),
+   'abusefilter-log-search-title' => array(
+   'section' => 'search',
+   'label-message' => 
'abusefilter-log-search-title',
+   'type' => 'title',
+   'name' => 'wpSearchTitle',
+   'value' => $this->mSearchTitle
+   )
+   );
if ( self::canSeeDetails() ) {
-   $fields['abusefilter-log-search-filter'] =
-   Xml::input( 'wpSearchFilter', 45, 
$this->mSearchFilter );
+   $formDescriptor['abusefilter-log-search-filter'] = 
array(
+   'section' => 'search',
+   'label-message' => 
'abusefilter-log-search-filter',
+   'type' => 'text',
+   'name' => 'wpSearchFilter',
+   'value' => $this->mSearchFilter,
+   );
}
-   $fields['abusefilter-log-search-title'] =
-   Xml::input( 'wpSearchTitle', 45, $this->mSearchTitle );
-
if ( $wgAbuseFilterIsCentral ) {
// Add free form input for wiki name. Would be nice to 
generate
// a select with unique names in the db at some point.
-   $fields['abusefilter-log-search-wiki'] =
-   Xml::input( 'wpSearchWiki', 45, 
$this->mSearchWiki );
+   $formDescriptor['abusefilter-log-search-wiki'] = array(
+   'section' => 'search',
+   'label-message' => 
'abusefilter-log-search-wiki',
+   'type' => 'text',
+   'name' => 'wpSearchWiki',
+   'value' => $this->mSearchWiki
+   );
}
 
-   $output .= Xml::tags( 'form',
-   array( 'method' => 'get', 'action' => 
$this->getPageTitle()->getLocalURL() ),
-   Xml::buildForm( $fields, 
'abusefilter-log-search-submit' ) .
-   Html::hidden( 'title', 
$this->getPageTitle()->getPrefixedDBkey() )
-   );
-   $output = Xml::tags( 'fieldset', null, $output );
-
-   $this->getOutput()->addHTML( $output );
+   $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 
'abusefilter-log' );
+   $htmlForm->setSubmitTextMsg( 'abusefilter-log-search-submit' );
+   $htmlForm->setMethod( 'get' );
+   $htmlForm->addHiddenField( 'title', 
$this->getPageTitle()->getPrefixedDBkey() );
+   $htmlForm->prepareForm()->displayForm(false);
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I614cd9b962b7b672e43dd35b14700c72f3425c1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow listing of Newsletter issues for a given newsletter - change (mediawiki...Newsletter)

2016-04-03 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Allow listing of Newsletter issues for a given newsletter
..

Allow listing of Newsletter issues for a given newsletter

Made a new subpage Special:Newsletter/id/issues which would list down the
issues using a TablePager class

Bug: T131682
Change-Id: I4d224d619e40472a3163f8655ef4b17168ec00d4
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialNewsletter.php
A includes/specials/pagers/NewsletterIssuesTablePager.php
5 files changed, 165 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/92/281292/1

diff --git a/extension.json b/extension.json
index 78d915d..0a027c6 100644
--- a/extension.json
+++ b/extension.json
@@ -63,6 +63,7 @@
"SpecialNewsletters": 
"includes/specials/SpecialNewsletters.php",
"SpecialNewsletterCreate": 
"includes/specials/SpecialNewsletterCreate.php",
"NewsletterTablePager": 
"includes/specials/pagers/NewsletterTablePager.php",
+   "NewsletterIssuesTablePager": 
"includes/specials/pagers/NewsletterIssuesTablePager.php",
"ApiNewsletterManage": "includes/api/ApiNewsletterManage.php",
"ApiNewsletterSubscribe": 
"includes/api/ApiNewsletterSubscribe.php",
"EchoNewsletterPresentationModel": 
"includes/Echo/EchoNewsletterPresentationModel.php",
diff --git a/i18n/en.json b/i18n/en.json
index be33eb2..dfb9ee8 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -29,9 +29,11 @@
"newsletter-subtitlelinks-announce": "announce",
"newsletter-subtitlelinks-manage": "manage",
"newsletter-subtitlelinks-delete": "delete",
+   "newsletter-subtitlelinks-issues": "issues",
"newsletters": "Newsletters",
"newsletter-subscribe-loginrequired": "Please log in to subscribe to 
[[Special:Newsletters|newsletters]].",
"newsletter-notfound": "Newsletter not found",
+   "newsletter-issue-none-found": "No issues found for this Newsletter",
"newsletter-not-found-id": "A newsletter with this ID does not exist. A 
[[Special:Newsletters|list of existing newsletters]] is available.",
"newsletter-view": "View newsletter details",
"newsletter-view-name": "Newsletter name:",
@@ -45,6 +47,7 @@
"newsletter-unsubscribe-button": "Unsubscribe",
"newsletter-subscribe-button": "Subscribe",
"newsletter-announce-button": "Announce",
+   "newsletter-issues-button": "Issues",
"newsletter-announce-nopermission": "You are not a publisher for this 
newsletter.",
"newsletter-announce": "Announce a new issue of \"$1\"",
"newsletter-announce-submit": "Announce",
@@ -106,6 +109,8 @@
"newsletter-header-description": "Description",
"newsletter-header-action": "Subscribed?",
"newsletter-header-subscriber_count": "Subscriber count",
+   "newsletter-header-issue_name": "Issue",
+   "newsletter-header-issue_publisher": "Publisher",
"newsletter-delete-confirmation": "Are you sure you want to delete this 
newsletter?",
"newsletter-delete-confirm-details": "Note that this action is not 
reversible and data cannot be restored once it has been deleted.",
"newsletter-delete-confirm-cancel": "Cancel",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b928c3b..574ffba 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -28,14 +28,16 @@
"newsletter-create-short-description-error": "Error message shown on 
[[Special:CreateNewsletter]] if the text entered in the description field is 
too short.",
"newsletter-subtitlelinks-list": "Label for link to 
[[Special:Newsletters]] shown under the header on Newsletter special 
pages.\n\nSee also:\n* {{msg-mw|newsletter-subtitlelinks-create}}",
"newsletter-subtitlelinks-create": "Label for link to 
[[Special:CreateNewsletter]] shown under the header on Newsletter special 
pages.\n\nSee also:\n* {{msg-mw|newsletter-subtitlelinks-list}}",
-   "newsletter-subtitlelinks-unsubscribe": "Label for link to 
Special:Newsletter unsubscribe page. \n\nSee also:\n* 
{{msg-mw|newsletter-subtitlelinks-subscribe}}\n* 
{{msg-mw|newsletter-subtitlelinks-announce}}\n* 
{{msg-mw|newsletter-subtitlelinks-manage}}\n* 
{{msg-mw|newsletter-subtitlelinks-delete}}\n{{Identical|Unsubscribe}}",
-   "newsletter-subtitlelinks-subscribe": "Label for link to 
Special:Newsletter subscribe page. Used as a navigation link on 
Special:Newsletter.\n\nSee also:\n* 
{{msg-mw|newsletter-subtitlelinks-unsubscribe}}\n* 
{{msg-mw|newsletter-subtitlelinks-announce}}\n* 
{{msg-mw|newsletter-subtitlelinks-manage}}\n* 
{{msg-mw|newsletter-subtitlelinks-delete}}\n{{Identical|Subscribe}}",
-   "newsletter-subtitlelinks-announce": "Label for link to 
Special:Newsletter announce page

[MediaWiki-commits] [Gerrit] Center last two columns in Special:Newsletters - change (mediawiki...Newsletter)

2016-04-03 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Center last two columns in Special:Newsletters
..

Center last two columns in Special:Newsletters

Bug: T131654
Change-Id: I3df9b942cc183ab7893460424cb90eb98b5b6af8
---
M modules/ext.newsletter.newsletters.styles.css
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/51/281251/1

diff --git a/modules/ext.newsletter.newsletters.styles.css 
b/modules/ext.newsletter.newsletters.styles.css
index 2c05939..ab2d9d7 100644
--- a/modules/ext.newsletter.newsletters.styles.css
+++ b/modules/ext.newsletter.newsletters.styles.css
@@ -53,4 +53,7 @@
 .mw-special-Newsletters .mw-datatable, .mw-special-Newsletters .mw-datatable 
tr {
border: solid #AA;
border-width: 0 0 1px 0;
-}
\ No newline at end of file
+}
+.mw-special-Newsletters .mw-datatable td:nth-child(3), .mw-special-Newsletters 
.mw-datatable td:nth-child(4) {
+   text-align: center;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3df9b942cc183ab7893460424cb90eb98b5b6af8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add Newsletter extension to beta - change (operations/mediawiki-config)

2016-04-02 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add Newsletter extension to beta
..

Add Newsletter extension to beta

Bug: T127297
Change-Id: I97f6f021ed26b371a4fff879cefe2f62748d600b
---
M wmf-config/CommonSettings-labs.php
M wmf-config/InitialiseSettings.php
M wmf-config/extension-list-labs
3 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/49/281249/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index 8bf542b..59de815 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -337,6 +337,10 @@
$wgOresBaseUrl = 'https://ores.wmflabs.org/';
 }
 
+if ( $wmgUseNewsletter ) {
+   wfLoadExtension( 'Newsletter' );
+}
+
 // Experimental
 $wgGadgetsCaching = false;
 
diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index fef15f7..93efd93 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -14840,6 +14840,9 @@
 'wmgUseBounceHandler' => array(
'default' => true,
 ),
+'wmgUseNewsletter' => array(
+   'default' => true,
+),
 
 'wmgUseTranslate' => array(
'default' => false,
diff --git a/wmf-config/extension-list-labs b/wmf-config/extension-list-labs
index e4a5d32..f9142a2 100644
--- a/wmf-config/extension-list-labs
+++ b/wmf-config/extension-list-labs
@@ -4,3 +4,4 @@
 $IP/extensions/EventBus/extension.json
 $IP/extensions/Kartographer/extension.json
 $IP/extensions/ORES/extension.json
+$IP/extensions/Newsletter/extension.json
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97f6f021ed26b371a4fff879cefe2f62748d600b
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add required = true for Newsletter manage form elements - change (mediawiki...Newsletter)

2016-04-02 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add required = true for Newsletter manage form elements
..

Add required = true for Newsletter manage form elements

Change-Id: I4dd1bfec6d45388c704f23d3823d3e64f6f76f40
---
M includes/specials/SpecialNewsletter.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/88/281088/1

diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index ac2d9c7..cd14ed4 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -650,17 +650,20 @@
'type' => 'text',
'label-message' => 'newsletter-manage-name',
'default' => $this->newsletter->getName(),
+   'required' => true,
);
$fields['MainPage'] = array(
'type' => 'title',
'label-message' => 'newsletter-manage-title',
'default' =>  $mainTitle->getPrefixedText(),
+   'required' => true,
);
$fields['Description'] = array(
'type' => 'textarea',
'label-message' => 'newsletter-manage-description',
'rows' => 6,
'default' => $this->newsletter->getDescription(),
+   'required' => true,
);
$fields['Publishers'] = array(
'type' => 'textarea',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4dd1bfec6d45388c704f23d3823d3e64f6f76f40
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow managing of name, description and main page of Newsle... - change (mediawiki...Newsletter)

2016-04-01 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Allow managing of  name, description and main page of 
Newsletters
..

Allow managing of  name, description and main page of Newsletters

Implemented in Newsletter/id/manage

Bug: T131489
Change-Id: Ie9d4c87892e60a88170333caa7c1f6eda62dbd9d
---
M i18n/en.json
M i18n/qqq.json
M includes/NewsletterDb.php
M includes/specials/SpecialNewsletter.php
4 files changed, 177 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/28/280928/1

diff --git a/i18n/en.json b/i18n/en.json
index 54c53ee..6c944dc 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -27,7 +27,7 @@
"newsletter-subtitlelinks-unsubscribe": "unsubscribe",
"newsletter-subtitlelinks-subscribe": "subscribe",
"newsletter-subtitlelinks-announce": "announce",
-   "newsletter-subtitlelinks-manage": "collaborators",
+   "newsletter-subtitlelinks-manage": "manage",
"newsletter-subtitlelinks-delete": "delete",
"newsletters": "Newsletters",
"newsletter-subscribe-loginrequired": "Please log in to subscribe to 
[[Special:Newsletters|newsletters]].",
@@ -41,7 +41,7 @@
"newsletter-view-subscriber-count": "Subscriber count:",
"newsletter-view-no-publishers": "No publishers.",
"newsletter-delete-button": "Delete",
-   "newsletter-collaborators-button": "Collaborators",
+   "newsletter-manage-button": "Manage",
"newsletter-unsubscribe-button": "Unsubscribe",
"newsletter-subscribe-button": "Subscribe",
"newsletter-announce-button": "Announce",
@@ -56,13 +56,16 @@
"newsletter-announce-failure": "A new issue could not be announced. 
Please try again.",
"newsletter-manage": "Manage \"$1\" newsletter",
"newsletter-manage-publishers": "Publishers (separated by newline):",
+   "newsletter-manage-name": "Newsletter name:",
+   "newsletter-manage-title": "Title of Main Page",
+   "newsletter-manage-description": "Description:",
"newsletter-manage-text": "You can add or remove publishers for \"$1\" 
by modifying the list below.",
"newsletter-managenewsletter-button": "Submit",
"newsletter-manage-no-publishers": "Are you sure that you want to 
remove all the publishers from this newsletter?",
"newsletter-manage-invalid-publisher": "\"$1\" is not a valid user. 
Please make sure that you entered valid input and try again.",
"newsletter-manage-remove-self-publisher": "Are you sure that you want 
to remove yourself from the publishers?",
-   "newsletter-manage-publishers-success": "The publishers for this 
newsletter have been modified.",
-   "newsletter-manage-publishers-nochanges": "No changes were made to the 
existing publishers' list.",
+   "newsletter-manage-newsletter-success": "The newsletter have been 
modified.",
+   "newsletter-manage-newsletter-nochanges": "No changes were made to the 
existing newsletter.",
"newsletter-delete": "Delete newsletter",
"newsletter-delete-text": "This interface can be used to delete the 
\"$1\" newsletter. Please confirm that you intend to do this. This 
action cannot be undone.",
"newsletter-deletenewsletter-button": "Delete this newsletter",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index e931497..361fb48 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -45,7 +45,7 @@
"newsletter-view-subscriber-count": "Label for newsletter's subscriber 
count field. Shown on Special:Newsletter/.",
"newsletter-view-no-publishers": "Message shown on Special:Newsletter 
if there are no publishers for the newsletter.",
"newsletter-delete-button": "Label for \"Delete\" button shown on 
Special:Newsletter/. Links to Special:Newsletter//delete. Only shown if 
the current user has permissions to delete the 
newsletter.\n{{Identical|Delete}}",
-   "newsletter-collaborators-button": "Label for \"Collaborators\" button 
shown on Special:Newsletter/. Links to Special:Newsletter//manage. Only 
shown if the current user has permissions to manage the newsletter. Actions 
include adding publishers, removing publishers by editing the textbox.",
+   "newsletter-manage-button": "Label for \"Manage\" button shown on 
Special:Newsletter/. Links to Special:Newsletter//manage. Only shown if 
the current user has permissions to manage the newsletter. Actions include 
adding publishers, removing publishers by editing the textbox.",
"newsletter-unsubscribe-button": "Label for \"Unsubscribe\" button 
shown on Special:Newsletter/. Links to Special:Newsletter//unsubscribe. 
Shown only for logged-in users and if the user is currently subscribed to the 
newsletter.\n{{Identical|Unsubscribe}}",
"newsletter-subscribe-button": "Label for \"Subscribe\" button shown on 
Special:

[MediaWiki-commits] [Gerrit] Allow newsletter managers to edit newsletter description - change (mediawiki...Newsletter)

2016-04-01 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Allow newsletter managers to edit newsletter description
..

Allow newsletter managers to edit newsletter description

Bug: T131454
Change-Id: I332ef0381ddbf34dde0eae153daf1ce7fe3154ea
---
M includes/specials/SpecialNewsletter.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/33/280833/1

diff --git a/includes/specials/SpecialNewsletter.php 
b/includes/specials/SpecialNewsletter.php
index f77c517..26301a0 100644
--- a/includes/specials/SpecialNewsletter.php
+++ b/includes/specials/SpecialNewsletter.php
@@ -229,6 +229,11 @@
$fields['publishers']['default'] = $this->msg( 
'newsletter-view-no-publishers' )->escaped();
}
 
+   // Allow editing of newsletter description for users with 
manage rights
+   if ( $this->newsletter->canManage( $user ) ) {
+   $fields['description']['readonly'] = false;
+   }
+
$form = $this->getHTMLForm(
$fields,
function() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I332ef0381ddbf34dde0eae153daf1ce7fe3154ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add summary back to echo web notifications - change (mediawiki...Newsletter)

2015-12-31 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add summary back to echo web notifications
..

Add summary back to echo web notifications

Bug: T122663
Change-Id: I363d93a4ff7ec433b16c36be6131a96075ad1a97
---
M i18n/en.json
M i18n/qqq.json
M includes/Echo/EchoNewsletterPresentationModel.php
3 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/74/261774/1

diff --git a/i18n/en.json b/i18n/en.json
index 4473eeb..007a6ad 100755
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -123,6 +123,7 @@
"apihelp-newslettermanage-example-1": "Add a publisher with a user id 
of 3 to newsletter with id 1.",
"apihelp-newslettermanage-example-2": "Remove publisher with a user id 
of 5 from newsletter with id 2.",
"notification-header-newsletter-announce": "$1 {{GENDER:$2|has 
announced}} a new issue of $3.",
+   "notification-body-newsletter-announce": "$1",
"newsletter-list-table": "Filter table by: ",
"newsletter-list-section":  "Search for newsletters",
"newsletter-list-option-all": "All newsletters",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f1f242e..d64e294 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -126,6 +126,7 @@
"apihelp-newslettermanage-example-1": 
"{{doc-apihelp-example|newslettermanage}}",
"apihelp-newslettermanage-example-2": 
"{{doc-apihelp-example|newslettermanage}}",
"notification-header-newsletter-announce": "Header text for a 
notification when a new issue of a newsletter is announced. Parameters:\n* $1 
is that user's name (not suitable for GENDER).\n* $2 is the user's name for use 
in GENDER.\n* $3 is the title of the newsletter.",
+   "notification-body-newsletter-announce": "Body text for a notification 
when a new issue of a newsletter is announced. Parameters:\n* $1 is the summary 
of the new newsletter issue.",
"newsletter-list-table": "Label of the drop down menu in 
[[Special:Newsletters]], the options of which can be used to customize the 
search of newsletters",
"newsletter-list-section": "Section header of HTML form in 
[[Special:Newsletters]] used to search for newsletters",
"newsletter-list-option-all": "Option of the drop down menu in 
[[Special:Newsletters]] to display all newsletters",
diff --git a/includes/Echo/EchoNewsletterPresentationModel.php 
b/includes/Echo/EchoNewsletterPresentationModel.php
index 8b197da..748a755 100644
--- a/includes/Echo/EchoNewsletterPresentationModel.php
+++ b/includes/Echo/EchoNewsletterPresentationModel.php
@@ -36,4 +36,9 @@
// Add the newsletter name
return $msg->params( $this->event->getExtraParam( 
'newsletter-name' ) );
}
+
+   public function getBodyMessage() {
+   return $this->msg( 'notification-body-newsletter-announce' )
+   ->params( $this->event->getExtraParam('section-text') );
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I363d93a4ff7ec433b16c36be6131a96075ad1a97
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add Reedy to BounceHandler maintainers list - change (mediawiki...BounceHandler)

2015-11-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add Reedy to BounceHandler maintainers list
..

Add Reedy to BounceHandler maintainers list

Change-Id: Ibe70d2d1368b992b7f8ea23661c2793d97ba071e
---
M extension.json
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/97/253297/1

diff --git a/extension.json b/extension.json
index cf79254..e3bcbbb 100644
--- a/extension.json
+++ b/extension.json
@@ -4,7 +4,8 @@
"author": [
"Tony Thomas",
"Kunal Mehta",
-   "Jeff Green"
+   "Jeff Green",
+   "Sam Reed"
],
"url": "https://www.mediawiki.org/wiki/Extension:BounceHandler";,
"descriptionmsg": "bouncehandler-desc",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe70d2d1368b992b7f8ea23661c2793d97ba071e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add Username too to the Unsubscribe message log - change (mediawiki...BounceHandler)

2015-11-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add Username too to the Unsubscribe message log
..

Add Username too to the Unsubscribe message log

Bug: T118651
Change-Id: I257ddd0028d7efdcdaa1d82afb352da940650d49
---
M includes/BounceHandlerActions.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/74/253174/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index defa56e..d8b3134 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -141,7 +141,7 @@
$caUser->saveSettings();
$this->notifyGlobalUser( $bounceUserId, 
$originalEmail );
wfDebugLog( 'BounceHandler',
-   "Un-subscribed global user 
$originalEmail for exceeding Bounce Limit 
$this->bounceRecordLimit.\nHeaders:\n" .
+   "Un-subscribed global user 
$caUser->getName() <$originalEmail> for exceeding Bounce Limit 
$this->bounceRecordLimit.\nHeaders:\n" .
$this->formatHeaders( 
$emailHeaders )
);

RequestContext::getMain()->getStats()->increment( 'bouncehandler.unsub.global' 
);
@@ -152,7 +152,7 @@
$user->saveSettings();
$this->createEchoNotification( $bounceUserId, 
$originalEmail );
wfDebugLog( 'BounceHandler',
-   "Un-subscribed $originalEmail for exceeding 
Bounce limit $this->bounceRecordLimit.\nHeaders:\n" .
+   "Un-subscribed $user->getName() 
<$originalEmail> for exceeding Bounce limit 
$this->bounceRecordLimit.\nHeaders:\n" .
$this->formatHeaders( $emailHeaders )
);
RequestContext::getMain()->getStats()->increment( 
'bouncehandler.unsub.local' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I257ddd0028d7efdcdaa1d82afb352da940650d49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Log the entire bounce email too before invalidating email - change (mediawiki...BounceHandler)

2015-11-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Log the entire bounce email too before invalidating email
..

Log the entire bounce email too before invalidating email

Bug: T99767
Change-Id: I3f4fbcc61b50bcb4f41f09849af1326d9fa76b1d
---
M includes/BounceHandlerActions.php
M includes/ProcessBounceEmails.php
M includes/ProcessBounceWithRegex.php
3 files changed, 18 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/72/253172/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index defa56e..f84ac76 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -32,13 +32,19 @@
protected $bounceHandlerUnconfirmUsers;
 
/**
+* @var string
+*/
+   protected $emailRaw;
+
+   /**
 * @param string $wikiId The database id of the failing recipient
 * @param int $bounceRecordPeriod Time period for which bounce 
activities are considered before un-subscribing
 * @param int $bounceRecordLimit The number of bounce allowed in the 
bounceRecordPeriod.
 * @param bool $bounceHandlerUnconfirmUsers Enable/Disable user 
un-subscribe action
 * @throws Exception
 */
-   public function __construct( $wikiId, $bounceRecordPeriod, 
$bounceRecordLimit, $bounceHandlerUnconfirmUsers ) {
+   public function __construct( $wikiId, $bounceRecordPeriod, 
$bounceRecordLimit, $bounceHandlerUnconfirmUsers,
+$emailRaw ) {
if ( $wikiId !== wfWikiID() ) {
// We want to use the User class methods, which make no 
sense on the wrong wiki
throw new Exception( "BounceHandlerActions constructed 
for a foreign wiki." );
@@ -48,6 +54,7 @@
$this->bounceRecordPeriod = $bounceRecordPeriod;
$this->bounceRecordLimit = $bounceRecordLimit;
$this->bounceHandlerUnconfirmUsers = 
$bounceHandlerUnconfirmUsers;
+   $this->emailRaw = $emailRaw;
}
 
/**
@@ -142,7 +149,7 @@
$this->notifyGlobalUser( $bounceUserId, 
$originalEmail );
wfDebugLog( 'BounceHandler',
"Un-subscribed global user 
$originalEmail for exceeding Bounce Limit 
$this->bounceRecordLimit.\nHeaders:\n" .
-   $this->formatHeaders( 
$emailHeaders )
+   $this->formatHeaders( 
$emailHeaders ) . "\nBounced_Email: $this->emailRaw"
);

RequestContext::getMain()->getStats()->increment( 'bouncehandler.unsub.global' 
);
}
diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index 536ba80..fb0cd3e 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -31,13 +31,15 @@
 * Process bounce email
 *
 * @param array $emailHeaders
+* @param string $emailRaw
+*
 * @return bool
 */
-   public function processEmail( $emailHeaders ) {
+   public function processEmail( $emailHeaders, $emailRaw ) {
// The bounceHandler needs to respond only to permanent 
failures.
$isPermanentFailure = $this->checkPermanentFailure( 
$emailHeaders );
if ( $isPermanentFailure ) {
-   return $this->processBounceHeaders( $emailHeaders );
+   return $this->processBounceHeaders( $emailHeaders, 
$emailRaw );
}
 
return false;
@@ -47,9 +49,10 @@
 * Process received bounce emails from Job Queue
 *
 * @param array $emailHeaders
+* @param string $emailRaw
 * @return bool
 */
-   public function processBounceHeaders( $emailHeaders ) {
+   public function processBounceHeaders( $emailHeaders, $emailRaw ) {
global $wgBounceRecordPeriod, $wgBounceRecordLimit, 
$wgBounceHandlerUnconfirmUsers, $wgBounceRecordMaxAge;
$to = $emailHeaders['to'];
$subject = $emailHeaders['subject'];
@@ -81,7 +84,8 @@
$wikiId,
$wgBounceRecordPeriod,
$wgBounceRecordLimit,
-   $wgBounceHandlerUnconfirmUsers
+   $wgBounceHandlerUnconfirmUsers,
+   $emailRaw
);
$takeBounceActions->handleFailingRecipient( 
$failedUser, $emailHeaders );
return true;
diff --git a/includes/ProcessBounceWithRegex.ph

[MediaWiki-commits] [Gerrit] Make mx1001/mx2001 to HTTP POST to meta.wikimedia.org - change (operations/puppet)

2015-10-11 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Make mx1001/mx2001 to HTTP POST to meta.wikimedia.org
..

Make mx1001/mx2001 to HTTP POST to meta.wikimedia.org

Currently it is POST ing to test2.wikipedia.org, which was setup as
an inital configuration.

Bug: T114984
Change-Id: I73833dbfaf8d47fccf0d62fb85f05b7d38ed66e5
---
M manifests/role/mail.pp
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/28/245128/1

diff --git a/manifests/role/mail.pp b/manifests/role/mail.pp
index e3ef8c7..2f6f11c 100644
--- a/manifests/role/mail.pp
+++ b/manifests/role/mail.pp
@@ -9,7 +9,7 @@
 $verp_domains = [
 'wikimedia.org'
 ],
-$verp_post_connect_server = 'test2.wikipedia.org',
+$verp_post_connect_server = 'meta.wikimedia.org',
 $verp_bounce_post_url = "api.svc.${::mw_primary}.wmnet/w/api.php",
 ) {
 include network::constants

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73833dbfaf8d47fccf0d62fb85f05b7d38ed66e5
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow unregistered users to access Special:Newsletters - change (mediawiki...Newsletter)

2015-10-01 Thread 01tonythomas (Code Review)
01tonythomas has submitted this change and it was merged.

Change subject: Allow unregistered users to access Special:Newsletters
..


Allow unregistered users to access Special:Newsletters

Subscribe column is disabled for IPs everything else is now public.

Change-Id: I215612ed48c17f2520960745027f6c4084964079
---
M includes/specials/SpecialNewsletters.php
M includes/specials/pagers/NewsletterTablePager.php
2 files changed, 17 insertions(+), 6 deletions(-)

Approvals:
  01tonythomas: Looks good to me, approved



diff --git a/includes/specials/SpecialNewsletters.php 
b/includes/specials/SpecialNewsletters.php
index 313aa47..be2c763 100644
--- a/includes/specials/SpecialNewsletters.php
+++ b/includes/specials/SpecialNewsletters.php
@@ -14,9 +14,11 @@
 
public function execute( $par ) {
$this->setHeaders();
-   $this->requireLogin();
$out = $this->getOutput();
-   $out->addModules( 'ext.newsletter' );
+   if ( $this->getUser()->isLoggedIn() ) {
+   // IPs cannot subscribe
+   $out->addModules( 'ext.newsletter' );
+   }
$out->setSubtitle( LinksGenerator::getSubtitleLinks() );
$pager = new NewsletterTablePager();
 
diff --git a/includes/specials/pagers/NewsletterTablePager.php 
b/includes/specials/pagers/NewsletterTablePager.php
index 24673dd..1141eea 100644
--- a/includes/specials/pagers/NewsletterTablePager.php
+++ b/includes/specials/pagers/NewsletterTablePager.php
@@ -26,14 +26,18 @@
'nl_desc' => $this->msg( 
'newsletter-header-description' )->text(),
'nl_frequency' => $this->msg ( 
'newsletter-header-frequency' )->text(),
'subscriber_count' => $this->msg( 
'newsletter-header-subscriber_count' )->text(),
-   'action' => $this->msg( 
'newsletter-header-action' )->text(),
);
+
+   if ( $this->getUser()->isLoggedIn() ) {
+   // Only logged-in users can (un)subscribe
+   $this->fieldNames['action'] = $this->msg( 
'newsletter-header-action' )->text();
+   }
}
+
return $this->fieldNames;
}
 
public function getQueryInfo() {
-   $userId = $this->getUser()->getId();
//TODO we could probably just retrieve all subscribers IDs as a 
string here.
$info = array(
'tables' => array( 'nl_newsletters' ),
@@ -43,10 +47,14 @@
'nl_id',
'nl_frequency',
'subscribers' => ( '( SELECT COUNT(*) FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )' ),
-   'current_user_subscribed' => "$userId IN 
(SELECT nls_subscriber_id FROM nl_subscriptions WHERE nls_newsletter_id = nl_id 
)" ,
),
'options' => array( 'DISTINCT nl_id' ),
);
+
+   if ( $this->getUser()->isLoggedIn() ) {
+   $info['fields']['current_user_subscribed'] = 
$this->mDb->addQuotes( $this->getUser()->getId() ) .
+   ' IN (SELECT nls_subscriber_id FROM 
nl_subscriptions WHERE nls_newsletter_id = nl_id )';
+   }
 
return $info;
}
@@ -101,7 +109,8 @@
 
public function getDefaultSort() {
$this->mDefaultDirection = IndexPager::DIR_DESCENDING;
-   return 'current_user_subscribed';
+   $sort = $this->getUser()->isLoggedIn() ? 
'current_user_subscribed' : 'nl_name';
+   return $sort;
}
 
public function isFieldSortable( $field ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I215612ed48c17f2520960745027f6c4084964079
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: Glaisher 
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Tinaj1234 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Check for 'newsletter-addpublisher' permission in API too - change (mediawiki...Newsletter)

2015-10-01 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Check for 'newsletter-addpublisher' permission in API too
..

Check for 'newsletter-addpublisher' permission in API too

Fix minor documentation error too.
Follow up from : I00c15c5cbbb7fcfbed5593a61422560f4f854324

Change-Id: I9fb50571c6bc8b72fb2e6870dc61b0d0006aaaee
---
M includes/api/ApiNewsletterManage.php
M includes/specials/SpecialNewsletterManage.php
2 files changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/46/242846/1

diff --git a/includes/api/ApiNewsletterManage.php 
b/includes/api/ApiNewsletterManage.php
index 5fc8d90..67cf8cc 100644
--- a/includes/api/ApiNewsletterManage.php
+++ b/includes/api/ApiNewsletterManage.php
@@ -15,6 +15,10 @@
$this->dieUsage( 'You must be logged-in to interact 
with newsletters', 'notloggedin' );
}
 
+   if ( !$user->isAllowed( 'newsletter-addpublisher' ) ) {
+   $this->dieUsage( 'You do not have the necessary rights 
to interact with the newsletter', 'notnewsletteradmin' );
+   }
+
//TODO should probably do something here depending on the 
result..
if ( $this->getMain()->getVal( 'todo' ) === 'removepublisher' ) 
{
$db = NewsletterDb::newFromGlobalState();
diff --git a/includes/specials/SpecialNewsletterManage.php 
b/includes/specials/SpecialNewsletterManage.php
index beca03d..8c46460 100644
--- a/includes/specials/SpecialNewsletterManage.php
+++ b/includes/specials/SpecialNewsletterManage.php
@@ -35,7 +35,7 @@
$announceIssueForm->show();
 
if ( $this->getUser()->isAllowed( 
'newsletter-addpublisher' ) ) {
-   // The user does not have required permissions
+   // The user have required permissions
$addPublisherForm = new HTMLForm(
$this->getPublisherFormFields(),
$this->getContext(),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fb50571c6bc8b72fb2e6870dc61b0d0006aaaee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix Undefined index in CirrusSearch/includes/Hooks.php - change (mediawiki...CirrusSearch)

2015-09-29 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Fix Undefined index in CirrusSearch/includes/Hooks.php
..

Fix Undefined index in CirrusSearch/includes/Hooks.php

Minor syntax issue with the count( $array ) statement

Bug: T108938
Change-Id: I44c56e8f4df03c3c53959554509cca26ca6e1aaf
---
M includes/Hooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/35/242335/1

diff --git a/includes/Hooks.php b/includes/Hooks.php
index 83eca40..5047e05 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -368,7 +368,7 @@
 
foreach ( $lines as $line ) {
$linePieces = explode( ':', $line, 2 );
-   if ( count( $linePieces < 2 ) ) {
+   if ( count( $linePieces ) < 2 ) {
// Skip improperly formatted lines without a 
key:value
continue;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I44c56e8f4df03c3c53959554509cca26ca6e1aaf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove unused code from CirrusSearch File - change (mediawiki...CirrusSearch)

2015-09-29 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Remove unused code from CirrusSearch File
..

Remove unused code from CirrusSearch File

Few issues PHPStorm was pointing out

Change-Id: Ifb9298a2f3a2cbdd3a34363c13e40e898455dfa2
---
M includes/ElasticsearchIntermediary.php
1 file changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/68/242268/1

diff --git a/includes/ElasticsearchIntermediary.php 
b/includes/ElasticsearchIntermediary.php
index 018ed5b..ee23b57 100644
--- a/includes/ElasticsearchIntermediary.php
+++ b/includes/ElasticsearchIntermediary.php
@@ -93,7 +93,7 @@
$this->user = $user;
$this->slowMillis = round( 1000 * $slowSeconds );
$this->ut = UserTesting::getInstance();
-   $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'CirrusSearch' );
+   ConfigFactory::getDefaultInstance()->makeConfig( 'CirrusSearch' 
);
}
 
/**
@@ -161,7 +161,6 @@
FormatJson::encode( $parameters ),
);
 
-   $tests = array();
$logger = LoggerFactory::getInstance( 'CirrusSearchUserTesting' 
);
foreach ( $ut->getActiveTestNames() as $test ) {
$bucket = $ut->getBucket( $test );
@@ -302,7 +301,7 @@
 
/**
 * Log the completion of a request to Elasticsearch.
-* @return int number of milliseconds it took to complete the request
+* @return bool|int number of milliseconds it took to complete the 
request
 */
private function finishRequest() {
global $wgCirrusSearchLogElasticRequests;
@@ -311,7 +310,7 @@
LoggerFactory::getInstance( 'CirrusSearch' )->warning(
'finishRequest called without staring a request'
);
-   return;
+   return false;
}
$endTime = microtime( true );
$took = round( ( $endTime - $this->requestStart ) * 1000 );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb9298a2f3a2cbdd3a34363c13e40e898455dfa2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Minor leftover after https://gerrit.wikimedia.org/r/#/c/230383/ - change (mediawiki...Newsletter)

2015-08-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Minor leftover after https://gerrit.wikimedia.org/r/#/c/230383/
..

Minor leftover after https://gerrit.wikimedia.org/r/#/c/230383/

Change-Id: I71e151648af84e7b8a65e8c053c544465597eb38
---
M modules/ext.newslettermanage.js
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter 
refs/changes/64/230564/1

diff --git a/modules/ext.newslettermanage.js b/modules/ext.newslettermanage.js
index 6509867..968bdcd 100644
--- a/modules/ext.newslettermanage.js
+++ b/modules/ext.newslettermanage.js
@@ -18,6 +18,5 @@
console.log( data );
} );
$( this ).closest( 'tr' ).remove();
-   location.reload();
} );
 } )( jQuery, mediaWiki );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71e151648af84e7b8a65e8c053c544465597eb38
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Disable email notification on Echo event 'unsubscribe-bounce... - change (mediawiki...BounceHandler)

2015-08-06 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Disable email notification on Echo event 
'unsubscribe-bouncehandler'
..

Disable email notification on Echo event 'unsubscribe-bouncehandler'

The unsubscribe notification is sent when a user is unsubscribed,
and sending one more email to it will get dropped too.

Change-Id: I41d2372e56b72990acadb93d232f4d33cb2d1efa
---
M BounceHandlerHooks.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/82/229682/1

diff --git a/BounceHandlerHooks.php b/BounceHandlerHooks.php
index 7feb3cb..c5e8e22 100644
--- a/BounceHandlerHooks.php
+++ b/BounceHandlerHooks.php
@@ -16,6 +16,7 @@
 
$wgUnrecognizedBounceNotify = $wgUnrecognizedBounceNotify ? : 
array( $wgNoReplyAddress );
$wgVERPdomainPart = $wgVERPdomainPart ? : $wgServerName;
+   
$wgEchoDefaultNotificationTypes['unsubscribe-bouncehandler']['email'] = false;
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41d2372e56b72990acadb93d232f4d33cb2d1efa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add an option to disable email notification while defining a... - change (mediawiki...Echo)

2015-07-28 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add an option to disable email notification while defining an 
Echo $notification
..

Add an option to disable email notification while defining an Echo $notification

Bug: T97925
Change-Id: I1fc529c755d930d4657b7f286669483159756c7d
---
M Notifier.php
M includes/formatters/BasicFormatter.php
2 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/48/227648/1

diff --git a/Notifier.php b/Notifier.php
index fa4dcb1..4f09dde 100644
--- a/Notifier.php
+++ b/Notifier.php
@@ -31,7 +31,7 @@
 * @return bool
 */
public static function notifyWithEmail( $user, $event ) {
-   global $wgEnableEmail;
+   global $wgEnableEmail, $wgEchoNotifications;
 
if ( !$wgEnableEmail ) {
return false;
@@ -41,6 +41,11 @@
return false;
}
 
+   // The user might turn off email notification for this 
particular event
+   if( 
!$wgEchoNotifications[$event->getType()]['email-notification'] ) {
+   return false;
+   }
+
// Final check on whether to send email for this user & event
if ( !Hooks::run( 'EchoAbortEmailNotification', array( $user, 
$event ) ) ) {
return false;
diff --git a/includes/formatters/BasicFormatter.php 
b/includes/formatters/BasicFormatter.php
index d973acb..c8cc0d5 100644
--- a/includes/formatters/BasicFormatter.php
+++ b/includes/formatters/BasicFormatter.php
@@ -98,6 +98,7 @@
 
// Notification email subject and body
$this->email = array(
+   'notification' => $params['email-notification'],
'subject' => array(
'message' => $params['email-subject-message'],
'params' => $params['email-subject-params']
@@ -127,6 +128,7 @@
'bundle-message' => '',
'bundle-params' => array(),
'payload' => array(),
+   'email-notification' => true,
'email-subject-message' => 'echo-email-subject-default',
'email-subject-params' => array(),
'email-body-batch-message' => 
'echo-email-batch-body-default',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fc529c755d930d4657b7f286669483159756c7d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Changed my blog address to new Jekyll from Wordpress - change (operations/puppet)

2015-07-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Changed my blog address to new Jekyll from Wordpress
..

Changed my blog address to new Jekyll from Wordpress

The earlier website is dropped. Please change it to this new one

Change-Id: Ie6b13612fcc578cb601f9f2c15a781cf39d62cda
---
M modules/planet/templates/feeds/en_config.erb
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/52/225952/1

diff --git a/modules/planet/templates/feeds/en_config.erb 
b/modules/planet/templates/feeds/en_config.erb
index 13afd1d..27a1352 100644
--- a/modules/planet/templates/feeds/en_config.erb
+++ b/modules/planet/templates/feeds/en_config.erb
@@ -446,7 +446,7 @@
 [https://timotijhof.net/category/tools/feed/]
 name=User:Krinkle
 
-[https://tttwrites.wordpress.com/category/wikimedia/feed/]
+[http://blog.tttwrites.in/wikimedia.xml]
 name=Tony Thomas
 
 [http://thingelstad.com/tag/mediawiki/feed/]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6b13612fcc578cb601f9f2c15a781cf39d62cda
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Added Mailgun extension for Mediawiki - change (mediawiki...Mailgun)

2015-07-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Added Mailgun extension for Mediawiki
..

Added Mailgun extension for Mediawiki

Todo: Still requires exception handling

Bug: T105781
Change-Id: I12951a9397d80b2a4929afaba1e170616e44473b
---
A MailgunHooks.php
A composer.json
A extension.json
3 files changed, 107 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Mailgun 
refs/changes/84/224984/1

diff --git a/MailgunHooks.php b/MailgunHooks.php
new file mode 100644
index 000..128b6a7
--- /dev/null
+++ b/MailgunHooks.php
@@ -0,0 +1,76 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Tony Thomas <01tonytho...@gmail.com>
+ * @license GPL-2.0
+ * @ingroup Extensions
+*/
+class MailgunHooks {
+   /**
+* Function to be run on startup in $wgExtensionFunctions
+*/
+   public static function onRegistration() {
+   if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
+   require_once __DIR__ . '/vendor/autoload.php';
+   }
+
+   }
+
+   /**
+* Send a mail using Mailgun API
+*
+* @param array $headers
+* @param array $to
+* @param MailAddress $from
+* @param $subject
+* @param $body
+* @return bool
+*/
+   public static function onAlternateUserMailer( array $headers, array 
$to, MailAddress $from, $subject, $body ) {
+   global $wgMailgunAPIKey, $wgMailgunDomain;
+
+   try {
+   $mailgunTransport = new \Mailgun\Mailgun( 
$wgMailgunAPIKey );
+   } catch( Exception $e ) {
+   return $e->getMessage();
+   }
+
+   foreach( $to as $recip ) {
+   $message = $mailgunTransport->MessageBuilder();
+
+   $message->setFromAddress( $from );
+   $message->addToRecipient( $recip );
+   $message->setSubject( $subject );
+   $message->setTextBody( $body );
+
+   foreach( $headers as $headerName => $headerValue ) {
+   $message->addCustomHeader( $headerName, 
$headerValue );
+   }
+
+   try {
+   $mailgunTransport->sendMessage( 
$wgMailgunDomain, $message->getMessage() );
+   } catch( Exception $e ){
+   return $e->getMessage();
+   }
+   }
+
+   return false;
+   }
+}
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 000..6acf437
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,8 @@
+{
+"name": "mediawiki/mailgun",
+"require": {
+"mailgun/mailgun-php": "1.7.2"
+},
+"prepend-autoloader": false,
+"optimize-autoloader": true
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..89121d1
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,23 @@
+{
+"name": "Mailgun",
+"version": "1.0",
+"author": [
+"Tony Thomas"
+],
+"url": "https://www.mediawiki.org/wiki/Extension:Mailgun";,
+"AutoloadClasses": {
+"MailgunHooks": "MailgunHooks.php"
+},
+"Hooks": {
+"AlternateUserMailer": [
+"MailgunHooks::onAlternateUserMailer"
+]
+},
+"callback": "MailgunHooks::onRegistration",
+"config": {
+"MailgunAPIKey": "key-8fad6f8f77944d7d7abb9b7c66185476",
+"MailgunDomain": "amritafoss.in"
+},
+"manifest_version": 1
+
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12951a9397d80b2a4929afaba1e170616e44473b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Mailgun
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add API tests to SpamBlacklist - change (mediawiki...SpamBlacklist)

2015-06-27 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add API tests to SpamBlacklist
..

Add API tests to SpamBlacklist

Broken: The extension returns "OK", even though the URL is blacklisted.

Bug: T87402
Change-Id: I6e184658cf7db78219b2d82c2094235fd9361fff
---
M SpamBlacklistHooks.php
M extension.json
A tests/ApiSpamBlacklistTest.php
A tests/spamblacklists.txt
4 files changed, 80 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SpamBlacklist 
refs/changes/68/221368/1

diff --git a/SpamBlacklistHooks.php b/SpamBlacklistHooks.php
index 877882d..b70aa22 100755
--- a/SpamBlacklistHooks.php
+++ b/SpamBlacklistHooks.php
@@ -245,4 +245,32 @@
}
return true;
}
+
+   /**
+* Hook to add PHPUnit test cases.
+* @see https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList
+*
+* @param array &$files
+*
+* @return boolean
+*/
+   public static function registerUnitTests( array &$files ) {
+   // @codeCoverageIgnoreStart
+   $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . 
'/tests/' );
+
+   /**
+* @var SplFileInfo $fileInfo
+*/
+   $ourFiles = array();
+   foreach ( new RecursiveIteratorIterator( $directoryIterator ) 
as $fileInfo ) {
+   if ( substr( $fileInfo->getFilename(), -8 ) === 
'Test.php' ) {
+   $ourFiles[] = $fileInfo->getPathname();
+   }
+   }
+
+   $files = array_merge( $files, $ourFiles );
+
+   return true;
+   // @codeCoverageIgnoreEnd
+   }
 }
diff --git a/extension.json b/extension.json
index 7298673..84a030b 100644
--- a/extension.json
+++ b/extension.json
@@ -60,6 +60,9 @@
],
"AbortNewAccount": [
"SpamBlacklistHooks::abortNewAccount"
+   ],
+   "UnitTestsList" : [
+   "SpamBlacklistHooks::registerUnitTests"
]
},
"config": {
diff --git a/tests/ApiSpamBlacklistTest.php b/tests/ApiSpamBlacklistTest.php
new file mode 100644
index 000..65dfa4d
--- /dev/null
+++ b/tests/ApiSpamBlacklistTest.php
@@ -0,0 +1,48 @@
+http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
+ */
+class ApiSpamBlacklistTest extends ApiTestCase {
+
+   function setup() {
+   parent::setUp();
+   $this->doLogin( 'sysop' );
+   }
+
+   public static function provideSpamBlacklists() {
+   $blacklist = file_get_contents( __DIR__ . '/spamblacklists.txt' 
);
+   return array(
+   array( $blacklist )
+   );
+   }
+
+   /**
+* @dataProvider provideSpamBlacklists
+* @param $blacklist
+*/
+   function testApiSpamBlacklistwithSpamUrls( $blacklist ) {
+   $this->setMwGlobals(
+   array(
+   'wgSpamBlacklistFiles' => array(
+   $blacklist
+   )
+   )
+   );
+   $testUrl = "http://testspam.com";;
+
+   list( $apiResult ) = $this->doApiRequest( array(
+   'action' => 'spamblacklist',
+   'url' => $testUrl
+   ) );
+
+   $this->assertEquals( 'blacklisted', 
$apiResult['spamblacklist']['result'] );
+
+   }
+}
\ No newline at end of file
diff --git a/tests/spamblacklists.txt b/tests/spamblacklists.txt
new file mode 100644
index 000..89698c2
--- /dev/null
+++ b/tests/spamblacklists.txt
@@ -0,0 +1 @@
+\testspam\.com\b
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e184658cf7db78219b2d82c2094235fd9361fff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SpamBlacklist
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Implement 'Create a newsletter' and 'Announce issue' feature... - change (mediawiki...Newsletter)

2015-06-18 Thread 01tonythomas (Code Review)
01tonythomas has submitted this change and it was merged.

Change subject: Implement 'Create a newsletter' and 'Announce issue' feature 
for Newsletter extension
..


Implement 'Create a newsletter' and 'Announce issue' feature for Newsletter 
extension

What the patch does:
1. Adds newsletters and issues table to database on running update.php script.
2. Implements interface (version 1) for publishers for creating newsletters and
announcing issues.
3. Creates new special pages - Special:NewsletterCreate and 
Special:NewsletterManage
4. Adds user entries on the HTML forms to database.
5. Added qqq messages.

Bug: T100125
Change-Id: I9cf8be2ba89991dcb7c6f41f5b483c3c4f700a24
---
M Newsletter.hooks.php
M Newsletter.php
M i18n/en.json
A i18n/qqq.json
A includes/SpecialNewsletterCreate.php
A includes/SpecialNewsletterManage.php
A sql/newsletter.sql
7 files changed, 262 insertions(+), 42 deletions(-)

Approvals:
  01tonythomas: Looks good to me, approved



diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
old mode 100644
new mode 100755
index 72d02bd..ab4af42
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -1,44 +1,18 @@
 isEmailConfirmed() ) {
-   // 'newsletter-pref-newsletter' is used as opt-in for
-   // users with a confirmed email address
-   $prefs = array(
-   'newsletter-newsletter' => array(
-   'type' => 'toggle',
-   'section' => 'personal/email',
-   'label-message' => 
'newsletter-pref-newsletter'
-   )
-   );
-
-   // Add setting after 'enotifrevealaddr'.
-   $preferences = wfArrayInsertAfter( $preferences, $prefs,
-   $wgEnotifRevealEditorAddress ? 
'enotifrevealaddr' : 'enotifminoredits' );
-   }
+   public static function onLoadExtensionSchemaUpdates( DatabaseUpdater 
$updater ) {
+   $updater->addExtensionTable( 'newsletters', __DIR__ . 
'/sql/newsletter.sql', true );
 
return true;
}
+
 }
diff --git a/Newsletter.php b/Newsletter.php
old mode 100644
new mode 100755
index 9e78daa..29e3189
--- a/Newsletter.php
+++ b/Newsletter.php
@@ -17,7 +17,7 @@
 $wgExtensionCredits[ 'other' ][ ] = array(
'path'   => __FILE__,
'name'   => 'Newsletter',
-   'author' => array( 'Siebrand Mazeland', ),
+   'author' => array( 'Siebrand Mazeland', 'Tina Johnson' ),
'url'=> 
'https://www.mediawiki.org/wiki/Extension:Newsletter',
'descriptionmsg' => 'newsletter-desc',
'version'=> '1.2.0',
@@ -25,6 +25,13 @@
 
 $wgMessagesDirs['Newsletter'] = __DIR__ . '/i18n';
 
-$wgAutoloadClasses['NewsletterPreferences'] = __DIR__ . 
'/Newsletter.hooks.php';
+$wgAutoloadClasses['NewsletterHooks'] = __DIR__ . '/Newsletter.hooks.php';
+$wgAutoloadClasses['SpecialNewsletterCreate'] = __DIR__ . 
'/includes/SpecialNewsletterCreate.php';
+$wgAutoloadClasses['SpecialNewsletterManage'] = __DIR__ . 
'/includes/SpecialNewsletterManage.php';
 
-$wgHooks['GetPreferences'][] = 'NewsletterPreferences::onGetPreferences';
+$wgSpecialPages['NewsletterCreate'] = 'SpecialNewsletterCreate';
+$wgSpecialPages['NewsletterManage'] = 'SpecialNewsletterManage';
+
+//Register Hooks
+$wgHooks['GetPreferences'][] = 'NewsletterHooks::onGetPreferences';
+$wgHooks['LoadExtensionSchemaUpdates'][] = 
'NewsletterHooks::onLoadExtensionSchemaUpdates';
diff --git a/i18n/en.json b/i18n/en.json
old mode 100644
new mode 100755
index 0e54bf2..c0eaba5
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -1,7 +1,12 @@
 {
-"@metadata": {
-"authors": []
-},
-"newsletter-desc": "Adds a preference for users to subscribe to a 
newsletter",
-"newsletter-pref-newsletter": "Send me email newsletters"
+   "@metadata": {
+   "authors": [
+   "Tina Johnson"
+   ]
+   },
+   "newsletter-desc": "Adds a preference for users to subscribe to a 
newsletter",
+   "newslettercreate": "Create newsletters",
+   "newslettermanage": "Manage newsletters",
+   "announceissue-section": "Announce new issue",
+   "createnewsletter-section": "Create newsletter"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
new file mode 100644
index 000..99e6bc5
--- /dev/null
+++ b/i18n/qqq.json
@@ -0,0 +1,12 @@
+{
+   "@metadata": {
+   "authors": [
+   "Tina Johnson"
+   ]
+   },
+   "newsletter-desc": 
"{{desc|name=Newsletter|url=https://www.mediawiki.org/wiki/Extension:Newsletter}}";,
+   "newslettercreate": "Name of special page which creates newsletters as 
seen in URLs and links",
+   "newslettermanage": "Name of special page

[MediaWiki-commits] [Gerrit] Removed PlancakeMailParser library completely from the exten... - change (mediawiki...BounceHandler)

2015-06-03 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed PlancakeMailParser library completely from the extension
..

Removed PlancakeMailParser library completely from the extension

Leftover from I4e932581c02cbb7beecd356853fe7592237b2511

Change-Id: I2108fb72da976b30e38cde0c6392fbd49f2eb2e4
---
M BounceHandler.php
M includes/ProcessBounceEmails.php
D includes/ProcessBounceWithPlancake.php
M tests/ProcessBounceWithRegexTest.php
4 files changed, 2 insertions(+), 87 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/26/215626/1

diff --git a/BounceHandler.php b/BounceHandler.php
index e7b9d39..defb200 100644
--- a/BounceHandler.php
+++ b/BounceHandler.php
@@ -36,7 +36,6 @@
 $wgAutoloadClasses['ProcessBounceEmails'] = $dir. 
'/includes/ProcessBounceEmails.php';
 $wgAutoloadClasses['BounceHandlerActions'] = $dir. 
'/includes/BounceHandlerActions.php';
 $wgAutoloadClasses['ProcessUnRecognizedBounces'] = $dir. 
'/includes/ProcessUnRecognizedBounces.php';
-$wgAutoloadClasses['ProcessBounceWithPlancake'] = $dir. 
'/includes/ProcessBounceWithPlancake.php';
 $wgAutoloadClasses['ProcessBounceWithRegex'] = $dir. 
'/includes/ProcessBounceWithRegex.php';
 $wgAutoloadClasses['VerpAddressGenerator'] = $dir. 
'/includes/VerpAddressGenerator.php';
 $wgAutoloadClasses['PruneOldBounceRecords'] = $dir. 
'/includes/PruneOldBounceRecords.php';
@@ -91,9 +90,4 @@
 $wgBounceHandlerSharedDB = false;
 
 # Maximum time in seconds until which a bounce record should be stored in the 
table
-$wgBounceRecordMaxAge = 5184000; //60 * 24 * 60 *60  ( 60 Days time in seconds 
)
-
-// Local composer install during development
-if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
-   require_once __DIR__ . '/vendor/autoload.php';
-}
\ No newline at end of file
+$wgBounceRecordMaxAge = 5184000; //60 * 24 * 60 *60  ( 60 Days time in seconds 
)
\ No newline at end of file
diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index 84cdc67..46b1de8 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -23,11 +23,7 @@
 * @return ProcessBounceEmails
 */
public static function getProcessor() {
-   if ( !class_exists( 'PlancakeEmailParser' ) ) {
-   $bounceProcessor = new ProcessBounceWithRegex();
-   } else {
-   $bounceProcessor = new ProcessBounceWithPlancake();
-   }
+   $bounceProcessor = new ProcessBounceWithRegex();
return $bounceProcessor;
}
 
diff --git a/includes/ProcessBounceWithPlancake.php 
b/includes/ProcessBounceWithPlancake.php
deleted file mode 100644
index 658b62d..000
--- a/includes/ProcessBounceWithPlancake.php
+++ /dev/null
@@ -1,51 +0,0 @@
-http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
- */
-class ProcessBounceWithPlancake extends ProcessBounceEmails {
-   /**
-* Process bounce email using the Plancake mail parser library
-*
-* @param string $email
-*/
-   public function handleBounce( $email ) {
-   $emailHeaders = $this->extractHeaders( $email );
-   $to = $emailHeaders['to'];
-
-   $processEmail = $this->processEmail( $emailHeaders );
-   if ( !$processEmail ){
-   $this->handleUnrecognizedBounces( $email, $to );
-   }
-   }
-
-   /**
-* Extract headers from the received bounce email using Plancake mail 
parser
-*
-* @param string $email
-* @return array $emailHeaders.
-*/
-   public function extractHeaders( $email ) {
-   $emailHeaders = array();
-   $decoder = new PlancakeEmailParser( $email );
-
-   $emailHeaders['to'] = $decoder->getHeader( 'To' );
-   $emailHeaders['date'] = $decoder->getHeader( 'Date' );
-   $emailHeaders['x-failed-recipients'] = $decoder->getHeader( 
'X-Failed-Recipients' );
-   try {
-   $emailHeaders['subject'] = $decoder->getSubject();
-   } catch( Exception $e ) {
-   wfDebugLog( 'BounceHandler', "Plancake Mail Parser: 
Couldn't parse the bounce email subject
-   header, got exception {$e->getCode()}" );
-   }
-
-   return $emailHeaders;
-   }
-
-}
diff --git a/tests/ProcessBounceWithRegexTest.php 
b/tests/ProcessBounceWithRegexTest.php
index 5ac2a88..1844dc5 100644
--- a/tests/ProcessBounceWithRegexTest.php
+++ b/tests/ProcessBounceWithRegexTest.php
@@ -11,13 +11,6 @@
parent::setUp();
}
 
-   public static function provideBounceEmails() {
-   $email = file_get_contents( __DIR__ .'/bounce_emails/email2' );

[MediaWiki-commits] [Gerrit] Fix SSL/TLS SMTP authentication missing in SwiftMailer - change (mediawiki...SwiftMailer)

2015-05-25 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Fix SSL/TLS SMTP authentication missing in SwiftMailer
..

Fix SSL/TLS SMTP authentication missing in SwiftMailer

This will make the maile work with SMTP configurations requiring
issue of a STARTTLS or SSL command

Bug: T100284
Change-Id: If5ff23ebb444d6ffefccd51c28702491f35a38b1
---
M SwiftMailer.php
M SwiftMailerHooks.php
2 files changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SwiftMailer 
refs/changes/47/213547/1

diff --git a/SwiftMailer.php b/SwiftMailer.php
index d4d218e..dc530fb 100644
--- a/SwiftMailer.php
+++ b/SwiftMailer.php
@@ -37,6 +37,10 @@
'license-name' => "GPL-2.0",
 );
 
+// Used when $wgSMTP['auth'] is set to true
+// Set to 'ssl' or 'tls'. Eg: $wgSMTPAuthenticationMethod = 'tls'
+$wgSMTPAuthenticationMethod = false;
+
 //Hooks files
 $wgAutoloadClasses[ 'SwiftMailerHooks' ] =  __DIR__ . '/SwiftMailerHooks.php';
 
diff --git a/SwiftMailerHooks.php b/SwiftMailerHooks.php
index a99d01d..391ddcd 100644
--- a/SwiftMailerHooks.php
+++ b/SwiftMailerHooks.php
@@ -78,7 +78,7 @@
 * @return SwiftMailer::Transport object 
Swift_MailTransport|Swift_SmtpTransport
 */
protected static function getSwiftMailer() {
-   global $wgSMTP;
+   global $wgSMTP, $wgSMTPAuthenticationMethod;
static $swiftTransport = null;
if ( !$swiftTransport ) {
if ( is_array( $wgSMTP ) ) {
@@ -86,6 +86,9 @@
$swiftTransport = 
Swift_SmtpTransport::newInstance( $wgSMTP['host'], $wgSMTP['port'] )
->setUsername( $wgSMTP['username'] )
->setPassword( $wgSMTP['password'] );
+   if ( $wgSMTP['auth'] === true ) {
+   $swiftTransport->setEncryption( 
$wgSMTPAuthenticationMethod );
+   }
} else {
$swiftTransport = 
Swift_MailTransport::newInstance();
}
@@ -93,4 +96,4 @@
 
return $swiftTransport;
}
-}
\ No newline at end of file
+};
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5ff23ebb444d6ffefccd51c28702491f35a38b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SwiftMailer
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed composer.json to get rid of the Plancake dependancy - change (mediawiki...BounceHandler)

2015-05-25 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed composer.json to get rid of the Plancake dependancy
..

Removed composer.json to get rid of the Plancake dependancy

Change-Id: I4e932581c02cbb7beecd356853fe7592237b2511
---
D composer.json
1 file changed, 0 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/33/213533/1

diff --git a/composer.json b/composer.json
deleted file mode 100644
index 83cb42a..000
--- a/composer.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-"name": "mediawiki/bouncehandler",
-"authors" : [
-{
-"name": "Tony Thomas",
-"email": "01tonytho...@gmail.com",
-"homepage": "http://tttwrites.in";,
-"role": "Developer"
-},
-{
-"name": "Legoktm",
-"email": "lego...@gmail.com"
-},
-{
-"name": "Jeff Green",
-"email": "jgr...@wikimedia.org"
-}
-],
-"homepage" : "https://www.mediawiki.org/wiki/Extension:BounceHandler";,
-"support" : {
-"email": "01tonytho...@gmail.com",
-"issues": "https://bugzilla.wikimedia.org";,
-"irc": "irc://irc.freenode.org/wikimedia-dev",
-"source": 
"https://github.com/wikimedia/mediawiki-extensions-BounceHandler";
-},
-"description": "MediaWiki extension to process emails that bounce using 
VERP",
-"license" : "GPL-2.0+",
-"require":
-{
-"floriansemm/official-library-php-email-parser": "dev-master"
-}
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e932581c02cbb7beecd356853fe7592237b2511
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Trim leading blanks from servernames - change (mediawiki...LdapAuthentication)

2015-04-26 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Trim leading blanks from servernames
..

Trim leading blanks from servernames

Bug: T56968
Change-Id: I15437b21a9e73660defd201ef804762fbb2b8ba3
---
M LdapAuthentication.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LdapAuthentication 
refs/changes/45/206645/1

diff --git a/LdapAuthentication.php b/LdapAuthentication.php
index d9014a3..4b75450 100644
--- a/LdapAuthentication.php
+++ b/LdapAuthentication.php
@@ -598,7 +598,7 @@
$servers = $servers . " " . $serverpre . $tok . ":" . 
$this->getConf( 'Port', $domain );
$tok = strtok( " " );
}
-   $servers = rtrim( $servers );
+   $servers = trim( $servers );
 
$this->printDebug( "Using servers: $servers", SENSITIVE );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15437b21a9e73660defd201ef804762fbb2b8ba3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LdapAuthentication
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix Undefined index: in Collection.body.php - change (mediawiki...Collection)

2015-04-24 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Fix Undefined index:  in Collection.body.php
..

Fix Undefined index:  in Collection.body.php

Bug: T97108
Change-Id: I63d9e19c8f6bd5eaa6c64f8dfc5c547afe51eb4c
---
M Collection.body.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection 
refs/changes/97/206397/1

diff --git a/Collection.body.php b/Collection.body.php
index 37fecf9..2695071 100644
--- a/Collection.body.php
+++ b/Collection.body.php
@@ -768,7 +768,7 @@
$old_items = $collection['items'];
$new_items = array();
foreach ( $items as $new_index => $old_index ) {
-   $new_items[$new_index] = $old_items[$old_index];
+   $new_items[$new_index] = isset( $old_items[$old_index] 
) ? : null;
}
$collection['items'] = $new_items;
CollectionSession::setCollection( $collection );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63d9e19c8f6bd5eaa6c64f8dfc5c547afe51eb4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Made Echo respect $wgEnableEmail = false - change (mediawiki...Echo)

2015-04-18 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Made Echo respect $wgEnableEmail = false
..

Made Echo respect $wgEnableEmail = false

Bug: T96143
Change-Id: I09f7cadb98633e171c23072f7282fecf377cd648
---
M Notifier.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/05/205005/1

diff --git a/Notifier.php b/Notifier.php
index 53c6e74..f0988f6 100644
--- a/Notifier.php
+++ b/Notifier.php
@@ -31,6 +31,11 @@
 * @return bool
 */
public static function notifyWithEmail( $user, $event ) {
+   global $wgEnableEmail;
+
+   if ( !$wgEnableEmail ) {
+   return false;
+   }
// No valid email address or email notification
if ( !$user->isEmailConfirmed() || $user->getOption( 
'echo-email-frequency' ) < 0 ) {
return false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09f7cadb98633e171c23072f7282fecf377cd648
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Unreachable code in Echo hooks - change (mediawiki...Echo)

2015-04-18 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Unreachable code in Echo hooks
..

Unreachable code in Echo hooks

Change-Id: I5a2d219c3daea87705776f76744a8e7753e01fac
---
M Hooks.php
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/97/204997/1

diff --git a/Hooks.php b/Hooks.php
index 6e9334a..4269480 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -195,7 +195,6 @@
}
 
$revision = Revision::newFromId( 
$extraData['revid'] );
-   break;
if ( $revision ) {
$users += 
EchoDiscussionParser::getNotifiedUsersForComment( $revision );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a2d219c3daea87705776f76744a8e7753e01fac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix cassing of interface message abusefilter-topnav-log - change (mediawiki...AbuseFilter)

2015-04-13 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Fix cassing of interface message abusefilter-topnav-log
..

Fix cassing of interface message abusefilter-topnav-log

Bug: T95977
Change-Id: Id5e1572b36fbedfe411fae8dab3670f4e7dcfd9a
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/16/204016/1

diff --git a/i18n/en.json b/i18n/en.json
index 83a8a48..033b7ac 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -377,7 +377,7 @@
"abusefilter-topnav-home": "Home",
"abusefilter-topnav-test": "Batch testing",
"abusefilter-topnav-examine": "Examine past edits",
-   "abusefilter-topnav-log": "Abuse Log",
+   "abusefilter-topnav-log": "Abuse log",
"abusefilter-topnav-tools": "Debugging tools",
"abusefilter-topnav-import": "Import filter",
"abusefilter-log-name": "Abuse Filter log",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5e1572b36fbedfe411fae8dab3670f4e7dcfd9a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Corrected typos in function name unpackMetaData and getMetaData - change (mediawiki/core)

2015-04-12 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Corrected typos in function name unpackMetaData and getMetaData
..

Corrected typos in function name unpackMetaData and getMetaData

Bug: T95873
Change-Id: I71dffaaed24c983ce07bc02f806294337ca086e2
---
M includes/media/SVG.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/203788/1

diff --git a/includes/media/SVG.php b/includes/media/SVG.php
index 8fdfa47..b505280 100644
--- a/includes/media/SVG.php
+++ b/includes/media/SVG.php
@@ -307,9 +307,9 @@
 */
function getImageSize( $file, $path, $metadata = false ) {
if ( $metadata === false ) {
-   $metadata = $file->getMetaData();
+   $metadata = $file->getMetadata();
}
-   $metadata = $this->unpackMetaData( $metadata );
+   $metadata = $this->unpackMetadata( $metadata );
 
if ( isset( $metadata['width'] ) && isset( $metadata['height'] 
) ) {
return array( $metadata['width'], $metadata['height'], 
'SVG',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71dffaaed24c983ce07bc02f806294337ca086e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed unused variable $time from OAuthListConsumers - change (mediawiki...OAuth)

2015-04-07 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed unused variable $time from OAuthListConsumers
..

Removed unused variable $time from OAuthListConsumers

Change-Id: Ie774e508d155fd7f8b6513d2904ce9fd54583455
---
M frontend/specialpages/SpecialMWOAuthListConsumers.php
1 file changed, 1 insertion(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth 
refs/changes/78/202678/1

diff --git a/frontend/specialpages/SpecialMWOAuthListConsumers.php 
b/frontend/specialpages/SpecialMWOAuthListConsumers.php
index 1116695..b1b6232 100644
--- a/frontend/specialpages/SpecialMWOAuthListConsumers.php
+++ b/frontend/specialpages/SpecialMWOAuthListConsumers.php
@@ -256,10 +256,7 @@
);
}
$links = $this->getLanguage()->pipeList( $links );
-
-   $time = $this->getLanguage()->timeanddate(
-   wfTimestamp( TS_MW, $cmr->get( 'registration' ) ), true 
);
-
+   
$encStageKey = htmlspecialchars( $stageKey ); // sanity
$r = "";
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie774e508d155fd7f8b6513d2904ce9fd54583455
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add more tests to variables and remove undefined index issue - change (mediawiki...BounceHandler)

2015-04-03 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Add more tests to variables and remove undefined index issue
..

Add more tests to variables and remove undefined index issue

Bug: T93112
Change-Id: I815c25ad7023239efea7e2e41de0c0bee3e47821
---
M includes/ProcessBounceEmails.php
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/31/201731/1

diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index 9a53b91..4b05628 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -59,7 +59,7 @@
$subject = $emailHeaders['subject'];
 
// Get original failed user email and wiki details
-   $failedUser = $this->getUserDetails( $to );
+   $failedUser = $to ? $this->getUserDetails( $to ) : false;
if ( is_array( $failedUser ) && isset( $failedUser['wikiId'] ) 
&& isset( $failedUser['rawEmail'] )
&& isset( $failedUser[ 'bounceTime' ] )
) {
@@ -101,13 +101,16 @@
global $wgVERPalgorithm, $wgVERPsecret, $wgVERPAcceptTime;
 
$failedUser = array();
+   $hashedData = null;
 
$currentTime = wfTimestamp();
preg_match( '~(.*?)@~', $hashedEmail, $hashedPart );
-   $hashedVERPPart = explode( '-', $hashedPart[1] );
-   $hashedData = $hashedVERPPart[0]. '-'. $hashedVERPPart[1]. '-'. 
$hashedVERPPart[2]. '-'. $hashedVERPPart[3];
+   $hashedVERPPart = $hashedPart[1] ? explode( '-', $hashedPart[1] 
) : false;
+   if ( $hashedVERPPart[0] && $hashedVERPPart[1] && 
$hashedVERPPart[2] && $hashedVERPPart[3] ) {
+   $hashedData = $hashedVERPPart[0]. '-'. 
$hashedVERPPart[1]. '-'. $hashedVERPPart[2]. '-'. $hashedVERPPart[3];
+   }
$bounceTime = base_convert( $hashedVERPPart[3], 36, 10 );
-
+   // Check if the VERP hash is valid
if ( base64_encode( substr( hash_hmac( $wgVERPalgorithm, 
$hashedData, $wgVERPsecret, true ), 0, 12 ) ) === $hashedVERPPart[4]
&& $currentTime - $bounceTime < $wgVERPAcceptTime
) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I815c25ad7023239efea7e2e41de0c0bee3e47821
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Install bouncehandler extension everywhere ( including wikip... - change (operations/mediawiki-config)

2015-03-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Install bouncehandler extension everywhere ( including 
wikipedias )
..

Install bouncehandler extension everywhere ( including wikipedias )

Currently, the extension is installed in the group1 wikis, and running
good as per https://phabricator.wikimedia.org/T48640#1117090

Bug: T92877
Change-Id: Ib45e3724bf6a7bda5e7fcad72aee457d842552fd
---
M wmf-config/InitialiseSettings.php
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/20/198220/1

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 6f0079a..30dc979 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -13558,7 +13558,6 @@
 
 'wmgUseBounceHandler' => array(
'default' => true,
-   'wikipedia' => false,
 ),
 
 'wmgUseTranslate' => array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib45e3724bf6a7bda5e7fcad72aee457d842552fd
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed repititive un-subscribe action on a global user - change (mediawiki...BounceHandler)

2015-03-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed repititive un-subscribe action on a global user
..

Removed repititive un-subscribe action on a global user

Currently the unsubscribe user function unsubscribes the user from
CA, and erroneously does the same considering the user to be local.
CentralAuth unsubscribe should be enough for a global user

Change-Id: I0246634ddc469798cf207519b1a273cb16981319
(cherry picked from commit c09dd342dbd0af90accb02cbde4a5f8822164a24)
---
M includes/BounceHandlerActions.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/78/196878/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index 942cb75..cab659c 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -101,13 +101,14 @@
"Un-subscribed global user 
$originalEmail for exceeding Bounce Limit $this->bounceRecordLimit"
);
}
+   } else {
+   // Handle the local account email status
+   $this->unConfirmUserEmail( $user );
}
-   // Handle the local account email status
-   $this->unConfirmUserEmail( $user );
}
 
/**
-* Perform the un-subscribe email action on a given bounced user
+* Perform the un-subscribe email action on a given bounced local user
 *
 * @param User $user
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0246634ddc469798cf207519b1a273cb16981319
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: wmf/1.25wmf20
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed repititive un-subscribe action on a global user - change (mediawiki...BounceHandler)

2015-03-15 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed repititive un-subscribe action on a global user
..

Removed repititive un-subscribe action on a global user

Currently the unsubscribe user function unsubscribes the user from
CA, and erroneously does the same considering the user to be local.
CentralAuth unsubscribe should be enough for a global user

Change-Id: I0246634ddc469798cf207519b1a273cb16981319
(cherry picked from commit c09dd342dbd0af90accb02cbde4a5f8822164a24)
---
M includes/BounceHandlerActions.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/77/196877/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index 942cb75..cab659c 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -101,13 +101,14 @@
"Un-subscribed global user 
$originalEmail for exceeding Bounce Limit $this->bounceRecordLimit"
);
}
+   } else {
+   // Handle the local account email status
+   $this->unConfirmUserEmail( $user );
}
-   // Handle the local account email status
-   $this->unConfirmUserEmail( $user );
}
 
/**
-* Perform the un-subscribe email action on a given bounced user
+* Perform the un-subscribe email action on a given bounced local user
 *
 * @param User $user
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0246634ddc469798cf207519b1a273cb16981319
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: wmf/1.25wmf21
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed repititive un-subscribe action on a global user - change (mediawiki...BounceHandler)

2015-03-13 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Removed repititive un-subscribe action on a global user
..

Removed repititive un-subscribe action on a global user

Currently the unsubscribe user function unsubscribes the user from
CA, and erroneously does the same considering the user to be local.
CentralAuth unsubscribe should be enough for a global user

Change-Id: I0246634ddc469798cf207519b1a273cb16981319
---
M includes/BounceHandlerActions.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/12/196612/1

diff --git a/includes/BounceHandlerActions.php 
b/includes/BounceHandlerActions.php
index 942cb75..cab659c 100644
--- a/includes/BounceHandlerActions.php
+++ b/includes/BounceHandlerActions.php
@@ -101,13 +101,14 @@
"Un-subscribed global user 
$originalEmail for exceeding Bounce Limit $this->bounceRecordLimit"
);
}
+   } else {
+   // Handle the local account email status
+   $this->unConfirmUserEmail( $user );
}
-   // Handle the local account email status
-   $this->unConfirmUserEmail( $user );
}
 
/**
-* Perform the un-subscribe email action on a given bounced user
+* Perform the un-subscribe email action on a given bounced local user
 *
 * @param User $user
 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0246634ddc469798cf207519b1a273cb16981319
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update 'notification-page-linked-email-subject' message - change (mediawiki...Echo)

2015-03-10 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Update 'notification-page-linked-email-subject' message
..

Update 'notification-page-linked-email-subject' message

Bug: T53996
Change-Id: I79ea30c3f6970df54faa266bc59878f525c7
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/84/195584/1

diff --git a/i18n/en.json b/i18n/en.json
index 9d0b73a..3e23549 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -79,7 +79,7 @@
"notification-edit-talk-page-email-subject2": "$1 {{GENDER:$1|left}} 
you a message on {{SITENAME}}",
"notification-edit-talk-page-email-batch-body2": "$1 {{GENDER:$1|left}} 
a message on your talk page:",
"notification-edit-talk-page-email-batch-body-with-section": "$1 
{{GENDER:$1|left}} a message on your talk page in \"$2\".",
-   "notification-page-linked-email-subject": "Your page was linked on 
{{SITENAME}}",
+   "notification-page-linked-email-subject": "A page you created was 
linked on {{SITENAME}}",
"notification-page-linked-email-batch-body": "$2 was 
{{GENDER:$1|linked}} from $3.",
"notification-reverted-email-subject2": "Your {{PLURAL:$3|edit 
was|edits were}} {{GENDER:$1|reverted}} on {{SITENAME}}",
"notification-reverted-email-batch-body2": "Your {{PLURAL:$3|edit on $2 
has been|edits on $2 have been}} {{GENDER:$1|reverted}} by $1.",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79ea30c3f6970df54faa266bc59878f525c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Added BounceHandler extension to special wikis - change (operations/mediawiki-config)

2015-02-20 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Added BounceHandler extension to special wikis
..

Added BounceHandler extension to special wikis

This would deploy the BounceHandler extension to all special wikis.

Change-Id: Ia52c3caf52e485d3ce2d445c3b6fbdfad41b6ed5
---
M wmf-config/InitialiseSettings.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/37/191937/1

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 67e139c..ab3313c 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -13476,6 +13476,7 @@
 'wmgUseBounceHandler' => array(
'default' => false,
'group0' => true,
+   'special' => true,
 ),
 
 'wmgUseTranslate' => array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia52c3caf52e485d3ce2d445c3b6fbdfad41b6ed5
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Un-subscribe frequently failing recipients - change (operations/mediawiki-config)

2015-02-08 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Un-subscribe frequently failing recipients
..

Un-subscribe frequently failing recipients

Bounce threshold set to 2, to match mailman standards
http://www.esosoft.com/support/mailinglist/mailman/bounce.html

Bug: T48640
Change-Id: I1dfef5406cfb389d4f9a36f5cc41ecfdae940dee
---
M wmf-config/CommonSettings-labs.php
M wmf-config/CommonSettings.php
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/16/189316/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index 204d6e3..16dac47 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -150,7 +150,8 @@
$wgBounceHandlerCluster = false;
$wgBounceHandlerSharedDB = false;
$wgBounceHandlerInternalIPs = array( '127.0.0.1', '::1', '10.68.17.78' 
); //deployment-mx.wmflabs.org
-   $wgBounceHandlerUnconfirmUsers = false;
+   $wgBounceHandlerUnconfirmUsers = true;
+   $wgBounceRecordLimit = 2;
$wgVERPdomainPart = 'beta.wmflabs.org';
 }
 
diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 0eb4dd4..b51155c 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -2187,7 +2187,8 @@
// $wmgVERPsecret is set in PrivateSettings.php
$wgVERPsecret = $wmgVERPsecret;
$wgVERPdomainPart = 'wikimedia.org';
-   $wgBounceHandlerUnconfirmUsers = false;
+   $wgBounceHandlerUnconfirmUsers = true;
+   $wgBounceRecordLimit = 2;
$wgBounceHandlerCluster = 'extension1';
$wgBounceHandlerSharedDB = 'wikishared';
$wgBounceHandlerInternalIPs = array( '208.80.154.90', '208.80.154.89', 
'2620:0:861:3:208:80:154:90', '2620:0:861:3:208:80:154:91', 
'2620:0:861:3:ca1f:66ff:febf:8dd6' ); # polonium and lead

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dfef5406cfb389d4f9a36f5cc41ecfdae940dee
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Revert "Added the Plancake e-mail parser library to MediaWik... - change (mediawiki/vendor)

2015-02-04 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Revert "Added the Plancake e-mail parser library to MediaWiki 
using Composer".
..

Revert "Added the Plancake e-mail parser library to MediaWiki using Composer".

This reverts commit d9daf2bb8fe75944647f84391f145414d5f80b8d.
Cherrypick from I27cafb61ea78a0c5200f47298835c547d3465343 to wmf/1.25wmf15

Change-Id: Ifabebbef089699df7f5dce5a8ad4d2ffe4e8253d
---
D Plancake/EmailParser/LICENSE.txt
D Plancake/EmailParser/PlancakeEmailParser.php
D Plancake/EmailParser/README.txt
D Plancake/EmailParser/composer.json
D Plancake/EmailParser/tests/emails/0.txt
D Plancake/EmailParser/tests/emails/1.txt
D Plancake/EmailParser/tests/emails/2.txt
D Plancake/EmailParser/tests/emails/from_ipad_with_attachment.txt
D Plancake/EmailParser/tests/emails/subject_on_multiple_lines.txt
D Plancake/EmailParser/tests/run_tests.php
M composer.json
M composer.lock
M composer/autoload_classmap.php
13 files changed, 2 insertions(+), 921 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/75/188575/1

diff --git a/Plancake/EmailParser/LICENSE.txt b/Plancake/EmailParser/LICENSE.txt
deleted file mode 100644
index 65c5ca8..000
--- a/Plancake/EmailParser/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
-   GNU LESSER GENERAL PUBLIC LICENSE
-   Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effect

[MediaWiki-commits] [Gerrit] Revert "Added the Plancake e-mail parser library to MediaWik... - change (mediawiki/vendor)

2015-02-04 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Revert "Added the Plancake e-mail parser library to MediaWiki 
using Composer".
..

Revert "Added the Plancake e-mail parser library to MediaWiki using Composer".

This reverts commit d9daf2bb8fe75944647f84391f145414d5f80b8d.
Cherrypick from I27cafb61ea78a0c5200f47298835c547d3465343

Change-Id: Ifabebbef089699df7f5dce5a8ad4d2ffe4e8253d
---
D Plancake/EmailParser/LICENSE.txt
D Plancake/EmailParser/PlancakeEmailParser.php
D Plancake/EmailParser/README.txt
D Plancake/EmailParser/composer.json
D Plancake/EmailParser/tests/emails/0.txt
D Plancake/EmailParser/tests/emails/1.txt
D Plancake/EmailParser/tests/emails/2.txt
D Plancake/EmailParser/tests/emails/from_ipad_with_attachment.txt
D Plancake/EmailParser/tests/emails/subject_on_multiple_lines.txt
D Plancake/EmailParser/tests/run_tests.php
M composer.json
M composer.lock
M composer/autoload_classmap.php
13 files changed, 2 insertions(+), 921 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/72/188572/1

diff --git a/Plancake/EmailParser/LICENSE.txt b/Plancake/EmailParser/LICENSE.txt
deleted file mode 100644
index 65c5ca8..000
--- a/Plancake/EmailParser/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
-   GNU LESSER GENERAL PUBLIC LICENSE
-   Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not rest

[MediaWiki-commits] [Gerrit] Remove leftover from I27cafb61ea78a0c5200f47298835c547d3465343 - change (mediawiki/vendor)

2015-02-04 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Remove leftover from I27cafb61ea78a0c5200f47298835c547d3465343
..

Remove leftover from I27cafb61ea78a0c5200f47298835c547d3465343

Change-Id: I9d0ca303b2a6647677fd12c348ebac6dace77164
---
M composer.json
1 file changed, 0 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/60/188560/1

diff --git a/composer.json b/composer.json
index 2cf0be5..f7efe64 100644
--- a/composer.json
+++ b/composer.json
@@ -3,12 +3,6 @@
"description": "External libraries required or recommened for use with 
MediaWiki",
"type": "managed-library-collection",
"license": "GPL-2.0+",
-   "repositories": [
-   {
-   "type": "vcs",
-   "url": 
"https://github.com/plancake/official-library-php-email-parser";
-   }
-   ],
"require": {
"cssjanus/cssjanus": "1.1.1",
"leafo/lessphp": "0.5.0",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d0ca303b2a6647677fd12c348ebac6dace77164
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vendor
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Minor correction in error logs - change (mediawiki...BounceHandler)

2015-02-03 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Minor correction in error logs
..

Minor correction in error logs

Change-Id: I36cb80e6f48401192f0acfb8bb3ca9e4666d93ca
---
M includes/ProcessBounceEmails.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler 
refs/changes/77/188377/1

diff --git a/includes/ProcessBounceEmails.php b/includes/ProcessBounceEmails.php
index fec7602..2151161 100644
--- a/includes/ProcessBounceEmails.php
+++ b/includes/ProcessBounceEmails.php
@@ -118,7 +118,7 @@
$failedUser['bounceTime'] = wfTimestamp( TS_MW, 
$bounceTime );
} else {
wfDebugLog( 'BounceHandler',
-   "Error: Hash validation failed. Expected hash 
of $hashedData, got $hashedVERPPart[3]."
+   "Error: Hash validation failed. Expected hash 
of $hashedData, got $hashedVERPPart[4]."
);
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36cb80e6f48401192f0acfb8bb3ca9e4666d93ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BounceHandler
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Set $domain part override for emails from beta - change (operations/mediawiki-config)

2015-01-31 Thread 01tonythomas (Code Review)
01tonythomas has uploaded a new change for review.

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

Change subject: Set $domain part override for emails from beta
..

Set $domain part override for emails from beta

This would set a Return-Path from beta have a $domain part as
'beta.wmflabs.org' so that emails do not bounce back to polonium.

Bug: T88204
Change-Id: I30bedb7b1170618a1932a4e61b00956e0dbd8ab6
---
M wmf-config/CommonSettings-labs.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/05/187905/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index 78a8c19..bc5609b 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -151,6 +151,7 @@
$wgBounceHandlerSharedDB = false;
$wgBounceHandlerInternalIPs = array( '127.0.0.1', '::1', '10.68.17.78' 
); //deployment-mx.wmflabs.org
$wgBounceHandlerUnconfirmUsers = false;
+   $wgVERPdomainPart = 'beta.wmflabs.org';
 }
 
 if ( $wmgUseTimedMediaHandler ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30bedb7b1170618a1932a4e61b00956e0dbd8ab6
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: 01tonythomas <01tonytho...@gmail.com>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


  1   2   3   >