[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Stop QuickTemplate from complaining in the debug logs so much

2018-01-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404894 )

Change subject: Stop QuickTemplate from complaining in the debug logs so much
..

Stop QuickTemplate from complaining in the debug logs so much

Bug: T185173
Change-Id: I68625ef2f3403cff202d16c24254e269e263001f
---
M includes/specialpage/LoginSignupSpecialPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/404894/1

diff --git a/includes/specialpage/LoginSignupSpecialPage.php 
b/includes/specialpage/LoginSignupSpecialPage.php
index d6ace0a..ce6d43d 100644
--- a/includes/specialpage/LoginSignupSpecialPage.php
+++ b/includes/specialpage/LoginSignupSpecialPage.php
@@ -735,7 +735,7 @@
 
$titleObj = $this->getPageTitle();
$user = $this->getUser();
-   $template = new FakeAuthTemplate();
+   $template = new FakeAuthTemplate( 
MediaWikiServices::getInstance()->getMainConfig() );
 
// Pre-fill username (if not creating an account, T46775).
if ( $data->mUsername == '' && $this->isSignup() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68625ef2f3403cff202d16c24254e269e263001f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Fix Lockdown deprecation notice

2018-01-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404779 )

Change subject: Fix Lockdown deprecation notice
..

Fix Lockdown deprecation notice

Also address some codesniffer problems

Bug: T185105
Change-Id: I5a66085ad7eb228fa82b2a8d6ea9919f25667864
---
M src/Hooks.php
1 file changed, 37 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/79/404779/1

diff --git a/src/Hooks.php b/src/Hooks.php
index 9b1cb87..dc9dac6 100644
--- a/src/Hooks.php
+++ b/src/Hooks.php
@@ -44,6 +44,33 @@
  */
 class Hooks {
 
+   private static function shouldNotLockdown( Title $title, $action ) {
+   global $wgWhitelistRead;
+
+   // don't impose extra restrictions on UI pages
+   if ( $title->isCssJsSubpage() ) {
+   return true;
+   }
+
+   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
+   // don't impose read restrictions on whitelisted pages
+   if ( in_array( $title->getPrefixedText(), 
$wgWhitelistRead ) ) {
+   return true;
+   }
+   }
+   return false;
+   }
+
+   // Shim to avoid deprecation notice while still being usable on 1.27
+   private static function getGroupLinks( $groups ) {
+   if ( method_exists( 'UserGroupMembership', 'getGroupName' ) ) {
+   $groupLinks = array_map( [ 'UserGroupMembership', 
'getGroupName' ], $groups );
+   } else {
+   $groupLinks = array_map( [ 'User', 'makeGroupLinkWiki' 
], $groups );
+   }
+   return $groupLinks;
+   }
+
/**
 * Fetch an appropriate permission error (or none!)
 *
@@ -56,6 +83,7 @@
 *   error message keys when multiple messages are needed
 * @return bool
 * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/getUserPermissionsErrors
+* @SuppressWarnings(ShortVariable)
 */
public static function onGetUserPermissionsErrors(
Title $title,
@@ -63,20 +91,12 @@
$action,
&$result = null
) {
-   global $wgSpecialPageLockdown, $wgWhitelistRead, $wgLang;
+   global $wgSpecialPageLockdown, $wgLang;
 
$result = null;
 
-   // don't impose extra restrictions on UI pages
-   if ( $title->isCssJsSubpage() ) {
+   if ( self::shouldNotLockdown( $title, $action ) ) {
return true;
-   }
-
-   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
-   // don't impose read restrictions on whitelisted pages
-   if ( in_array( $title->getPrefixedText(), 
$wgWhitelistRead ) ) {
-   return true;
-   }
}
 
$groups = null;
@@ -118,7 +138,7 @@
return true;
} else {
# group is denied - abort
-   $groupLinks = array_map( [ 'User', 'makeGroupLinkWiki' 
], $groups );
+   $groupLinks = self::getGroupLinks( $groups );
 
$result = [
'badaccess-groups',
@@ -142,6 +162,7 @@
 * @param MediaWiki $wiki used to get the parsed action
 * @return bool
 * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/MediaWikiPerformAction
+* @SuppressWarnings(UnusedFormalParameter)
 */
public static function onMediawikiPerformAction(
OutputPage $output,
@@ -173,7 +194,7 @@
if ( $match ) {
return true;
} else {
-   $groupLinks = array_map( [ 'User', 'makeGroupLinkWiki' 
], $groups );
+   $groupLinks = self::getGroupLinks( $groups );
 
$err = [
'badaccess-groups', $wgLang->commaList( 
$groupLinks ),
@@ -195,7 +216,7 @@
$user = RequestContext::getMain()->getUser();
$ugroups = $user->getEffectiveGroups();
 
-   foreach ( $searchableNs as $ns => $name ) {
+   foreach ( array_keys( $searchableNs ) as $ns ) {
if ( !self::namespaceCheck( $ns, $ugroups ) ) {
unset( $searchableNs[$ns] );
}
@@ -208,6 +229,7 @@
 * @param int $ns to check
 * @param string $action to check (default: read)
 * @return null|array of groups
+* @SuppressWarnings(ShortVariable)
 */
protected static function namespaceGroups( $ns, $action = 'read' ) {

[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Merge branch 'master' of https://gerrit.wikimedia.org/r/medi...

2018-01-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404776 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/mediawiki/extensions/Lockdown
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/mediawiki/extensions/Lockdown

Change-Id: I70ae71f1d4d48f7ba5ce9771049a82fd31783a1a
---
M .phpcs.xml
D Lockdown.php
M composer.json
3 files changed, 0 insertions(+), 250 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/76/404776/1

diff --git a/.phpcs.xml b/.phpcs.xml
index 92fad25..b915cf8 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -1,30 +1,7 @@
 
 
-<<< HEAD   (d2e5d5 Use phpcs from composer)
-  
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  
-  .
-  
-  
-===

.


->>> BRANCH (4d3629 build: Updating mediawiki/mediawiki-codesniffer to 
15.0.0)
 
diff --git a/Lockdown.php b/Lockdown.php
deleted file mode 100644
index d57dd60..000
--- a/Lockdown.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<<< HEAD   (d2e5d5 Use phpcs from composer)
- may work in some versions of 
mediawiki. Same with diff, etc.
-*
-* NOTE: you cannot GRANT access to things forbidden by $wgGroupPermissions. 
You can only DENY access
-* granted there.
-*/
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo( "This file is an extension to the MediaWiki software and cannot 
be used standalone.\n" );
-   die( 1 );
-}
-
-$wgExtensionCredits['other'][] = array(
-   'path' => __FILE__,
-   'name' => 'Lockdown',
-   'author' => array(
-   'Daniel Kinzler',
-   'Platonides',
-   '...'
-   ),
-   'url' => 'https://mediawiki.org/wiki/Extension:Lockdown',
-   'descriptionmsg' => 'lockdown-desc',
-   'license-name' => 'GPL-2.0+'
-);
-
-$wgMessagesDirs['Lockdown'] = __DIR__ . '/i18n';
-
-$wgNamespacePermissionLockdown = array();
-$wgSpecialPageLockdown = array();
-$wgActionLockdown = array();
-
-$wgHooks['getUserPermissionsErrors'][] = 'lockdownUserPermissionsErrors';
-$wgHooks['MediaWikiPerformAction'][] = 'lockdownMediawikiPerformAction';
-$wgHooks['SearchableNamespaces'][] = 'lockdownSearchableNamespaces';
-$wgHooks['SearchGetNearMatchComplete'][] = 
'lockdownSearchGetNearMatchComplete';
-
-/**
- * @param Title $title
- * @param User $user
- * @param string $action
- * @param MessageSpecifier|array|string|bool|null $result
- * @return bool
- */
-function lockdownUserPermissionsErrors(
-   Title $title,
-   User $user,
-   $action,
-   &$result = null
-) {
-   global $wgNamespacePermissionLockdown, $wgSpecialPageLockdown, 
$wgWhitelistRead, $wgLang;
-
-   $result = null;
-
-   // don't impose extra restrictions on UI pages
-   if ( $title->isCssJsSubpage() ) {
-   return true;
-   }
-
-   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
-   // don't impose read restrictions on whitelisted pages
-   if ( in_array( $title->getPrefixedText(), $wgWhitelistRead ) ) {
-   return true;
-   }
-   }
-
-   $groups = null;
-   $ns = $title->getNamespace();
-   if ( NS_SPECIAL == $ns ) {
-   foreach ( $wgSpecialPageLockdown as $page => $g ) {
-   if ( !$title->isSpecial( $page ) ) continue;
-   $groups = $g;
-   break;
-   }
-   }
-   else {
-   $groups = @$wgNamespacePermissionLockdown[$ns][$action];
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown['*'][$action];
-   }
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown[$ns]['*'];
-   }
-   }
-
-   if ( $groups === null ) {
-   #no restrictions
-   return true;
-   }
-
-   if ( !$groups ) {
-   #no groups allowed
-
-   $result = array(
-   'badaccess-group0'
-   );
-
-   return false;
-   }
-
-   $ugroups = $user->getEffectiveGroups();
-
-   $match = array_intersect( $ugroups, $groups );
-
-   if ( $match ) {
-   # group is allowed - keep processing
-   $result = null;
-   return true;
-   } else {
-   # group is denied - abort
-   $groupLinks = array_map( array( 'User', 'makeGroupLinkWiki' ), 
$groups );
-
-   $result = array(
-   'badaccess-groups',
-   $wgLang->commaList( $groupLinks ),
-   count( $groups )
-   );
-
-   return false;
-   }
-}
-
-function lockdownMediawikiPerformAction (
-   OutputPage $output,
-   Arti

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make FormatMetadata::flattenArrayReal() work for for an asso...

2018-01-04 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402151 )

Change subject: Make FormatMetadata::flattenArrayReal() work for for an 
associative array
..

Make FormatMetadata::flattenArrayReal() work for for an associative array

Bug: T87572
Change-Id: I19490ebbbdc3613ae2116c6890ca470bb9f332db
---
M includes/media/FormatMetadata.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/402151/1

diff --git a/includes/media/FormatMetadata.php 
b/includes/media/FormatMetadata.php
index b008a22..f683da2 100644
--- a/includes/media/FormatMetadata.php
+++ b/includes/media/FormatMetadata.php
@@ -1047,7 +1047,7 @@
 
if ( !is_array( $vals ) ) {
return $vals; // do nothing if not an array;
-   } elseif ( count( $vals ) === 1 && $type !== 'lang' ) {
+   } elseif ( count( $vals ) === 1 && $type !== 'lang' && isset( 
$vals[0] ) ) {
return $vals[0];
} elseif ( count( $vals ) === 0 ) {
wfDebug( __METHOD__ . " metadata array with 0 
elements!\n" );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19490ebbbdc3613ae2116c6890ca470bb9f332db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...PluggableAuth[master]: Update composer so it is loadable via local VCS

2018-01-01 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401404 )

Change subject: Update composer so it is loadable via local VCS
..

Update composer so it is loadable via local VCS

I would like to use this to register on Packagist,

Change-Id: I6903ae1641c3ac3f12dd3909a7b6106b8cfb9056
---
M composer.json
1 file changed, 29 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PluggableAuth 
refs/changes/04/401404/1

diff --git a/composer.json b/composer.json
index 7d306d5..f9d1f1d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,16 +1,42 @@
 {
+   "name": "mediawiki/pluggable-auth",
+   "license": "MIT",
+   "type": "mediawiki-extension",
+   "homepage": "https://www.mediawiki.org/wiki/Extension:PluggableAuth";,
+   "description": "An authentication framework for MediaWiki",
+   "keywords": [
+   "extension",
+   "wiki",
+   "mediawiki",
+   "authentication"
+   ],
+   "authors": [
+   {
+   "name": "Cindy Cicalese",
+   "email": "cin...@gmail.com",
+   "role": "Contributor"
+   }
+   ],
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"jakub-onderka/php-console-highlighter": "0.3.2",
-   "mediawiki/minus-x": "0.2.1"
+   "mediawiki/minus-x": "0.2.1",
+   "mediawiki/mediawiki-codesniffer": "14.1.0",
+   "phpunit/phpunit": "4.8.36",
+   "phpmd/phpmd": "~2.1"
},
"scripts": {
+   "phpunit": "php $MW_INSTALL_PATH/tests/phpunit/phpunit.php -c 
.phpunit.xml.dist",
+   "phpdbg": "phpdbg -qrr 
$MW_INSTALL_PATH/tests/phpunit/phpunit.php -c .phpunit.xml.dist",
"test": [
"parallel-lint . --exclude vendor --exclude 
node_modules",
-   "minus-x check ."
+   "minus-x check .",
+   "phpmd src text .phpmd.xml || :",
+   "phpcs -p -s"
],
"fix": [
-   "minus-x fix ."
+   "minus-x fix .",
+   "phpcbf"
]
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6903ae1641c3ac3f12dd3909a7b6106b8cfb9056
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PluggableAuth
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Add methods to retrieve log and latest entry

2017-12-27 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400462 )

Change subject: Add methods to retrieve log and latest entry
..

Add methods to retrieve log and latest entry

* Need to cache instead of using multiple db queries
* Add maint script for showing log.

Change-Id: Ife3d4c1544acbd34bff27cadc6de5377ef555f68
---
M ApprovedRevs_body.php
A maintenance/ShowLog.php
2 files changed, 162 insertions(+), 0 deletions(-)


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

diff --git a/ApprovedRevs_body.php b/ApprovedRevs_body.php
index 9d46c68..21f0338 100644
--- a/ApprovedRevs_body.php
+++ b/ApprovedRevs_body.php
@@ -35,6 +35,63 @@
return $revID;
}
 
+/**
+ * Get the person who made the last approval (or un-approval) for this page
+ *
+ * @param Title $title page
+ * @return User
+ */
+public static function getLastApprovalUser( Title $title ) {
+$log = self::getApprovalLog( $title );
+return User::newFromID( $log->current()->user_id );
+}
+
+/**
+ * Get the date of the last entry in the approval log for this page
+ *
+ * @param Title $title page
+ * @return Timestamp
+ */
+public static function getLastApprovalDate( Title $title ) {
+$log = self::getApprovalLog( $title );
+return new MWTimestamp( $log->current()->log_timestamp );
+}
+
+/**
+ * Get the status of the last entry in the approval log for this page
+ *
+ * @param Title $title page
+ * @return Timestamp
+ */
+public static function getLastApprovalStatus( Title $title ) {
+$log = self::getApprovalLog( $title );
+return $log->current()->log_action;
+}
+
+/**
+ * Get the approval log for this page
+ *
+ * @param Title $title page
+ * @return array of elements where [ 'ts' => timestamp, 'user' => user id ]
+ */
+public static function getApprovalLog( Title $title ) {
+$dbr = wfGetDB( DB_SLAVE );
+$query = DatabaseLogEntry::getSelectQueryData();
+
+$query['conds'] = [
+'log_type' => 'approval',
+'log_title' => $title->getDBKey()
+];
+$query['options'] = [ 'ORDER BY' => 'log_timestamp desc' ];
+
+$res = $dbr->select(
+$query['tables'], $query['fields'], $query['conds'],
+__METHOD__, $query['options'], $query['join_conds']
+);
+
+return $res;
+}
+
/**
 * Returns whether or not this page has a revision ID.
 */
diff --git a/maintenance/ShowLog.php b/maintenance/ShowLog.php
new file mode 100644
index 000..75fbd78
--- /dev/null
+++ b/maintenance/ShowLog.php
@@ -0,0 +1,105 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @author Jeroen De Dauw
+ * @author Yaron Koren
+ * @ingroup Maintenance
+ */
+
+// Allow people to have different layouts.
+if ( ! isset( $IP ) ) {
+   $IP = getenv( "MW_INSTALL_PATH" )
+   ? getenv( "MW_INSTALL_PATH" )
+   : __DIR__ . '/../../../';
+}
+if ( !is_readable( "$IP/maintenance/Maintenance.php" ) ) {
+   die( "Please set MW_INSTALL_PATH to the MediaWiki installation." );
+}
+require_once "$IP/maintenance/Maintenance.php";
+
+class ShowLog extends Maintenance {
+
+   public function __construct() {
+   parent::__construct();
+
+   $this->mDescription = "Show the approval log for a page.";
+   $this->addOption( "title", "Target page.", true, true, "t" );
+   }
+
+   /**
+* Where the magic happens.
+*/
+   public function execute() {
+   $this->title = Title::newFromText( $this->getOption( "title" ) 
);
+   if ( !$this->title->exists() ) {
+   $this->error( "Title does not exist!", 1 );
+   }
+
+   $log = ApprovedRevs::getApprovalLog( $this->title );
+   if ( $log->numRows() === 0 ) {
+   $this->error(
+   "No entries in the approval log for 
[[$this->title]].", 1
+   );
+   }
+
+   $this->printHeader();
+   foreach ( $log as $row ) {
+   $this->print( $row );
+   }
+   }
+
+   protected function printHeader() {
+   $this->output(
+   "Most Recently by: "
+   . ApprovedRevs::getLastApprovalUser( $this->title )
+   . "\n"
+   );
+   $this->output(
+   "Most Recently on: "
+   . ApprovedRevs::getLastApprovalDate( $this->title )
+   . "\n"
+   );
+   $this->output(
+   "Most Recently set to: "
+   . ApprovedRevs::g

[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceNamespaceManager[master]: Add dependency and loader for BSFoundation

2017-12-22 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399970 )

Change subject: Add dependency and loader for BSFoundation
..

Add dependency and loader for BSFoundation

Seems like composer.json and/or extension.json should make this un-necessary.

Change-Id: I8ecbcda6cc0ba177a1eda724ad77a6efbf916f8f
---
M NamespaceManager.class.php
M composer.json
M extension.json
3 files changed, 10 insertions(+), 1 deletion(-)


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

diff --git a/NamespaceManager.class.php b/NamespaceManager.class.php
index c6d4c3c..b1aca33 100644
--- a/NamespaceManager.class.php
+++ b/NamespaceManager.class.php
@@ -86,6 +86,9 @@
 */
public static function onRegistration() {
global $bsgConfigFiles;
+   if ( !class_exists( "BsExtensionMW" ) ) {
+   wfLoadExtension( "BlueSpiceFoundation" );
+   }
$bsgConfigFiles['NamespaceManager']
= BSCONFIGDIR . DS . 'nm-settings.php';
}
diff --git a/composer.json b/composer.json
index 938247c..cdf6b90 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,8 @@
"description": "BlueSpiceNamespaceManager Administration interface for 
adding, editing and deleting namespaces",
"license": "GPL-3.0",
"require": {
-   "composer/installers": "~1.0"
+   "composer/installers": "~1.0",
+   "hallowelt/blue-spice-foundation": "~2.0"
},
"autoload": {
"psr-4": {
diff --git a/extension.json b/extension.json
index c399168..c6122ba 100644
--- a/extension.json
+++ b/extension.json
@@ -8,6 +8,11 @@
"Stefan Widmann",
"Robert Vogel"
],
+   "require": {
+   "extensions": {
+   "BlueSpiceFoundation": "*"
+   }
+   },
"descriptionmsg": "bs-namespacemanager-desc",
"type": "bluespice",
"attributes": {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ecbcda6cc0ba177a1eda724ad77a6efbf916f8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceNamespaceManager
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Use Namespace

2017-12-20 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399544 )

Change subject: Use Namespace
..

Use Namespace

* Elminate final phpcs warnings
* Use namespace instead of global functions
* Break up NS checking into reusable code
* Credit self

Change-Id: Ief7034bc7b308e3250b4a3241d9bacbc9f49c595
---
M .phpcs.xml
M Lockdown.php
2 files changed, 212 insertions(+), 196 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/44/399544/1

diff --git a/.phpcs.xml b/.phpcs.xml
index 634226c..9292826 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -1,9 +1,6 @@
 
 
-  
-
-
-  
+  
   .
   
   
diff --git a/Lockdown.php b/Lockdown.php
index 871a667..1e2bcde 100644
--- a/Lockdown.php
+++ b/Lockdown.php
@@ -7,7 +7,9 @@
  * @file
  * @ingroup Extensions
  * @author Daniel Kinzler, brightbyte.de
- * @copyright © 2007 Daniel Kinzler
+ * @author Mark A. Hershberger, NicheWork, LLC
+ * @copyright © 2007, 2016 Daniel Kinzler
+ * @copyright © 2017 NicheWork, LLC
  * @license GNU General Public Licence 2.0 or later
  */
 
@@ -22,6 +24,7 @@
'name' => 'Lockdown',
'author' => [
'Daniel Kinzler',
+   'Mark A. Hershberger',
'Platonides',
'...'
],
@@ -36,217 +39,233 @@
 $wgSpecialPageLockdown = [];
 $wgActionLockdown = [];
 
-$wgHooks['getUserPermissionsErrors'][] = 'lockdownUserPermissionsErrors';
-$wgHooks['MediaWikiPerformAction'][] = 'lockdownMediawikiPerformAction';
-$wgHooks['SearchableNamespaces'][] = 'lockdownSearchableNamespaces';
-$wgHooks['SearchGetNearMatchComplete'][] = 
'lockdownSearchGetNearMatchComplete';
+$wgHooks['getUserPermissionsErrors'][] = 
'Lockdown::onGetUserPermissionsErrors';
+$wgHooks['MediaWikiPerformAction'][] = 'Lockdown::onMediawikiPerformAction';
+$wgHooks['SearchableNamespaces'][] = 'Lockdown::onSearchableNamespaces';
+$wgHooks['SearchGetNearMatchComplete'][]
+   = 'Lockdown::onSearchGetNearMatchComplete';
 
-/**
- * Return an error if the user is locked out of this namespace.
- *
- * @param Title $title that is being requested
- * @param User $user who is requesting
- * @param string $action they are performing
- * @param MessageSpecifier|array|string|bool|null &$result response
- * @return bool
- * @see https://www.mediawiki.org/wiki/Manual:Hooks/getUserPermissionsErrors
- */
-function lockdownUserPermissionsErrors(
-   Title $title,
-   User $user,
-   $action,
-   &$result = null
-) {
-   global $wgNamespacePermissionLockdown, $wgSpecialPageLockdown,
-   $wgWhitelistRead, $wgLang;
+class Lockdown {
 
-   $result = null;
+   /**
+* Fetch an appropriate permission error (or none!)
+*
+* @param Title $title being checked
+* @param User $user whose access is being checked
+* @param string $action being checked
+* @param MessageSpecifier|array|string|bool|null &$result User
+*   permissions error to add. If none, return true. $result can be
+*   returned as a single error message key (string), or an array of
+*   error message keys when multiple messages are needed
+* @return bool
+* @see 
https://www.mediawiki.org/wiki/Manual:Hooks/getUserPermissionsErrors
+*/
+   public static function onGetUserPermissionsErrors(
+   Title $title,
+   User $user,
+   $action,
+   &$result = null
+   ) {
+   global $wgSpecialPageLockdown, $wgWhitelistRead, $wgLang;
 
-   // don't impose extra restrictions on UI pages
-   if ( $title->isCssJsSubpage() ) {
-   return true;
-   }
+   $result = null;
 
-   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
-   // don't impose read restrictions on whitelisted pages
-   if ( in_array( $title->getPrefixedText(), $wgWhitelistRead ) ) {
+   // don't impose extra restrictions on UI pages
+   if ( $title->isCssJsSubpage() ) {
return true;
}
-   }
 
-   $groups = null;
-   $ns = $title->getNamespace();
-   if ( NS_SPECIAL == $ns ) {
-   foreach ( $wgSpecialPageLockdown as $page => $g ) {
-   if ( !$title->isSpecial( $page ) ) {
-   continue;
+   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
+   // don't impose read restrictions on whitelisted pages
+   if ( in_array( $title->getPrefixedText(), 
$wgWhitelistRead ) ) {
+   return true;
}
-   $groups = $g;
-   break;
}
-   } else {
-   $groups = @$wgNamespacePermissionLockdown[$ns][$action];
+
+  

[MediaWiki-commits] [Gerrit] mediawiki...codesniffer[master]: Bump version req so phpcs:disable can be used

2017-12-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399321 )

Change subject: Bump version req so phpcs:disable can be used
..

Bump version req so phpcs:disable can be used

Change-Id: I82c805222f42cd6511f0481c3cbfcead5cb45bb4
---
M composer.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer 
refs/changes/21/399321/1

diff --git a/composer.json b/composer.json
index 13ee388..c62f6d7 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
"license": "GPL-2.0+",
"require": {
"php": ">= 5.5.9",
-   "squizlabs/php_codesniffer": "3.2.1"
+   "squizlabs/php_codesniffer": "~3.2"
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82c805222f42cd6511f0481c3cbfcead5cb45bb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Use phpcs from composer

2017-12-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399315 )

Change subject: Use phpcs from composer
..

Use phpcs from composer

Change-Id: I1a030cb530847db05f47298b3be4c1f9474d3857
---
A .phpcs.xml
M composer.json
2 files changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/15/399315/1

diff --git a/.phpcs.xml b/.phpcs.xml
new file mode 100644
index 000..d30e856
--- /dev/null
+++ b/.phpcs.xml
@@ -0,0 +1,8 @@
+
+
+  
+  .
+  
+  
+  
+
diff --git a/composer.json b/composer.json
index 7d306d5..a094fa5 100644
--- a/composer.json
+++ b/composer.json
@@ -2,15 +2,18 @@
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"jakub-onderka/php-console-highlighter": "0.3.2",
-   "mediawiki/minus-x": "0.2.1"
+   "mediawiki/minus-x": "0.2.1",
+   "mediawiki/mediawiki-codesniffer": "14.1.0"
},
"scripts": {
"test": [
"parallel-lint . --exclude vendor --exclude 
node_modules",
-   "minus-x check ."
+   "minus-x check .",
+   "phpcs -p -s"
],
"fix": [
-   "minus-x fix ."
+   "minus-x fix .",
+   "phpcbf"
]
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a030cb530847db05f47298b3be4c1f9474d3857
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Lockdown
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ReplaceText[master]: Re-order files to keep the top level clean

2017-12-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398619 )

Change subject: Re-order files to keep the top level clean
..

Re-order files to keep the top level clean

Change-Id: I981f43ac397ac6f79df093abb94ab77ba4100a6c
---
M extension.json
R maintenance/ReplaceAll.php
R modules/ReplaceText.css
R modules/ReplaceText.js
R modules/ReplaceTextSearch.js
R src/Hook.php
R src/Job.php
R src/Search.php
R src/SpecialPage.php
R src/i18n/Alias.php
10 files changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ReplaceText 
refs/changes/19/398619/1

diff --git a/extension.json b/extension.json
index a4f4ccf..56f0c4b 100644
--- a/extension.json
+++ b/extension.json
@@ -31,13 +31,13 @@
]
},
"ExtensionMessagesFiles": {
-   "ReplaceTextAlias": "ReplaceText.alias.php"
+   "ReplaceTextAlias": "src/i18n/Alias.php"
},
"AutoloadClasses": {
-   "MediaWiki\\Extension\\ReplaceText\\Hook": 
"ReplaceText.hooks.php",
-   "MediaWiki\\Extension\\ReplaceText\\SpecialPage": 
"SpecialReplaceText.php",
-   "MediaWiki\\Extension\\ReplaceText\\Job": "ReplaceTextJob.php",
-   "MediaWiki\\Extension\\ReplaceText\\Search": 
"ReplaceTextSearch.php"
+   "MediaWiki\\Extension\\ReplaceText\\Hook": "src/Hook.php",
+   "MediaWiki\\Extension\\ReplaceText\\SpecialPage": 
"src/SpecialPage.php",
+   "MediaWiki\\Extension\\ReplaceText\\Job": "src/Job.php",
+   "MediaWiki\\Extension\\ReplaceText\\Search": "src/Search.php"
},
"Hooks": {
"AdminLinks": [
@@ -70,8 +70,8 @@
}
},
"ResourceFileModulePaths": {
-   "localBasePath": "",
-   "remoteExtPath": "ReplaceText"
+   "localBasePath": "modules",
+   "remoteExtPath": "ReplaceText/modules"
},
"manifest_version": 1
 }
diff --git a/replaceAll.php b/maintenance/ReplaceAll.php
similarity index 99%
rename from replaceAll.php
rename to maintenance/ReplaceAll.php
index a93c52a..6254323 100755
--- a/replaceAll.php
+++ b/maintenance/ReplaceAll.php
@@ -32,7 +32,7 @@
  *
  */
 
-namespace MediaWiki\\Extension\\ReplaceText;
+namespace MediaWiki\Extension\ReplaceText;
 
 use Maintenance;
 use MWException;
diff --git a/ReplaceText.css b/modules/ReplaceText.css
similarity index 100%
rename from ReplaceText.css
rename to modules/ReplaceText.css
diff --git a/ReplaceText.js b/modules/ReplaceText.js
similarity index 100%
rename from ReplaceText.js
rename to modules/ReplaceText.js
diff --git a/ReplaceTextSearch.js b/modules/ReplaceTextSearch.js
similarity index 100%
rename from ReplaceTextSearch.js
rename to modules/ReplaceTextSearch.js
diff --git a/ReplaceText.hooks.php b/src/Hook.php
similarity index 95%
rename from ReplaceText.hooks.php
rename to src/Hook.php
index 636cb1c..8832c38 100644
--- a/ReplaceText.hooks.php
+++ b/src/Hook.php
@@ -20,7 +20,7 @@
  * 02110-1301, USA.
  */
 
-namespace MediaWiki\\Extension\\ReplaceText;
+namespace MediaWiki\Extension\ReplaceText;
 
 use ALTree;
 use ALRow;
diff --git a/ReplaceTextJob.php b/src/Job.php
similarity index 98%
rename from ReplaceTextJob.php
rename to src/Job.php
index 090d2a5..9ce5c30 100644
--- a/ReplaceTextJob.php
+++ b/src/Job.php
@@ -25,7 +25,7 @@
  * @author Ankit Garg
  */
 
-namespace MediaWiki\\Extension\\ReplaceText;
+namespace MediaWiki\Extension\ReplaceText;
 
 use Title;
 use User;
diff --git a/ReplaceTextSearch.php b/src/Search.php
similarity index 97%
rename from ReplaceTextSearch.php
rename to src/Search.php
index 74657e0..2354e2b 100644
--- a/ReplaceTextSearch.php
+++ b/src/Search.php
@@ -23,7 +23,7 @@
  * @author Mark A. Hershberger 
  */
 
-namespace MediaWiki\\Extension\\ReplaceText;
+namespace MediaWiki\Extension\ReplaceText;
 
 use DatabasePostgres;
 use Title;
diff --git a/SpecialReplaceText.php b/src/SpecialPage.php
similarity index 98%
rename from SpecialReplaceText.php
rename to src/SpecialPage.php
index 83e8445..f98fe78 100644
--- a/SpecialReplaceText.php
+++ b/src/SpecialPage.php
@@ -25,7 +25,7 @@
  * @author Mark A. Hershberger 
  */
 
-namespace MediaWiki\\Extension\\ReplaceText;
+namespace MediaWiki\Extension\ReplaceText;
 
 use Html;
 use JobQueueGroup;
diff --git a/ReplaceText.alias.php b/src/i18n/Alias.php
similarity index 100%
rename from ReplaceText.alias.php
rename to src/i18n/Alias.php

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I981f43ac397ac6f79df093abb94ab77ba4100a6c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ReplaceText
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

___
MediaWiki-commits mailing list
M

[MediaWiki-commits] [Gerrit] mediawiki...ReplaceText[master]: Refactor and bump version to 1.3

2017-12-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398618 )

Change subject: Refactor and bump version to 1.3
..

Refactor and bump version to 1.3

* Address any phpcs issues.
* Put everything in MediaWiki\Extension\ReplaceText namespace.
* Break up big functions into smaller bite-size pieces.
* Create and use modules for CSS and JS.
* Assign my copyright to NicheWork LLC

Change-Id: I251188efa2fc1fbf0563b0e1f792a912d077d8c9
---
M README
A ReplaceText.css
M ReplaceText.hooks.php
M ReplaceText.js
M ReplaceText.php
M ReplaceTextJob.php
A ReplaceTextSearch.js
M ReplaceTextSearch.php
M SpecialReplaceText.php
M extension.json
M replaceAll.php
11 files changed, 1,141 insertions(+), 468 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ReplaceText 
refs/changes/18/398618/1

diff --git a/README b/README
index 1e0859b..95bdc72 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 Replace Text Extension
 
-Version 1.2
+Version 1.3
 Yaron Koren and Niklas Laxström
 
 This is free software licenced under the GNU General Public Licence. Please
diff --git a/ReplaceText.css b/ReplaceText.css
new file mode 100644
index 000..2b65254
--- /dev/null
+++ b/ReplaceText.css
@@ -0,0 +1,4 @@
+.rt-searchmatch {
+font-weight: bold;
+font-size: 1.4em;
+}
diff --git a/ReplaceText.hooks.php b/ReplaceText.hooks.php
index 4edf513..636cb1c 100644
--- a/ReplaceText.hooks.php
+++ b/ReplaceText.hooks.php
@@ -1,11 +1,40 @@
 getSection( wfMessage( 
'adminlinks_general' )->text() );
+use ALTree;
+use ALRow;
+
+class Hook {
+
+   /**
+* Hook for AdminLinks to include ReplaceText
+* @param ALTree $adminLinksTree the tree
+*/
+   public static function addToAdminLinks( ALTree $adminLinksTree ) {
+   $generalSection = $adminLinksTree->getSection(
+   wfMessage( 'adminlinks_general' )->text()
+   );
$extensionsRow = $generalSection->getRow( 'extensions' );
 
if ( is_null( $extensionsRow ) ) {
@@ -14,8 +43,6 @@
}
 
$extensionsRow->addItem( ALItem::newFromSpecialPage( 
'ReplaceText' ) );
-
-   return true;
}
 
 }
diff --git a/ReplaceText.js b/ReplaceText.js
index 666c462..9efc327 100644
--- a/ReplaceText.js
+++ b/ReplaceText.js
@@ -1,17 +1,27 @@
-function invertSelections() {
-   'use strict';
+/* @license GPL 2.0 */
+/* @author Yaron Koren */
+( function ( mw, $ ) {
+   $( function () {
+   invertSelections = function() {
+   'use strict';
 
-   var form = document.getElementById('choose_pages' ),
-   num_elements = form.elements.length,
-   i,
-   cur_element;
+   var form = document.getElementById( 'choose_pages' ),
+   num_elements = form.elements.length,
+   i,
+   cur_element;
 
-   for (i = 0; i < num_elements; i++) {
-   cur_element = form.elements[i];
+   for ( i = 0; i < num_elements; i++ ) {
+   cur_element = form.elements[i];
 
-   if (cur_element.type === "checkbox" && cur_element.id !== 
'create-redirect' &&
-   cur_element.id !== 'watch-pages' && cur_element.id !== 
'doEnotif' ) {
-   form.elements[i].checked = form.elements[i].checked !== 
true;
-   }
-   }
-}
+   if (
+   cur_element.type === "checkbox" &&
+   cur_element.id !== 
'create-redirect' &&
+   cur_element.id !== 
'watch-pages' &&
+   cur_element.id !== 'doEnotif'
+   ) {
+   form.elements[i].checked = 
form.elements[i].checked !== true;
+   }
+   }
+   };
+   } );
+}( mediaWiki, jQuery ) );
diff --git a/ReplaceText.php b/ReplaceText.php
index 81c592a..62b12a3 100644
--- a/ReplaceText.php
+++ b/ReplaceText.php
@@ -34,14 +34,14 @@
die();
 }
 
-define( 'REPLACE_TEXT_VERSION', '1.2' );
+define( 'REPLACE_TEXT_VERSION', '1.3' );
 
 // credits
 $wgExtensionCredits['specialpage'][] = [
'path' => __FILE__,
'name' => 'Replace Text',
'version' => REPLACE_TEXT_VERSION,
-   'author' => [ 'Yaron Koren', 'Niklas Laxström', '...' ],
+   'author' => [ 'Yaron Koren', 'Niklas Laxström', '[https://hexmode.com/ 
Mark A. Hershberger]', '...' ],
'url' => 'https://www.mediawiki.org/wiki/Extension:Replace_Text',
'descriptionmsg' => 'replacetext-desc',
'license-name' => 'GPL-2.0+'
@@ -49,19 +49,19 @@
 
 $wgMess

[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Update to extension.json

2017-12-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398525 )

Change subject: Update to extension.json
..

Update to extension.json

* Add conventional GPL header
* Remove block comment that is duplicated in README.
* Use MediaWiki\Extensions… namespace

Change-Id: Ied913791c53da80841e50df670bd6c93184772bd
---
A extension.json
R src/Hook.php
2 files changed, 58 insertions(+), 56 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/25/398525/1

diff --git a/extension.json b/extension.json
new file mode 100644
index 000..6fa24f1
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,36 @@
+{
+   "name": "Lockdown",
+   "author": [
+   "Daniel Kinzler",
+   "Platonides",
+   "Mark A. Hershberger",
+   "..."
+   ],
+   "url": "https://mediawiki.org/wiki/Extension:Lockdown";,
+   "descriptionmsg": "lockdown-desc",
+   "license-name": "GPL-2.0+",
+   "type": "other",
+   "MessagesDirs": {
+   "Lockdown": [
+   "i18n"
+   ]
+   },
+   "Hooks": {
+   "getUserPermissionsErrors": 
"MediaWiki\\Extensions\\Lockdown\\Hook::onGetUserPermissionsErrors",
+   "MediaWikiPerformAction": 
"MediaWiki\\Extensions\\Lockdown\\Hook::onMediawikiPerformAction",
+   "SearchableNamespaces": 
"MediaWiki\\Extensions\\Lockdown\\Hook::onSearchableNamespaces",
+   "SearchGetNearMatchComplete": 
"MediaWiki\\Extensions\\Lockdown\\Hook::onSearchGetNearMatchComplete"
+   },
+   "config": {
+   "NamespacePermissionLockdown": {
+   "value": []
+   },
+   "SpecialPageLockdown": {
+   "value": []
+   },
+   "ActionLockdown": {
+   "value": []
+   }
+   },
+   "manifest_version": 2
+}
diff --git a/Lockdown.php b/src/Hook.php
similarity index 74%
rename from Lockdown.php
rename to src/Hook.php
index 1db1a2a..397f3d3 100644
--- a/Lockdown.php
+++ b/src/Hook.php
@@ -1,72 +1,38 @@
 
  * @license GNU General Public Licence 2.0 or later
  */
+namespace MediaWiki\Extensions\Lockdown;
 
 /**
- * WARNING: you can use this extension to deny read access to some
- * namespaces. Keep in mind that this may be circumvented in several
- * ways. This extension doesn't try to plug such holes. Also note that
- * pages that are not readable will still be shown in listings, such as
- * the search page, categories, etc.
- *
- * Known ways to access "hidden" pages:
- * - transcluding as template. can be avoided using $wgNonincludableNamespaces.
- *
- * - Some search messages may reveal the page existance by producing
- *   links to it (MediaWiki:searchsubtitle, MediaWiki:noexactmatch,
- *   MediaWiki:searchmenu-exists, MediaWiki:searchmenu-new...).
- *
- * - supplying oldid= may work in some
- *   versions of mediawiki. Same with diff, etc.
- *
- * NOTE: you cannot GRANT access to things forbidden by
- * $wgGroupPermissions. You can only DENY access granted there.
+ * Holds the hooks for the Lockdown extension.
  */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo( "This file is an extension to the MediaWiki software and cannot "
- . "be used standalone.\n" );
-   die( 1 );
-}
-
-$wgExtensionCredits['other'][] = [
-   'path' => __FILE__,
-   'name' => 'Lockdown',
-   'author' => [
-   'Daniel Kinzler',
-   'Mark A. Hershberger',
-   'Platonides',
-   '...'
-   ],
-   'url' => 'https://mediawiki.org/wiki/Extension:Lockdown',
-   'descriptionmsg' => 'lockdown-desc',
-   'license-name' => 'GPL-2.0+'
-];
-
-$wgMessagesDirs['Lockdown'] = __DIR__ . '/i18n';
-
-$wgNamespacePermissionLockdown = [];
-$wgSpecialPageLockdown = [];
-$wgActionLockdown = [];
-
-$wgHooks['getUserPermissionsErrors'][] = 
'Lockdown::onGetUserPermissionsErrors';
-$wgHooks['MediaWikiPerformAction'][] = 'Lockdown::onMediawikiPerformAction';
-$wgHooks['SearchableNamespaces'][] = 'Lockdown::onSearchableNamespaces';
-$wgHooks['SearchGetNearMatchComplete'][]
-   = 'Lockdown::onSearchGetNearMatchComplete';
-
-class Lockdown {
+class Hook {
 
/**
 * Fetch an appropriate permission error (or none!)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied913791c53da80841e50df670bd6c93184772bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Lockdown
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Clean up formatting, bring code up to modernish standards

2017-12-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398520 )

Change subject: Clean up formatting, bring code up to modernish standards
..

Clean up formatting, bring code up to modernish standards

* Take functions out of the global context.
* Newish array notation.
* Documentation for every function.
* Line length.
* Consolidate checking of $wgNamespacePermissionLockdown.

Change-Id: I319a09a2dad1178ea3470949e4928e9a665cc8c6
---
M Lockdown.php
1 file changed, 230 insertions(+), 170 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/20/398520/1

diff --git a/Lockdown.php b/Lockdown.php
index 9ba1af0..1db1a2a 100644
--- a/Lockdown.php
+++ b/Lockdown.php
@@ -1,220 +1,280 @@
  may work in some versions of 
mediawiki. Same with diff, etc.
-*
-* NOTE: you cannot GRANT access to things forbidden by $wgGroupPermissions. 
You can only DENY access
-* granted there.
-*/
+/**
+ * WARNING: you can use this extension to deny read access to some
+ * namespaces. Keep in mind that this may be circumvented in several
+ * ways. This extension doesn't try to plug such holes. Also note that
+ * pages that are not readable will still be shown in listings, such as
+ * the search page, categories, etc.
+ *
+ * Known ways to access "hidden" pages:
+ * - transcluding as template. can be avoided using $wgNonincludableNamespaces.
+ *
+ * - Some search messages may reveal the page existance by producing
+ *   links to it (MediaWiki:searchsubtitle, MediaWiki:noexactmatch,
+ *   MediaWiki:searchmenu-exists, MediaWiki:searchmenu-new...).
+ *
+ * - supplying oldid= may work in some
+ *   versions of mediawiki. Same with diff, etc.
+ *
+ * NOTE: you cannot GRANT access to things forbidden by
+ * $wgGroupPermissions. You can only DENY access granted there.
+ */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
-   echo( "This file is an extension to the MediaWiki software and cannot 
be used standalone.\n" );
+   echo( "This file is an extension to the MediaWiki software and cannot "
+ . "be used standalone.\n" );
die( 1 );
 }
 
-$wgExtensionCredits['other'][] = array(
+$wgExtensionCredits['other'][] = [
'path' => __FILE__,
'name' => 'Lockdown',
-   'author' => array(
+   'author' => [
'Daniel Kinzler',
+   'Mark A. Hershberger',
'Platonides',
'...'
-   ),
+   ],
'url' => 'https://mediawiki.org/wiki/Extension:Lockdown',
'descriptionmsg' => 'lockdown-desc',
'license-name' => 'GPL-2.0+'
-);
+];
 
 $wgMessagesDirs['Lockdown'] = __DIR__ . '/i18n';
 
-$wgNamespacePermissionLockdown = array();
-$wgSpecialPageLockdown = array();
-$wgActionLockdown = array();
+$wgNamespacePermissionLockdown = [];
+$wgSpecialPageLockdown = [];
+$wgActionLockdown = [];
 
-$wgHooks['getUserPermissionsErrors'][] = 'lockdownUserPermissionsErrors';
-$wgHooks['MediaWikiPerformAction'][] = 'lockdownMediawikiPerformAction';
-$wgHooks['SearchableNamespaces'][] = 'lockdownSearchableNamespaces';
-$wgHooks['SearchGetNearMatchComplete'][] = 
'lockdownSearchGetNearMatchComplete';
+$wgHooks['getUserPermissionsErrors'][] = 
'Lockdown::onGetUserPermissionsErrors';
+$wgHooks['MediaWikiPerformAction'][] = 'Lockdown::onMediawikiPerformAction';
+$wgHooks['SearchableNamespaces'][] = 'Lockdown::onSearchableNamespaces';
+$wgHooks['SearchGetNearMatchComplete'][]
+   = 'Lockdown::onSearchGetNearMatchComplete';
 
-/**
- * @param Title $title
- * @param User $user
- * @param string $action
- * @param MessageSpecifier|array|string|bool|null $result
- * @return bool
- */
-function lockdownUserPermissionsErrors(
-   Title $title,
-   User $user,
-   $action,
-   &$result = null
-) {
-   global $wgNamespacePermissionLockdown, $wgSpecialPageLockdown, 
$wgWhitelistRead, $wgLang;
+class Lockdown {
 
-   $result = null;
+   /**
+* Fetch an appropriate permission error (or none!)
+*
+* @param Title $title being checked
+* @param User $user whose access is being checked
+* @param string $action being checked
+* @param MessageSpecifier|array|string|bool|null &$result User
+*   permissions error to add. If none, return true. $result can be
+*   returned as a single error message key (string), or an array of
+*   error message keys when multiple messages are needed
+* @return bool
+* @see 
https://www.mediawiki.org/wiki/Manual:Hooks/getUserPermissionsErrors
+*/
+   public static function onGetUserPermissionsErrors(
+   Title $title, User $user, $action, &$result = null
+   ) {
+   global $wgSpecialPageLockdown, $wgWhitelistRead, $wgLang;
 
-   // don't impose extra restrictions on UI pages
-   if ( $title->isCssJsSubpage() ) {
-   return true

[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Fix two bugs with lockdownNamespace()

2017-12-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398519 )

Change subject: Fix two bugs with lockdownNamespace()
..

Fix two bugs with lockdownNamespace()

* Changing search's behavior for “go to page” by actually setting
  $title to null.
* Allow the general public to see namespaces without any group restrictions.

Change-Id: Icaf433663311f36f0893a7ec4b660c954fa1b5e6
---
M Lockdown.php
1 file changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lockdown 
refs/changes/19/398519/1

diff --git a/Lockdown.php b/Lockdown.php
index 9deef15..9ba1af0 100644
--- a/Lockdown.php
+++ b/Lockdown.php
@@ -200,12 +200,7 @@
$groups = @$wgNamespacePermissionLockdown[$ns]['*'];
}
 
-   if ( $groups === null ) {
-   return false;
-   }
-
-   if ( !$groups || !array_intersect($ugroups, $groups) ) {
-   $title = null;
+   if ( $groups && !array_intersect($ugroups, $groups) ) {
return false;
}
 
@@ -218,6 +213,8 @@
 
if ( $title ) {
$ugroups = $wgUser->getEffectiveGroups();
-   return lockdownNamespace( $title->getNamespace(), $ugroups );
+   if ( !lockdownNamespace( $title->getNamespace(), $ugroups ) ) {
+   $title = null;
+   }
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaf433663311f36f0893a7ec4b660c954fa1b5e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Lockdown
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: [WIP] Update for extension registration

2017-12-14 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398414 )

Change subject: [WIP] Update for extension registration
..

[WIP] Update for extension registration

Also fix what look like a couple of bugs

Change-Id: I7e0659872a273fc2026b9bf8d4c4e05f1338c381
---
D Lockdown.php
A extension.json
A src/Hook.php
3 files changed, 279 insertions(+), 223 deletions(-)


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

diff --git a/Lockdown.php b/Lockdown.php
deleted file mode 100644
index 9deef15..000
--- a/Lockdown.php
+++ /dev/null
@@ -1,223 +0,0 @@
- may work in some versions of 
mediawiki. Same with diff, etc.
-*
-* NOTE: you cannot GRANT access to things forbidden by $wgGroupPermissions. 
You can only DENY access
-* granted there.
-*/
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo( "This file is an extension to the MediaWiki software and cannot 
be used standalone.\n" );
-   die( 1 );
-}
-
-$wgExtensionCredits['other'][] = array(
-   'path' => __FILE__,
-   'name' => 'Lockdown',
-   'author' => array(
-   'Daniel Kinzler',
-   'Platonides',
-   '...'
-   ),
-   'url' => 'https://mediawiki.org/wiki/Extension:Lockdown',
-   'descriptionmsg' => 'lockdown-desc',
-   'license-name' => 'GPL-2.0+'
-);
-
-$wgMessagesDirs['Lockdown'] = __DIR__ . '/i18n';
-
-$wgNamespacePermissionLockdown = array();
-$wgSpecialPageLockdown = array();
-$wgActionLockdown = array();
-
-$wgHooks['getUserPermissionsErrors'][] = 'lockdownUserPermissionsErrors';
-$wgHooks['MediaWikiPerformAction'][] = 'lockdownMediawikiPerformAction';
-$wgHooks['SearchableNamespaces'][] = 'lockdownSearchableNamespaces';
-$wgHooks['SearchGetNearMatchComplete'][] = 
'lockdownSearchGetNearMatchComplete';
-
-/**
- * @param Title $title
- * @param User $user
- * @param string $action
- * @param MessageSpecifier|array|string|bool|null $result
- * @return bool
- */
-function lockdownUserPermissionsErrors(
-   Title $title,
-   User $user,
-   $action,
-   &$result = null
-) {
-   global $wgNamespacePermissionLockdown, $wgSpecialPageLockdown, 
$wgWhitelistRead, $wgLang;
-
-   $result = null;
-
-   // don't impose extra restrictions on UI pages
-   if ( $title->isCssJsSubpage() ) {
-   return true;
-   }
-
-   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
-   // don't impose read restrictions on whitelisted pages
-   if ( in_array( $title->getPrefixedText(), $wgWhitelistRead ) ) {
-   return true;
-   }
-   }
-
-   $groups = null;
-   $ns = $title->getNamespace();
-   if ( NS_SPECIAL == $ns ) {
-   foreach ( $wgSpecialPageLockdown as $page => $g ) {
-   if ( !$title->isSpecial( $page ) ) continue;
-   $groups = $g;
-   break;
-   }
-   }
-   else {
-   $groups = @$wgNamespacePermissionLockdown[$ns][$action];
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown['*'][$action];
-   }
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown[$ns]['*'];
-   }
-   }
-
-   if ( $groups === null ) {
-   #no restrictions
-   return true;
-   }
-
-   if ( !$groups ) {
-   #no groups allowed
-
-   $result = array(
-   'badaccess-group0'
-   );
-
-   return false;
-   }
-
-   $ugroups = $user->getEffectiveGroups();
-
-   $match = array_intersect( $ugroups, $groups );
-
-   if ( $match ) {
-   # group is allowed - keep processing
-   $result = null;
-   return true;
-   } else {
-   # group is denied - abort
-   $groupLinks = array_map( array( 'User', 'makeGroupLinkWiki' ), 
$groups );
-
-   $result = array(
-   'badaccess-groups',
-   $wgLang->commaList( $groupLinks ),
-   count( $groups )
-   );
-
-   return false;
-   }
-}
-
-function lockdownMediawikiPerformAction (
-   OutputPage $output,
-   Article $article,
-   Title $title,
-   User $user,
-   WebRequest $request,
-   MediaWiki $wiki
-) {
-   global $wgActionLockdown, $wgLang;
-
-   $action = $wiki->getAction();
-
-   if ( !isset( $wgActionLockdown[$action] ) ) {
-   return true;
-   }
-
-   $groups = $wgActionLockdown[$action];
-   if ( $groups === null ) {
-   return true;
-   }
-   if ( !$groups ) {
-   return false;
-   }
-
-   $ugroups = $user->get

[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Use Content Handler and prepareContentForEdit() where approp...

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

Change subject: Use Content Handler and prepareContentForEdit() where 
appropriate
..

Use Content Handler and prepareContentForEdit() where appropriate

Change-Id: Ifdd67efedfc5fcb0708caf446473b6e161d89f41
WikiPage::prepareTextForEdit() was removed in 1.29
Bug: T181872
---
M ApprovedRevs.hooks.php
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index 4dd19b3..883fa37 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -74,7 +74,12 @@
}
}
 
-   $editInfo = $page->prepareTextForEdit( $text );
+   if ( method_exists( "ContentHandler", "makeContent" ) ) {
+   $content = ContentHandler::makeContent( $text, 
$page->getTitle() );
+   $editInfo = $page->prepareContentForEdit( $content );
+   } else {
+   $editInfo = $page->prepareTextForEdit( $text );
+   }
$u = new LinksUpdate( $page->mTitle, $editInfo->output );
$u->doUpdate();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdd67efedfc5fcb0708caf446473b6e161d89f41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: Don't wrap Documents with tags

2017-11-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390078 )

Change subject: Don't wrap Documents with  tags
..

Don't wrap Documents with  tags

Some old comments get to this point as entire HTML documents,
including .

Alternatively, it might make sense to do a stristr check for .
Or we could try parsing again without calling createDOM().

Bug: T108089
Change-Id: I124c4ceff4ee612ec3cb567decf99ddf08c50f74
---
M includes/Parsoid/ContentFixer.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/78/390078/1

diff --git a/includes/Parsoid/ContentFixer.php 
b/includes/Parsoid/ContentFixer.php
index 6ecda82..5eb9aa7 100644
--- a/includes/Parsoid/ContentFixer.php
+++ b/includes/Parsoid/ContentFixer.php
@@ -82,7 +82,10 @@
 * The body tag is required otherwise  tags at the top are
 * magic'd into  rather than kept with the content.
 */
-   if ( substr( $content, 0, 5 ) !== ' tags, but prior to I0d9659f we were
// storing only the contents and not the body tag 
itself.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I124c4ceff4ee612ec3cb567decf99ddf08c50f74
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: PageForms should use the PageContentSave hook

2017-11-01 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387793 )

Change subject: PageForms should use the PageContentSave hook
..

PageForms should use the PageContentSave hook

Without it, pages are not (reliably) displayed without purging the
article. PFFormUtils::purgeCache is called on the ArticlePurge hook
and used to be called on the ArticleSave hook. We need to put it back
in place for PageContentSave.

Bug: T179486
Change-Id: I6fde43a6654031eb4bc8202f1aec59a7fbe2265f
---
M extension.json
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms 
refs/changes/93/387793/1

diff --git a/extension.json b/extension.json
index c735c7d..1d4c864 100644
--- a/extension.json
+++ b/extension.json
@@ -412,6 +412,9 @@
"ArticlePurge": [
"PFFormUtils::purgeCache"
],
+   "PageContentSave": [
+   "PFFormUtils::purgeCache"
+   ],
"ParserFirstCallInit": [
"PFHooks::registerFunctions"
],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fde43a6654031eb4bc8202f1aec59a7fbe2265f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update phpunit requirement

2017-10-23 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386118 )

Change subject: Update phpunit requirement
..

Update phpunit requirement

Bug: T178859
Change-Id: I9cae424026fc3ae6f0b9d43ed5c8c22f9dd16f30
---
M composer.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/18/386118/1

diff --git a/composer.json b/composer.json
index a0fe9a2..a24da69 100644
--- a/composer.json
+++ b/composer.json
@@ -58,7 +58,7 @@
"monolog/monolog": "~1.22.1",
"nikic/php-parser": "2.1.0",
"nmred/kafka-php": "0.1.5",
-   "phpunit/phpunit": "4.8.35",
+   "phpunit/phpunit": "5.7.23",
"psy/psysh": "0.8.11",
"wikimedia/avro": "1.7.7",
"wikimedia/testing-access-wrapper": "~1.0",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cae424026fc3ae6f0b9d43ed5c8c22f9dd16f30
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: add Echo support

2017-10-23 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386007 )

Change subject: add Echo support
..

add Echo support

* Sprinkle debug statements throught to help with that.
* Add shim to work w/o WatchedItemStore from MediaWikiServices.
* Make third arg on CategoryAfterPageRemovalHook optional.
* Add title-message key that older Echo requires and silently dies without.

Change-Id: Id0df74ccef1f9c6ea51c22396977f5424cbe19ae
---
M .gitignore
D CategoryWatch.php
A assets/catwatch.svg
M extension.json
M i18n/en.json
M i18n/qqq.json
A src/CategoryWatch.php
A src/EchoEventPresentationModel.php
A src/Hook.php
9 files changed, 905 insertions(+), 464 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index 4a59931..d2d7c2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 *~
 \#*\#
 .\#*
+.tramp_history
 
 # misc
 PHPTAGS.sqlite
diff --git a/CategoryWatch.php b/CategoryWatch.php
deleted file mode 100644
index aca8f23..000
--- a/CategoryWatch.php
+++ /dev/null
@@ -1,453 +0,0 @@
-https://www.mediawiki.org/Extension:CategoryWatch
- * for installation and usage details
- * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch
- * for development notes and disucssion
- *
- * @file
- * @ingroup Extensions
- * @author Aran Dunkley [http://www.organicdesign.co.nz/nad User:Nad]
- * @copyright © 2008 Aran Dunkley
- * @licence GNU General Public Licence 2.0 or later
- */
-
-class CategoryWatch {
-   // Instance
-   protected static $watcher;
-
-   /**
-* The extension function.
-* It has to be the static function in a class now.
-*/
-   public static function setupCategoryWatch() {
-   wfDebugLog( 'CategoryWatch', 'loading extension...' );
-
-   # Instantiate the CategoryWatch singleton now
-   # that the environment is prepared
-   self::$watcher = new CategoryWatch();
-   }
-
-   /**
-* Get a list of categories before article updated Since MediaWiki
-* version 1.25.x, we have to use static function for hooks.  the
-* hook has different signatures.
-* @param WikiPage $wikiPage the page
-* @param User $user who is modifying
-* @param Content $content the new article content
-* @param string $summary the article summary (comment)
-* @param bool $isMinor minor flag
-* @param bool $isWatch watch flag (not used, aka always null)
-* @param int $section section number (not used, aka always null)
-* @param int $flags see WikiPage::doEditContent documentation for 
flags' definition
-* @param Status $status Status (object)
-*/
-   public static function onPageContentSave(
-   $wikiPage, $user, $content, $summary, $isMinor,
-   $isWatch, $section, $flags, $status
-   ) {
-   global $wgCategoryWatchUseAutoCat, 
$wgCategoryWatchUseAutoCatRealName,
-   $wgCategoryWatch;
-
-   self::$watcher->before = [];
-   $dbr  = wfGetDB( DB_MASTER );
-   $cl   = $dbr->tableName( 'categorylinks' );
-   $id   = $wikiPage->getID();
-   wfDebugLog( 'CategoryWatch', "tablename = $cl" );
-   wfDebugLog( 'CategoryWatch', "page id=$id" );
-   $res  = $dbr->select(
-   $cl, 'cl_to', "cl_from = $id", __METHOD__,
-   [ 'ORDER BY' => 'cl_sortkey' ]
-   );
-   $row = $dbr->fetchRow( $res );
-   while ( $row ) {
-   self::$watcher->before[] = $row[0];
-   $row = $dbr->fetchRow( $res );
-   }
-   $dbr->freeResult( $res );
-   wfDebugLog( 'CategoryWatch', 'Categories before page saved' );
-   wfDebugLog( 'CategoryWatch', join( ', ', self::$watcher->before 
) );
-
-   # If using the automatically watched category feature, ensure
-   # that all users are watching it
-   if ( $wgCategoryWatchUseAutoCat ) {
-   $dbr = wfGetDB( DB_SLAVE );
-
-   # Find all users not watching the autocat
-   $like = str_replace(
-   ' ', '_',
-   trim( wfMessage( 'categorywatch-autocat', '' 
)->text() )
-   );
-   $utbl = $dbr->tableName( 'user' );
-   $wtbl = $dbr->tableName( 'watchlist' );
-   $sql = "SELECT user_id FROM $utbl LEFT JOIN $wtbl ON "
-. "user_id=wl_user AND wl_title LIKE '%$like%' 
"
-. "WHERE wl_user IS NULL";
-
-   # Insert

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Replace FooBar with WhoIsWatching

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/384788 )

Change subject: Replace FooBar with WhoIsWatching
..


Replace FooBar with WhoIsWatching

Missed these in I3b80e90fc3df42af6112673d0d68ca9bc888363d

Change-Id: Ie5321c89f7bb7bd88002cc321d4b3884f543aae9
---
M WhoIsWatching.php
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/WhoIsWatching.php b/WhoIsWatching.php
index 770cf00..1eedc70 100644
--- a/WhoIsWatching.php
+++ b/WhoIsWatching.php
@@ -5,11 +5,11 @@
$wgMessagesDirs['WhoIsWatching'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['WhoIsWatchingAlias'] = __DIR__ . 
'/src/i18n/Alias.php';
wfWarn(
-   'Deprecated PHP entry point used for the FooBar extension. ' .
+   'Deprecated PHP entry point used for the WhoIsWatching 
extension. ' .
'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
);
return;
 } else {
-   die( 'This version of the FooBar extension requires MediaWiki 1.25+' );
+   die( 'This version of the WhoIsWatching extension requires MediaWiki 
1.25+' );
 }
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5321c89f7bb7bd88002cc321d4b3884f543aae9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Replace FooBar with WhoIsWatching

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384788 )

Change subject: Replace FooBar with WhoIsWatching
..

Replace FooBar with WhoIsWatching

Missed these in I3b80e90fc3df42af6112673d0d68ca9bc888363d

Change-Id: Ie5321c89f7bb7bd88002cc321d4b3884f543aae9
---
M WhoIsWatching.php
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/WhoIsWatching.php b/WhoIsWatching.php
index 770cf00..1eedc70 100644
--- a/WhoIsWatching.php
+++ b/WhoIsWatching.php
@@ -5,11 +5,11 @@
$wgMessagesDirs['WhoIsWatching'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['WhoIsWatchingAlias'] = __DIR__ . 
'/src/i18n/Alias.php';
wfWarn(
-   'Deprecated PHP entry point used for the FooBar extension. ' .
+   'Deprecated PHP entry point used for the WhoIsWatching 
extension. ' .
'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
);
return;
 } else {
-   die( 'This version of the FooBar extension requires MediaWiki 1.25+' );
+   die( 'This version of the WhoIsWatching extension requires MediaWiki 
1.25+' );
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5321c89f7bb7bd88002cc321d4b3884f543aae9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_30]: Add back shim per request.

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/384717 )

Change subject: Add back shim per request.
..


Add back shim per request.

Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
(cherry picked from commit 3d27e560fa947346054ad79f53e3e707d8136741)
---
A WhoIsWatching.php
1 file changed, 15 insertions(+), 0 deletions(-)

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



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

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_30
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[REL1_29]: Add back shim per request.

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/384716 )

Change subject: Add back shim per request.
..


Add back shim per request.

Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
(cherry picked from commit 3d27e560fa947346054ad79f53e3e707d8136741)
---
A WhoIsWatching.php
1 file changed, 15 insertions(+), 0 deletions(-)

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



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

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_29
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[REL1_30]: link to whole message instead of just a number

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/384719 )

Change subject: link to whole message instead of just a number
..


link to whole message instead of just a number

easier clicking

Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
(cherry picked from commit 97460ca2172c8fb3d36bd1a30ecba0fc3bac7f56)
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_30
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[REL1_29]: link to whole message instead of just a number

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/384720 )

Change subject: link to whole message instead of just a number
..


link to whole message instead of just a number

easier clicking

Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
(cherry picked from commit 97460ca2172c8fb3d36bd1a30ecba0fc3bac7f56)
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_29
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_29]: link to whole message instead of just a number

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384720 )

Change subject: link to whole message instead of just a number
..

link to whole message instead of just a number

easier clicking

Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
(cherry picked from commit 97460ca2172c8fb3d36bd1a30ecba0fc3bac7f56)
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/20/384720/1

diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_29
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_30]: link to whole message instead of just a number

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384719 )

Change subject: link to whole message instead of just a number
..

link to whole message instead of just a number

easier clicking

Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
(cherry picked from commit 97460ca2172c8fb3d36bd1a30ecba0fc3bac7f56)
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/19/384719/1

diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_30
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: parent::execute() is deprecating

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/378979 )

Change subject: parent::execute() is deprecating
..


parent::execute() is deprecating

Change-Id: Icf206480190c360517f58b91949815868068a8a4
---
M src/SpecialWhoIsWatching.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/src/SpecialWhoIsWatching.php b/src/SpecialWhoIsWatching.php
index 56a5a3b..c3fd8e4 100644
--- a/src/SpecialWhoIsWatching.php
+++ b/src/SpecialWhoIsWatching.php
@@ -63,7 +63,9 @@
 * @return boolean
 */
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf206480190c360517f58b91949815868068a8a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[master]: link to whole message instead of just a number

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/378980 )

Change subject: link to whole message instead of just a number
..


link to whole message instead of just a number

easier clicking

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

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
Gerrit-Reviewer: Siebrand 
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...WhoIsWatching[REL1_29]: Add back shim per request.

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384716 )

Change subject: Add back shim per request.
..

Add back shim per request.

Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
(cherry picked from commit 3d27e560fa947346054ad79f53e3e707d8136741)
---
A WhoIsWatching.php
1 file changed, 15 insertions(+), 0 deletions(-)


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

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

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_29
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_30]: Add back shim per request.

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384717 )

Change subject: Add back shim per request.
..

Add back shim per request.

Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
(cherry picked from commit 3d27e560fa947346054ad79f53e3e707d8136741)
---
A WhoIsWatching.php
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/17/384717/1

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

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_30
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Add back shim per request.

2017-10-17 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384704 )

Change subject: Add back shim per request.
..

Add back shim per request.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/04/384704/1

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

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b80e90fc3df42af6112673d0d68ca9bc888363d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Match hook, avoid warnings

2017-10-10 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383492 )

Change subject: Match hook, avoid warnings
..

Match hook, avoid warnings

Bug: T177897
Change-Id: Ia559f6925edb10131c54eb683245fbc5ee20f358
---
M ApprovedRevs.hooks.php
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index de014da..6791533 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -801,13 +801,13 @@
 *
 * @since 0.5.6
 *
-* @param Article &$article
+* @param Article $article
 * @param boolean $outputDone
 * @param boolean $useParserCache
 *
 * @return true
 */
-   public static function setArticleHeader( Article &$article, 
&$outputDone, &$useParserCache ) {
+   public static function setArticleHeader( Article $article, 
&$outputDone, &$useParserCache ) {
global $wgOut, $wgRequest, $egApprovedRevsBlankIfUnapproved;
 
// For now, we only set the header if "blank if unapproved"
@@ -889,7 +889,7 @@
 * a header message stating that, if the setting to display this
 * message is activated.
 */
-   public static function displayNotApprovedHeader( Article &$article, 
&$outputDone, &$useParserCache ) {
+   public static function displayNotApprovedHeader( Article $article, 
&$outputDone, &$useParserCache ) {
global $egApprovedRevsShowNotApprovedMessage;
if ( !$egApprovedRevsShowNotApprovedMessage) {
return true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia559f6925edb10131c54eb683245fbc5ee20f358
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[REL1_27]: Match hook, avoid warnings

2017-10-10 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383489 )

Change subject: Match hook, avoid warnings
..

Match hook, avoid warnings

Bug: T177897
Change-Id: I2cdb4943f4a861474134cdee7f3988524bada74f
---
M common/Hooks.php
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/common/Hooks.php b/common/Hooks.php
index 792e78a..a7862ae 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -437,12 +437,13 @@
}
 
/**
-* @param Article &$article
+* @param Article $article
+* @param Article $article
 * @param bool &$outputDone
 * @param bool &$pcache
 * @return bool
 */
-   public static function showDocPageHeader( Article &$article, 
&$outputDone, &$pcache ) {
+   public static function showDocPageHeader( Article $article, 
&$outputDone, &$pcache ) {
global $wgOut;
 
$title = $article->getTitle();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cdb4943f4a861474134cdee7f3988524bada74f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: REL1_27
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[master]: Match hook, avoid warnings

2017-10-10 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383486 )

Change subject: Match hook, avoid warnings
..

Match hook, avoid warnings

Bug: T177897
Change-Id: I2cdb4943f4a861474134cdee7f3988524bada74f
---
M common/Hooks.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/86/383486/1

diff --git a/common/Hooks.php b/common/Hooks.php
index ab75dd2..62ca956 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -389,12 +389,12 @@
}
 
/**
-* @param Article &$article
+* @param Article $article
 * @param bool &$outputDone
 * @param bool &$pcache
 * @return bool
 */
-   public static function showDocPageHeader( Article &$article, 
&$outputDone, &$pcache ) {
+   public static function showDocPageHeader( Article $article, 
&$outputDone, &$pcache ) {
$title = $article->getTitle();
if ( Scribunto::isDocPage( $title, $forModule ) ) {
$article->getContext()->getOutput()->addHTML(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cdb4943f4a861474134cdee7f3988524bada74f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ReplaceText[master]: Refactor & Reorganize ReplaceText for Readability

2017-10-04 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382173 )

Change subject: Refactor & Reorganize ReplaceText for Readability
..

Refactor & Reorganize ReplaceText for Readability

* Moving files into place
* Also updating .gitignore and adding .dir-locals.el for emacs
* Use ResourceLoader for our JS snippet
* Show bad category notice before searching for titles.
* Using RL needed some adjustments.
* Create our own JS in place of using mediawiki.special.search since
  theirs has dependencies we don't provide.
* Break up showForm() into bits for easier comprehension.
* Add CSS to highlight matches

Bug: T177290
Change-Id: I819e08eb6ec59cfb46c5156556c2aae5899cfc97
---
A .dir-locals.el
M .gitignore
D ReplaceText.hooks.php
D ReplaceText.js
D ReplaceText.php
D ReplaceTextJob.php
D SpecialReplaceText.php
M extension.json
R maintenance/ReplaceAll.php
A modules/ReplaceText.css
A modules/ReplaceText.js
A modules/ReplaceTextSearch.js
M package.json
A src/Hook.php
A src/Job.php
R src/Search.php
A src/SpecialPage.php
R src/i18n/Alias.php
18 files changed, 1,559 insertions(+), 902 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ReplaceText 
refs/changes/73/382173/1

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..75ce2ef
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,89 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(lice:default-license . "gpl-3.0")
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+ (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+

[MediaWiki-commits] [Gerrit] mediawiki...ReplaceText[master]: Refactor & Reorganize ReplaceText for Readability

2017-10-03 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382006 )

Change subject: Refactor & Reorganize ReplaceText for Readability
..

Refactor & Reorganize ReplaceText for Readability

* Moving files into place
* Also updating .gitignore and adding .dir-locals.el for emacs
* Use ResourceLoader for our JS snippet
* Show bad category notice before searching for titles.
* Using RL needed some adjustments.
* Create our own JS in place of using mediawiki.special.search since
  theirs has dependencies we don't provide.
* Break up showForm() into bits for easier comprehension.
* Add CSS to highlight matches

Bug: T177290
Change-Id: I86a77823ebc6a1c767579067d27733159e057bdd
---
A .dir-locals.el
M .gitignore
D ReplaceText.hooks.php
D ReplaceText.js
D ReplaceText.php
D ReplaceTextJob.php
D SpecialReplaceText.php
M extension.json
R maintenance/replaceAll.php
A modules/ReplaceText.css
A modules/ReplaceText.js
A modules/ReplaceTextSearch.js
M package.json
A src/Hook.php
A src/Job.php
R src/Search.php
A src/SpecialPage.php
R src/i18n/Alias.php
18 files changed, 1,566 insertions(+), 902 deletions(-)


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

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..75ce2ef
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,89 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(lice:default-license . "gpl-3.0")
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+ (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+

[MediaWiki-commits] [Gerrit] mediawiki...ReplaceText[master]: Add option to not send enotifs on replacetext

2017-10-03 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382007 )

Change subject: Add option to not send enotifs on replacetext
..

Add option to not send enotifs on replacetext

On a wiki with thousands of users and an edit that affects thousands
of pages, ReplaceText should be able to make mass changes wihout
sending out a bunch of emails (which would then result in a bunch of
complaints from fairly active users with a long watchlist).

This adds a checkbox to disable emails.

Bug: T177291
Change-Id: I119506e697a7f8e6bdda92183c098a2e733d6d3d
---
M i18n/en.json
M maintenance/replaceAll.php
M modules/ReplaceText.js
M src/Job.php
M src/SpecialPage.php
5 files changed, 44 insertions(+), 9 deletions(-)


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

diff --git a/i18n/en.json b/i18n/en.json
index eaabd65..362d93c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -25,6 +25,7 @@
"replacetext_formovedpages": "For moved pages:",
"replacetext_savemovedpages": "Save the old titles as redirects to the 
new titles",
"replacetext_watchmovedpages": "Watch these pages",
+   "replacetext_doenotif": "Notify watchers of changes",
"replacetext_invertselections": "Invert selections",
"replacetext_replace": "Replace",
"replacetext_success": "\"$1\" will be replaced with \"$2\" in 
{{PLURAL:$3|one page|$3 pages}}.",
@@ -38,4 +39,4 @@
"replacetext_editsummary": "Text replacement - \"$1\" to \"$2\"",
"right-replacetext": "Make string replacements on the entire wiki",
"action-replacetext": "make string replacements on the entire wiki"
-}
\ No newline at end of file
+}
diff --git a/maintenance/replaceAll.php b/maintenance/replaceAll.php
index b86e547..81a3a99 100755
--- a/maintenance/replaceAll.php
+++ b/maintenance/replaceAll.php
@@ -44,7 +44,10 @@
 if ( !is_readable( "$IP/maintenance/Maintenance.php" ) ) {
$IP = getenv( "MW_INSTALL_PATH" );
if ( $IP === false ) {
-   die( "MW_INSTALL_PATH needs to be set to your MediaWiki 
installation." );
+   if ( !is_readable( getcwd() . "/maintenance/Maintenance.php" ) 
) {
+   die( "MW_INSTALL_PATH needs to be set to your MediaWiki 
installation." );
+   }
+   $IP = getcwd();
}
 }
 
@@ -68,6 +71,7 @@
protected $useRegex;
protected $titles;
protected $defaultContinue;
+   protected $doEnotif;
 
public function __construct() {
parent::__construct();
@@ -98,6 +102,8 @@
false, true, "f" );
$this->addOption( "show-file-format", "Show a description of 
the file format to ".
"use with --replacements.", false, false );
+   $this->addOption( "noEnotif", "Do not sent email 
notifications.",
+   false, false "m" );
$this->addOption( "debug", "Display replacements being made.", 
false, false );
 
$this->addOption( "listns", "List out the namespaces on this 
wiki.",
@@ -272,7 +278,7 @@
}
 
protected function getTitles( $res ) {
-   if ( count( $this->titles ) == 0 ) {
+   if ( !$this->titles || count( $this->titles ) == 0 ) {
$this->titles = [];
// @codingStandardsIgnoreStart
while ( $row = $res->fetchObject() ) {
@@ -303,6 +309,7 @@
'use_regex'   => $useRegex,
'user_id' => $this->user->getId(),
'edit_summary'=> $this->summaryMsg,
+   'doEnotif'=> $this->doEnotif
];
echo "Replacing on $title... ";
$job = new Job( $title, $param, 0 );
@@ -351,6 +358,7 @@
global $wgShowExceptionDetails;
$wgShowExceptionDetails = true;
 
+   $this->doEnotif = true;
if ( $this->localSetup() ) {
if ( $this->namespaces === [] ) {
$this->error( "No matching namespaces.", true );
@@ -387,6 +395,9 @@
if ( $this->getOption( "user", null ) === null 
) {
$comment = " (Use --user to override)";
}
+   if ( $this->getOption( "noEnotif", false ) ) {
+   $this->doEnotif = false;
+   }
if ( !$this->getReply( "Attribute changes to 
the user '{$this->user}'?$comment" ) ) {
return;
}
diff --git a/modules/ReplaceT

[MediaWiki-commits] [Gerrit] mediawiki...MsCalendar[master]: Updated translation from riverbees

2017-09-27 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381069 )

Change subject: Updated translation from riverbees
..

Updated translation from riverbees

Change-Id: I6f23f2ce0c043b49b25f4f00f9da4e01f3108fd5
---
M i18n/fr.json
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MsCalendar 
refs/changes/69/381069/1

diff --git a/i18n/fr.json b/i18n/fr.json
index b3dcf58..85d6f8d 100644
--- a/i18n/fr.json
+++ b/i18n/fr.json
@@ -1,10 +1,11 @@
 {
"@metadata": {
"authors": [
-   "mberthault"
+   "mberthault",
+"riverbees"
]
},
-   "msc-desc": "Adds the  tag to insert 
calendars into wiki pages",
+   "msc-desc": "Ajouter  pour insérer un 
calendrier dans une page dans le wiki.",
"msc-notfirstday": "Pas le premier jour... ",
"msc-change": "Confirmer",
"msc-remove": "Supprimer",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f23f2ce0c043b49b25f4f00f9da4e01f3108fd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MsCalendar
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...MsCalendar[master]: Fix MySQLism

2017-09-27 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381059 )

Change subject: Fix MySQLism
..

Fix MySQLism

Reported here: 
https://www.mediawiki.org/w/index.php?title=Topic:Tpg1rnsqsaa0wsp0&topic_showPostId=tpg1rnsqse834wn8#flow-post-tpg1rnsqse834wn8

Change-Id: I422a640a59e5e23bb48e105499e328671dd48abd
---
M MsCalendar.sql
1 file changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MsCalendar 
refs/changes/59/381059/1

diff --git a/MsCalendar.sql b/MsCalendar.sql
index 2054002..0029235 100644
--- a/MsCalendar.sql
+++ b/MsCalendar.sql
@@ -1,23 +1,23 @@
 CREATE TABLE IF NOT EXISTS /*_*/mscal_names (
-   ID int UNSIGNED NOT NULL auto_increment,
+   ID int NOT NULL auto_increment,
Cal_Name varchar(255) NOT NULL,
PRIMARY KEY (ID)
 );
 
 CREATE TABLE IF NOT EXISTS /*_*/mscal_list (
-   ID int UNSIGNED NOT NULL auto_increment,
+   ID int NOT NULL auto_increment,
Date DATE NOT NULL,
-   Text_ID int UNSIGNED NOT NULL,
-   Day_of_Set int UNSIGNED NOT NULL DEFAULT 1,
-   Cal_ID int UNSIGNED NOT NULL,
+   Text_ID int NOT NULL,
+   Day_of_Set int NOT NULL DEFAULT 1,
+   Cal_ID int NOT NULL,
PRIMARY KEY (ID)
 );
 
 CREATE TABLE IF NOT EXISTS /*_*/mscal_content (
-   ID int UNSIGNED NOT NULL auto_increment,
+   ID int NOT NULL auto_increment,
Text varchar(255) NOT NULL,
Start_Date DATE NOT NULL,
-   Duration int UNSIGNED NOT NULL,
-   Yearly int UNSIGNED NOT NULL,
+   Duration int NOT NULL,
+   Yearly int NOT NULL,
PRIMARY KEY (ID)
-);
\ No newline at end of file
+);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I422a640a59e5e23bb48e105499e328671dd48abd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MsCalendar
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: Provide base href in Echo's HTML emails

2017-09-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379151 )

Change subject: Provide base href in Echo's HTML emails
..

Provide base href in Echo's HTML emails

While working on my own Echo notifications for CategoryWatch, I came
across this bug.  I was happy to see that someone else identified this
a while back.

Wikitext-to-html production for the body of Echo messages does
not fully qualify urls.  This means that links are created pointing
to, for example, "/w/index.php..." instead of
"http://example.com/w/index.php";.  Supplying a base URL in the html
for the message fixes this problem.

Bug: T141521
Change-Id: Icfb9f3be58b83d2a441972adb58fef1169169d7c
---
M includes/formatters/EchoHtmlEmailFormatter.php
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/includes/formatters/EchoHtmlEmailFormatter.php 
b/includes/formatters/EchoHtmlEmailFormatter.php
index 5cf41cd..b1aae7d 100644
--- a/includes/formatters/EchoHtmlEmailFormatter.php
+++ b/includes/formatters/EchoHtmlEmailFormatter.php
@@ -51,6 +51,7 @@
 
$iconImgSrc = Sanitizer::encodeAttribute( $emailIcon );
 
+   global $wgServer;
return <<< EOF
 

@@ -60,6 +61,7 @@
table[id="email-container"]{max-width:600px !important; 
width:100% !important;}
}

+   
 
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfb9f3be58b83d2a441972adb58fef1169169d7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: link to whole message instead of just a number

2017-09-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378980 )

Change subject: link to whole message instead of just a number
..

link to whole message instead of just a number

easier clicking

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/80/378980/1

diff --git a/i18n/en.json b/i18n/en.json
index f554ddb..d2e99e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1 watching {{PLURAL:$1|user|users}}]",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4581fa79eff0d6bf60c8c336cb248063fa4d1a06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: parent::execute() is deprecating

2017-09-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378979 )

Change subject: parent::execute() is deprecating
..

parent::execute() is deprecating

Change-Id: Icf206480190c360517f58b91949815868068a8a4
---
M src/SpecialWhoIsWatching.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/79/378979/1

diff --git a/src/SpecialWhoIsWatching.php b/src/SpecialWhoIsWatching.php
index 56a5a3b..c3fd8e4 100644
--- a/src/SpecialWhoIsWatching.php
+++ b/src/SpecialWhoIsWatching.php
@@ -63,7 +63,9 @@
 * @return boolean
 */
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf206480190c360517f58b91949815868068a8a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add method to WatchedItemStore to retrieve all watchers of a...

2017-09-16 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378488 )

Change subject: Add method to WatchedItemStore to retrieve all watchers of a 
page
..

Add method to WatchedItemStore to retrieve all watchers of a page

While this won't be useful for Wikipedia, it will help people who
write extensions that run on corporate wikis. As far as I can tell
there is no standard method to get the watchers and this is useful
information for tools like CategoryWatch.

Bug: T176064
Change-Id: I36c8607c6aca71c7f09b8d5511583b3c4f41d6b3
---
M includes/WatchedItemStore.php
1 file changed, 50 insertions(+), 41 deletions(-)


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

diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php
index 69a9df2..9eb3888 100644
--- a/includes/WatchedItemStore.php
+++ b/includes/WatchedItemStore.php
@@ -198,11 +198,9 @@
 * @return array
 */
private function dbCond( User $user, LinkTarget $target ) {
-   return [
-   'wl_user' => $user->getId(),
-   'wl_namespace' => $target->getNamespace(),
-   'wl_title' => $target->getDBkey(),
-   ];
+   return array_merge(
+   [ 'wl_user' => $user->getId() ], $this->getTargetConds( 
$target )
+   );
}
 
/**
@@ -240,6 +238,37 @@
/**
 * @param LinkTarget $target
 *
+* @return array of conditions
+*/
+   protected function getTargetConds( LinkTarget $target ) {
+   return [
+   'wl_namespace' => $target->getNamespace(),
+   'wl_title' => $target->getDBkey(),
+   ];
+   }
+
+   /**
+* Get a list of watchers
+*
+* @param LinkTarget $target to get watchers for
+*
+* @return array of user ids
+*/
+   public function getWatchers( LinkTarget $target ) {
+   $dbr = $this->getConnectionRef( DB_REPLICA );
+   $return = $dbr->selectFieldValues(
+   'watchlist',
+   'wl_user',
+   $this->getTargetConds( $target ),
+   __METHOD__
+   );
+
+   return $return;
+   }
+
+   /**
+* @param LinkTarget $target
+*
 * @return int
 */
public function countWatchers( LinkTarget $target ) {
@@ -247,10 +276,7 @@
$return = (int)$dbr->selectField(
'watchlist',
'COUNT(*)',
-   [
-   'wl_namespace' => $target->getNamespace(),
-   'wl_title' => $target->getDBkey(),
-   ],
+   $this->getTargetConds( $target ),
__METHOD__
);
 
@@ -272,13 +298,11 @@
$visitingWatchers = (int)$dbr->selectField(
'watchlist',
'COUNT(*)',
-   [
-   'wl_namespace' => $target->getNamespace(),
-   'wl_title' => $target->getDBkey(),
+   array_merge( [
'wl_notificationtimestamp >= ' .
$dbr->addQuotes( $dbr->timestamp( $threshold ) 
) .
' OR wl_notificationtimestamp IS NULL'
-   ],
+   ], $this->getTargetConds( $target ) ),
__METHOD__
);
 
@@ -620,12 +644,10 @@
$rows = [];
$items = [];
foreach ( $targets as $target ) {
-   $rows[] = [
+   $rows[] = array_merge( [
'wl_user' => $user->getId(),
-   'wl_namespace' => $target->getNamespace(),
-   'wl_title' => $target->getDBkey(),
'wl_notificationtimestamp' => null,
-   ];
+   ], $this->getTargetConds( $target ) );
$items[] = new WatchedItem(
$user,
$target,
@@ -671,11 +693,10 @@
 
$dbw = $this->getConnectionRef( DB_MASTER );
$dbw->delete( 'watchlist',
-   [
-   'wl_user' => $user->getId(),
-   'wl_namespace' => $target->getNamespace(),
-   'wl_title' => $target->getDBkey(),
-   ], __METHOD__
+ array_merge( [
+

[MediaWiki-commits] [Gerrit] mediawiki...Echo[REL1_28]: un-needed reference causes warnings

2017-09-16 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378402 )

Change subject: un-needed reference causes warnings
..

un-needed reference causes warnings

PHP Warning:  Parameter 1 to EchoHooks::onPageContentSaveComplete() expected to 
be a reference, value given in .../includes/Hooks.php on line 195

Change-Id: Ic7f1cd44f4bfd108daae684b279b6e6d1b551a22
---
M Hooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/Hooks.php b/Hooks.php
index 09a98b6..87efdce 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -470,7 +470,7 @@
 * @param $status Status
 * @return bool true in all cases
 */
-   public static function onPageContentSaveComplete( &$article, &$user, 
$content, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, 
&$status ) {
+   public static function onPageContentSaveComplete( $article, &$user, 
$content, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, 
&$status ) {
global $wgEchoNotifications, $wgRequest;
 
if ( !$revision ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7f1cd44f4bfd108daae684b279b6e6d1b551a22
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Echo[REL1_28]: Fail out if Maintenance.php can't be loaded with informative...

2017-09-16 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378394 )

Change subject: Fail out if Maintenance.php can't be loaded with informative 
message.
..

Fail out if Maintenance.php can't be loaded with informative message.

Change-Id: I8af73961a3b1eb55252673895aea289d943de064
---
M maintenance/processEchoEmailBatch.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/maintenance/processEchoEmailBatch.php 
b/maintenance/processEchoEmailBatch.php
index ad94331..de71a80 100644
--- a/maintenance/processEchoEmailBatch.php
+++ b/maintenance/processEchoEmailBatch.php
@@ -4,6 +4,10 @@
 if ( $IP === false ) {
$IP = __DIR__ . '/../../..';
 }
+if ( !file_exists( "$IP/maintenance/Maintenance.php" ) ) {
+echo "Please set MW_INSTALL_PATH.\n";
+exit;
+}
 require_once ( "$IP/maintenance/Maintenance.php" );
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8af73961a3b1eb55252673895aea289d943de064
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WikiPage::doCreate() should provide 12th parameter to PageCo...

2017-09-11 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377299 )

Change subject: WikiPage::doCreate() should provide 12th parameter to 
PageContentSaveComplete hook
..

WikiPage::doCreate() should provide 12th parameter to PageContentSaveComplete 
hook

In case the hook user has created the 12th param without a default.

Bug: T175596
Change-Id: I63142daaaeea069364dc70b45ee62680ac955f1e
---
M includes/page/WikiPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/99/377299/1

diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 6fc36f6..947af79 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -1921,7 +1921,7 @@
$wikiPage = $this;
// Trigger post-create hook
$params = [ &$wikiPage, &$user, 
$content, $summary,
-   $flags & EDIT_MINOR, null, 
null, &$flags, $revision ];
+   $flags & 
EDIT_MINOR, null, null, &$flags, $revision, 0 ];
Hooks::run( 
'PageContentInsertComplete', $params );
// Trigger post-save hook
$params = array_merge( $params, [ 
&$status, $meta['baseRevId'] ] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63142daaaeea069364dc70b45ee62680ac955f1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_27]: replace parent::execute with something that makes more sense.

2017-09-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/376863 )

Change subject: replace parent::execute with something that makes more sense.
..


replace parent::execute with something that makes more sense.

Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
(cherry picked from commit c7a60277be51f3d7fbe12a2604a8141a515b4861)
---
M WhoIsWatching_body.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..263998e 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -23,7 +23,9 @@
}
 
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_27
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[REL1_27]: replace parent::execute with something that makes more sense.

2017-09-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376863 )

Change subject: replace parent::execute with something that makes more sense.
..

replace parent::execute with something that makes more sense.

Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
(cherry picked from commit c7a60277be51f3d7fbe12a2604a8141a515b4861)
---
M WhoIsWatching_body.php
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..263998e 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -23,7 +23,9 @@
}
 
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_27
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_28]: replace parent::execute with something that makes more sense.

2017-09-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/376859 )

Change subject: replace parent::execute with something that makes more sense.
..


replace parent::execute with something that makes more sense.

Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
---
M WhoIsWatching_body.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..263998e 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -23,7 +23,9 @@
}
 
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[REL1_28]: replace parent::execute with something that makes more sense.

2017-09-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376859 )

Change subject: replace parent::execute with something that makes more sense.
..

replace parent::execute with something that makes more sense.

Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
---
M WhoIsWatching_body.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/59/376859/1

diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..263998e 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -23,7 +23,9 @@
}
 
function execute( $par ) {
-   parent::execute( $par );
+   $this->setHeaders();
+   $this->checkPermissions();
+   $this->outputHeader();
 
if ( $this->getTargetPage( $par ) ) {
if ( $this->addWatchersForm() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66d62ab412923fdf138a4071ed47b6ab7f4328c0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...CommentStreams[master]: typo

2017-09-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376783 )

Change subject: typo
..

typo

Change-Id: I793a0cfd30b9ccb151da0a2d668ad5878b08be78
---
M includes/ApiCSPostComment.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommentStreams 
refs/changes/83/376783/1

diff --git a/includes/ApiCSPostComment.php b/includes/ApiCSPostComment.php
index e191e57..adc1c79 100644
--- a/includes/ApiCSPostComment.php
+++ b/includes/ApiCSPostComment.php
@@ -123,7 +123,7 @@
}
 
/**
-* @return string indicates that this API module requires a CSRF toekn
+* @return string indicates that this API module requires a CSRF token
 */
public function needstoken() {
return 'csrf';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I793a0cfd30b9ccb151da0a2d668ad5878b08be78
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommentStreams
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_28]: Improve WhoIsWatching extension

2017-09-07 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376647 )

Change subject: Improve WhoIsWatching extension
..

Improve WhoIsWatching extension

* Use extension.json
* Add rights so that we can use those instead of globals to control
  access:
  * addpagetoanywatchlist: gets to use the special page to add users.
  * seepagewatchers: gets to see the watchers.
* Clean up WhoIsWatching::execute() method:
  * Use fewer globals.  Use GlobalVarConfig where possible.
  * Use protected methods for various parts of the execution path.
  * Add stub (WhoIsWatching::eNotifUser()) to later notify editors when
their watchlists are changed.
  * Add stub (WhoIsWatching::uiNotifyUser()) to later provide better
feedback to users of this extension.
  * Instead of listing out every user to choose from, provide
autocomplete for user selection.
  * Instead of showing a confusing "usage" message, provide an
autocomplete input box so that the user can select a page to
inspect.
  * Provide slightly better error messages.
  * Refactor to make code more readable.
* Adapted to changes in core MediaWiki:
  * Remove .i18n.php stub.
  * Moved $wgPageShowWatchingUsers which was removed from core in 1.25
to $whoiswathing_showwatchingusers
  * Since the message had to be changed anyway, moved the message from
number_of_watching_users_pageview to whoiswatchingpageview
* Remove use of sprintf for i18n construction.

Change-Id: I9474771788bbeecbbfa521cfbe1792524d04d301
(cherry picked from commit dcd0aad156785b00a799ef45b185778da58b95fb)
(cherry picked from commit e5015a5ff822d2099be95f121afe630a81c0a69a)
---
A ChangeLog
A ChangeLog.mediawiki
D WhoIsWatching.i18n.php
M WhoIsWatching.php
M WhoIsWatching_body.php
A extension.json
M i18n/en.json
M i18n/qqq.json
8 files changed, 343 insertions(+), 163 deletions(-)


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

diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 000..8fba8eb
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,28 @@
+Changes since 0.11:
+
+
+Incompatibilites:
+* Requires at least MediaWiki 1.26
+* If you've made changes to the message displayed at the bottom of the page in 
[[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
+* Note the use of permissions is preferred to globals to allow access to the 
Special Page
+
+
+Other Changes:
+* Use extension.json
+* Remove .i18n.php stub.
+* Add rights so that we can use those instead of globals to control access:
+** addpagetoanywatchlist: gets to use the special page to add users.
+** seepagewatchers: gets to see the watchers.
+* Clean up WhoIsWatching::execute() method:
+** Use fewer globals.  Use GlobalVarConfig where possible.
+** Use protected methods for various parts of the execution path.
+** Add stub (WhoIsWatching::eNotifUser()) to later notify editors when their 
watchlists are changed.
+** Add stub (WhoIsWatching::uiNotifyUser()) to later provide better feedback 
to users of this extension.
+** Instead of listing out every user to choose from, provide autocomplete for 
user selection.
+** Instead of showing a confusing "usage" message, provide an autocomplete 
input box so that the user can select a page to inspect.
+** Provide slightly better error messages.
+** Refactor to make code more readable.
+* Adapted to changes in core MediaWiki since 1.25:
+** Moved $wgPageShowWatchingUsers which was removed from core in 1.25 to 
$whoiswathing_showwatchingusers
+** Since the message had to be changed anyway, moved the message from 
number_of_watching_users_pageview to whoiswatchingpageview
+* Remove use of sprintf for i18n construction.
diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
new file mode 12
index 000..b0936e8
--- /dev/null
+++ b/ChangeLog.mediawiki
@@ -0,0 +1 @@
+ChangeLog
\ No newline at end of file
diff --git a/WhoIsWatching.i18n.php b/WhoIsWatching.i18n.php
deleted file mode 100644
index 6df9df6..000
--- a/WhoIsWatching.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShim6c3b7e8be40a26ae' ) ) {
-   function wfJsonI18nShim6c3b7e8be40a26ae( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach 

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Some refactoring and re-arranging

2017-09-05 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376161 )

Change subject: Some refactoring and re-arranging
..

Some refactoring and re-arranging

Change-Id: I1cb2e4d75dc382563918726c2b1072724b5e430e
---
M .gitignore
D CategoryWatch.php
M extension.json
A src/CategoryWatch.php
A src/Hook.php
5 files changed, 455 insertions(+), 457 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index 4a59931..d2d7c2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
 *~
 \#*\#
 .\#*
+.tramp_history
 
 # misc
 PHPTAGS.sqlite
diff --git a/CategoryWatch.php b/CategoryWatch.php
deleted file mode 100644
index aca8f23..000
--- a/CategoryWatch.php
+++ /dev/null
@@ -1,453 +0,0 @@
-https://www.mediawiki.org/Extension:CategoryWatch
- * for installation and usage details
- * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch
- * for development notes and disucssion
- *
- * @file
- * @ingroup Extensions
- * @author Aran Dunkley [http://www.organicdesign.co.nz/nad User:Nad]
- * @copyright © 2008 Aran Dunkley
- * @licence GNU General Public Licence 2.0 or later
- */
-
-class CategoryWatch {
-   // Instance
-   protected static $watcher;
-
-   /**
-* The extension function.
-* It has to be the static function in a class now.
-*/
-   public static function setupCategoryWatch() {
-   wfDebugLog( 'CategoryWatch', 'loading extension...' );
-
-   # Instantiate the CategoryWatch singleton now
-   # that the environment is prepared
-   self::$watcher = new CategoryWatch();
-   }
-
-   /**
-* Get a list of categories before article updated Since MediaWiki
-* version 1.25.x, we have to use static function for hooks.  the
-* hook has different signatures.
-* @param WikiPage $wikiPage the page
-* @param User $user who is modifying
-* @param Content $content the new article content
-* @param string $summary the article summary (comment)
-* @param bool $isMinor minor flag
-* @param bool $isWatch watch flag (not used, aka always null)
-* @param int $section section number (not used, aka always null)
-* @param int $flags see WikiPage::doEditContent documentation for 
flags' definition
-* @param Status $status Status (object)
-*/
-   public static function onPageContentSave(
-   $wikiPage, $user, $content, $summary, $isMinor,
-   $isWatch, $section, $flags, $status
-   ) {
-   global $wgCategoryWatchUseAutoCat, 
$wgCategoryWatchUseAutoCatRealName,
-   $wgCategoryWatch;
-
-   self::$watcher->before = [];
-   $dbr  = wfGetDB( DB_MASTER );
-   $cl   = $dbr->tableName( 'categorylinks' );
-   $id   = $wikiPage->getID();
-   wfDebugLog( 'CategoryWatch', "tablename = $cl" );
-   wfDebugLog( 'CategoryWatch', "page id=$id" );
-   $res  = $dbr->select(
-   $cl, 'cl_to', "cl_from = $id", __METHOD__,
-   [ 'ORDER BY' => 'cl_sortkey' ]
-   );
-   $row = $dbr->fetchRow( $res );
-   while ( $row ) {
-   self::$watcher->before[] = $row[0];
-   $row = $dbr->fetchRow( $res );
-   }
-   $dbr->freeResult( $res );
-   wfDebugLog( 'CategoryWatch', 'Categories before page saved' );
-   wfDebugLog( 'CategoryWatch', join( ', ', self::$watcher->before 
) );
-
-   # If using the automatically watched category feature, ensure
-   # that all users are watching it
-   if ( $wgCategoryWatchUseAutoCat ) {
-   $dbr = wfGetDB( DB_SLAVE );
-
-   # Find all users not watching the autocat
-   $like = str_replace(
-   ' ', '_',
-   trim( wfMessage( 'categorywatch-autocat', '' 
)->text() )
-   );
-   $utbl = $dbr->tableName( 'user' );
-   $wtbl = $dbr->tableName( 'watchlist' );
-   $sql = "SELECT user_id FROM $utbl LEFT JOIN $wtbl ON "
-. "user_id=wl_user AND wl_title LIKE '%$like%' 
"
-. "WHERE wl_user IS NULL";
-
-   # Insert an entry into watchlist for each
-   $row = $dbr->fetchRow( $res );
-   while ( $row ) {
-   $user = User::newFromId( $row[0] );
-   $name = $wgCategoryWatchUseAutoCatRealName
-  

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: WIP :

2017-09-05 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376162 )

Change subject: WIP :
..

WIP :

See bug for hints.
Bug: T175052

Change-Id: I601b1449b8984fc695e5e1255be257222f02b995
---
M extension.json
M src/CategoryWatch.php
M src/Hook.php
3 files changed, 260 insertions(+), 171 deletions(-)


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

diff --git a/extension.json b/extension.json
index 343fa1e..a55522d 100644
--- a/extension.json
+++ b/extension.json
@@ -21,11 +21,14 @@
"CategoryWatch": "i18n"
},
"Hooks": {
-   "PageContentSave": [
-   "CategoryWatch\\Hook::onPageContentSave"
+   "RecentChanges_save": [
+   "CategoryWatch\\Hook::onRecentChangesSave"
],
-   "PageContentSaveComplete": [
-   "CategoryWatch\\Hook::onPageContentSaveComplete"
+   "SendWatchlistEmailNotification": [
+   "CategoryWatch\\Hook::onSendWatchlistEmailNotification"
+   ],
+   "UpdateUserMailerFormattedPageStatus": [
+   
"CategoryWatch\\Hook::onUpdateUserMailerFormattedPageStatus"
]
},
"config": {
diff --git a/src/CategoryWatch.php b/src/CategoryWatch.php
index 09469c9..768e1b0 100644
--- a/src/CategoryWatch.php
+++ b/src/CategoryWatch.php
@@ -1,8 +1,12 @@
 http://www.gnu.org/licenses/>.
+ *
+ * See https://www.mediawiki.org/Extension:CategoryWatch
+ * for installation and usage details
+ * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch
+ * for development notes and disucssion
+ *
+ * @file
+ * @ingroup Extensions
+ * @author Aran Dunkley [http://www.organicdesign.co.nz/nad User:Nad]
+ * @copyright © 2008 Aran Dunkley
+ * @licence GNU General Public Licence 2.0 or later
  */
 
 namespace CategoryWatch;
 
 class CategoryWatch {
-public $before = [];
-public $after = [];
+   public $before = [];
+   public $after = [];
 
-protected $count = 0;
-protected $allParents = [];
+   protected $count = 0;
+   protected $allParents = [];
 
-protected $wikiPage;
-protected $editor;
-protected $content;
-protected $summary;
-protected $minorEdit;
-protected $flags;
+   protected $wikiPage;
+   protected $editor;
+   protected $content;
+   protected $summary;
+   protected $minorEdit;
+   protected $flags;
 
-/**
- * Construction
- * @param WikiPage $wikiPage the page
+   /**
+* Construction
+* @param WikiPage $wikiPage the page
 * @param User $user who is modifying
 * @param Content $content the new article content
 * @param string $summary the article summary (comment)
 * @param bool $isMinor minor flag
 * @param int $flags see WikiPage::doEditContent documentation for 
flags' definition
 */
-public function __construct(
-WikiPage $wikiPage, User $user, Content $content, $summary, $isMinor, 
$flags
-) {
-$this->wikiPage;
-$this->editor;
-$this->content;
-$this->summary;
-$this->minorEdit;
-$this->flags;
+   public function __construct(
+   WikiPage $wikiPage, User $user, Content $content, $summary, 
$isMinor, $flags
+   ) {
+   $this->wikiPage;
+   $this->editor;
+   $this->content;
+   $this->summary;
+   $this->minorEdit;
+   $this->flags;
 
$this->before = 
$this->wikiPage->getTitle()->getParentCategories();
-$this->doAutoCat();
-}
+   $this->doAutoCat();
+   }
 
-/**
- * Notify all category watchers
- *
+   /**
+* Notify all category watchers
+*
 * @param Revision $revision that was created
 * @param int $baseRevId base revision
 */
-public function notifyCategoryWatchers(
-Revision $revision, $baseRevId
-) {
+   public function notifyCategoryWatchers(
+   Revision $revision, $baseRevId
+   ) {
# Get cats after update
$this->after = 
$this->wikiPage->getTitle()->getParentCategories();
 
@@ -88,9 +103,9 @@
$page = "$pagename ($pageurl)";
 
if ( count( $add ) == 1 && count( $sub ) == 1 ) {
-$this->notifyMove( $sub[0], $add[0] );
+   $this->notifyMove( $sub[0], $add[0] );
} else {
-$this->notifyAdd( $add );
+   $this->notifyAdd( $add );
 
foreach ( $sub as $cat ) {
$title   = Title::newFromText( $cat, 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: EmailNotification should provide a getter for pageStatus

2017-09-05 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376160 )

Change subject: EmailNotification should provide a getter for pageStatus
..

EmailNotification should provide a getter for pageStatus

This will allow extensions to confirm that they are actually handling
the right notification when they hook into
SendWatchlistEmailNotification.

Bug: T175104
Change-Id: I2beb5b3576f2cd739dab16b9adf613c96636edd3
---
M includes/mail/EmailNotification.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/376160/1

diff --git a/includes/mail/EmailNotification.php 
b/includes/mail/EmailNotification.php
index 2931d9d..44ef615 100644
--- a/includes/mail/EmailNotification.php
+++ b/includes/mail/EmailNotification.php
@@ -76,6 +76,16 @@
protected $editor;
 
/**
+* Getter for the protected property, so extensions can use
+* SendWatchlistEmailNotification to handle their own
+* notifications if they want to.
+* @return string
+*/
+   public function getPageStatus() {
+   return $this->pageStatus;
+   }
+
+   /**
 * @deprecated since 1.27 use 
WatchedItemStore::updateNotificationTimestamp directly
 *
 * @param User $editor The editor that triggered the update.  Their 
notification

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2beb5b3576f2cd739dab16b9adf613c96636edd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Note whether a category was added in a machine readable way

2017-09-05 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376070 )

Change subject: Note whether a category was added in a machine readable way
..

Note whether a category was added in a machine readable way

CategoryMembershipChange is great, but it doesn't have a
machine-readable way to see if the category has been added or removed
from the page. We could parse the comments, but that would rely on
reading the comments and matching the message against the translated
strings.

This patch adds a couple of parameters and notes whether the change
was an addition or removal in rc_params.

Also, puts the evaluation of the AbortEmailNotification hook before
the check of rc_type in the hopes that the extension CatWatch can send
out emails at the right time.

Change-Id: I3e2ac0cc148b9d618e2f8b7853b14bff827ee443
---
M includes/changes/CategoryMembershipChange.php
M includes/changes/RecentChange.php
2 files changed, 14 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/376070/1

diff --git a/includes/changes/CategoryMembershipChange.php 
b/includes/changes/CategoryMembershipChange.php
index 5d19961..6fa6907 100644
--- a/includes/changes/CategoryMembershipChange.php
+++ b/includes/changes/CategoryMembershipChange.php
@@ -134,7 +134,8 @@
),
$this->pageTitle,
$this->getPreviousRevisionTimestamp(),
-   $this->revision
+   $this->revision,
+   $type === self::CATEGORY_ADDITION
);
}
 
@@ -146,6 +147,7 @@
 * @param Title $pageTitle Title of the page that is being added or 
removed
 * @param string $lastTimestamp Parent revision timestamp of this 
change in TS_MW format
 * @param Revision|null $revision
+* @param bool $added true, if the category was added, false for removed
 *
 * @throws MWException
 */
@@ -156,7 +158,8 @@
$comment,
Title $pageTitle,
$lastTimestamp,
-   $revision
+   $revision,
+   $added
) {
$deleted = $revision ? $revision->getVisibility() & 
Revision::SUPPRESSED_USER : 0;
$newRevId = $revision ? $revision->getId() : 0;
@@ -197,7 +200,8 @@
$lastTimestamp,
$bot,
$ip,
-   $deleted
+   $deleted,
+   $added
]
);
$rc->save();
diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index cd11070..e72f588 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -364,8 +364,8 @@
 
// Never send an RC notification email about 
categorization changes
if (
-   $this->mAttribs['rc_type'] != RC_CATEGORIZE &&
-   Hooks::run( 'AbortEmailNotification', [ 
$editor, $title, $this ] )
+   Hooks::run( 'AbortEmailNotification', [ 
$editor, $title, $this ] ) &&
+   $this->mAttribs['rc_type'] != RC_CATEGORIZE
) {
// @FIXME: This would be better as an extension 
hook
// Send emails or email jobs once this row is 
safely committed
@@ -853,6 +853,7 @@
 * @param bool $bot true, if the change was made by a bot
 * @param string $ip IP address of the user, if the change was made 
anonymously
 * @param int $deleted Indicates whether the change has been deleted
+* @param bool $added true, if the category was added, false for removed
 *
 * @return RecentChange
 */
@@ -867,7 +868,8 @@
$lastTimestamp,
$bot,
$ip = '',
-   $deleted = 0
+   $deleted = 0,
+   $added
) {
$rc = new RecentChange;
$rc->mTitle = $categoryTitle;
@@ -898,7 +900,8 @@
'rc_log_type' => null,
'rc_log_action' => '',
'rc_params' => serialize( [
-   'hidden-cat' => WikiCategoryPage::factory( 
$categoryTitle )->isHidden()
+   'hidden-cat' => WikiCategoryPage::factory( 
$categoryTitle )->isHidden(),
+   'added' => $added
] )
];
 

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

Gerrit-MessageType: newchange
Gerrit-Chan

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix php notice

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374047 )

Change subject: Fix php notice
..

Fix php notice

PHP Notice: Array to string conversion in .../includes/installer/Installer.php 
on line 1392

Bug: T174258
Change-Id: I6f8497a74a83aec183684bcb441191c32c67ccde
---
M includes/installer/Installer.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/374047/1

diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index ae80c8b..52be321 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -1389,7 +1389,7 @@
}
}
closedir( $dh );
-   natcasesort( $exts );
+   uksort( $exts, 'strnatcasecmp' );
 
return $exts;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f8497a74a83aec183684bcb441191c32c67ccde
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Accomodate dump files that don't come directly from dumpBack...

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374045 )

Change subject: Accomodate dump files that don't come directly from 
dumpBackup.php
..

Accomodate dump files that don't come directly from dumpBackup.php

Bug: T174257
Change-Id: I581d29b37b2b0030838563e247a635b0defe3bbd
---
M includes/import/WikiImporter.php
M languages/i18n/en.json
2 files changed, 22 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/45/374045/1

diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php
index 2099709..b69dc92 100644
--- a/includes/import/WikiImporter.php
+++ b/includes/import/WikiImporter.php
@@ -996,14 +996,24 @@
$text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
 
$revision->setTitle( $pageInfo['_title'] );
-   $revision->setID( $pageInfo['id'] );
-   $revision->setTimestamp( $uploadInfo['timestamp'] );
+   if ( isset( $pageInfo['id'] ) ) {
+   $revision->setID( $pageInfo['id'] );
+   }
+   if ( isset( $uploadInfo['timestamp'] ) ) {
+   $revision->setTimestamp( $uploadInfo['timestamp'] );
+   }
$revision->setText( $text );
+   if ( !isset( $uploadInfo['filename'] ) ) {
+   $this->notice( 'import-error-need-filename', 
$pageInfo['_title'] );
+   $uploadInfo['filename'] = 
$pageInfo['_title']->getDBKey();
+   }
$revision->setFilename( $uploadInfo['filename'] );
if ( isset( $uploadInfo['archivename'] ) ) {
$revision->setArchiveName( $uploadInfo['archivename'] );
}
-   $revision->setSrc( $uploadInfo['src'] );
+   if ( isset( $uploadInfo['src'] ) ) {
+   $revision->setSrc( $uploadInfo['src'] );
+   }
if ( isset( $uploadInfo['fileSrc'] ) ) {
$revision->setFileSrc( $uploadInfo['fileSrc'],
!empty( $uploadInfo['isTempSrc'] ) );
@@ -1011,14 +1021,20 @@
if ( isset( $uploadInfo['sha1base36'] ) ) {
$revision->setSha1Base36( $uploadInfo['sha1base36'] );
}
-   $revision->setSize( intval( $uploadInfo['size'] ) );
-   $revision->setComment( $uploadInfo['comment'] );
+   if ( isset( $uploadInfo['size'] ) ) {
+   $revision->setSize( intval( $uploadInfo['size'] ) );
+   }
+   if ( isset( $uploadInfo['comment'] ) ) {
+   $revision->setComment( $uploadInfo['comment'] );
+   }
 
if ( isset( $uploadInfo['contributor']['ip'] ) ) {
$revision->setUserIP( $uploadInfo['contributor']['ip'] 
);
}
if ( isset( $uploadInfo['contributor']['username'] ) ) {
$revision->setUsername( 
$uploadInfo['contributor']['username'] );
+   } else {
+   $revision->setUsername( __CLASS__ );
}
$revision->setNoUpdates( $this->mNoUpdates );
 
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index a44b3cf..96c0952 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2765,6 +2765,7 @@
"import-error-invalid": "Page \"$1\" was not imported because the name 
to which it would be imported is invalid on this wiki.",
"import-error-unserialize": "Revision $2 of page \"$1\" could not be 
unserialized. The revision was reported to use content model $3 serialized as 
$4.",
"import-error-bad-location": "Revision $2 using content model $3 cannot 
be stored on \"$1\" on this wiki, since that model is not supported on that 
page.",
+   "import-error-need-filename": "No filename supplied for $1, using 
title.",
"import-options-wrong": "Wrong {{PLURAL:$2|option|options}}: 
$1",
"import-rootpage-invalid": "Given root page is an invalid title.",
"import-rootpage-nosubpage": "Namespace \"$1\" of the root page does 
not allow subpages.",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I581d29b37b2b0030838563e247a635b0defe3bbd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Declare uploadCount property

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374044 )

Change subject: Declare uploadCount property
..

Declare uploadCount property

Bug: T174255
Change-Id: Ic5014821a8f10ab29b729104cd7d4e434085e2f2
---
M maintenance/importDump.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/374044/1

diff --git a/maintenance/importDump.php b/maintenance/importDump.php
index 802619e..206c7ee 100644
--- a/maintenance/importDump.php
+++ b/maintenance/importDump.php
@@ -37,6 +37,7 @@
public $revCount = 0;
public $dryRun = false;
public $uploads = false;
+   protected $uploadCount = 0;
public $imageBasePath = false;
public $nsFilter = false;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5014821a8f10ab29b729104cd7d4e434085e2f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: "PHP Warning: XMLReader::open(): Unable to open source data"...

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374041 )

Change subject: "PHP Warning: XMLReader::open(): Unable to open source data" on 
JPG data
..

"PHP Warning: XMLReader::open(): Unable to open source data" on JPG data

MimeAnalyzer::doGuessMimeType() uses XmlTypeCheck to find the type of
a file. When the file does not contain XML data (e.g JPEG data) the
following is emitted:

PHP Warning:  XMLReader::open(): Unable to open source data

suppressWarnings() should be used or the getimagesize() check should be done 
earlier.

Bug: T174254
Change-Id: I2d4f1991490c6989e54527c03dd9146e87e175a0
---
M includes/libs/mime/MimeAnalyzer.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/41/374041/1

diff --git a/includes/libs/mime/MimeAnalyzer.php 
b/includes/libs/mime/MimeAnalyzer.php
index 4d860bb..826cc37 100644
--- a/includes/libs/mime/MimeAnalyzer.php
+++ b/includes/libs/mime/MimeAnalyzer.php
@@ -760,7 +760,9 @@
/**
 * look for XML formats (XHTML and SVG)
 */
+   MediaWiki\suppressWarnings();
$xml = new XmlTypeCheck( $file );
+   MediaWiki\restoreWarnings();
if ( $xml->wellFormed ) {
$xmlTypes = $this->xmlTypes;
if ( isset( $xmlTypes[$xml->getRootElement()] ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d4f1991490c6989e54527c03dd9146e87e175a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_28]: Declare uploadCount property

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374040 )

Change subject: Declare uploadCount property
..

Declare uploadCount property

Bug: T174255
Change-Id: Ic5014821a8f10ab29b729104cd7d4e434085e2f2
---
M maintenance/importDump.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/374040/1

diff --git a/maintenance/importDump.php b/maintenance/importDump.php
index f0e0555..38d786b 100644
--- a/maintenance/importDump.php
+++ b/maintenance/importDump.php
@@ -37,6 +37,7 @@
public $revCount = 0;
public $dryRun = false;
public $uploads = false;
+   protected $uploadCount = 0;
public $imageBasePath = false;
public $nsFilter = false;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5014821a8f10ab29b729104cd7d4e434085e2f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_28]: Fix/hack ErrorPageError to work from non-UI contexts

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374038 )

Change subject: Fix/hack ErrorPageError to work from non-UI contexts
..

Fix/hack ErrorPageError to work from non-UI contexts

Right now, ErrorPageError *assumes* you're never running on the cli
or the API. It's kinda a crappy superclass to use for errors unless
you're 1000% sure you'll never hit that code path. Yay assumptions!

Ideally, all of this report() crap is cleaned up and unified across
the like 1192902117 places we have it spread out, but for now just
detect the scenario and delegate back to MWException, which does the
right thing

Bug: T168337
Change-Id: Ia2f490528e128527a7a5ef1f4f5eea36ec9ee810
---
M includes/exception/ErrorPageError.php
M tests/phpunit/includes/exception/ErrorPageErrorTest.php
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/374038/1

diff --git a/includes/exception/ErrorPageError.php 
b/includes/exception/ErrorPageError.php
index 2f502d8..97ba56b 100644
--- a/includes/exception/ErrorPageError.php
+++ b/includes/exception/ErrorPageError.php
@@ -53,9 +53,12 @@
}
 
public function report() {
-   global $wgOut;
-
-   $wgOut->showErrorPage( $this->title, $this->msg, $this->params 
);
-   $wgOut->output();
+   if ( self::isCommandLine() || defined( 'MW_API' ) ) {
+   parent::report();
+   } else {
+   global $wgOut;
+   $wgOut->showErrorPage( $this->title, $this->msg, 
$this->params );
+   $wgOut->output();
+   }
}
 }
diff --git a/tests/phpunit/includes/exception/ErrorPageErrorTest.php 
b/tests/phpunit/includes/exception/ErrorPageErrorTest.php
index 71398e3..e72865f 100644
--- a/tests/phpunit/includes/exception/ErrorPageErrorTest.php
+++ b/tests/phpunit/includes/exception/ErrorPageErrorTest.php
@@ -43,6 +43,7 @@
$mock->expects( $this->once() )
->method( 'output' );
$this->setMwGlobals( 'wgOut', $mock );
+   $this->setMwGlobals( 'wgCommandLineMode', false );
 
$e = new ErrorPageError( $title, $mockMessage, $params );
$e->report();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2f490528e128527a7a5ef1f4f5eea36ec9ee810
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: Chad 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_28]: "PHP Warning: XMLReader::open(): Unable to open source data"...

2017-08-26 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374039 )

Change subject: "PHP Warning: XMLReader::open(): Unable to open source data" on 
JPG data
..

"PHP Warning: XMLReader::open(): Unable to open source data" on JPG data

MimeAnalyzer::doGuessMimeType() uses XmlTypeCheck to find the type of
a file. When the file does not contain XML data (e.g JPEG data) the
following is emitted:

PHP Warning:  XMLReader::open(): Unable to open source data

suppressWarnings() should be used or the getimagesize() check should be done 
earlier.

Bug: T174254
Change-Id: I2d4f1991490c6989e54527c03dd9146e87e175a0
---
M includes/libs/mime/MimeAnalyzer.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/39/374039/1

diff --git a/includes/libs/mime/MimeAnalyzer.php 
b/includes/libs/mime/MimeAnalyzer.php
index 5f4d7c9..8621f43 100644
--- a/includes/libs/mime/MimeAnalyzer.php
+++ b/includes/libs/mime/MimeAnalyzer.php
@@ -743,7 +743,9 @@
/**
 * look for XML formats (XHTML and SVG)
 */
+   MediaWiki\suppressWarnings();
$xml = new XmlTypeCheck( $file );
+   MediaWiki\restoreWarnings();
if ( $xml->wellFormed ) {
$xmlTypes = $this->xmlTypes;
if ( isset( $xmlTypes[$xml->getRootElement()] ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d4f1991490c6989e54527c03dd9146e87e175a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_27]: Improve WhoIsWatching extension

2017-08-21 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/372849 )

Change subject: Improve WhoIsWatching extension
..


Improve WhoIsWatching extension

* Use extension.json
* Add rights so that we can use those instead of globals to control
  access:
  * addpagetoanywatchlist: gets to use the special page to add users.
  * seepagewatchers: gets to see the watchers.
* Clean up WhoIsWatching::execute() method:
  * Use fewer globals.  Use GlobalVarConfig where possible.
  * Use protected methods for various parts of the execution path.
  * Add stub (WhoIsWatching::eNotifUser()) to later notify editors when
their watchlists are changed.
  * Add stub (WhoIsWatching::uiNotifyUser()) to later provide better
feedback to users of this extension.
  * Instead of listing out every user to choose from, provide
autocomplete for user selection.
  * Instead of showing a confusing "usage" message, provide an
autocomplete input box so that the user can select a page to
inspect.
  * Provide slightly better error messages.
  * Refactor to make code more readable.
* Adapted to changes in core MediaWiki:
  * Remove .i18n.php stub.
  * Moved $wgPageShowWatchingUsers which was removed from core in 1.25
to $whoiswathing_showwatchingusers
  * Since the message had to be changed anyway, moved the message from
number_of_watching_users_pageview to whoiswatchingpageview
* Remove use of sprintf for i18n construction.

Change-Id: I9474771788bbeecbbfa521cfbe1792524d04d301
(cherry picked from commit dcd0aad156785b00a799ef45b185778da58b95fb)
---
A ChangeLog
A ChangeLog.mediawiki
D WhoIsWatching.i18n.php
M WhoIsWatching.php
M WhoIsWatching_body.php
A extension.json
M i18n/en.json
M i18n/qqq.json
8 files changed, 343 insertions(+), 163 deletions(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 000..8fba8eb
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,28 @@
+Changes since 0.11:
+
+
+Incompatibilites:
+* Requires at least MediaWiki 1.26
+* If you've made changes to the message displayed at the bottom of the page in 
[[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
+* Note the use of permissions is preferred to globals to allow access to the 
Special Page
+
+
+Other Changes:
+* Use extension.json
+* Remove .i18n.php stub.
+* Add rights so that we can use those instead of globals to control access:
+** addpagetoanywatchlist: gets to use the special page to add users.
+** seepagewatchers: gets to see the watchers.
+* Clean up WhoIsWatching::execute() method:
+** Use fewer globals.  Use GlobalVarConfig where possible.
+** Use protected methods for various parts of the execution path.
+** Add stub (WhoIsWatching::eNotifUser()) to later notify editors when their 
watchlists are changed.
+** Add stub (WhoIsWatching::uiNotifyUser()) to later provide better feedback 
to users of this extension.
+** Instead of listing out every user to choose from, provide autocomplete for 
user selection.
+** Instead of showing a confusing "usage" message, provide an autocomplete 
input box so that the user can select a page to inspect.
+** Provide slightly better error messages.
+** Refactor to make code more readable.
+* Adapted to changes in core MediaWiki since 1.25:
+** Moved $wgPageShowWatchingUsers which was removed from core in 1.25 to 
$whoiswathing_showwatchingusers
+** Since the message had to be changed anyway, moved the message from 
number_of_watching_users_pageview to whoiswatchingpageview
+* Remove use of sprintf for i18n construction.
diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
new file mode 12
index 000..b0936e8
--- /dev/null
+++ b/ChangeLog.mediawiki
@@ -0,0 +1 @@
+ChangeLog
\ No newline at end of file
diff --git a/WhoIsWatching.i18n.php b/WhoIsWatching.i18n.php
deleted file mode 100644
index 6df9df6..000
--- a/WhoIsWatching.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShim6c3b7e8be40a26ae' ) ) {
-   function wfJsonI18nShim6c3b7e8be40a26ae( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = dirname( __FILE__ ) . "/i18n/$

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[REL1_27]: Improve WhoIsWatching extension

2017-08-21 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372849 )

Change subject: Improve WhoIsWatching extension
..

Improve WhoIsWatching extension

* Use extension.json
* Add rights so that we can use those instead of globals to control
  access:
  * addpagetoanywatchlist: gets to use the special page to add users.
  * seepagewatchers: gets to see the watchers.
* Clean up WhoIsWatching::execute() method:
  * Use fewer globals.  Use GlobalVarConfig where possible.
  * Use protected methods for various parts of the execution path.
  * Add stub (WhoIsWatching::eNotifUser()) to later notify editors when
their watchlists are changed.
  * Add stub (WhoIsWatching::uiNotifyUser()) to later provide better
feedback to users of this extension.
  * Instead of listing out every user to choose from, provide
autocomplete for user selection.
  * Instead of showing a confusing "usage" message, provide an
autocomplete input box so that the user can select a page to
inspect.
  * Provide slightly better error messages.
  * Refactor to make code more readable.
* Adapted to changes in core MediaWiki:
  * Remove .i18n.php stub.
  * Moved $wgPageShowWatchingUsers which was removed from core in 1.25
to $whoiswathing_showwatchingusers
  * Since the message had to be changed anyway, moved the message from
number_of_watching_users_pageview to whoiswatchingpageview
* Remove use of sprintf for i18n construction.

Change-Id: I9474771788bbeecbbfa521cfbe1792524d04d301
(cherry picked from commit dcd0aad156785b00a799ef45b185778da58b95fb)
---
A ChangeLog
A ChangeLog.mediawiki
D WhoIsWatching.i18n.php
M WhoIsWatching.php
M WhoIsWatching_body.php
A extension.json
M i18n/en.json
M i18n/qqq.json
8 files changed, 343 insertions(+), 163 deletions(-)


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

diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 000..8fba8eb
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,28 @@
+Changes since 0.11:
+
+
+Incompatibilites:
+* Requires at least MediaWiki 1.26
+* If you've made changes to the message displayed at the bottom of the page in 
[[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
+* Note the use of permissions is preferred to globals to allow access to the 
Special Page
+
+
+Other Changes:
+* Use extension.json
+* Remove .i18n.php stub.
+* Add rights so that we can use those instead of globals to control access:
+** addpagetoanywatchlist: gets to use the special page to add users.
+** seepagewatchers: gets to see the watchers.
+* Clean up WhoIsWatching::execute() method:
+** Use fewer globals.  Use GlobalVarConfig where possible.
+** Use protected methods for various parts of the execution path.
+** Add stub (WhoIsWatching::eNotifUser()) to later notify editors when their 
watchlists are changed.
+** Add stub (WhoIsWatching::uiNotifyUser()) to later provide better feedback 
to users of this extension.
+** Instead of listing out every user to choose from, provide autocomplete for 
user selection.
+** Instead of showing a confusing "usage" message, provide an autocomplete 
input box so that the user can select a page to inspect.
+** Provide slightly better error messages.
+** Refactor to make code more readable.
+* Adapted to changes in core MediaWiki since 1.25:
+** Moved $wgPageShowWatchingUsers which was removed from core in 1.25 to 
$whoiswathing_showwatchingusers
+** Since the message had to be changed anyway, moved the message from 
number_of_watching_users_pageview to whoiswatchingpageview
+* Remove use of sprintf for i18n construction.
diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
new file mode 12
index 000..b0936e8
--- /dev/null
+++ b/ChangeLog.mediawiki
@@ -0,0 +1 @@
+ChangeLog
\ No newline at end of file
diff --git a/WhoIsWatching.i18n.php b/WhoIsWatching.i18n.php
deleted file mode 100644
index 6df9df6..000
--- a/WhoIsWatching.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShim6c3b7e8be40a26ae' ) ) {
-   function wfJsonI18nShim6c3b7e8be40a26ae( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = di

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Touch up comment start in header

2017-08-21 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/343310 )

Change subject: Touch up comment start in header
..


Touch up comment start in header

Change-Id: I263b94213d94c5f2dbc28e561e890c9f9737e6dd
---
M src/Hook.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/src/Hook.php b/src/Hook.php
index 4fd62cf..ac87c3f 100644
--- a/src/Hook.php
+++ b/src/Hook.php
@@ -1,5 +1,5 @@
 https://gerrit.wikimedia.org/r/343310
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I263b94213d94c5f2dbc28e561e890c9f9737e6dd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...PluggableAuth[master]: Encode url properly

2017-08-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372760 )

Change subject: Encode url properly
..

Encode url properly

Bug: T173627
Change-Id: I165bbc3f56394fd135d21c982695cfb21ba37b8c
---
M PluggableAuthHooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PluggableAuth 
refs/changes/60/372760/1

diff --git a/PluggableAuthHooks.php b/PluggableAuthHooks.php
index 325dc6f..f98ba72 100644
--- a/PluggableAuthHooks.php
+++ b/PluggableAuthHooks.php
@@ -157,7 +157,7 @@
$oldTitle = $title;
$title = Title::newFromText( "UserLogin", NS_SPECIAL );
$out->redirect( $title->getFullURL( [
-   'returnto' => $oldTitle,
+   'returnto' => urlencode( $oldTitle ),
'returntoquery' => $request->getRawQueryString()
] ) );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I165bbc3f56394fd135d21c982695cfb21ba37b8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PluggableAuth
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Add the ability to notify watchers of parent categories

2017-08-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370774 )

Change subject: Add the ability to notify watchers of parent categories
..

Add the ability to notify watchers of parent categories

Needs to be tested.

Change-Id: Ic7d32294a573fcb95b96e8c00f6792c39abdb5d8
---
M CategoryWatch.php
M README.md
2 files changed, 100 insertions(+), 4 deletions(-)


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

diff --git a/CategoryWatch.php b/CategoryWatch.php
index cfd3fca..aca8f23 100644
--- a/CategoryWatch.php
+++ b/CategoryWatch.php
@@ -223,6 +223,97 @@
}
}
}
+
+   global $wgCategoryWatchNotifyParentWatchers;
+   if ( $wgCategoryWatchNotifyParentWatchers ) {
+   self::notifyParentWatchers();
+   }
+   }
+
+   /**
+* Notify the watchers of parent categories
+*/
+   protected static function notifyParentWatchers() {
+   self::$watcher->allparents = [];
+   self::$watcher->i = 0;
+   self::$watcher->findCategoryParents( self::$watcher->after );
+   ## For each active parent category, send the mail
+   if ( self::$watcher->allparents ) {
+   $page = $article->getTitle();
+   $pageurl  = $page->getFullUrl();
+   foreach ( self::$watcher->allparents as $cat ) {
+   $title   = Title::newFromText( $cat, 
NS_CATEGORY );
+   $message = wfMessage(
+   'categorywatch-catchange', $page,
+   self::$watcher->friendlyCat( $cat )
+   );
+   self::$watcher->notifyWatchers(
+   $title, $user, $message, $summary, 
$medit, $pageurl
+   );
+   }
+   }
+   }
+
+   /**
+* Recursively find all parents of the given categories
+*
+* @param array $catarray the categories
+*/
+   protected function findCategoryParents( array $catarray ) {
+   $this->i++;
+   if ( $this->i == 200 ) {
+   return;
+   }
+
+   if ( $catarray ) {
+   foreach ( $catarray as $catname ) {
+   self::$watcher->allparents[] = $catname;
+   $id = self::$watcher->getCategoryArticleId( 
$catname );
+   if ( is_numeric( $id ) ) {
+   $parentCat = 
self::$watcher->getParentCategories( $id );
+   if ( $parentCat ) {
+   self::$watcher->allparents[] = 
$parentCat;
+   
self::$watcher->findCategoryParents( [ $parentCat ] );
+   }
+   }
+   }
+   self::$watcher->allparents = array_unique( 
self::$watcher->allparents );
+   }
+   }
+
+   /**
+* Return the parent categories
+* @param int $id Category Article id
+* @return parents
+*/
+   protected function getParentCategories( $id ) {
+   $dbr  = wfGetDB( DB_SLAVE );
+   $cl   = $dbr->tableName( 'categorylinks' );
+   $res  = $dbr->select(
+   $cl, 'cl_to', "cl_from = $id", __METHOD__,
+   [ 'ORDER BY' => 'cl_sortkey' ]
+   );
+   $row = $dbr->fetchRow( $res );
+   $dbr->freeResult( $res );
+   if ( empty( $row[0] ) ) {
+   return false;
+   }
+   return $row[0];
+   }
+
+   /**
+* Load page ID of one category
+*
+* @param string $catname name of category
+* @return int
+*/
+   protected function getCategoryArticleId( $catname ) {
+   $dbr = wfGetDB( DB_SLAVE );
+   $cl  = $dbr->tableName( 'page' );
+   $res = $dbr->select( $cl, 'page_id', "page_title = '$catname'", 
__METHOD__ );
+   $row = $dbr->fetchRow( $res );
+   $dbr->freeResult( $res );
+   return $row[0];
}
 
/**
diff --git a/README.md b/README.md
index 1fb356e..6433bdf 100644
--- a/README.md
+++ b/README.md
@@ -18,14 +18,19 @@
 $wgCategoryWatchNotifyEditor = true;
 ```
 
-Set this to give every user a unique category that they're automatically 
watching. The format of the category name is defined on the 
"categorywatch-autocat" lo

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Fix up

2017-08-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370773 )

Change subject: Fix up
..

Fix up

* Trim long lines.
* Add copyright notice.
* Fix up config variable prefix in extension.json.
* Use a protected class variable instead of a global variable for
  storing instance.
* Move comments providing documentation for globals to README.
* Fix up doc comments to comply with coding conventions.

Change-Id: I33ae7ce52c371c54d002862ae984863283193e9a
---
M CategoryWatch.php
M README.md
M extension.json
3 files changed, 242 insertions(+), 133 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryWatch 
refs/changes/73/370773/1

diff --git a/CategoryWatch.php b/CategoryWatch.php
index e576d63..cfd3fca 100644
--- a/CategoryWatch.php
+++ b/CategoryWatch.php
@@ -1,11 +1,32 @@
 https://www.mediawiki.org/Extension:CategoryWatch for installation and 
usage details
- * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch for 
development notes and disucssion
+ * Copyright (C) 2008  Aran Dunkley
+ * Copyright (C) 2017  Sean Chen
+ * Copyright (C) 2017  Mark A. Hershberger
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * See https://www.mediawiki.org/Extension:CategoryWatch
+ * for installation and usage details
+ * See http://www.organicdesign.co.nz/Extension_talk:CategoryWatch
+ * for development notes and disucssion
  *
  * @file
  * @ingroup Extensions
@@ -14,125 +35,138 @@
  * @licence GNU General Public Licence 2.0 or later
  */
 
-# Whether or not to also send notificaton to the person 
-# who made the change
-# The default value is set in file extension.json
-//$wgCategoryWatchNotifyEditor = true;
-
-# Set this to give every user a unique category that 
-# they're automatically watching
-# - the format of the category name is defined on the 
-# "categorywatch-autocat" localisation message
-# The default value is set in file extension.json
-//$wgCategoryWatchUseAutoCat = false;
-
-# Set this to make the categorisation work by realname 
-# instead of username
-# The default value is set in file extension.json
-//$wgCategoryWatchUseAutoCatRealName = false;
-
 class CategoryWatch {
+   // Instance
+   protected static $watcher;
 
/**
 * The extension function.
 * It has to be the static function in a class now.
 */
-   public static function wfSetupCategoryWatch() {
-   wfDebugLog('CategoryWatch', 'loading extension...');
-   global $wgCategoryWatch;
+   public static function setupCategoryWatch() {
+   wfDebugLog( 'CategoryWatch', 'loading extension...' );
 
-   # Instantiate the CategoryWatch singleton now 
-# that the environment is prepared
-   $wgCategoryWatch = new CategoryWatch();
-   }
-
-   function __construct() {
-   # the constructor will do nothing now.
-   # New extension register process will use the file
-   # extension.json to set hooks.
+   # Instantiate the CategoryWatch singleton now
+   # that the environment is prepared
+   self::$watcher = new CategoryWatch();
}
 
/**
-* Get a list of categories before article updated
-* Since MediaWiki version 1.25.x, we have to use static function
-* for hooks.
-* the hook has different signatures.
+* Get a list of categories before article updated Since MediaWiki
+* version 1.25.x, we have to use static function for hooks.  the
+* hook has different signatures.
+* @param WikiPage $wikiPage the page
+* @param User $user who is modifying
+* @param Content $content the new article content
+* @param string $summary the article summary (comment)
+* @param bool $isMinor minor flag
+* @param bool $isWatch watch flag (not used, aka always null)
+* @param int $section section number (not used, aka always null)
+* @param int $flags see WikiPage::doEditContent documentation for 
flags' definition
+* @param Status $status Status (object)
 */
-   public static function onPageCon

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: Emacs settings

2017-08-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370767 )

Change subject: Emacs settings
..

Emacs settings

Change-Id: I6f00a10eede26256974008afba9344d3fbb29892
---
A .dir-locals.el
M .gitignore
2 files changed, 102 insertions(+), 0 deletions(-)


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

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..75ce2ef
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,89 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(lice:default-license . "gpl-3.0")
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+ (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+(inclass . +)
+(incomposition . +)
+(inexpr-class . +)
+(inexpr-statement . +)
+(inextern-lang . +)
+(inher-cont . 
c-lineup-multi-inher)
+(inher-intro . +)
+(inlambda . 0)
+(inline-close . 0)
+(inline-open . 0)
+(inmodule . +)
+  

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: i18n the modern, js way

2017-08-08 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370766 )

Change subject: i18n the modern, js way
..

i18n the modern, js way

Change-Id: I1fcf62124fd828a13b932571272967593b4d838a
---
D CategoryWatch.i18n.php
M extension.json
A i18n/ar.json
A i18n/arz.json
A i18n/ba.json
A i18n/be-tarask.json
A i18n/bg.json
A i18n/br.json
A i18n/bs.json
A i18n/ca.json
A i18n/cs.json
A i18n/cy.json
A i18n/da.json
A i18n/de.json
A i18n/dsb.json
A i18n/el.json
A i18n/en.json
A i18n/eo.json
A i18n/es.json
A i18n/eu.json
A i18n/fi.json
A i18n/fr.json
A i18n/frp.json
A i18n/gl.json
A i18n/gsw.json
A i18n/gu.json
A i18n/he.json
A i18n/hsb.json
A i18n/hu.json
A i18n/ia.json
A i18n/id.json
A i18n/it.json
A i18n/ja.json
A i18n/km.json
A i18n/ko.json
A i18n/ksh.json
A i18n/lb.json
A i18n/li.json
A i18n/lt.json
A i18n/mk.json
A i18n/ms.json
A i18n/nl.json
A i18n/nn.json
A i18n/no.json
A i18n/oc.json
A i18n/pdc.json
A i18n/pl.json
A i18n/pms.json
A i18n/pt-br.json
A i18n/pt.json
A i18n/qqq.json
A i18n/ro.json
A i18n/roa-tara.json
A i18n/ru.json
A i18n/sah.json
A i18n/sk.json
A i18n/sr-ec.json
A i18n/sr-el.json
A i18n/stq.json
A i18n/sv.json
A i18n/te.json
A i18n/tl.json
A i18n/tr.json
A i18n/uk.json
A i18n/vi.json
A i18n/vo.json
A i18n/yi.json
A i18n/zh-hans.json
A i18n/zh-hant.json
69 files changed, 949 insertions(+), 901 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryWatch 
refs/changes/66/370766/1

diff --git a/CategoryWatch.i18n.php b/CategoryWatch.i18n.php
deleted file mode 100644
index a70e3f2..000
--- a/CategoryWatch.i18n.php
+++ /dev/null
@@ -1,899 +0,0 @@
- 'Extends watchlist functionality to include 
notification about membership changes of watched categories',
-   'categorywatch-emailsubject' => "Activity involving watched category 
\"$1\"",
-   'categorywatch-catmovein' => "$1 has moved into $2 from $3",
-   'categorywatch-catmoveout' => "$1 has moved out of $2 into $3",
-   'categorywatch-catadd' => "$1 has been added to $2",
-   'categorywatch-catsub' => "$1 has been removed from $2",
-   'categorywatch-autocat' => "Automatically watched by $1",
-);
-
-/** Message documentation (Message documentation)
- * @author Fryed-peach
- * @author Purodha
- * @author Siebrand
- * @author The Evil IP address
- */
-$messages['qqq'] = array(
-   'categorywatch-desc' => '{{desc}}',
-   'categorywatch-catmovein' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is the target category name
-* $3 is the source category name',
-   'categorywatch-catmoveout' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is the source category name
-* $3 is the target category name',
-   'categorywatch-catadd' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is a category name',
-   'categorywatch-catsub' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is a category name',
-);
-
-/** Arabic (العربية)
- * @author Meno25
- * @author OsamaK
- */
-$messages['ar'] = array(
-   'categorywatch-desc' => 'يمدد وظيفة قائمة المراقبة لتشمل الإخطارات حول 
تغييرات العضوية للتصنيفات المراقبة',
-   'categorywatch-emailsubject' => 'النشاط الذي يشمل التصنيف المراقب "$1"',
-   'categorywatch-catmovein' => 'نقل $1 إلى التصنيف $2 من $3',
-   'categorywatch-catmoveout' => 'نقل $1 من التصنيف $2 إلى $3',
-   'categorywatch-catadd' => 'أضاف $1 إلى التصنيف $2',
-   'categorywatch-catsub' => 'أزال $1 من التصنيف $2',
-   'categorywatch-autocat' => 'مراقبة تلقائيا بواسطة $1',
-);
-
-/** Egyptian Spoken Arabic (مصرى)
- * @author Ghaly
- * @author Meno25
- */
-$messages['arz'] = array(
-   'categorywatch-desc' => 'يمدد وظيفة قائمة المراقبة لتشمل الإخطارات حول 
تغييرات العضوية للتصنيفات المراقبة',
-   'categorywatch-emailsubject' => 'النشاط الذى يشمل التصنيف المراقب "$1"',
-   'categorywatch-catmovein' => 'نقل $1 إلى التصنيف $2 من $3',
-   'categorywatch-catmoveout' => 'نقل $1 من التصنيف $2 إلى $3',
-   'categorywatch-catadd' => 'أضاف $1 إلى التصنيف $2',
-   'categorywatch-catsub' => 'ازال $1 من التصنيف $2',
-);
-
-/** Bashkir (Башҡортса)
- * @author Assele
- */
-$messages['ba'] = array(
-   'categorywatch-desc' => 'Күҙәтелгән категорияларға кергән биттәр 
исемлегенең үҙгәреүе тураһында белгертеү мөмкинлеге менән күҙәтеү исемлеген 
киңәйтә',
-   'categorywatch-emailsubject' => '"$1" категорияһына ҡағылған 
үҙгәртеүҙәр',
-   'categorywatch-catmovein' => '$1 битен $3 категорияһынан $2 
категорияһына күсергән',
-   'categorywatch-catmoveout' => '$1 битен $3 категорияһынан $2 
категорияһына күсергән',
-   'categorywatch-catadd' => '$2 категорияһына $1 битен өҫтәгән',
-   'categorywatch-catsub' => '$2 категорияһынан $1 битен юйған',
-   'categorywatch-autocat' =>

[MediaWiki-commits] [Gerrit] mediawiki...PluggableAuth[master]: Add earlier hook to avoid JS redirect

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

Change subject: Add earlier hook to avoid JS redirect
..

Add earlier hook to avoid JS redirect

Note that we have to pass in $title by ref because we will replace the object.

Change-Id: I3eff5988c95738ef6de5fd8404ad3becba09b0c8
---
M PluggableAuthHooks.php
1 file changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PluggableAuth 
refs/changes/85/369585/1

diff --git a/PluggableAuthHooks.php b/PluggableAuthHooks.php
index a82d024..724faec 100644
--- a/PluggableAuthHooks.php
+++ b/PluggableAuthHooks.php
@@ -176,4 +176,46 @@
unset( $personal_urls['logout'] );
}
}
+
+   /**
+* Implements PersonalUrls hook.
+* See https://www.mediawiki.org/wiki/Manual:Hooks/BeforeInitialize
+* Redirects ASAP to login
+* @param Title &$title being used for request
+* @param Article $article associated Article
+* @param OutputPage $out object
+* @param User $user current user
+* @param WebRequest $request why we're here
+* @param MediaWiki $mw object
+*
+* Note that $title has to be passed by ref so we can replace it.
+*/
+   public static function doBeforeInitialize(
+   Title &$title, Article $article, OutputPage $out, User $user,
+   WebRequest $request, MediaWiki $mw
+   ) {
+   if ( !$GLOBALS['wgPluggableAuth_EnableAutoLogin'] ) {
+   return;
+   }
+   if ( !$out->getUser()->isAnon() ) {
+   return;
+   }
+   if ( !User::isEveryoneAllowed( 'read' ) && $title->userCan( 
'read' ) ) {
+   return;
+   }
+   $loginSpecialPages = 
ExtensionRegistry::getInstance()->getAttribute(
+   'PluggableAuthLoginSpecialPages' );
+   foreach ( $loginSpecialPages as $page ) {
+   if ( $title->isSpecial( $page ) ) {
+   return;
+   }
+   }
+
+   $oldTitle = $title;
+   $title = Title::newFromText( "UserLogin", NS_SPECIAL );
+   $out->redirect( $title->getFullURL( [
+   'returnto' => $oldTitle,
+   'returntoquery' => $request->getRawQueryString()
+   ] ) );
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3eff5988c95738ef6de5fd8404ad3becba09b0c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PluggableAuth
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...PluggableAuth[master]: Conform to coding conventions

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

Change subject: Conform to coding conventions
..

Conform to coding conventions

* Address CodeSniffer issues.
* Add .dir-locals.el for emacs users.
* Introduce personal pref for long lines in argument lists
* Hooks don't need to return true any more.  Doing so makes
  CodeSniffer go bonkers w/o a comment.
* When passing in objects pass by ref isn't needed.

Change-Id: Iad94d077418078bb9d714606ff328b338a30b5cf
---
A .dir-locals.el
M PluggableAuthHooks.php
2 files changed, 125 insertions(+), 36 deletions(-)


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

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..2280495
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,88 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+ (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+(inclass . +)
+(incomposition . +)
+(inexpr-class . +)
+(inexpr-statement . +)
+(inextern-lang . +)
+(inher-cont . 
c-lineup-multi-inher)
+(inher-intro . +)
+  

[MediaWiki-commits] [Gerrit] mediawiki...CategoryWatch[master]: i18n the modern, js way

2017-07-29 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368568 )

Change subject: i18n the modern, js way
..

i18n the modern, js way
---
D CategoryWatch.i18n.php
M extension.json
A i18n/ar.json
A i18n/arz.json
A i18n/ba.json
A i18n/be-tarask.json
A i18n/bg.json
A i18n/br.json
A i18n/bs.json
A i18n/ca.json
A i18n/cs.json
A i18n/cy.json
A i18n/da.json
A i18n/de.json
A i18n/dsb.json
A i18n/el.json
A i18n/en.json
A i18n/eo.json
A i18n/es.json
A i18n/eu.json
A i18n/fi.json
A i18n/fr.json
A i18n/frp.json
A i18n/gl.json
A i18n/gsw.json
A i18n/gu.json
A i18n/he.json
A i18n/hsb.json
A i18n/hu.json
A i18n/ia.json
A i18n/id.json
A i18n/it.json
A i18n/ja.json
A i18n/km.json
A i18n/ko.json
A i18n/ksh.json
A i18n/lb.json
A i18n/li.json
A i18n/lt.json
A i18n/mk.json
A i18n/ms.json
A i18n/nl.json
A i18n/nn.json
A i18n/no.json
A i18n/oc.json
A i18n/pdc.json
A i18n/pl.json
A i18n/pms.json
A i18n/pt-br.json
A i18n/pt.json
A i18n/qqq.json
A i18n/ro.json
A i18n/roa-tara.json
A i18n/ru.json
A i18n/sah.json
A i18n/sk.json
A i18n/sr-ec.json
A i18n/sr-el.json
A i18n/stq.json
A i18n/sv.json
A i18n/te.json
A i18n/tl.json
A i18n/tr.json
A i18n/uk.json
A i18n/vi.json
A i18n/vo.json
A i18n/yi.json
A i18n/zh-hans.json
A i18n/zh-hant.json
69 files changed, 949 insertions(+), 901 deletions(-)


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

diff --git a/CategoryWatch.i18n.php b/CategoryWatch.i18n.php
deleted file mode 100644
index a70e3f2..000
--- a/CategoryWatch.i18n.php
+++ /dev/null
@@ -1,899 +0,0 @@
- 'Extends watchlist functionality to include 
notification about membership changes of watched categories',
-   'categorywatch-emailsubject' => "Activity involving watched category 
\"$1\"",
-   'categorywatch-catmovein' => "$1 has moved into $2 from $3",
-   'categorywatch-catmoveout' => "$1 has moved out of $2 into $3",
-   'categorywatch-catadd' => "$1 has been added to $2",
-   'categorywatch-catsub' => "$1 has been removed from $2",
-   'categorywatch-autocat' => "Automatically watched by $1",
-);
-
-/** Message documentation (Message documentation)
- * @author Fryed-peach
- * @author Purodha
- * @author Siebrand
- * @author The Evil IP address
- */
-$messages['qqq'] = array(
-   'categorywatch-desc' => '{{desc}}',
-   'categorywatch-catmovein' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is the target category name
-* $3 is the source category name',
-   'categorywatch-catmoveout' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is the source category name
-* $3 is the target category name',
-   'categorywatch-catadd' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is a category name',
-   'categorywatch-catsub' => 'Substituted as $5 in 
{{msg-mw|categorywatch-emailbody}}.
-* $1 is a page name
-* $2 is a category name',
-);
-
-/** Arabic (العربية)
- * @author Meno25
- * @author OsamaK
- */
-$messages['ar'] = array(
-   'categorywatch-desc' => 'يمدد وظيفة قائمة المراقبة لتشمل الإخطارات حول 
تغييرات العضوية للتصنيفات المراقبة',
-   'categorywatch-emailsubject' => 'النشاط الذي يشمل التصنيف المراقب "$1"',
-   'categorywatch-catmovein' => 'نقل $1 إلى التصنيف $2 من $3',
-   'categorywatch-catmoveout' => 'نقل $1 من التصنيف $2 إلى $3',
-   'categorywatch-catadd' => 'أضاف $1 إلى التصنيف $2',
-   'categorywatch-catsub' => 'أزال $1 من التصنيف $2',
-   'categorywatch-autocat' => 'مراقبة تلقائيا بواسطة $1',
-);
-
-/** Egyptian Spoken Arabic (مصرى)
- * @author Ghaly
- * @author Meno25
- */
-$messages['arz'] = array(
-   'categorywatch-desc' => 'يمدد وظيفة قائمة المراقبة لتشمل الإخطارات حول 
تغييرات العضوية للتصنيفات المراقبة',
-   'categorywatch-emailsubject' => 'النشاط الذى يشمل التصنيف المراقب "$1"',
-   'categorywatch-catmovein' => 'نقل $1 إلى التصنيف $2 من $3',
-   'categorywatch-catmoveout' => 'نقل $1 من التصنيف $2 إلى $3',
-   'categorywatch-catadd' => 'أضاف $1 إلى التصنيف $2',
-   'categorywatch-catsub' => 'ازال $1 من التصنيف $2',
-);
-
-/** Bashkir (Башҡортса)
- * @author Assele
- */
-$messages['ba'] = array(
-   'categorywatch-desc' => 'Күҙәтелгән категорияларға кергән биттәр 
исемлегенең үҙгәреүе тураһында белгертеү мөмкинлеге менән күҙәтеү исемлеген 
киңәйтә',
-   'categorywatch-emailsubject' => '"$1" категорияһына ҡағылған 
үҙгәртеүҙәр',
-   'categorywatch-catmovein' => '$1 битен $3 категорияһынан $2 
категорияһына күсергән',
-   'categorywatch-catmoveout' => '$1 битен $3 категорияһынан $2 
категорияһына күсергән',
-   'categorywatch-catadd' => '$2 категорияһына $1 битен өҫтәгән',
-   'categorywatch-catsub' => '$2 категорияһынан $1 битен юйған',
-   'categorywatch-autocat' => '$1 категорияһы үҙенән-үҙе күҙәтелә',
-);
-
-/** Bela

[MediaWiki-commits] [Gerrit] mediawiki...UserGroups[master]: Convert to extension registration

2017-07-22 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367125 )

Change subject: Convert to extension registration
..

Convert to extension registration

Also add some files that will help me work on this.

Change-Id: Ife9a3f5ea77baee80d6fad5cef420432e45d3deb
---
A .dir-locals.el
M .gitignore
D UserGroups.php
A extension.json
4 files changed, 147 insertions(+), 66 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UserGroups 
refs/changes/25/367125/1

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..ac271a9
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,89 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(lice:default-license . "gpl-3.0")
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+   (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+(inclass . +)
+(incomposition . +)
+(inexpr-class . +)
+(inexpr-statement . +)
+(inextern-lang . +)
+(inher-cont . 
c-lineup-multi-inher)
+(inher-intro . +)
+(inlambda . 0)
+(inline-close . 0)
+

[MediaWiki-commits] [Gerrit] mediawiki...LdapGroups[master]: Add .dir-locals.el

2017-07-22 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367111 )

Change subject: Add .dir-locals.el
..

Add .dir-locals.el

and comment

Change-Id: I0bbc124277a2c5527f4117290436d7ba04965e59
---
A .dir-locals.el
M src/LdapGroups.php
2 files changed, 94 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LdapGroups 
refs/changes/11/367111/1

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..75ce2ef
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,89 @@
+((nil . ((mode . flycheck)
+(mode . company)
+(mode . edep)
+(mode . subword)
+(tab-width . 4)
+(c-basic-offset . 4)
+(indent-tabs-mode . t)
+(lice:default-license . "gpl-3.0")
+(eval . (progn (when (fboundp 'delete-trailing-whitespace)
+ (delete-trailing-whitespace))
+ (tabify (point-min) 
(point-max
+(c-hanging-braces-alist
+ (defun-open after)
+ (block-open after)
+ (defun-close))
+(c-offsets-alist . (
+(access-label . -)
+(annotation-top-cont . 
0)
+(annotation-var-cont . 
+)
+(arglist-close . 
php-lineup-arglist-close)
+(arglist-cont-nonempty 
first
+   
php-lineup-cascaded-calls
+   
c-lineup-arglist)
+(arglist-intro . 
php-lineup-arglist-intro)
+(block-close . 0)
+(block-open . 0)
+(brace-entry-open . 0)
+(brace-list-close . 0)
+(brace-list-entry . 0)
+(brace-list-intro . +)
+(brace-list-open . 0)
+(c . 
c-lineup-C-comments)
+(case-label . 0)
+(catch-clause . 0)
+(class-close . 0)
+(comment-intro . 0)
+(composition-close . 0)
+(composition-open . 0)
+(cpp-define-intro 
c-lineup-cpp-define +)
+(cpp-macro . [0])
+(cpp-macro-cont . +)
+(defun-block-intro . +)
+(defun-close . 0)
+(defun-open . 0)
+(do-while-closure . 0)
+(else-clause . 0)
+(extern-lang-close . 0)
+(extern-lang-open . 0)
+(friend . 0)
+(func-decl-cont . +)
+(inclass . +)
+(incomposition . +)
+(inexpr-class . +)
+(inexpr-statement . +)
+(inextern-lang . +)
+(inher-cont . 
c-lineup-multi-inher)
+(inher-intro . +)
+(inlambda . 0)
+(inline-close . 0)
+(inline-open . 0)
+ 

[MediaWiki-commits] [Gerrit] mediawiki...LdapGroups[master]: Remove call to pluggablesso hook

2017-07-22 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367112 )

Change subject: Remove call to pluggablesso hook
..

Remove call to pluggablesso hook

which was just wrong

Change-Id: I37a60189d7c511c2010b4a8ebb809ddb55030e58
---
M src/LdapGroups.php
1 file changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LdapGroups 
refs/changes/12/367112/1

diff --git a/src/LdapGroups.php b/src/LdapGroups.php
index 9b75e83..0a9cd25 100644
--- a/src/LdapGroups.php
+++ b/src/LdapGroups.php
@@ -160,14 +160,11 @@
 
public function fetchLDAPData( User $user ) {
$email = $user->getEmail();
-   if ( !$email ) {
-   \Hooks::run( 'PluggableSSOEmail', [ &$email ] );
-   if( !$email ) {
-   // Fail early
-   throw new MWException( "No email found for 
$user" );
-   }
-   $user->setEmail( $email );
+   if( !$email ) {
+   // Fail early
+   throw new MWException( "No email found for $user" );
}
+
wfDebug( __METHOD__ . ": Fetching user data for $user from 
LDAP\n" );
$entry = $this->doLDAPSearch( $this->param['searchattr'] .
"=" . 
$user->getEmail() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37a60189d7c511c2010b4a8ebb809ddb55030e58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LdapGroups
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...LdapGroups[master]: Clean up with coding standards

2017-07-22 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367113 )

Change subject: Clean up with coding standards
..

Clean up with coding standards

house keeping

Change-Id: Ic0726ef43ae3fcc3c4ea2627d665487500c295f0
---
M .dir-locals.el
M .gitignore
M extension.json
A src/Hook.php
M src/LdapGroups.php
5 files changed, 117 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LdapGroups 
refs/changes/13/367113/1

diff --git a/.dir-locals.el b/.dir-locals.el
index 75ce2ef..ac271a9 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -8,7 +8,7 @@
 (lice:default-license . "gpl-3.0")
 (eval . (progn (when (fboundp 'delete-trailing-whitespace)
  (delete-trailing-whitespace))
- (tabify (point-min) 
(point-max
+   (tabify (point-min) 
(point-max
 (c-hanging-braces-alist
  (defun-open after)
  (block-open after)
diff --git a/.gitignore b/.gitignore
index 07fe9ec..18693be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,6 @@
 *~
 \#*#
 .#*
-.tramp_history
\ No newline at end of file
+.tramp_history
+
+PHPTAGS.sqlite
diff --git a/extension.json b/extension.json
index 35db3f0..b323f6a 100644
--- a/extension.json
+++ b/extension.json
@@ -17,7 +17,8 @@
]
},
"AutoloadClasses": {
-   "LdapGroups\\LdapGroups": "src/LdapGroups.php"
+   "LdapGroups\\LdapGroups": "src/LdapGroups.php",
+   "LdapGroups\\Hook": "src/Hook.php"
},
"GroupPermissions": {
"sysop": {
@@ -31,7 +32,7 @@
"LdapGroups": "LdapGroups\\LdapGroups::makeConfig"
},
"Hooks": {
-   "PluggableAuthPopulateGroups": [ "LdapGroups::populateGroups" ]
+   "PluggableAuthPopulateGroups": [ 
"LdapGroups\\Hook::populateGroups" ]
},
"config": {
"_prefix": "LdapGroups",
diff --git a/src/Hook.php b/src/Hook.php
new file mode 100644
index 000..0afea52
--- /dev/null
+++ b/src/Hook.php
@@ -0,0 +1,39 @@
+http://www.gnu.org/licenses/>.
+ */
+
+namespace LdapGroups;
+
+class Hook {
+   /**
+* Hook to handle group population for a user
+* @param User $user to map
+*/
+   public static function populateGroups( User $user ) {
+   $config
+   = ConfigFactory::getDefaultInstance()->makeConfig( 
'LdapGroups' );
+   $here = self::newFromIniFile( $config->get( "IniFile" ) );
+
+   $here->fetchLDAPData( $user );
+
+   // Make sure user is in the right groups;
+   $here->mapGroups( $user );
+   }
+}
diff --git a/src/LdapGroups.php b/src/LdapGroups.php
index dde1609..525af82 100644
--- a/src/LdapGroups.php
+++ b/src/LdapGroups.php
@@ -32,17 +32,31 @@
protected $ldapGroupMap;
protected $mwGroupMap;
 
+   /**
+* Constructor for LdapGroups
+* @param string $param extension
+*/
public function __construct( $param ) {
wfDebug( __METHOD__ );
$this->param = $param;
$this->setupGroupMap();
}
 
-   static public function makeConfig() {
+   /**
+* Get the config accessor
+* @return GlobalVarConfig
+*/
+   public static function makeConfig() {
return new GlobalVarConfig( 'LdapGroups' );
}
 
-   static public function newFromIniFile( $iniFile = null ) {
+   /**
+* The ini constructor
+* @param mixed $iniFile to read from for old style mapping.
+* @return LdapGroups
+* @throws MWException
+*/
+   public static function newFromIniFile( $iniFile = null ) {
if ( !is_readable( $iniFile ) ) {
throw new MWException( "Can't read '$iniFile'" );
}
@@ -54,9 +68,13 @@
return new LdapGroups( $data );
}
 
-   protected function setGroupRestrictions( $groupMap = [] ) {
+   /**
+* Restrict what can be done with these groups on Special:UserRights
+* @param array $groupMap The map
+*/
+   protected function setGroupRestrictions( array $groupMap ) {
global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups;
-   foreach( $groupMap as $name => $DNs ) {
+   foreach ( $groupMap as $name => $DNs ) {
if ( !isset( $wgGroupPermissions[$name] ) ) {
$wgGroupPermissions[$name] = 
$wgGroupPermissions['user'];
}
@@ -68,8 +86,8 @@
 
// Restrict the ability of users to change these rights
f

[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: Use group rights for viewlinktolatest instead of page rights.

2017-07-19 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366303 )

Change subject: Use group rights for viewlinktolatest instead of page rights.
..

Use group rights for viewlinktolatest instead of page rights.

Found during user testing.

Bug: T171004
Change-Id: I0d1084e9bfe5de2cabac4cb3985ef500ba44d9b7
---
M ApprovedRevs.hooks.php
M ApprovedRevs_body.php
2 files changed, 13 insertions(+), 2 deletions(-)


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

diff --git a/ApprovedRevs.hooks.php b/ApprovedRevs.hooks.php
index de53f8a..e4e738a 100644
--- a/ApprovedRevs.hooks.php
+++ b/ApprovedRevs.hooks.php
@@ -446,7 +446,7 @@
return false;
}
 
-   if ( ! $title->userCan( 'viewlinktolatest' ) ) {
+   if ( ! ApprovedRevs::userCanViewLatest( $title ) ) {
return false;
}
 
@@ -823,7 +823,7 @@
 
// If the user isn't supposed to see these kinds of
// messages, exit.
-   if ( ! $title->userCan( 'viewlinktolatest' ) ) {
+   if ( ! ApprovedRevs::userCanViewLatest( $title ) ) {
return false;
}
 
diff --git a/ApprovedRevs_body.php b/ApprovedRevs_body.php
index c384590..63417ff 100644
--- a/ApprovedRevs_body.php
+++ b/ApprovedRevs_body.php
@@ -142,6 +142,17 @@
return $isApprovable;
}
 
+   public static function userCanViewLatest( $title ) {
+   global $wgUser;
+
+   $permission = 'viewlinktolatest';
+   if ( ! $title->userCan( $permission )
+&& ! $wgUser->isAllowed( $permission ) ) {
+   return false;
+   }
+   return true;
+   }
+
public static function userCanApprove( $title ) {
global $egApprovedRevsSelfOwnedNamespaces, $wgUser;
$permission = 'approverevisions';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d1084e9bfe5de2cabac4cb3985ef500ba44d9b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ApprovedRevs[master]: ApprovedRevs only recognises per-page rights, not group rights

2017-07-18 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366171 )

Change subject: ApprovedRevs only recognises per-page rights, not group rights
..

ApprovedRevs only recognises per-page rights, not group rights

When testing to see if a user has the approverevisions right, the only
check is of $title->userCan('approverevisions'). This check, though
has hooks that allow other code to alter the value returned on a
per-page basis.

Instead, $wgUser->isAllowed('approverevisions') should be used since
it is a general check on the approverevisions right.

Change-Id: I77e3c4bbe0b73b6d3992eaf41dbc6eec2ebbc82f
---
M ApprovedRevs_body.php
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApprovedRevs 
refs/changes/71/366171/1

diff --git a/ApprovedRevs_body.php b/ApprovedRevs_body.php
index f59a955..d279b25 100644
--- a/ApprovedRevs_body.php
+++ b/ApprovedRevs_body.php
@@ -14,7 +14,7 @@
static $mApprovedContentForPage = array();
static $mApprovedRevIDForPage = array();
static $mUserCanApprove = null;
-
+   
/**
 * Gets the approved revision ID for this page, or null if there isn't
 * one.
@@ -49,8 +49,8 @@
 * (otherwise).
 */
public static function getPageText( $title, $revisionID = null ) {
-   $revision = Revision::newFromTitle( $title, $revisionID );
-   return $revision->getContent()->getNativeData();
+   $revision = Revision::newFromTitle( $title, $revisionID 
);
+   return $revision->getContent()->getNativeData();
}
 
/**
@@ -143,7 +143,8 @@
}
 
public static function userCanApprove( $title ) {
-   global $egApprovedRevsSelfOwnedNamespaces;
+   global $egApprovedRevsSelfOwnedNamespaces, $wgUser;
+   $permission = 'approverevisions';
 
// $mUserCanApprove is a static variable used for
// "caching" the result of this function, so that
@@ -152,7 +153,8 @@
return true;
} elseif ( self::$mUserCanApprove === false ) {
return false;
-   } elseif ( $title->userCan( 'approverevisions' ) ) {
+   } elseif ( $title->userCan( $permission )
+  || $wgUser->isAllowed( $permission ) ) {
self::$mUserCanApprove = true;
return true;
} else {
@@ -161,7 +163,6 @@
// revisions - it depends on whether the current
// namespace is within the admin-defined
// $egApprovedRevsSelfOwnedNamespaces array.
-   global $wgUser;
$namespace = $title->getNamespace();
if ( in_array( $namespace, 
$egApprovedRevsSelfOwnedNamespaces ) ) {
if ( $namespace == NS_USER ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77e3c4bbe0b73b6d3992eaf41dbc6eec2ebbc82f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApprovedRevs
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: ignore .tramp_history

2017-07-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365465 )

Change subject: ignore .tramp_history
..

ignore .tramp_history

Change-Id: I2e8a0ebb6da2e603ed5124be65eeccfde3a73f45
---
M .gitignore
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index aa302b0..2f5650e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@
 .\#*
 
 PHPTAGS.sqlite
+.tramp_history

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e8a0ebb6da2e603ed5124be65eeccfde3a73f45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Give some idea of time remaining

2017-07-06 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363737 )

Change subject: Give some idea of time remaining
..

Give some idea of time remaining

Bug: T169931
Change-Id: I3c80727516c329e5b911e9f29d17a2a9e860f44d
---
M maintenance/updateRestrictions.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/363737/1

diff --git a/maintenance/updateRestrictions.php 
b/maintenance/updateRestrictions.php
index 96eaf82..02b4405 100644
--- a/maintenance/updateRestrictions.php
+++ b/maintenance/updateRestrictions.php
@@ -57,7 +57,7 @@
$blockEnd = $start + $this->mBatchSize - 1;
$encodedExpiry = 'infinity';
while ( $blockEnd <= $end ) {
-   $this->output( "...doing page_id from $blockStart to 
$blockEnd\n" );
+   $this->output( "...doing page_id from $blockStart to 
$blockEnd out of $end\n" );
$cond = "page_id BETWEEN $blockStart AND $blockEnd AND 
page_restrictions !=''";
$res = $db->select(
'page',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c80727516c329e5b911e9f29d17a2a9e860f44d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Widgets[REL1_27]: Fix hard-coding of paths

2017-06-25 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361305 )

Change subject: Fix hard-coding of paths
..

Fix hard-coding of paths

From christi3k's patch for Mozilla's WikiMo

https://github.com/MozillaWiki/mediawiki-widgets/commit/140b2cf133316de7f2c4c00e1353668c6fc6907b

Change-Id: Ic61616830a8517dbf6b69be402d16425440f31cd
(cherry picked from commit 615848f1ed6d478f189005ae6a59919a30205453)
---
M WidgetRenderer.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/WidgetRenderer.php b/WidgetRenderer.php
index 9b47099..58f1cf2 100644
--- a/WidgetRenderer.php
+++ b/WidgetRenderer.php
@@ -27,7 +27,7 @@
$smarty->compile_dir = $wgWidgetsCompileDir;
 
// registering custom Smarty plugins
-   $smarty->addPluginsDir( 
"$IP/extensions/Widgets/smarty_plugins/" );
+   $smarty->addPluginsDir( __DIR__ . "/smarty_plugins/" );
 
$smarty->enableSecurity();
// These settings were for Smarty v2 - they don't seem to

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic61616830a8517dbf6b69be402d16425440f31cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Widgets
Gerrit-Branch: REL1_27
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...ConfirmAccount[master]: Pay attention to CAPTCHA failures

2017-06-24 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361283 )

Change subject: Pay attention to CAPTCHA failures
..

Pay attention to CAPTCHA failures

The CAPTCHA is shown, but without this hook it is ignored.

Bug: T168783
Change-Id: Id9518664f85b2c718591c15662a9978bae01efd0
---
M frontend/ConfirmAccountUI.setup.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmAccount 
refs/changes/83/361283/1

diff --git a/frontend/ConfirmAccountUI.setup.php 
b/frontend/ConfirmAccountUI.setup.php
index 5924fca..ce454c4 100644
--- a/frontend/ConfirmAccountUI.setup.php
+++ b/frontend/ConfirmAccountUI.setup.php
@@ -20,6 +20,8 @@
$hooks['AdminLinks'][] = 
'ConfirmAccountUIHooks::confirmAccountAdminLinks';
# Pre-fill/lock the form if its for an approval
$hooks['AuthChangeFormFields'][] = 
'ConfirmAccountUIHooks::onAuthChangeFormFields';
+# Let the CAPTCHA block an account request.
+   $hooks['AbortNewAccount'][] = 
'ConfirmEditHooks::confirmUserCreate';
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9518664f85b2c718591c15662a9978bae01efd0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmAccount
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...PluggableAuth[master]: Formatting changes

2017-06-15 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359173 )

Change subject: Formatting changes
..

Formatting changes

* Standardize style
* Break up long lines

Change-Id: Ie6df2eb19b3e3e5226df6863ba0f3a87094e11a9
---
M PluggableAuthBeginAuthenticationRequest.php
M PluggableAuthHooks.php
M PluggableAuthLogin.php
M PluggableAuthPrimaryAuthenticationProvider.php
M ext.PluggableAuthAutoLogin.js
5 files changed, 48 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PluggableAuth 
refs/changes/73/359173/1

diff --git a/PluggableAuthBeginAuthenticationRequest.php 
b/PluggableAuthBeginAuthenticationRequest.php
index a08946f..b4716a5 100644
--- a/PluggableAuthBeginAuthenticationRequest.php
+++ b/PluggableAuthBeginAuthenticationRequest.php
@@ -24,14 +24,15 @@
 
 use \MediaWiki\Auth\ButtonAuthenticationRequest;
 
-class PluggableAuthBeginAuthenticationRequest extends 
ButtonAuthenticationRequest {
+class PluggableAuthBeginAuthenticationRequest extends
+   ButtonAuthenticationRequest {
 
public function __construct() {
parent::__construct(
'pluggableauthlogin',
-   wfMessage('pluggableauth-loginbutton-label'),
-   wfMessage('pluggableauth-loginbutton-help'),
-   true);
+   wfMessage( 'pluggableauth-loginbutton-label' ),
+   wfMessage( 'pluggableauth-loginbutton-help' ), true
+   );
}
 
 }
diff --git a/PluggableAuthHooks.php b/PluggableAuthHooks.php
index d550b8a..ee26983 100644
--- a/PluggableAuthHooks.php
+++ b/PluggableAuthHooks.php
@@ -45,7 +45,9 @@
$primaries = $providers['primaryauth'];
foreach ( $primaries as $key => $provider ) {
if ( in_array( $provider['class'], 
$passwordProviders ) ) {
-   unset( 
$GLOBALS['wgAuthManagerAutoConfig']['primaryauth'][$key] );
+   unset(
+   
$GLOBALS['wgAuthManagerAutoConfig']['primaryauth'][$key]
+   );
}
}
}
@@ -60,7 +62,9 @@
 * @since 2.0
 *
 */
-   public static function onTitleReadWhitelist( $title, $user, 
&$whitelisted ) {
+   public static function onTitleReadWhitelist(
+   $title, $user, &$whitelisted
+   ) {
$loginSpecialPages = 
ExtensionRegistry::getInstance()->getAttribute(
'PluggableAuthLoginSpecialPages' );
foreach ( $loginSpecialPages as $page ) {
@@ -85,8 +89,9 @@
 * @param array $formDescriptor
 * @param $action
 */
-   public static function onAuthChangeFormFields( array $requests,
-   array $fieldInfo, array &$formDescriptor, $action) {
+   public static function onAuthChangeFormFields(
+   array $requests, array $fieldInfo, array &$formDescriptor, 
$action
+   ) {
if ( isset( $formDescriptor['pluggableauthlogin'] ) ) {
$formDescriptor['pluggableauthlogin']['weight'] = 101;
}
@@ -103,8 +108,9 @@
 * @param $inject_html
 * @param $old_name
 */
-   public static function deauthenticate( User &$user, $inject_html,
-   $old_name ) {
+   public static function deauthenticate(
+   User &$user, $inject_html, $old_name
+   ) {
$old_user = User::newFromName( $old_name );
if ( $old_user === false ) {
return true;
@@ -168,8 +174,9 @@
 * @param Title $title
 * @param SkinTemplate $skin
 */
-   public static function modifyLoginURLs( array &$personal_urls,
-   Title $title = null, SkinTemplate $skin = null ) {
+   public static function modifyLoginURLs(
+   array &$personal_urls, Title $title = null, SkinTemplate $skin 
= null
+   ) {
if ( $GLOBALS['wgPluggableAuth_EnableAutoLogin'] ) {
unset( $personal_urls['logout'] );
}
diff --git a/PluggableAuthLogin.php b/PluggableAuthLogin.php
index 1ab86bb..aec1b78 100644
--- a/PluggableAuthLogin.php
+++ b/PluggableAuthLogin.php
@@ -44,8 +44,9 @@
$pluggableauth = PluggableAuth::singleton();
$error = null;
if ( $pluggableauth ) {
-   if ( $pluggableauth->authenticate( $id, $username, 
$realname, $email,
-   $error ) ) {
+   if (
+   $pluggableauth->authenticate( $id, $username, 
$realname, $email, $error
+  

[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: Avoid a backtrace when running

2017-06-13 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358892 )

Change subject: Avoid a backtrace when running
..

Avoid a backtrace when running

This populates the field with random data if there is none so that the primary 
key condition does not produce a backtrace.

Without this change, the table contained 11 \0's in these columns—the result of 
forcing nulls to have a value (NOT NULL) in a binary field.

Bug: T167843
Change-Id: I7ce64bbe20f55282395c0dec287639727ec2b235
---
M db_patches/patch-ref_id-phase2.sql
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/db_patches/patch-ref_id-phase2.sql 
b/db_patches/patch-ref_id-phase2.sql
index 6ae67e5..b6712d7 100644
--- a/db_patches/patch-ref_id-phase2.sql
+++ b/db_patches/patch-ref_id-phase2.sql
@@ -1,3 +1,6 @@
+UPDATE /*_*/flow_wiki_ref SET ref_id=unhex(replace(uuid(), '-', '')) WHERE 
ref_id IS NULL OR ref_id=repeat(unhex(0), 11);
+UPDATE /*_*/flow_ext_ref SET ref_id=unhex(replace(uuid(), '-', '')) WHERE 
ref_id IS NULL OR ref_id=repeat(unhex(0), 11);
+
 ALTER TABLE /*_*/flow_wiki_ref CHANGE ref_id ref_id BINARY(11) NOT NULL;
 ALTER TABLE /*_*/flow_ext_ref CHANGE ref_id ref_id BINARY(11) NOT NULL;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ce64bbe20f55282395c0dec287639727ec2b235
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update documentation URL

2017-05-30 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356323 )

Change subject: Update documentation URL
..

Update documentation URL

Change-Id: I6a32689c5d224674fe96ad631b073f9efba47e3f
---
M includes/mail/EmailNotification.php
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/356323/1

diff --git a/includes/mail/EmailNotification.php 
b/includes/mail/EmailNotification.php
index d66e7e3..932797a 100644
--- a/includes/mail/EmailNotification.php
+++ b/includes/mail/EmailNotification.php
@@ -43,7 +43,8 @@
  * of sending out bulk mails (bcc:user1,user2...) for all these users having 
the
  * same timeoffset in their preferences.
  *
- * Visit the documentation pages under http://meta.wikipedia.com/Enotif
+ * Visit the documentation pages under
+ * https://www.mediawiki.org/wiki/Help:Watching_pages
  */
 class EmailNotification {
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a32689c5d224674fe96ad631b073f9efba47e3f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Gadgets[REL1_27]: Address strict warning

2017-05-10 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353141 )

Change subject: Address strict warning
..

Address strict warning

Change-Id: I11e9a6254952a4779b4afc5313974bb5090c4a91
---
M Gadgets_body.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/Gadgets_body.php b/Gadgets_body.php
index 9e75abd..f0e4af7 100644
--- a/Gadgets_body.php
+++ b/Gadgets_body.php
@@ -252,7 +252,7 @@
 * Returns names of resources this gadget depends on
 * @return Array
 */
-   public function getDependencies() {
+   public function getDependencies( ResourceLoaderContext $context = null 
) {
return $this->dependencies;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11e9a6254952a4779b4afc5313974bb5090c4a91
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: REL1_27
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...Widgets[master]: Fix hard-coding of paths

2017-05-06 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/352353 )

Change subject: Fix hard-coding of paths
..

Fix hard-coding of paths

From christi3k's patch for Mozilla's WikiMo

https://github.com/MozillaWiki/mediawiki-widgets/commit/140b2cf133316de7f2c4c00e1353668c6fc6907b

Change-Id: Ic61616830a8517dbf6b69be402d16425440f31cd
---
M WidgetRenderer.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Widgets 
refs/changes/53/352353/1

diff --git a/WidgetRenderer.php b/WidgetRenderer.php
index 27db8ad..97bed1b 100644
--- a/WidgetRenderer.php
+++ b/WidgetRenderer.php
@@ -27,7 +27,7 @@
$smarty->compile_dir = $wgWidgetsCompileDir;
 
// registering custom Smarty plugins
-   $smarty->addPluginsDir( 
"$IP/extensions/Widgets/smarty_plugins/" );
+   $smarty->addPluginsDir( __DIR__ . "smarty_plugins/" );
 
$smarty->enableSecurity();
// These settings were for Smarty v2 - they don't seem to

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic61616830a8517dbf6b69be402d16425440f31cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Widgets
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Recover lost fix for redirect bug

2017-04-25 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350326 )

Change subject: Recover lost fix for redirect bug
..

Recover lost fix for redirect bug

Bug: T149250
Change-Id: I9060af0d1369c94e212329b7a2e4ef3ba6a94394
---
M i18n/en.json
M src/Hook.php
2 files changed, 7 insertions(+), 3 deletions(-)


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

diff --git a/i18n/en.json b/i18n/en.json
index 7e51951..f554ddb 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,7 +12,7 @@
"specialwhoiswatchingusage": "This special page cannot be used on its 
own.",
"specialwhoiswatchingaddusers": "Add users to watch the page",
"specialwhoiswatchingaddbtn": "Add selected users",
-   "whoiswatching_users_pageview": 
"[{{fullurl:Special:WhoIsWatching/{{FULLPAGENAMEE $1] watching 
{{PLURAL:$1|user|users}}",
+   "whoiswatching_users_pageview": "[{{fullurl:Special:WhoIsWatching/$2}} 
$1] watching {{PLURAL:$1|user|users}}",
"whoiswatching-not-possible-title": "Impossible page to watch",
"whoiswatching-not-possible": "It is not possible to watch the [[$1]] 
page.",
"whoiswatching-usage-title": "How to use this page",
diff --git a/src/Hook.php b/src/Hook.php
index fd13fc9..4fd62cf 100644
--- a/src/Hook.php
+++ b/src/Hook.php
@@ -36,6 +36,10 @@
$conf = new GlobalVarConfig( "whoiswatching_" );
$showIfZero = $conf->get( "showifzero" );
$title = $template->getTitle();
+   if ( $title->isRedirect() ) {
+   $article = Article::newFromID( $title->getArticleID() );
+   $title = $article->getRedirectTarget();
+   }
$user = $template->getUser();
$showWatchingUsers = $conf->get( "showwatchingusers" )
   || $user->isAllowed( 
'seepagewatchers' );
@@ -48,9 +52,9 @@
], __METHOD__ );
$watch = $dbr->fetchObject( $res );
if ( $watch->count > 0 || $showIfZero ) {
+   $lang = 
RequestContext::getMain()->getLanguage();
$msg = wfMessage( 
'whoiswatching_users_pageview',
-   
RequestContext::getMain()->getLanguage()->formatNum
- ( 
$watch->count )
+ 
$lang->formatNum( $watch->count ), $title
)->parse();
$tpl->set( 'numberofwatchingusers', $msg );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9060af0d1369c94e212329b7a2e4ef3ba6a94394
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Make README match mw.org better

2017-04-25 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350261 )

Change subject: Make README match mw.org better
..

Make README match mw.org better

Change-Id: Ibedaa9f7067c9644b379bfde9bc9ad62149de0d8
---
M README.mediawiki
1 file changed, 68 insertions(+), 39 deletions(-)


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

diff --git a/README.mediawiki b/README.mediawiki
index b69717a..f8a072e 100644
--- a/README.mediawiki
+++ b/README.mediawiki
@@ -1,4 +1,4 @@
-The WhoIsWatching extension allows to find out who is watching a particular 
page, and add others to watchlist for that page
+The '''WhoIsWatching''' extension allows to find out who is watching a 
particular page, and add others to watchlist for that page
 
 == Rationale ==
 Even though this notion goes against Wikipedia and Wikimedia 
[[w:en:Wikipedia:Watchlist#Privacy_of_watchlists|privacy policy]], some wikis 
may actually like to see which of its users are watching particular pages. This 
extension provides just such an interface at the bottom of every page. 
Additionally, this extension has an option to allow any user to add any page to 
any other user's watch list.
@@ -21,7 +21,8 @@
 
 === Additional Configuration ===
 You can simply start using the extension without changing anything else. The 
only additional configuration that is currently possible for the extension 
defines how to display the names of the users watching the pages. In 
''SpecialWhoIsWatching.php'', there is
-# Set the following to either 'UserName' or 'RealName' to 
display the list of watching users as such.
+# Set the following to either 'UserName' or 'RealName' to 
change how watching
+# users are displayed.
 $whoiswatching_nametype = 'RealName';
 
 As the comment implies, depending on the value of this variable, you can 
display either the real names of the watching users or their wiki usernames. 
The reason some wiki's may want to switch over to the 'UserName' mode is if 
they do not require their members to have a valid real name.
@@ -47,47 +48,75 @@
 
 The first time after a you submit a request to remove a page from the users 
watchlist, the user is still shown on the form.  To get around this it is 
disabled and displayed with a red strikethrough.
 
+(There maybe a way to address this in a better way, patches welcome!)
+
 == Revisions ==
-*0.12 -- 2016-05-22:  '''Incompatibilites''':
-** Requires at least MediaWiki 1.26
+;0.12.1 - April 15,  2017
+* Deprecated PHP entry point was removed.
 
-** If you've made changes to the message displayed at the bottom of the page 
in [[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
+;0.12.0 - May 22, 2016
+'''Incompatibilites''':
+* Requires at least MediaWiki 1.26
 
-** Note the use of permissions is preferred to globals to allow access to the 
Special Page '''Other Changes''':
-** Use extension.json
+* If you've made changes to the message displayed at the bottom of the page in 
[[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
 
-** Remove .i18n.php stub.
+* Note the use of permissions is preferred to globals to allow access to the 
Special Page
 
-** Add rights so that we can use those instead of globals to control access:
-*** addpagetoanywatchlist: gets to use the special page to add users.
-*** seepagewatchers: gets to see the watchers.
+'''Other Changes''':
+* Use extension.json
 
-** Clean up WhoIsWatching::execute() method:
-*** Use fewer globals.  Use GlobalVarConfig where possible.
-*** Use protected methods for various parts of the execution path.
-*** Add stub (WhoIsWatching::eNotifUser()) to later notify editors when their 
watchlists are changed.
-*** Add stub (WhoIsWatching::uiNotifyUser()) to later provide better feedback 
to users of this extension.
-*** Instead of listing out every user to choose from, provide autocomplete for 
user selection.
-*** Instead of showing a confusing "usage" message, provide an autocomplete 
input box so that the user can select a page to inspect.
-*** Provide slightly better error messages.
-*** Refactor to make code more readable.
+* Remove .i18n.php stub.
 
-** Adapted to changes in core MediaWiki since 1.25:
-*** Moved $wgPageShowWatchingUsers which was removed from core in 1.25 to 
$whoiswathing_showwatchingusers
-*** Since the message had to be changed anyway, moved the message from 
number_of_watching_users_pageview to whoiswatchingpageview
-*** Remove use of sprintf for i18n construction.
-* v0.9 - October 6, 2008
-** Fixed the extension instantiation to work across MW versions
-** Fixed the feature that displays count of users if zero
-* v0.8 - September 29, 2008 - optionally display a count of 0 watching users 
(contributed 

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: More file reorg + hack for deleting users

2017-04-25 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350245 )

Change subject: More file reorg + hack for deleting users
..

More file reorg + hack for deleting users

Change-Id: I21a989957efbb8057ccda8a14448358b20e3c721
---
M .gitignore
M README.mediawiki
M extension.json
A modules/ext.whoIsWatching.css
A src/Hook.php
R src/SpecialWhoIsWatching.php
6 files changed, 99 insertions(+), 56 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index 8d96304..aa302b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,5 @@
 .*.swp
 \#*\#
 .\#*
+
+PHPTAGS.sqlite
diff --git a/README.mediawiki b/README.mediawiki
index 02a8242..b69717a 100644
--- a/README.mediawiki
+++ b/README.mediawiki
@@ -43,6 +43,10 @@
 $wgGroupPermissions['user']['seepagewatchers'] = true;
 
 
+== Known Issues ==
+
+The first time after a you submit a request to remove a page from the users 
watchlist, the user is still shown on the form.  To get around this it is 
disabled and displayed with a red strikethrough.
+
 == Revisions ==
 *0.12 -- 2016-05-22:  '''Incompatibilites''':
 ** Requires at least MediaWiki 1.26
@@ -87,4 +91,3 @@
 * v0.3 - November 25, 2007 - More standard way to load i18n messages (resolve 
bug about "Call to undefined function wfLoadExtensionMessages()")
 * v0.2 - November 23, 2007
 * v0.1 - October 12, 2007 - Initial publication.
-
diff --git a/extension.json b/extension.json
index 6f2ebd8..5863794 100644
--- a/extension.json
+++ b/extension.json
@@ -15,7 +15,7 @@
"descriptionmsg": "whoiswatching-desc",
"type": "specialpage",
"SpecialPages": {
-   "WhoIsWatching": "WhoIsWatching\\WhoIsWatching"
+   "WhoIsWatching": "WhoIsWatching\\SpecialWhoIsWatching"
},
"MessagesDirs": {
"WhoIsWatching": [
@@ -26,11 +26,12 @@
"WhoIsWatchingAlias": "src/i18n/Alias.php"
},
"AutoloadClasses": {
-   "WhoIsWatching\\WhoIsWatching": "src/SpecialPage.php"
+   "WhoIsWatching\\SpecialWhoIsWatching": 
"src/SpecialWhoIsWatching.php",
+   "WhoIsWatching\\Hook": "src/Hook.php"
},
"Hooks": {
"SkinTemplateOutputPageBeforeExec": [
-   
"WhoIsWatching\\WhoIsWatching::onSkinTemplateOutputPageBeforeExec"
+   
"WhoIsWatching\\Hook::onSkinTemplateOutputPageBeforeExec"
]
},
"GroupPermissions": {
@@ -43,6 +44,17 @@
"addpagetoanywatchlist",
"seepagewatchers"
],
+   "ResourceModules": {
+   "ext.whoIsWatching": {
+   "styles": [
+   "modules/ext.whoIsWatching.css"
+   ]
+   }
+   },
+   "ResourceFileModulePaths": {
+   "localBasePath": "",
+   "remoteExtPath": ""
+   },
"config": {
"_prefix": "whoiswatching_",
"nametype": "RealName",
diff --git a/modules/ext.whoIsWatching.css b/modules/ext.whoIsWatching.css
new file mode 100644
index 000..867016e
--- /dev/null
+++ b/modules/ext.whoIsWatching.css
@@ -0,0 +1,3 @@
+input:disabled+label {
+   text-decoration: line-through red;
+}
diff --git a/src/Hook.php b/src/Hook.php
new file mode 100644
index 000..fd13fc9
--- /dev/null
+++ b/src/Hook.php
@@ -0,0 +1,61 @@
+http://www.gnu.org/licenses/>.
+ */
+
+namespace WhoIsWatching;
+
+use GlobalVarConfig;
+use QuickTemplate;
+use RequestContext;
+use Skin;
+
+class Hook {
+   /**
+* Hook to display link to page watchers
+* @param Skin $template skin
+* @param QuickTemplate $tpl template
+* @return boolean
+*/
+   public static function onSkinTemplateOutputPageBeforeExec(
+   Skin $template, QuickTemplate $tpl
+   ) {
+   $conf = new GlobalVarConfig( "whoiswatching_" );
+   $showIfZero = $conf->get( "showifzero" );
+   $title = $template->getTitle();
+   $user = $template->getUser();
+   $showWatchingUsers = $conf->get( "showwatchingusers" )
+  || $user->isAllowed( 
'seepagewatchers' );
+
+   if ( $title->getNamespace() >= 0 && $showWatchingUsers ) {
+   $dbr = wfGetDB( DB_SLAVE );
+   $res = $dbr->select( 'watchlist', 'COUNT(*) as count', [
+'wl_namespace' 
=> $title->getNamespace(),
+'wl_title' => 
$title->getDBkey(),
+   ], __METHOD__ );
+   $watch = $dbr->fetchObject( $res );
+   if ( $watch->coun

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: reorg files and get ready for release

2017-04-25 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350244 )

Change subject: reorg files and get ready for release
..

reorg files and get ready for release

Change-Id: I9a9428d8586f8c58c44387bb14e4698d030763d6
---
D ChangeLog.mediawiki
A README.mediawiki
D WhoIsWatching_body.php
M extension.json
A src/SpecialPage.php
R src/i18n/Alias.php
6 files changed, 455 insertions(+), 273 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WhoIsWatching 
refs/changes/44/350244/1

diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
deleted file mode 100644
index 8fba8eb..000
--- a/ChangeLog.mediawiki
+++ /dev/null
@@ -1,28 +0,0 @@
-Changes since 0.11:
-
-
-Incompatibilites:
-* Requires at least MediaWiki 1.26
-* If you've made changes to the message displayed at the bottom of the page in 
[[MediaWiki:number_of_watching_users_pageview]], you'll need to see if it 
matches what is in [[MediaWiki:whoiswatchingpageview]] on your wiki.
-* Note the use of permissions is preferred to globals to allow access to the 
Special Page
-
-
-Other Changes:
-* Use extension.json
-* Remove .i18n.php stub.
-* Add rights so that we can use those instead of globals to control access:
-** addpagetoanywatchlist: gets to use the special page to add users.
-** seepagewatchers: gets to see the watchers.
-* Clean up WhoIsWatching::execute() method:
-** Use fewer globals.  Use GlobalVarConfig where possible.
-** Use protected methods for various parts of the execution path.
-** Add stub (WhoIsWatching::eNotifUser()) to later notify editors when their 
watchlists are changed.
-** Add stub (WhoIsWatching::uiNotifyUser()) to later provide better feedback 
to users of this extension.
-** Instead of listing out every user to choose from, provide autocomplete for 
user selection.
-** Instead of showing a confusing "usage" message, provide an autocomplete 
input box so that the user can select a page to inspect.
-** Provide slightly better error messages.
-** Refactor to make code more readable.
-* Adapted to changes in core MediaWiki since 1.25:
-** Moved $wgPageShowWatchingUsers which was removed from core in 1.25 to 
$whoiswathing_showwatchingusers
-** Since the message had to be changed anyway, moved the message from 
number_of_watching_users_pageview to whoiswatchingpageview
-* Remove use of sprintf for i18n construction.
diff --git a/README.mediawiki b/README.mediawiki
new file mode 100644
index 000..02a8242
--- /dev/null
+++ b/README.mediawiki
@@ -0,0 +1,90 @@
+The WhoIsWatching extension allows to find out who is watching a particular 
page, and add others to watchlist for that page
+
+== Rationale ==
+Even though this notion goes against Wikipedia and Wikimedia 
[[w:en:Wikipedia:Watchlist#Privacy_of_watchlists|privacy policy]], some wikis 
may actually like to see which of its users are watching particular pages. This 
extension provides just such an interface at the bottom of every page. 
Additionally, this extension has an option to allow any user to add any page to 
any other user's watch list.
+
+== Installation Instructions ==
+=== Step 1 ===
+Download the version of the extension code appropriate for your MediaWiki 
version from [[Special:ExtensionDistributor/WhoIsWatching|here]] and extract 
into the '''extensions/WhoIsWatching''' folder.
+
+=== Step 2 ===
+Add the following text to your 
'''[[Manual:LocalSettings.php|LocalSettings.php]]'''
+wfLoadExtension( "WhoIsWatching" );
+# $whoiswatching_nametype = "RealName";
+# $whoiswatching_allowaddingpeople = false;
+# $whoiswatching_showifzero = true;
+# $whoiswatching_showwatchingusers = false;
+# $whoiswatching_maxPicklistUsers = 10;
+# $wgGroupPermissions['sysop']['addpagetoanywatchlist'] = true;
+# $wgGroupPermissions['sysop']['seepagewatchers'] = true;
+
+
+=== Additional Configuration ===
+You can simply start using the extension without changing anything else. The 
only additional configuration that is currently possible for the extension 
defines how to display the names of the users watching the pages. In 
''SpecialWhoIsWatching.php'', there is
+# Set the following to either 'UserName' or 'RealName' to 
display the list of watching users as such.
+$whoiswatching_nametype = 'RealName';
+
+As the comment implies, depending on the value of this variable, you can 
display either the real names of the watching users or their wiki usernames. 
The reason some wiki's may want to switch over to the 'UserName' mode is if 
they do not require their members to have a valid real name.
+
+Another configurable option in the extension is the ability to switch on/off 
the option to allow any user to add any page to any other user's watch list. 
This is done in ''SpecialWhoIsWatching.php'', where there is
+# Set true if you don't want to use permissions and users 
are allowed to add
+# to other user's watchlists.
+$whoiswatching_allowaddingpeople = true;
+
+

[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Rename ChangeLog to ChangeLog.mediawiki for github

2017-04-24 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350106 )

Change subject: Rename ChangeLog to ChangeLog.mediawiki for github
..


Rename ChangeLog to ChangeLog.mediawiki for github

Change-Id: Ib48f690af93dab8e6a8cff59ec6d63a043cb0fa9
---
D ChangeLog.mediawiki
R ChangeLog.mediawiki
2 files changed, 0 insertions(+), 1 deletion(-)

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



diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
deleted file mode 12
index b0936e8..000
--- a/ChangeLog.mediawiki
+++ /dev/null
@@ -1 +0,0 @@
-ChangeLog
\ No newline at end of file
diff --git a/ChangeLog b/ChangeLog.mediawiki
similarity index 100%
rename from ChangeLog
rename to ChangeLog.mediawiki

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib48f690af93dab8e6a8cff59ec6d63a043cb0fa9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 
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...WhoIsWatching[master]: Rename ChangeLog to ChangeLog.mediawiki for github

2017-04-24 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350106 )

Change subject: Rename ChangeLog to ChangeLog.mediawiki for github
..

Rename ChangeLog to ChangeLog.mediawiki for github

Change-Id: Ib48f690af93dab8e6a8cff59ec6d63a043cb0fa9
---
D ChangeLog.mediawiki
R ChangeLog.mediawiki
2 files changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/ChangeLog.mediawiki b/ChangeLog.mediawiki
deleted file mode 12
index b0936e8..000
--- a/ChangeLog.mediawiki
+++ /dev/null
@@ -1 +0,0 @@
-ChangeLog
\ No newline at end of file
diff --git a/ChangeLog b/ChangeLog.mediawiki
similarity index 100%
rename from ChangeLog
rename to ChangeLog.mediawiki

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib48f690af93dab8e6a8cff59ec6d63a043cb0fa9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...WhoIsWatching[master]: Add hook for on output page

2017-04-24 Thread MarkAHershberger (Code Review)
MarkAHershberger has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350105 )

Change subject: Add hook for on output page
..

Add hook for on output page

Change-Id: I37e028c07be7ef1ae78848e3a382d5270d1625e1
---
M WhoIsWatching_body.php
1 file changed, 27 insertions(+), 0 deletions(-)


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

diff --git a/WhoIsWatching_body.php b/WhoIsWatching_body.php
index a87e585..5f24910 100644
--- a/WhoIsWatching_body.php
+++ b/WhoIsWatching_body.php
@@ -236,4 +236,31 @@
 
return true;
}
+
+   public static function onSkinTemplateOutputPageBeforeExec( Skin 
$template, QuickTemplate $tpl ) {
+   $conf = new GlobalVarConfig( "whoiswatching_" );
+   $showIfZero = $conf->get( "showifzero" );
+   $showWatchingUsers = $conf->get( "showwatchingusers" );
+
+   if (
+   
RequestContext::getMain()->getOutput()->getTitle()->getNamespace() >= 0 &&
+   $showWatchingUsers
+   ) {
+   $dbr = wfGetDB( DB_SLAVE );
+   $title = $template->getTitle();
+   $res = $dbr->select( 'watchlist', 'COUNT(*) as count', [
+'wl_namespace' 
=> $title->getNamespace(),
+'wl_title' => 
$title->getDBkey(),
+   ], __METHOD__ );
+   $watch = $dbr->fetchObject( $res );
+   if ( $watch->count > 0 || $showIfZero ) {
+   $msg = wfMessage( 
'whoiswatching_users_pageview',
+   
RequestContext::getMain()->getLanguage()->formatNum( $watch->count )
+   )->parse();
+   $tpl->set( 'numberofwatchingusers', $msg );
+   }
+   }
+
+   return true;
+   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37e028c07be7ef1ae78848e3a382d5270d1625e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WhoIsWatching
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 

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


[MediaWiki-commits] [Gerrit] mediawiki...LdapGroups[master]: tramp history

2017-04-13 Thread MarkAHershberger (Code Review)
MarkAHershberger has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348101 )

Change subject: tramp history
..


tramp history

Change-Id: I4ae2fc7b35a5e37da733d64622746d5436e45725
---
M .gitignore
M src/LdapGroups.php
2 files changed, 27 insertions(+), 26 deletions(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved



diff --git a/.gitignore b/.gitignore
index 306ad56..5a01b88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *~
 \#*#
-.#*
\ No newline at end of file
+.#*
+.tramp_history
\ No newline at end of file
diff --git a/src/LdapGroups.php b/src/LdapGroups.php
index 3b78b0a..d676539 100644
--- a/src/LdapGroups.php
+++ b/src/LdapGroups.php
@@ -108,7 +108,7 @@
$this->setGroupRestrictions( $groupMap );
}
 
-protected function setupConnection() {
+   protected function setupConnection() {
$this->ldap = ldap_connect( $this->param['server'] );
if ( !$this->ldap ) {
throw new MWException( "Error Connecting to LDAP 
server!" );
@@ -121,37 +121,37 @@
throw new MWException( "Couldn't bind to LDAP server: " 
.
   ldap_error( 
$this->ldap ) );
}
-}
+   }
 
protected function doLDAPSearch( $match ) {
wfProfileIn( __METHOD__ );
$runTime = -microtime( true );
-$key = wfMemcKey( 'ldapgroups', $match );
-$cache = wfGetMainCache();
-$entry = $cache->get( $key );
-if ( $entry === false ) {
-wfProfileIn( __METHOD__ . " - LDAP Search" );
-if ( !$this->ldap ) {
-$this->setupConnection();
-}
+   $key = wfMemcKey( 'ldapgroups', $match );
+   $cache = wfGetMainCache();
+   $entry = $cache->get( $key );
+   if ( $entry === false ) {
+   wfProfileIn( __METHOD__ . " - LDAP Search" );
+   if ( !$this->ldap ) {
+   $this->setupConnection();
+   }
 
-$res = ldap_search( $this->ldap, $this->param['basedn'],
-$match, [ "*" ] );
-if ( !$res ) {
-wfProfileOut( __METHOD__ . " - LDAP Search" );
-wfProfileOut( __METHOD__ );
-throw new MWException( "Error in LDAP search: " .
-   ldap_error( $this->ldap ) );
-}
+   $res = ldap_search( $this->ldap, $this->param['basedn'],
+   $match, [ "*" ] 
);
+   if ( !$res ) {
+   wfProfileOut( __METHOD__ . " - LDAP Search" );
+   wfProfileOut( __METHOD__ );
+   throw new MWException( "Error in LDAP search: " 
.
+  
ldap_error( $this->ldap ) );
+   }
 
-$entry = ldap_get_entries( $this->ldap, $res );
-$cache->set( $key, $entry, 3600 * 24 );
+   $entry = ldap_get_entries( $this->ldap, $res );
+   $cache->set( $key, $entry, 3600 * 24 );
 
-wfProfileOut( __METHOD__ . " - LDAP Search" );
-}
-wfProfileOut( __METHOD__ );
-$runTime += microtime( true );
-wfDebugLog( __CLASS__, "Ran LDAP search for '$match' in $runTime 
seconds.\n" );
+   wfProfileOut( __METHOD__ . " - LDAP Search" );
+   }
+   wfProfileOut( __METHOD__ );
+   $runTime += microtime( true );
+   wfDebugLog( __CLASS__, "Ran LDAP search for '$match' in 
$runTime seconds.\n" );
return $entry;
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4ae2fc7b35a5e37da733d64622746d5436e45725
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LdapGroups
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger 
Gerrit-Reviewer: MarkAHershberger 

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


  1   2   3   4   5   6   7   8   >