[MediaWiki-commits] [Gerrit] mediawiki...Video[master]: Implement Special:UnusedVideos

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

Change subject: Implement Special:UnusedVideos
..

Implement Special:UnusedVideos

Bug: T184902
Change-Id: I4304a022eda96e14820dd9351e2bc09918e7dcb7
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/Video.alias.php
M includes/Video.hooks.php
A includes/specials/SpecialUnusedVideos.php
6 files changed, 140 insertions(+), 37 deletions(-)


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

diff --git a/extension.json b/extension.json
index 5ca8bf9..4855cbb 100644
--- a/extension.json
+++ b/extension.json
@@ -1,10 +1,11 @@
 {
"name": "Video",
-   "version": "1.7.2",
+   "version": "1.8.2",
"author": [
"David Pean",
"Jack Phoenix",
-   "John Du Hart"
+   "John Du Hart",
+   "Mainframe98"
],
"license-name": "GPL-2.0+",
"url": "https://www.mediawiki.org/wiki/Extension:Video";,
@@ -13,7 +14,8 @@
"SpecialPages": {
"AddVideo": "AddVideo",
"NewVideos": "NewVideos",
-   "Undelete": "SpecialUndeleteWithVideoSupport"
+   "Undelete": "SpecialUndeleteWithVideoSupport",
+   "UnusedVideos": "SpecialUnusedVideos"
},
"MessagesDirs": {
"Video": [
@@ -68,7 +70,8 @@
"NewVideos": "includes/specials/SpecialNewVideos.php",
"SpecialUndeleteWithVideoSupport": 
"includes/specials/SpecialUndeleteWithVideoSupport.php",
"VideoHooks": "includes/Video.hooks.php",
-   "NewVideosPager": "includes/specials/pagers/NewVideosPager.php"
+   "NewVideosPager": "includes/specials/pagers/NewVideosPager.php",
+   "SpecialUnusedVideos": 
"includes/specials/SpecialUnusedVideos.php"
},
"Hooks": {
"ArticleFromTitle": [
@@ -105,6 +108,9 @@
],
"CanonicalNamespaces": [
"VideoHooks::onCanonicalNamespaces"
+   ],
+   "wgQueryPages": [
+   "VideoHooks::onwgQueryPages"
]
},
"ResourceFileModulePaths": {
diff --git a/i18n/en.json b/i18n/en.json
index a3d13d4..f165bc1 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -8,6 +8,7 @@
"video-desc": "Allows new Video namespace for embeddable media on 
supported sites",
"addvideo": "Add video",
"newvideos": "New videos",
+   "unusedvideos": "Unused videos",
"video-upload-new-version": "Upload a new version of this video",
"video-newvideos-showfrom": "Show new videos starting from $2, $1",
"video-newvideos-list-text": "Below is a list of $1 
{{PLURAL:$1|video|videos}}.",
@@ -45,5 +46,6 @@
"video-showhidebots": "($1 bots)",
"action-addvideo": "add videos from external services into the site",
"right-addvideo": "Add videos from external services into the site",
-   "video-hidebots": "Hide uploads by bots"
+   "video-hidebots": "Hide uploads by bots",
+   "unusedvideos-summary": "The following videos have been added to the 
wiki but are not used on any pages. Please note that other web sites may link 
to a file with a direct URL, and so may still be listed here despite being in 
active use."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 139fdd9..d6f1ccb 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -47,5 +47,6 @@
"video-showhidebots": "This is shown on the special page 
[[Special:NewVideos]]. The format is 
\"{{int:video-showhidebots|[[MediaWiki:Hide/{{SUBPAGENAME}}|{{int:hide}}]]}}\" 
or 
\"{{int:showhidebots|[[MediaWiki:Show/{{SUBPAGENAME}}|{{int:show}}]]}}\"\n\n{{Identical|$1
 bots}}",
"action-addvideo": "{{doc-action|addvideo}}",
"right-addvideo": "{{doc-right|addvideo}}",
-   "video-hidebots": "Used as label for a checkbox. When unchecked, 
[[Special:NewVideos]] will also display uploads by users in the bots group."
+   "video-hidebots": "Used as label for a checkbox. When unchecked, 
[[Special:NewVideos]] will also display uploads by users in the bots group.",
+   "unusedvideos-summary": "Header message of [[Special:UnusedVideos]]"
 }
diff --git a/includes/Video.alias.php b/includes/Video.alias.php
index 2967215..ea954ae 100644
--- a/includes/Video.alias.php
+++ b/includes/Video.alias.php
@@ -6,28 +6,30 @@
  * @ingroup Extensions
  */
 
-$specialPageAliases = array();
+$specialPageAliases = [];
 
 /** English */
-$specialPageAliases['en'] = array(
-   'AddVideo' => array( 'AddVideo' ),
-   'NewVideos' => array( 'NewVideos' ),
-);
+$specialPageAliases['en'] = [
+   'AddVideo' => [ 'AddVideo' ],
+   'NewVideos' => [ 'NewVideos' ],
+   'UnusedVideos' => [ 'UnusedVideos' ],
+];
 
 /** Finnish 

[MediaWiki-commits] [Gerrit] mediawiki...Nostalgia[master]: Don't style the special page selector like an OOUI button

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

Change subject: Don't style the special page selector like an OOUI button
..

Don't style the special page selector like an OOUI button

This doesn't match the appearance of the rest of the skin, nor is
it representative for Wikipedia from that time.

Bug: T184601
Change-Id: I1739b9f4d7f52ec73b312b1443d4e9c2fbab3484
---
M NostalgiaTemplate.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Nostalgia 
refs/changes/82/403482/1

diff --git a/NostalgiaTemplate.php b/NostalgiaTemplate.php
index 67dcf17..585889b 100644
--- a/NostalgiaTemplate.php
+++ b/NostalgiaTemplate.php
@@ -353,7 +353,11 @@
 
return Html::rawElement( 'form',
[ 'id' => 'specialpages', 'method' => 'get', 'action' 
=> $wgScript ],
-   $select->getHTML() . Xml::submitButton( wfMessage( 'go' 
)->text() ) );
+   $select->getHTML() . Html::element(
+   'input',
+   [ 'type' => 'submit', 'value' => wfMessage( 
'go' )->text() ]
+   )
+   );
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1739b9f4d7f52ec73b312b1443d4e9c2fbab3484
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Nostalgia
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...DeleteBatch[master]: Fix message ambiguity and allow omitting pipe

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

Change subject: Fix message ambiguity and allow omitting pipe
..

Fix message ambiguity and allow omitting pipe

The message shown on Special:DeleteBatch is commonly interpreted
as that the reason is optional, including the pipe that separates
the page name from the reason. While this is not necessarily an
issue, the real problem is that the script assumes there will be
a pipe and does not verify if the given line actually contained
one. This results in an error, but the script still continues to
run. Since the pipe is superfluous, allow omitting it.

Bug: T182455
Change-Id: If4d32cff2b09c9830ab07d17b93485d0b9be6cc8
---
M DeleteBatch.body.php
M i18n/en.json
2 files changed, 19 insertions(+), 7 deletions(-)


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

diff --git a/DeleteBatch.body.php b/DeleteBatch.body.php
index 893bbee..bafa2f7 100644
--- a/DeleteBatch.body.php
+++ b/DeleteBatch.body.php
@@ -255,25 +255,37 @@
if ( $filename ) { /* if from filename, delete from filename */
for ( $linenum = 1; !feof( $file ); $linenum++ ) {
$line = trim( fgets( $file ) );
-   if ( $line == false ) {
+   if ( !$line ) {
break;
}
/* explode and give me a reason
   the file should contain only "page 
title|reason"\n lines
   the rest is trash
*/
-   $arr = explode( "|", $line );
-   is_null( $arr[1] ) ? $reason = '' : $reason = 
$arr[1];
-   $this->deletePage( $arr[0], $reason, $dbw, 
true, $linenum );
+   if ( strpos( $line, '|' ) !== -1 ) {
+   $arr = explode( '|', $line );
+   } else {
+   $arr = [ $line ];
+   }
+   if ( count( $arr ) < 2 ) {
+   $arr[1] = '';
+   }
+   $this->deletePage( $arr[0], $arr[1], $dbw, 
true, $linenum );
}
} else {
/* run through text and do all like it should be */
$lines = explode( "\n", $line );
foreach ( $lines as $single_page ) {
+   $single_page =  trim( $single_page );
/* explode and give me a reason */
-   $page_data = explode( "|", trim( $single_page ) 
);
-   if ( count( $page_data ) < 2 )
+   if ( strpos( $single_page, '|' ) !== -1 ) {
+   $page_data = explode( '|', $single_page 
);
+   } else {
+   $page_data = [ $single_page ];
+   }
+   if ( count( $page_data ) < 2 ) {
$page_data[1] = '';
+   }
$this->deletePage( $page_data[0], 
$page_data[1], $dbw, false, 0, $OldUser );
}
}
diff --git a/i18n/en.json b/i18n/en.json
index 5eb1f52..fd35453 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -6,7 +6,7 @@
},
"deletebatch": "Delete batch of pages",
"deletebatch-desc": "[[Special:DeleteBatch|Delete a batch of pages]]",
-   "deletebatch-help": "Delete a batch of pages.\nYou can either perform a 
single delete, or delete pages listed in a file.\nChoose a user that will be 
shown in deletion logs.\nUploaded files should contain page name and optional 
reason, separated by a \"|\" character in each line.",
+   "deletebatch-help": "Delete a batch of pages.\nYou can either perform a 
single delete, or delete pages listed in a file.\nChoose a user that will be 
shown in deletion logs.\nUploaded files should contain page name and optional 
reason, separated by a \"|\".",
"deletebatch-caption": "Page list:",
"deletebatch-title": "Delete batch",
"deletebatch-link-back": "Go back to the special page",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4d32cff2b09c9830ab07d17b93485d0b9be6cc8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DeleteBatch
Gerrit-Branch: master
Gerrit-Owner: Mai

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix additional usage of incorrect case

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

Change subject: Fix additional usage of incorrect case
..

Fix additional usage of incorrect case

Courtesy of the PhpStorm inspection Case mismatch in method call or
class usage.

Bug: T166759
Change-Id: I27c53658b99048fa0dd8f9d6ef1398620386e1cc
---
M includes/AutoLoader.php
M includes/changes/ChangesListFilter.php
M includes/parser/ParserOutput.php
M includes/registration/ExtensionRegistry.php
M tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
M tests/phpunit/includes/jobqueue/JobTest.php
M tests/phpunit/structure/ResourcesTest.php
7 files changed, 14 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/53/398453/1

diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index 675e347..52410fe 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -133,5 +133,5 @@
}
 }
 
-Autoloader::$psr4Namespaces = AutoLoader::getAutoloadNamespaces();
+AutoLoader::$psr4Namespaces = AutoLoader::getAutoloadNamespaces();
 spl_autoload_register( [ 'AutoLoader', 'autoload' ] );
diff --git a/includes/changes/ChangesListFilter.php 
b/includes/changes/ChangesListFilter.php
index 2546f2b..1c86d44 100644
--- a/includes/changes/ChangesListFilter.php
+++ b/includes/changes/ChangesListFilter.php
@@ -468,7 +468,7 @@
 * @param FormOptions $opts
 * @return bool
 */
-   public function activelyInConflictWithFilter( ChangeslistFilter 
$filter, FormOptions $opts ) {
+   public function activelyInConflictWithFilter( ChangesListFilter 
$filter, FormOptions $opts ) {
if ( $this->isSelected( $opts ) && $filter->isSelected( $opts ) 
) {
/** @var ChangesListFilter $siblingFilter */
foreach ( $this->getSiblings() as $siblingFilter ) {
@@ -484,7 +484,7 @@
return false;
}
 
-   private function hasConflictWithFilter( ChangeslistFilter $filter ) {
+   private function hasConflictWithFilter( ChangesListFilter $filter ) {
return in_array( $filter, $this->getConflictingFilters() );
}
 
diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index ff9c28d..153a770 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -596,7 +596,7 @@
 
# Replace unnecessary URL escape codes with the referenced 
character
# This prevents spammers from hiding links from the filters
-   $url = parser::normalizeLinkUrl( $url );
+   $url = Parser::normalizeLinkUrl( $url );
 
$registerExternalLink = true;
if ( !$wgRegisterInternalExternals ) {
diff --git a/includes/registration/ExtensionRegistry.php 
b/includes/registration/ExtensionRegistry.php
index 994de97..6308461 100644
--- a/includes/registration/ExtensionRegistry.php
+++ b/includes/registration/ExtensionRegistry.php
@@ -323,7 +323,7 @@
}
 
if ( isset( $info['autoloaderNS'] ) ) {
-   Autoloader::$psr4Namespaces += $info['autoloaderNS'];
+   AutoLoader::$psr4Namespaces += $info['autoloaderNS'];
}
 
foreach ( $info['defines'] as $name => $val ) {
diff --git a/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php 
b/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
index db85727..aa59a5b 100644
--- a/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
+++ b/tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
@@ -300,28 +300,28 @@
 
private function provideAudienceCheckData( $field ) {
yield 'field accessible for oversighter (ALL)' => [
-   Revisionrecord::SUPPRESSED_ALL,
+   RevisionRecord::SUPPRESSED_ALL,
[ 'oversight' ],
true,
false
];
 
yield 'field accessible for oversighter' => [
-   Revisionrecord::DELETED_RESTRICTED | $field,
+   RevisionRecord::DELETED_RESTRICTED | $field,
[ 'oversight' ],
true,
false
];
 
yield 'field not accessible for sysops (ALL)' => [
-   Revisionrecord::SUPPRESSED_ALL,
+   RevisionRecord::SUPPRESSED_ALL,
[ 'sysop' ],
false,
false
];
 
yield 'field not accessible for sysops' => [
-   Revisionrecord::DELETED_RESTRICTED | $field,
+   RevisionRecord::DELETED_RESTRICTED | $field,
[ 'sysop' ],
   

[MediaWiki-commits] [Gerrit] mediawiki...Video[master]: Convert Special:AddVideo to use OOUI

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

Change subject: Convert Special:AddVideo to use OOUI
..

Convert Special:AddVideo to use OOUI

To achieve this, the special page now inherits from FormSpecialPage
rather than SpecialPage.

Bug: T179335
Change-Id: I7c5fccf07e6e06160b3c637594969916ada80f96
---
M includes/specials/SpecialAddVideo.php
1 file changed, 34 insertions(+), 44 deletions(-)


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

diff --git a/includes/specials/SpecialAddVideo.php 
b/includes/specials/SpecialAddVideo.php
index 2d0736d..07153bb 100644
--- a/includes/specials/SpecialAddVideo.php
+++ b/includes/specials/SpecialAddVideo.php
@@ -6,8 +6,7 @@
  * @file
  */
 
-class AddVideo extends SpecialPage {
-
+class AddVideo extends FormSpecialPage {
/**
 * New video object created when the title field is validated
 *
@@ -31,45 +30,39 @@
 *
 * @return string
 */
-   function getGroupName() {
+   public function getGroupName() {
return 'media';
}
 
/**
-* Show the special page
-*
-* @param mixed|null $par Parameter passed to the page or null
+* Add pre-text to the form
+* @return string HTML which will be sent to $form->addPreText()
 */
-   public function execute( $par ) {
-   $out = $this->getOutput();
+   protected function preText() {
+   $this->getOutput()->addModuleStyles( 'ext.video' );
 
-   // If the user doesn't have the required 'addvideo' permission, 
display an error
-   $this->checkPermissions();
+   return '';
+   }
 
-   // Show a message if the database is in read-only mode
-   $this->checkReadOnly();
-
-   // If user is blocked, s/he doesn't need to access this page
-   if ( $this->getUser()->isBlocked() ) {
-   throw new UserBlockedError( $this->getUser()->mBlock );
-   }
-
-   // Add CSS
-   $out->addModuleStyles( 'ext.video' );
-
-   $this->setHeaders();
-
-   $form = new HTMLForm( $this->getFormFields(), 
$this->getContext() );
+   /**
+* Play with the HTMLForm if you need to more substantially
+* @param HTMLForm $form
+*/
+   protected function alterForm( HTMLForm $form ) {
$form->setIntro( $this->msg( 'video-addvideo-instructions' 
)->parse() );
$form->setWrapperLegend( $this->msg( 'video-addvideo-title' 
)->plain() );
$form->setSubmitText( $this->msg( 'video-addvideo-button' 
)->plain() );
-   $form->setSubmitCallback( array( $this, 'submit' ) );
 
if ( $this->getRequest()->getCheck( 'forReUpload' ) ) {
$form->addHiddenField( 'forReUpload', true );
}
+   }
 
-   $form->show();
+   /**
+* Get display format for the form.
+*/
+   protected function getDisplayFormat() {
+   return 'ooui';
}
 
/**
@@ -84,7 +77,7 @@
$url = Video::getURLfromEmbedCode( $value );
}
 
-   return array( $url, Video::getProviderByURL( $url ) );
+   return [ $url, Video::getProviderByURL( $url ) ];
}
 
/**
@@ -93,14 +86,14 @@
 * Checks to see if the string given is a valid URL and corresponds
 * to a supported provider.
 *
-* @param array $value
+* @param string $value
 * @param array $allData
 * @return bool|string
 */
public function validateVideoField( $value, $allData ) {
list( , $provider ) = $this->getUrlAndProvider( $value );
 
-   if ( $provider == 'unknown' ) {
+   if ( $provider === 'unknown' ) {
return $this->msg( 'video-addvideo-invalidcode' 
)->plain();
}
 
@@ -140,7 +133,7 @@
 * @param array $data
 * @return bool
 */
-   public function submit( array $data ) {
+   public function onSubmit( array $data ) {
list( $url, $provider ) = $this->getUrlAndProvider( 
$data['Video'] );
 
$this->video->addVideo( $url, $provider, false, $data['Watch'] 
);
@@ -151,34 +144,31 @@
}
 
/**
-* Fields for HTMLForm
+* Get an HTMLForm descriptor array
 *
 * @return array
 */
protected function getFormFields() {
-   $fields = array(
-   'Title' => array(
+   return [
+   'Title' => [
'type' => 'text',
'label-message' => 'video-a

[MediaWiki-commits] [Gerrit] mediawiki...Video[master]: Fix the broken category in certain circumstances

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

Change subject: Fix the broken category in certain circumstances
..

Fix the broken category in certain circumstances

This occurs when the the UI language differs from the wikis
content language. The code uses the namespace name for the
category namespace based on the UI language. When a user has
a different language set in their preferences than the wiki
language, the category added will be in the wrong language
resulting in a broken link and uncategorized video.

This patch also introduces short array syntax.

Bug: T179332
Change-Id: I5e87e92e09b3c90e890e76e66066085d3006556e
---
M includes/Video.php
1 file changed, 43 insertions(+), 37 deletions(-)


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

diff --git a/includes/Video.php b/includes/Video.php
index 06fe244..c85f928 100644
--- a/includes/Video.php
+++ b/includes/Video.php
@@ -79,11 +79,16 @@
protected $context;
 
/**
+* @var \Wikimedia\Rdbms\IResultWrapper
+*/
+   private $historyRes;
+
+   /**
 * Array of providers codes to classes
 *
 * @var array
 */
-   static $providers = array(
+   static $providers = [
'bliptv' => 'BlipTVVideoProvider',
'dailymotion' => 'DailyMotionVideoProvider',
'gametrailers' => 'GametrailersVideoProvider',
@@ -97,7 +102,7 @@
'viddler' => 'ViddlerVideoProvider',
'vimeo' => 'VimeoVideoProvider',
'wegame' => 'WeGameVideoProvider',
-   );
+   ];
 
/**
 * Array of domain name to provider codes
@@ -163,21 +168,21 @@
// doesn't deadlock. SELECT FOR UPDATE causes a deadlock for 
every race condition.
$dbw->insert(
'video',
-   array(
+   [
'video_name' => $this->getName(),
'video_url' => $url,
'video_type' => $type,
-   'video_user_id' => $user->getID(),
+   'video_user_id' => $user->getId(),
'video_user_name' => $user->getName(),
'video_timestamp' => $now
-   ),
+   ],
__METHOD__,
'IGNORE'
);
 
$categoryWikiText = '';
 
-   if ( $dbw->affectedRows() == 0 ) {
+   if ( $dbw->affectedRows() === 0 ) {
$logAction = 'update';
 
// Clear cache
@@ -189,7 +194,7 @@
// Insert previous contents into oldvideo
$dbw->insertSelect(
'oldvideo', 'video',
-   array(
+   [
'ov_name' => 'video_name',
'ov_archive_name' => $dbw->addQuotes( 
gmdate( 'YmdHis' ) . "!{$this->getName()}" ),
'ov_url' => 'video_url',
@@ -197,24 +202,26 @@
'ov_user_id' => 'video_user_id',
'ov_user_name' => 'video_user_name',
'ov_timestamp' => 'video_timestamp'
-   ),
-   array( 'video_name' => $this->getName() ),
+   ],
+   [ 'video_name' => $this->getName() ],
__METHOD__
);
 
// Update the current video row
$dbw->update(
'video',
-   array( /* SET */
-   'video_url' => $url,
-   'video_type' => $type,
-   'video_user_id' => $user->getID(),
-   'video_user_name' => $user->getName(),
-   'video_timestamp' => $now
-   ),
-   array( /* WHERE */
-   'video_name' => $this->getName()
-   ),
+   [
+   /* SET */
+ 'video_url' => $url,
+ 'video_type' => $type,
+ 'video_user_id' => $user->getId(),
+ 'video_user_name' => $user->getName(),
+

[MediaWiki-commits] [Gerrit] mediawiki...Video[master]: Rework the internals of SpecialNewVideos

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

Change subject: Rework the internals of SpecialNewVideos
..

Rework the internals of SpecialNewVideos

This was the easiest way to add support for expiring user groups.
Additionally, this brings many more improvements, free of charge!

Special:NewVideos now has a OOUI interface and many more options
to sort by. SQL queries now use a wrapper, improving database
compatibility. All while still maintaining backwards query
parameter compatibility with previous versions.

Bug: T160027
Change-Id: I693e0d0cb583aa95f3614497b34c9ad8e6eb5cc8
---
M extension.json
M i18n/en.json
M includes/specials/SpecialNewVideos.php
A includes/specials/pagers/NewVideosPager.php
4 files changed, 320 insertions(+), 228 deletions(-)


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

diff --git a/extension.json b/extension.json
index fb6c31d..d562611 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "Video",
-   "version": "1.6.1",
+   "version": "1.7.1",
"author": [
"David Pean",
"Jack Phoenix",
@@ -67,7 +67,8 @@
"AddVideo": "includes/specials/SpecialAddVideo.php",
"NewVideos": "includes/specials/SpecialNewVideos.php",
"SpecialUndeleteWithVideoSupport": 
"includes/specials/SpecialUndeleteWithVideoSupport.php",
-   "VideoHooks": "includes/Video.hooks.php"
+   "VideoHooks": "includes/Video.hooks.php",
+   "NewVideosPager": "includes/specials/pagers/NewVideosPager.php"
},
"Hooks": {
"ArticleFromTitle": [
diff --git a/i18n/en.json b/i18n/en.json
index dbbdea0..88838aa 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -9,7 +9,7 @@
"newvideos": "New videos",
"video-upload-new-version": "Upload a new version of this video",
"video-newvideos-showfrom": "Show new videos starting from $2, $1",
-   "video-newvideos-list-text": "Below is a list of $1 
{{PLURAL:$1|video|videos}} sorted $2.",
+   "video-newvideos-list-text": "Below is a list of $1 
{{PLURAL:$1|video|videos}}.",
"video-addvideo-watchlist": "Add this video to my watchlist",
"video-addvideo-title": "Add video",
"video-addvideo-dest": "Add video for $1",
@@ -43,5 +43,6 @@
"video-more-links-to-video": "View [[Special:WhatLinksHere/$1|more 
links]] to this video.",
"video-showhidebots": "($1 bots)",
"action-addvideo": "add videos from external services into the site",
-   "right-addvideo": "Add videos from external services into the site"
+   "right-addvideo": "Add videos from external services into the site",
+   "video-hidebots": "Hide uploads by bots"
 }
diff --git a/includes/specials/SpecialNewVideos.php 
b/includes/specials/SpecialNewVideos.php
index f0b9415..2374f37 100644
--- a/includes/specials/SpecialNewVideos.php
+++ b/includes/specials/SpecialNewVideos.php
@@ -8,6 +8,8 @@
  */
 
 class NewVideos extends IncludableSpecialPage {
+   /** @var FormOptions */
+   protected $opts;
 
/**
 * Constructor
@@ -21,7 +23,7 @@
 *
 * @return string
 */
-   function getGroupName() {
+   public function getGroupName() {
return 'changes';
}
 
@@ -31,256 +33,169 @@
 * @param mixed|null $par Parameter passed to the page or null
 */
public function execute( $par ) {
-   global $wgGroupPermissions;
+   $context = new DerivativeContext( $this->getContext() );
 
$out = $this->getOutput();
-   $request = $this->getRequest();
$lang = $this->getLanguage();
 
$out->setPageTitle( $this->msg( 'newvideos' ) );
 
-   $wpIlMatch = $request->getText( 'wpIlMatch' );
-   $dbr = wfGetDB( DB_REPLICA );
-   $shownav = !$this->including();
-   $hidebots = $request->getBool( 'hidebots', 1 );
+   $opts = new FormOptions();
 
-   $hidebotsql = '';
-   if ( $hidebots ) {
-   /*
-* Make a list of group names which have the 'bot' flag
-* set.
-*/
-   $botconds = array();
-   foreach ( $wgGroupPermissions as $groupname => $perms ) 
{
-   if ( array_key_exists( 'bot', $perms ) && 
$perms['bot'] ) {
-   $botconds[] = "ug_group='$groupname'";
-   }
-   }
+   $opts->add( 'wpIlMatch', '' ); // Known as 'like', but uses old 
name for back-compat
+   $opts->add( 'user', '' );
+   $opts->add( 'hidebot

[MediaWiki-commits] [Gerrit] integration/config[master]: Archive Automatic Board Welcome

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

Change subject: Archive Automatic Board Welcome
..

Archive Automatic Board Welcome

Bug: T179196
Change-Id: I6b7f28152f203815aa351247393505a530719723
---
M zuul/layout.yaml
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/19/387019/1

diff --git a/zuul/layout.yaml b/zuul/layout.yaml
index 58f7d22..1e53956 100644
--- a/zuul/layout.yaml
+++ b/zuul/layout.yaml
@@ -4120,8 +4120,7 @@
 
   - name: mediawiki/extensions/AutomaticBoardWelcome
 template:
-  - name: extension-unittests-generic
-  - name: mwgate-npm
+  - name: archived
 
   - name: mediawiki/extensions/AutoProxyBlock
 template:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b7f28152f203815aa351247393505a530719723
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] translatewiki[master]: Archive Automatic Board Welcome

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

Change subject: Archive Automatic Board Welcome
..

Archive Automatic Board Welcome

Bug: T179196
Change-Id: I5f99be09ffe48c15903bd69e65c7dc035c992210
---
M groups/MediaWiki/mediawiki-extensions.txt
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/20/387020/1

diff --git a/groups/MediaWiki/mediawiki-extensions.txt 
b/groups/MediaWiki/mediawiki-extensions.txt
index d20e855..4746421 100644
--- a/groups/MediaWiki/mediawiki-extensions.txt
+++ b/groups/MediaWiki/mediawiki-extensions.txt
@@ -122,7 +122,7 @@
 Auto Proxy Block
 ignored = proxyblock-logentry
 
-Automatic Board Welcome
+# Automatic Board Welcome // 2017-10-27: Archived (T179196)
 
 # AWS // 2017-09-05: Archived (T174864)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f99be09ffe48c15903bd69e65c7dc035c992210
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki/extensions[master]: Archive Automatic Board Welcome

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

Change subject: Archive Automatic Board Welcome
..

Archive Automatic Board Welcome

Bug: T179196
Change-Id: I5c05c839f55fb55e08fe94dddb612555190c1469
---
M .gitmodules
D AutomaticBoardWelcome
2 files changed, 0 insertions(+), 5 deletions(-)


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

diff --git a/.gitmodules b/.gitmodules
index 41678bf..0dbe596 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -142,10 +142,6 @@
path = AutoProxyBlock
url = https://gerrit.wikimedia.org/r/mediawiki/extensions/AutoProxyBlock
branch = .
-[submodule "AutomaticBoardWelcome"]
-   path = AutomaticBoardWelcome
-   url = 
https://gerrit.wikimedia.org/r/mediawiki/extensions/AutomaticBoardWelcome
-   branch = .
 [submodule "Awesomeness"]
path = Awesomeness
url = https://gerrit.wikimedia.org/r/mediawiki/extensions/Awesomeness
diff --git a/AutomaticBoardWelcome b/AutomaticBoardWelcome
deleted file mode 16
index 24a943e..000
--- a/AutomaticBoardWelcome
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 24a943e8e1aff017b479386ff66645f2c4f1843b

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c05c839f55fb55e08fe94dddb612555190c1469
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...HAWelcome[master]: Integrate Automatic Board Welcome functionality

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

Change subject: Integrate Automatic Board Welcome functionality
..

Integrate Automatic Board Welcome functionality

Suggested in the dependency linked. It is toggeable by adding
board-welcome to welcome-enabled.

Depends-On: Iea20bad42abf2e1f966b835c6965aa1fd67fa92d
Change-Id: I373706e346995e33c747e0599285460ff4284fbc
---
M HAWelcome.class.php
M README
2 files changed, 23 insertions(+), 0 deletions(-)


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

diff --git a/HAWelcome.class.php b/HAWelcome.class.php
index 7b6d428..9013a4a 100644
--- a/HAWelcome.class.php
+++ b/HAWelcome.class.php
@@ -120,6 +120,27 @@

wfEscapeWikiText( $this->mUser->getName() )
)->text();
}
+
+   $msgObj = wfMessage( 
'user-board-welcome-message' )->inContentLanguage();
+   // Send a welcome message on 
UserBoard provided it's installed and enabled
+   if (
+   class_exists( 
'UserBoard' ) &&
+   $this->isEnabled( 
'board-welcome' )  &&
+   !$msgObj->isDisabled()
+   ) {
+   // Send the message
+   $board = new 
UserBoard();
+   
$board->sendBoardMessage(
+   
$this->mSysop->getId(), // sender's UID
+   
$this->mSysop->getName(), // sender's name
+   
$this->mUser->getId(),
+   
$this->mUser->getName(),
+   // passing the 
senderName as an argument here so that we can do
+   // stuff like 
[[User talk:$1|contact me]] or w/e in the message
+   
$msgObj->params( $this->mSysop->getName() )->parse()
+   // the final argument 
is message type: 0 (default) for public
+   );
+   }
}
 
if ( $welcomeMsg ) {
diff --git a/README b/README
index ee2d919..11b1a91 100644
--- a/README
+++ b/README
@@ -18,6 +18,7 @@
 ** page-user - Create a user page for a registered user. The content of the 
user page is controlled by the message welcome-user-page
 ** message-anon - Leave welcome messages for anonymous users. The content of 
the message is controlled by the message welcome-message-anon
 ** message-user - Leave welcome messages for registered users. The content of 
the message is controlled by the message welcome-message-user
+** board-welcome - Leave a welcome message on the UserBoard. The content of 
the message is controlled by the message user-board-welcome-message
 
 == User rights ==
 There is one user right, assigned to the groups bot, staff, sysop and 
bureaucrat by default: welcomeexempt. Users with this right will not receive a 
message or have their user page created when they make their first edit. This 
feature was backported from Wikia.
@@ -26,6 +27,7 @@
 * When the user rights are changed, and the user is the last active sysop, the 
cached value will be removed from cache. Tweaked to only remove the cache entry 
when the group sysop is removed. This feature was backported from Wikia.
 * When GlobalUserrights is installed, the global user groups table will too be 
checked for staff users.
 * When SocialProfile is installed, and the user has opted to use the social 
profile, the user page will be created in the UserWiki: namespace rather than 
the User: namespace.
+* When SocialProfile is installed, a message can be left on the UserBoard.
 
 == Known limitations ==
 * Structured Discussions nor LiquidThreads are not supported. No welcome 
message will be left on the talk page of users with a Structured Discussions or 
LiquidThreads talk page.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I373706e346995e33c747e0599285460ff4284fbc
G

[MediaWiki-commits] [Gerrit] mediawiki...HAWelcome[master]: Rework and improve HAWelcome

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

Change subject: Rework and improve HAWelcome
..

Rework and improve HAWelcome

As noted by Jack Phoenix in ca43438211d194749715fc541334ed9c030f098c,
there are still some outstanding TODO's. This patch attempts to
address those.
* The hardcoded welcomer name has been changed to use a configuration
variable, $wgHAWelcomeUserName, with the previously hardcoded value
as default.
* The global_user_groups table will only be queried if the
GlobalUserrights extension is installed, and the dependency on that
extension has been dropped.
* Expiring user rights are now taken in account for both local and
global user rights, which means only users with a valid group
membership will be used as welcomer.
* Two patches to HAWelcome from the Wikia codebase have been
incorporated:
** If the last active sysop has their groups changed, they will be
removed from cache. This has been adjusted to only remove the user
from cache when the sysop group is removed.
** Instead of checking against a list of hardcoded groups whose
members should never be welcomed, a user right welcomeexempt has
been introduced. Granted to the groups bureaucrat, sysop, staff
and bot, users with this right will not have their user page created
nor will a message be left on their talk page.

Other improvements include the removal of deprecated globals such as
$wgUser, $wgTitle and $wgRequest, i18n of the extension name and
description adding message documentation, adding a LICENSE file and
dedicated selection of staff users when the fallback has been activated.

Bug: T178605
Change-Id: Iea20bad42abf2e1f966b835c6965aa1fd67fa92d
---
M HAWelcome.class.php
A HAWelcome.hooks.php
A LICENSE
A README
M extension.json
M i18n/en.json
A i18n/qqq.json
7 files changed, 712 insertions(+), 272 deletions(-)


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

diff --git a/HAWelcome.class.php b/HAWelcome.class.php
index fbf7478..ef3d344 100644
--- a/HAWelcome.class.php
+++ b/HAWelcome.class.php
@@ -21,17 +21,14 @@
$mAnon,
$mSysop;
 
-   const WELCOMEUSER = 'ShoutWiki';
-
/**
 * Construct a job
 *
 * @param Title $title The title linked to
 * @param array $params Job parameters (table, start and end page_ids)
-* @param int $id job_id, 0 by default
 */
-   public function __construct( $title, $params, $id = 0 ) {
-   parent::__construct( 'HAWelcome', $title, $params, $id );
+   public function __construct( $title, $params ) {
+   parent::__construct( 'HAWelcome', $title, $params );
 
$this->mUserId   = $params['user_id'];
$this->mUserIP   = $params['user_ip'];
@@ -45,9 +42,7 @@
$this->mUser = User::newFromId( $this->mUserId );
}
 
-   /**
-* fallback
-*/
+   // Fallback
if ( !$this->mUser ) {
$this->mUser = User::newFromName( $this->mUserName );
}
@@ -57,91 +52,88 @@
 * Main entry point
 */
public function run() {
-   global $wgUser, $wgTitle, $wgLanguageCode;
+   global $wgLanguageCode, $wgHAWelcomeWelcomeUsername;
 
-   /**
-* overwrite $wgUser for  expanding
-*/
$sysop = trim( wfMessage( 'welcome-user' )->plain() );
-   if ( !in_array( $sysop, [ '@disabled', '-' ] ) ) {
-   $tmpUser = $wgUser;
-   $wgUser = User::newFromName( self::WELCOMEUSER );
-   $flags = 0;
-   if ( $wgUser && $wgUser->isBot() ) {
-   $flags = EDIT_FORCE_BOT;
-   }
+   if ( in_array( $sysop, [ '@disabled', '-' ] ) ) {
+   return true;
+   }
 
-   if ( $this->mUser && $this->mUser->getName() !== 
self::WELCOMEUSER && !$wgUser->isBlocked() ) {
-   /**
-* check again if talk page exists
-*/
-   $talkPage = 
$this->mUser->getUserPage()->getTalkPage();
+   $welcomeUser = User::newFromName( $wgHAWelcomeWelcomeUsername );
+   $flags = 0;
+   if ( $welcomeUser && $welcomeUser->isBot() ) {
+   $flags = EDIT_FORCE_BOT;
+   }
 
-   if ( $talkPage ) {
-   $this->mSysop = $this->getLastSysop();
-   $tmpTitle = $wgTitle;
-   $sysopPage= 
$this->mSysop->getUserPage()->

[MediaWiki-commits] [Gerrit] mediawiki...HAWelcome[master]: Add a hard dependency on GlobalUserrights

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

Change subject: Add a hard dependency on GlobalUserrights
..

Add a hard dependency on GlobalUserrights

Until there is a way to have the extension work without a global
user rights table, hard require GlobalUserrights.

Bug: T178605
Change-Id: I990afc09a9a1aa0a245139e32b4d249490d30e3f
---
M extension.json
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/extension.json b/extension.json
index e6aaaeb..ba08800 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "Highly Automated Welcome Tool",
-   "version": "0.6.8-SW",
+   "version": "0.6.9",
"author": [
"Krzysztof Krzyżaniak",
"Maciej Błaszkowski",
@@ -24,5 +24,10 @@
"Hooks": {
"RevisionInsertComplete": "HAWelcomeJob::revisionInsertComplete"
},
+   "requires": {
+   "extensions": {
+   "GlobalUserrights": ">=1.3.1"
+   }
+   },
"manifest_version": 1
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I990afc09a9a1aa0a245139e32b4d249490d30e3f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/HAWelcome
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


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

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

Change subject: Convert AntiBot to use extension registration
..

Convert AntiBot to use extension registration

Bug: T176872
Change-Id: I1b31e5bc214bf830e520cadeda0bf19cba3cf3e8
---
A AntiBot.class.php
M AntiBot.php
A AntiBotHooks.php
A extension.json
4 files changed, 133 insertions(+), 104 deletions(-)


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

diff --git a/AntiBot.class.php b/AntiBot.class.php
new file mode 100644
index 000..3680417
--- /dev/null
+++ b/AntiBot.class.php
@@ -0,0 +1,61 @@
+getIP();
+   $action = $wgRequest->getVal( 'action', '' );
+   $title = $wgRequest->getVal( 'title', '' );
+   $text = $wgRequest->getVal( 'wpTextbox1' );
+   if ( is_null( $text ) ) {
+   $text = '';
+   } else {
+   if ( strlen( $text ) > 60 ) {
+   $text = '"' . substr( $text, 0, 60 ) . '..."';
+   } else {
+   $text = "\"$text\"";
+   }
+   }
+   $action = str_replace( "\n", '', $action );
+   $title = str_replace( "\n", '', $title );
+   $text = str_replace( "\n", '', $text );
+
+   wfDebugLog( 'AntiBot', "$ip AntiBot plugin $pluginName hit: 
$action [[$title]] $text\n" );
+   }
+
+   static function quiet() {
+   return 'quiet';
+   }
+
+   static function fail() {
+   return 'fail';
+   }
+}
diff --git a/AntiBot.php b/AntiBot.php
index fe908a1..4fd059d 100644
--- a/AntiBot.php
+++ b/AntiBot.php
@@ -10,112 +10,19 @@
  *
  * To install, put this in LocalSettings.php:
  *
- * require_once( "$IP/extensions/AntiBot/AntiBot.php" );
+ * wfLoadExtension( "AntiBot" );
  *
  * And then copy the plugins you want into the active directory.
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-   exit( 1 );
-}
-
-/** Configuration */
-
-/**
- * Persistent secret token used for setting form field names and what not
- * Change it periodically if they try to filter by any affected form field
- */
-$wgAntiBotSecret = '';
-
-/** Configure the payload sequence when each plugin is triggered */
-$wgAntiBotPayloads = array(
-   'default' => array( 'log', 'fail' ),
-);
-
-/** END CONFIGURATION */
-
-$wgExtensionCredits['antispam'][] = array(
-   'path' => __FILE__,
-   'name' => 'AntiBot',
-   'url' => 'https://www.mediawiki.org/wiki/Extension:AntiBot',
-   'author' => 'Tim Starling',
-   'descriptionmsg' => 'antibot-desc',
-   'license-label' => 'GPL-2.0+'
-);
-
-$wgMessagesDirs['AntiBot'] = __DIR__ . '/i18n';
-
-/**
- * A map of payload types to callbacks
- * This may be extended by plugins.
- */
-$wgAntiBotPayloadTypes = array(
-   'log' => array( 'AntiBot', 'log' ),
-   'quiet' => array( 'AntiBot', 'quiet' ),
-   'fail' => array( 'AntiBot', 'fail' ),
-);
-
-# Load plugins
-foreach ( glob( __DIR__ . '/active/*.php' ) as $file ) {
-   require( $file );
-}
-
-class AntiBot {
-   static function getSecret( $name ) {
-   global $wgAntiBotSecret, $wgSecretKey;
-   $secret = $wgAntiBotSecret ? $wgAntiBotSecret : $wgSecretKey;
-   return substr( sha1( $secret . $name ), 0, 8 );
-   }
-
-   /**
-* Plugins should call this function when they are triggered
-*/
-   static function trigger( $pluginName ) {
-   global $wgAntiBotPayloads, $wgAntiBotPayloadTypes;
-   $ret = 'quiet';
-   if ( isset( $wgAntiBotPayloads[$pluginName] ) ) {
-   $payloadChain = $wgAntiBotPayloads[$pluginName];
-   } else {
-   $payloadChain = $wgAntiBotPayloads['default'];
-   }
-
-   foreach ( $payloadChain as $payloadType ) {
-   if ( !isset( $wgAntiBotPayloadTypes[$payloadType] ) ) {
-   wfDebug( "Invalid payload type: $payloadType\n" 
);
-   continue;
-   }
-   $ret = call_user_func( 
$wgAntiBotPayloadTypes[$payloadType], $pluginName );
-   }
-   return $ret;
-   }
-
-   static function log( $pluginName ) {
-   global $wgRequest;
-   $ip = $wgRequest->getIP();
-   $action = $wgRequest->getVal( 'action', '' );
-   $title = $wgRequest->getVal( 'title', '' );
-   $text = $wgRequest->getVal( 'wpTextbox1' );
-   if ( is_null( $text ) ) {
-   $text = '';
-   } else {
-   if ( strlen( $text ) > 60 ) {
-   $text = '"' . substr( $text, 0, 60 ) . '..."';

[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: Register to the wgQueryPages hook

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

Change subject: Register to the wgQueryPages hook
..

Register to the wgQueryPages hook

This allows the special page to be updated with the
updateSpecialPages.php maintenance script.

Change-Id: Ief3ec15ef18f525f7758e1c32b53e3b8001a6f11
---
A OrphanedTalkPagesHooks.php
M extension.json
2 files changed, 25 insertions(+), 3 deletions(-)


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

diff --git a/OrphanedTalkPagesHooks.php b/OrphanedTalkPagesHooks.php
new file mode 100644
index 000..42dd45f
--- /dev/null
+++ b/OrphanedTalkPagesHooks.php
@@ -0,0 +1,16 @@
+https://gerrit.wikimedia.org/r/375006
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief3ec15ef18f525f7758e1c32b53e3b8001a6f11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OrphanedTalkPages
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Extend the extension registry with wgRestrictionLevels

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

Change subject: Extend the extension registry with wgRestrictionLevels
..

Extend the extension registry with wgRestrictionLevels

This way extensions can easily extend the available
protection levels without having to resort to using
the callback.

I noted one difference compared to the callback:
The order of appearance of the protection levels is
swapped, if the added protection level was previously
last in the list, it will now be the first.
Changing the merge strategy did not make a
difference.

Bug: T174056
Change-Id: Ie75d8de750cd21990a86a06c400bd624f65ea038
---
M docs/extension.schema.v1.json
M docs/extension.schema.v2.json
M includes/registration/ExtensionProcessor.php
3 files changed, 15 insertions(+), 0 deletions(-)


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

diff --git a/docs/extension.schema.v1.json b/docs/extension.schema.v1.json
index 7cfebca..a65a11a 100644
--- a/docs/extension.schema.v1.json
+++ b/docs/extension.schema.v1.json
@@ -521,6 +521,13 @@
"type": "string"
}
},
+   "RestrictionLevels": {
+   "type": "array",
+   "description": "Additional protection levels added by 
the extension",
+   "items": {
+   "type": "string"
+   }
+   },
"ContentHandlers": {
"type": "object",
"description": "Mapping of model ID to class name",
diff --git a/docs/extension.schema.v2.json b/docs/extension.schema.v2.json
index 75a4f2c..268a1f3 100644
--- a/docs/extension.schema.v2.json
+++ b/docs/extension.schema.v2.json
@@ -542,6 +542,13 @@
"type": "string"
}
},
+   "RestrictionLevels": {
+   "type": "array",
+   "description": "Additional protection levels available 
added by the extension",
+   "items": {
+   "type": "string"
+   }
+   },
"ContentHandlers": {
"type": "object",
"description": "Mapping of model ID to class name",
diff --git a/includes/registration/ExtensionProcessor.php 
b/includes/registration/ExtensionProcessor.php
index ce262bd..b3cb737 100644
--- a/includes/registration/ExtensionProcessor.php
+++ b/includes/registration/ExtensionProcessor.php
@@ -50,6 +50,7 @@
'RemoveGroups',
'ResourceLoaderLESSVars',
'ResourceLoaderSources',
+   'RestrictionLevels',
'RevokePermissions',
'SessionProviders',
'SpecialPages',

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/vagrant[master]: Require MobileFrontend to be installed when enabling Minerva

2017-07-28 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368406 )

Change subject: Require MobileFrontend to be installed when enabling Minerva
..

Require MobileFrontend to be installed when enabling Minerva

Bug: T171942
Change-Id: I3f97ea6e5eb6bab4ce6f5e740034ca03e4bbdfb6
---
M puppet/modules/role/manifests/minerva.pp
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/06/368406/1

diff --git a/puppet/modules/role/manifests/minerva.pp 
b/puppet/modules/role/manifests/minerva.pp
index 81a967c..65e820c 100644
--- a/puppet/modules/role/manifests/minerva.pp
+++ b/puppet/modules/role/manifests/minerva.pp
@@ -2,5 +2,8 @@
 # Configures Minerva, a MediaWiki skin, as an option.
 # https://www.mediawiki.org/wiki/Skin:MinervaNeue
 class role::minerva {
+require ::role::mediawiki
+include ::role::mobilefrontend
+
 mediawiki::skin { 'MinervaNeue': }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f97ea6e5eb6bab4ce6f5e740034ca03e4bbdfb6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update the installphp.sh script to use a supported PHP version

2017-07-26 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367878 )

Change subject: Update the installphp.sh script to use a supported PHP version
..

Update the installphp.sh script to use a supported PHP version

It has been stuck on 5.4 since it was added to the repository
in 9e25a8e32e6d. It also contained some typos and updating
the version required multiple changes, so that has been fixed.

Bug: T165079
Change-Id: I30b4d6d0701dc60651d3c07fd364312a78a45800
---
M maintenance/dev/installphp.sh
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/367878/1

diff --git a/maintenance/dev/installphp.sh b/maintenance/dev/installphp.sh
index d26ffa6..cfb0f63 100755
--- a/maintenance/dev/installphp.sh
+++ b/maintenance/dev/installphp.sh
@@ -12,13 +12,14 @@
exit 0
 fi
 
-TAR=php5.4-latest.tar.gz
-PHPURL="http://snaps.php.net/$TAR";
+VER=5.6.31
+TAR=php-$VER.tar.gz
+PHPURL="https://github.com/php/php-src/archive/$TAR";
 
 cd "$DEV"
 
-echo "Preparing to download and install a local copy of PHP 5.4, note that 
this can take some time to do."
-echo "If you wish to avoid re-doing this for uture dev installations of 
MediaWiki we suggest installing php in ~/.mediawiki/php"
+echo "Preparing to download and install a local copy of PHP $VER, note that 
this can take some time to do."
+echo "If you wish to avoid re-doing this for future dev installations of 
MediaWiki we suggest installing php in ~/.mediawiki/php"
 echo -n "Install PHP in ~/.mediawiki/php [y/N]: "
 read INSTALLINHOME
 
@@ -31,9 +32,9 @@
;;
 esac
 
-# Some debain-like systems bundle wget but not curl, some other systems
+# Some debian-like systems bundle wget but not curl, some other systems
 # like os x bundle curl but not wget... use whatever is available
-echo -n "Downloading PHP 5.4"
+echo -n "Downloading PHP 5.6.31"
 if command -v wget &>/dev/null; then
echo "- using wget"
wget "$PHPURL"
@@ -46,12 +47,12 @@
exit 1;
 fi
 
-echo "Extracting php 5.4"
+echo "Extracting php $VER"
 tar -xzf "$TAR"
 
-cd php5.4-*/
+cd php$VER/
 
-echo "Configuring and installing php 5.4 in $PREFIX"
+echo "Configuring and installing php $VER in $PREFIX"
 ./configure --prefix="$PREFIX"
 make
 make install

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

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

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


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

2017-07-25 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367667 )

Change subject: Convert AccessControl to use extension registration
..

Convert AccessControl to use extension registration

Bug: T171576
Change-Id: Ieeb9484651d7d67d9171692d70e0ad862c3d171f
---
M AccessControl.php
A extension.json
2 files changed, 38 insertions(+), 54 deletions(-)


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

diff --git a/AccessControl.php b/AccessControl.php
index 9c3b317..951b4a9 100644
--- a/AccessControl.php
+++ b/AccessControl.php
@@ -1,56 +1,11 @@
 https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   );
+} else {
+   die( 'This version of the AccessControl extension requires MediaWiki 
1.25+' );
 }
-
-// Register extension with MediaWiki
-$wgExtensionCredits['parserhook'][] = [
-   'path' => __FILE__,
-   'name' => 'AccessControl',
-   'author' => [
-   '[https://www.mediawiki.org/wiki/m:User:Want Aleš Kapica]'
-   ],
-   'url' => 'https://www.mediawiki.org/wiki/Extension:AccessControl',
-   'version' => '2.6',
-   'descriptionmsg' => 'accesscontrol-desc',
-   'license-name' => 'GPL-2.0+'
-];
-
-// Set extension specific parameters
-// sysop users can read all restricted pages
-$wgAdminCanReadAll = true;
-// do not redirect from page in search results to restricted pages
-$wgAccessControlRedirect = true;
-
-// Load extension's class
-$wgAutoloadClasses['AccessControlHooks'] = __DIR__ . 
'/AccessControl.hooks.php';
-
-// Register extension's messages
-$wgMessagesDirs['AccessControl'] = __DIR__ . '/i18n';
-
-// Register hooks
-// Hook the ParserFirstCallInit for
-$wgHooks['ParserFirstCallInit'][] = 
'AccessControlHooks::accessControlExtension';
-// Hook the userCan function for bypassing the cache
-$wgHooks['userCan'][] = 'AccessControlHooks::onUserCan';
-// Hook the UnknownAction function for information user about restrictions
-$wgHooks['UnknownAction'][] = 'AccessControlHooks::onUnknownAction';
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..9a8faea
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,29 @@
+{
+   "name": "AccessControl",
+   "version": "2.6",
+   "author": [
+   "[https://www.mediawiki.org/wiki/m:User:Want Aleš Kapica]"
+   ],
+   "type": "parserhook",
+   "url": "https://www.mediawiki.org/wiki/Extension:AccessControl";,
+   "descriptionmsg": "accesscontrol-desc",
+   "license-name": "GPL-2.0+",
+   "AutoloadClasses": {
+   "AccessControlHooks": "AccessControl.hooks.php"
+   },
+   "MessagesDirs": {
+   "AccessControl": [
+   "i18n"
+   ]
+   },
+   "config": {
+   "AdminCanReadAll": true,
+   "AccessControlRedirect": true
+   },
+   "Hooks": {
+   "ParserFirstCallInit": 
"AccessControlHooks::accessControlExtension",
+   "userCan": "AccessControlHooks::onUserCan",
+   "UnknownAction": "AccessControlHooks::onUnknownAction"
+   },
+   "manifest_version": 1
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieeb9484651d7d67d9171692d70e0ad862c3d171f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AccessControl
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: Adhere to MediaWiki's Coding conventions

2017-07-01 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362814 )

Change subject: Adhere to MediaWiki's Coding conventions
..

Adhere to MediaWiki's Coding conventions

Also, the alias file had the wrong name in the top comment. This has
been fixed.

Change-Id: I784449b345405ebd4eee2d88ebc6affcefd95dbe
---
M OrphanedTalkPages.alias.php
M README
M specials/SpecialOrphanedTalkPages.php
3 files changed, 10 insertions(+), 22 deletions(-)


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

diff --git a/OrphanedTalkPages.alias.php b/OrphanedTalkPages.alias.php
index 0a9f0d6..c97a413 100644
--- a/OrphanedTalkPages.alias.php
+++ b/OrphanedTalkPages.alias.php
@@ -1,11 +1,6 @@
 https://www.mediawiki.org/wiki/Extension:OrphanedTalkPages
@@ -11,16 +9,11 @@
 to your LocalSettings.php file.
 
 == Configuration instructions ==
-This extension introduces two new configuration variables:
-$wgOrphanedTalkPagesExemptedNamespaces and $wgOrphanedTalkPagesIgnoreUserTalk
+This extension introduces two new configuration variables: 
$wgOrphanedTalkPagesExemptedNamespaces and $wgOrphanedTalkPagesIgnoreUserTalk.
 
-* $wgOrphanedTalkPagesExemptedNamespaces controls which talk namespaces should 
be ignored when looking for orphaned
-talk pages. This variable is an array of namespace ids and is empty by default.
-* $wgOrphanedTalkPagesIgnoreUserTalk determines if the user talk namespace (3, 
or NS_USER_TALK) should be ignored when
-looking for orphaned talk pages. This variable is a boolean and set to true by 
default.
+* $wgOrphanedTalkPagesExemptedNamespaces controls which talk namespaces should 
be ignored when looking for orphaned talk pages. This variable is an array of 
namespace ids and is empty by default.
+* $wgOrphanedTalkPagesIgnoreUserTalk determines if the user talk namespace (3, 
or NS_USER_TALK) should be ignored when looking for orphaned talk pages. This 
variable is a boolean and set to true by default.
 
 == Other important notes ==
-* The query that this special page uses is considered expensive. This means 
that when $wgMiserMode is enabled, the
-results will be served from cache.
-* The special page may report talk pages as orphaned when they are not. The 
most common situation where this happens
-is File talk pages when $wgUseInstantCommons or $wgForeignFileRepos is enabled.
\ No newline at end of file
+* The query that this special page uses is considered expensive. This means 
that when $wgMiserMode is enabled, the results will be served from cache.
+* The special page may report talk pages as orphaned when they are not. The 
most common situation where this happens is File talk pages when 
$wgUseInstantCommons or $wgForeignFileRepos is enabled.
diff --git a/specials/SpecialOrphanedTalkPages.php 
b/specials/SpecialOrphanedTalkPages.php
index d50ba8e..80f1fc4 100644
--- a/specials/SpecialOrphanedTalkPages.php
+++ b/specials/SpecialOrphanedTalkPages.php
@@ -40,7 +40,7 @@
}
 
// Check if the User talk namespace should be ignored
-   if ( $wgOrphanedTalkPagesIgnoreUserTalk === true ) {
+   if ( $wgOrphanedTalkPagesIgnoreUserTalk ) {
$exemptedNamespaces[] = NS_USER_TALK;
}
 
@@ -48,12 +48,12 @@
'tables' => 'page AS p1',
'fields' => [
'namespace' => 'p1.page_namespace',
-   'title' =>'p1.page_title',
+   'title' => 'p1.page_title',
'value' => 'page_title' // Sorting
],
'conds' => [
'p1.page_title NOT LIKE "%/%"',
-   'p1.page_namespace % 2 != 0'
+   'p1.page_namespace % 2 != 0'
]
];
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I784449b345405ebd4eee2d88ebc6affcefd95dbe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OrphanedTalkPages
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix the tableExists method of MysqlBase

2017-06-19 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/359961 )

Change subject: Fix the tableExists method of MysqlBase
..

Fix the tableExists method of MysqlBase

The table name generated by Database::tableName() does not work in
MysqlBase's tableExist method, as the syntax of SHOW TABLES does not
function like other foreign db queries. It instead should use FROM
$db rather than the database name in front of the table name.
I consider this a hack, as it just splits the output of tableName(),
but this way, the escaping of that method can be recycled.

Bug: T168207
Change-Id: I7806090eaa647959fd34de8bc606eeb952161529
---
M includes/libs/rdbms/database/DatabaseMysqlBase.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/61/359961/1

diff --git a/includes/libs/rdbms/database/DatabaseMysqlBase.php 
b/includes/libs/rdbms/database/DatabaseMysqlBase.php
index 50ead83..b0107a7 100644
--- a/includes/libs/rdbms/database/DatabaseMysqlBase.php
+++ b/includes/libs/rdbms/database/DatabaseMysqlBase.php
@@ -536,7 +536,16 @@
// other than the backslash, which is the only one supported by 
SHOW TABLES
$encLike = $this->escapeLikeInternal( $table, '\\' );
 
-   return $this->query( "SHOW TABLES LIKE '$encLike'", $fname 
)->numRows() > 0;
+   // Database::tableName returns shared tables prefixed with 
their database, which do not
+   // work in SHOW TABLES statements, so split them up.
+   if ( strpos( $encLike, '.' ) === false ) {
+   $db = $this->mDBname;
+   $table = $encLike;
+   } else {
+   list( $db, $table ) = explode( '.', $encLike, 2 );
+   }
+
+   return $this->query( "SHOW TABLES FROM $db LIKE '$table'", 
$fname )->numRows() > 0;
}
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...ParserMigration[master]: Fix the exception thrown when using the tool on unsupported ...

2017-06-12 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358425 )

Change subject: Fix the exception thrown when using the tool on unsupported 
content models
..

Fix the exception thrown when using the tool on unsupported content models

The exception appears when the ParserMigration tool is used on pages with
the flowboard content model. Since ParserMigration aims to migrate to a
new parser, it should only target pages that actually utilize the
parser, so anything that does not use the wikitext content model has no
reason to use the migration tool.

The error message is borrowed from RawAction.php to remain consistent.

Bug: T167722
Change-Id: Ib129e61c04288da366bc018625be2dddc8bdb687
---
M extension.json
M includes/Hooks.php
M includes/MigrationEditPage.php
3 files changed, 16 insertions(+), 2 deletions(-)


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

diff --git a/extension.json b/extension.json
index 0f9c888..bdb3d99 100644
--- a/extension.json
+++ b/extension.json
@@ -1,7 +1,7 @@
 {
"name": "ParserMigration",
"author": "Tim Starling",
-   "version": "1.0.0",
+   "version": "1.0.1",
"url": "https://www.mediawiki.org/wiki/Extension:ParserMigration";,
"descriptionmsg": "parsermigration-desc",
"license-name": "CC0-1.0",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 4b95588..ca75be0 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -27,7 +27,8 @@
$out = $skin->getOutput();
$title = $skin->getTitle();
$user = $skin->getUser();
-   if ( $out->isArticleRelated() && $user->getOption( 
'parsermigration' ) ) {
+   if ( $out->isArticleRelated() && $title->getContentModel() === 
CONTENT_MODEL_WIKITEXT &&
+$user->getOption( 'parsermigration' ) ) {
$toolbox['parsermigration'] = [
'href' => $title->getLocalURL( [ 'action' => 
'parsermigration-edit' ] ),
'text' => $skin->msg( 
'parsermigration-toolbox-label' )->text(),
diff --git a/includes/MigrationEditPage.php b/includes/MigrationEditPage.php
index a42ad14..a8b8da8 100644
--- a/includes/MigrationEditPage.php
+++ b/includes/MigrationEditPage.php
@@ -5,6 +5,19 @@
 class MigrationEditPage extends \EditPage {
 
public function __construct( \IContextSource $context, \Title $title ) {
+   // Display an error if the action is not possible for content 
model associated with this
+   // title as is not wikitext (similar to RawAction::getRawText())
+   if ( $title->getContentModel() !== CONTENT_MODEL_WIKITEXT ) {
+   $contentModel = \ContentHandler::getLocalizedName( 
CONTENT_MODEL_WIKITEXT,
+   \Language::factory( 'en' ) );
+
+   wfHttpError( 415, "Unsupported Media Type",
+   "The requested page uses the content model `" .
+$contentModel . "` which is not supported via this 
interface."
+   );
+   die();
+   }
+
$article = \Article::newFromTitle( $title, $context );
parent::__construct( $article );
$this->setContextTitle( $title );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib129e61c04288da366bc018625be2dddc8bdb687
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParserMigration
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: Remove period from extension description

2017-06-11 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358235 )

Change subject: Remove period from extension description
..

Remove period from extension description

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


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

diff --git a/i18n/en.json b/i18n/en.json
index bcc9aff..b35064d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,7 @@
]
},
"orphanedtalkpages": "Orphaned talk pages",
-   "orphanedtalkpages-desc": "Provides a list of orphaned talk pages.",
+   "orphanedtalkpages-desc": "Provides a list of orphaned talk pages",
"orphanedtalkpages-extensionname": "Orphaned Talk Pages",
"orphanedtalkpages-text": "The following talk pages do not have an 
accompanying page."
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d8c121f9ef4bf51f60e7e003811f6be6877bf15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OrphanedTalkPages
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: Remove period from extension description

2017-06-11 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358234 )

Change subject: Remove period from extension description
..

Remove period from extension description

This is standard with other extensions

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


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OrphanedTalkPages 
refs/changes/34/358234/1

diff --git a/i18n/en.json b/i18n/en.json
index bcc9aff..b35064d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,7 @@
]
},
"orphanedtalkpages": "Orphaned talk pages",
-   "orphanedtalkpages-desc": "Provides a list of orphaned talk pages.",
+   "orphanedtalkpages-desc": "Provides a list of orphaned talk pages",
"orphanedtalkpages-extensionname": "Orphaned Talk Pages",
"orphanedtalkpages-text": "The following talk pages do not have an 
accompanying page."
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54152fcd80aeec04718a326999e944020e2adcc3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OrphanedTalkPages
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: Simplify configuration checks

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

Change subject: Simplify configuration checks
..

Simplify configuration checks

I couldn't even understand what I wrote, so it was time to simplify it.

Change-Id: I9b281cb1d5e390c2a17ea896f53afabf04390890
---
M specials/SpecialOrphanedTalkPages.php
1 file changed, 14 insertions(+), 22 deletions(-)


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

diff --git a/specials/SpecialOrphanedTalkPages.php 
b/specials/SpecialOrphanedTalkPages.php
index 200043e..d50ba8e 100644
--- a/specials/SpecialOrphanedTalkPages.php
+++ b/specials/SpecialOrphanedTalkPages.php
@@ -30,23 +30,18 @@
public function getQueryInfo() {
global $wgOrphanedTalkPagesExemptedNamespaces, 
$wgOrphanedTalkPagesIgnoreUserTalk;
 
-   // Check if the configuration global is not empty and an array
-   if ( empty( $wgOrphanedTalkPagesExemptedNamespaces ) ||
-!is_array( $wgOrphanedTalkPagesExemptedNamespaces ) ) {
+   $exemptedNamespaces = [];
 
-   // Check if it is an int if it isn't an array so single 
values still work
-   if ( is_int( $wgOrphanedTalkPagesExemptedNamespaces ) ) 
{
-   $wgOrphanedTalkPagesExemptedNamespaces = [
-   $wgOrphanedTalkPagesExemptedNamespaces
-   ];
-   } else {
-   $wgOrphanedTalkPagesExemptedNamespaces = [];
-   }
+   // Check if the configuration global is an integer, so single 
values still work
+   if ( is_int( $wgOrphanedTalkPagesExemptedNamespaces ) ) {
+   $exemptedNamespaces[] = 
$wgOrphanedTalkPagesExemptedNamespaces;
+   } elseif ( is_array( $wgOrphanedTalkPagesExemptedNamespaces ) ) 
{
+   $exemptedNamespaces = 
$wgOrphanedTalkPagesExemptedNamespaces;
}
 
-   // Check if the User talk namespace should be ignored.
+   // Check if the User talk namespace should be ignored
if ( $wgOrphanedTalkPagesIgnoreUserTalk === true ) {
-   $wgOrphanedTalkPagesExemptedNamespaces[] = NS_USER_TALK;
+   $exemptedNamespaces[] = NS_USER_TALK;
}
 
$query = [
@@ -62,16 +57,13 @@
]
];
 
-   // Check if the configuration variable is still empty
-   if ( !empty( $wgOrphanedTalkPagesExemptedNamespaces ) ) {
-   // Loop through the exempted namespaces
-   foreach ( $wgOrphanedTalkPagesExemptedNamespaces as 
$namespace ) {
-   // Skip through non-numeric values
-   if ( !is_numeric( $namespace ) ) {
-   continue;
-   }
-   $query['conds'][] = "p1.page_namespace != 
$namespace";
+   // Loop through the exempted namespaces
+   foreach ( $exemptedNamespaces as $namespace ) {
+   // Skip through non-integer values
+   if ( !is_int( $namespace ) ) {
+   continue;
}
+   $query['conds'][] = "p1.page_namespace != $namespace";
}
 
// Add the final condition

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b281cb1d5e390c2a17ea896f53afabf04390890
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OrphanedTalkPages
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...GlobalUserrights[master]: Major rewrite of GlobalUserrights to unbreak it for 1.29

2017-05-28 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355906 )

Change subject: Major rewrite of GlobalUserrights to unbreak it for 1.29
..

Major rewrite of GlobalUserrights to unbreak it for 1.29

This extension needed attention as it did not function at all after the
changes made to Special:Userrights with 1.29, which this extension
derives of.
This bumps the version number up to 1.5 to prevent confusion with
ShoutWiki's 1.4-SW release.
Things fixed:
* Support for SQLite
* Support for expiring group membership
* Log formatting is now done with LogFormatter instead of the previous
hack, identical to the user rights log, complete with the advantages
that brings
* User Uid's are now the Central ID. This doesn't change anything for
shared tables setups, but should make the extension easier to support on
setups that have a different Central ID provider
* Global group membership has now been abstracted similar to local group
membership
* A hook handler for UsersPagerDoBatchLookups has been added, because a
previous hook is not in MediaWiki (anymore?)
* Short array syntax used

Bug: T166436
Change-Id: I2eca420b3590ce7680cbc96c3432ff777e091d2a
---
A GlobalRightsLogFormatter.php
A GlobalUserGroupMembership.php
M GlobalUserrights.alias.php
M GlobalUserrightsHooks.php
M GlobalUserrights_body.php
M extension.json
M global_user_groups.sql
M i18n/en.json
M i18n/qqq.json
9 files changed, 813 insertions(+), 253 deletions(-)


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

diff --git a/GlobalRightsLogFormatter.php b/GlobalRightsLogFormatter.php
new file mode 100644
index 000..fab20be
--- /dev/null
+++ b/GlobalRightsLogFormatter.php
@@ -0,0 +1,90 @@
+http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
+ */
+
+/**
+ * This class formats global rights log entries.
+ */
+class GlobalRightsLogFormatter extends RightsLogFormatter {
+
+   /**
+* Return the old key here for backwards compatibility.
+* This preserves old translations and log entries
+*
+* @return string message key
+*/
+   protected function getMessageKey() {
+   $key = parent::getMessageKey();
+
+   $params = $this->getMessageParameters();
+   if ( !isset( $params[4] ) ) {
+   $key = 'gur-rightslog-entry';
+   }
+
+   return $key;
+   }
+
+   protected function getMessageParameters() {
+   // This is hacky but required, because the parent 
RightsLogFormatter's method
+   // must be avoided, otherwise the group expiration date appears 
twice in the logs
+   $params = LogFormatter::getMessageParameters();
+
+   // Old entries do not contain a fourth parameter
+   if ( !isset( $params[4] ) ) {
+   return $params;
+   }
+
+   $oldGroups = $this->makeGroupArray( $params[3] );
+   $newGroups = $this->makeGroupArray( $params[4] );
+
+   $userName = $this->entry->getTarget()->getText();
+   if ( !$this->plaintext && count( $oldGroups ) ) {
+   foreach ( $oldGroups as &$group ) {
+   $group = 
GlobalUserGroupMembership::getGroupMemberName( $group, $userName );
+   }
+   }
+   if ( !$this->plaintext && count( $newGroups ) ) {
+   foreach ( $newGroups as &$group ) {
+   $group = 
GlobalUserGroupMembership::getGroupMemberName( $group, $userName );
+   }
+   }
+
+   // fetch the metadata about each group membership
+   $allParams = $this->entry->getParameters();
+
+   if ( count( $oldGroups ) ) {
+   $params[3] = [ 'raw' => $this->formatRightsList( 
$oldGroups,
+   isset( $allParams['oldmetadata'] ) ? 
$allParams['oldmetadata'] : [] ) ];
+   } else {
+   $params[3] = $this->msg( 'rightsnone' )->text();
+   }
+
+   if ( count( $newGroups ) ) {
+   // Array_values is used here because of T44211
+   // see use of array_unique in 
UserrightsPage::doSaveUserGroups on $newGroups.
+   $params[4] = [ 'raw' => $this->formatRightsList( 
array_values( $newGroups ),
+   isset( $allParams['newmetadata'] ) ? 
$allParams['newmetadata'] : [] ) ];
+   } else {
+   $params[4] = $this->msg( 'rightsnone' )->text();
+   }
+
+   $params[5] = $userName;
+
+   return $params;
+   }
+
+   private function makeGroupArray( $group ) {
+   // Migrate old group param

[MediaWiki-commits] [Gerrit] mediawiki...GlobalUserrights[master]: Fix the viewing of global user rights

2017-05-27 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355884 )

Change subject: Fix the viewing of global user rights
..

Fix the viewing of global user rights

Bug: T166436
Change-Id: I5f1033485d847528b075b1cea9c80b7f9a85c8ef
---
M GlobalUserrights_body.php
1 file changed, 52 insertions(+), 24 deletions(-)


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

diff --git a/GlobalUserrights_body.php b/GlobalUserrights_body.php
index c728b2a..6827581 100644
--- a/GlobalUserrights_body.php
+++ b/GlobalUserrights_body.php
@@ -20,10 +20,16 @@
/**
 * Save global user groups changes in the DB
 *
-* @param $username String: username
-* @param $reason String: reason
+* @param User|UserRightsProxy $user
+* @param array $add
+* @param array $remove
+* @param string $reason reason
+* @param array $tags
+* @param array $groupExpiries
+* @return array
+* @internal param string $username username
 */
-   function doSaveUserGroups( $user, $add, $remove, $reason = '' ) {
+   function doSaveUserGroups( $user, $add, $remove, $reason = '', $tags = 
[], $groupExpiries = [] ) {
$oldGroups = GlobalUserrightsHooks::getGroups( $user );
$newGroups = $oldGroups;
 
@@ -52,49 +58,57 @@
 
// if anything changed, log it
if ( $newGroups != $oldGroups ) {
-   $this->addLogEntry( $user, $oldGroups, $newGroups, 
$reason );
+   $this->addLogEntry( $user, $oldGroups, $newGroups, 
$reason, $tags, [], [] );
}
-   return array( $add, $remove );
+   return [ $add, $remove ];
}
 
function addGroup( $uid, $group ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->insert(
'global_user_groups',
-   array(
+   [
'gug_user' => $uid,
'gug_group' => $group
-   ),
+   ],
__METHOD__,
'IGNORE'
);
}
 
+   /**
+* @param int $uid
+* @param $group
+*/
function removeGroup( $uid, $group ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->delete(
'global_user_groups',
-   array(
+   [
'gug_user' => $uid,
'gug_group' => $group
-   ),
+   ],
__METHOD__
);
}
 
/**
 * Add a gblrights log entry
+* @param User|UserRightsProxy $user
+* @param array $oldGroups
+* @param array $newGroups
+* @param string $reason
 */
-   function addLogEntry( $user, $oldGroups, $newGroups, $reason ) {
+   function addLogEntry( $user, $oldGroups, $newGroups, $reason, $tags, 
$oldUGMs, $newUGMs ) {
$log = new LogPage( 'gblrights' );
 
$log->addEntry( 'rights',
$user->getUserPage(),
$reason,
-   array(
+   [
$this->makeGroupNameList( $oldGroups ),
$this->makeGroupNameList( $newGroups )
-   )
+   ]
);
}
 
@@ -116,29 +130,43 @@
}
}
 
-   protected function showEditUserGroupsForm( $user, $groups ) {
+   /**
+* @param User|UserRightsProxy $user
+* @param array $groups
+* @param array $groupMemberships
+*/
+   protected function showEditUserGroupsForm( $user, $groups, 
$groupMemberships ) {
// override the $groups that is passed, which will be
// the user's local groups
$groups = GlobalUserrightsHooks::getGroups( $user );
-   parent::showEditUserGroupsForm( $user, $groups );
+   parent::showEditUserGroupsForm( $user, $groups, 
$groupMemberships );
}
 
+   /**
+* @return array
+*/
function changeableGroups() {
-   global $wgUser;
-   if ( $wgUser->isAllowed( 'userrights-global' ) ) {
+   $groups = [
+   'add' => [],
+   'remove' => [],
+   'add-self' => [],
+   'remove-self' => []
+   ];
+
+   if ( $this->getUser()->isAllowed( 'userrights-global' ) ) {
// all groups can be added globally

[MediaWiki-commits] [Gerrit] mediawiki...GlobalUserrights[master]: Fix the incompatible function declarations

2017-05-27 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355880 )

Change subject: Fix the incompatible function declarations
..

Fix the incompatible function declarations

This allows the extension to function on Special:SpecialPages without
displaying errors

Bug: T166436
Change-Id: I8e023b5d37fa2c3f791a1d92366a179c3407f767
---
M GlobalUserrights_body.php
1 file changed, 17 insertions(+), 7 deletions(-)


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

diff --git a/GlobalUserrights_body.php b/GlobalUserrights_body.php
index c728b2a..dd11692 100644
--- a/GlobalUserrights_body.php
+++ b/GlobalUserrights_body.php
@@ -20,10 +20,16 @@
/**
 * Save global user groups changes in the DB
 *
-* @param $username String: username
-* @param $reason String: reason
+* @param User|UserRightsProxy $user
+* @param array $add
+* @param array $remove
+* @param string $reason reason
+* @param array $tags
+* @param array $groupExpiries
+* @return array
+* @internal param string $username username
 */
-   function doSaveUserGroups( $user, $add, $remove, $reason = '' ) {
+   function doSaveUserGroups( $user, $add, $remove, $reason = '', $tags = 
[], $groupExpiries = [] ) {
$oldGroups = GlobalUserrightsHooks::getGroups( $user );
$newGroups = $oldGroups;
 
@@ -52,7 +58,7 @@
 
// if anything changed, log it
if ( $newGroups != $oldGroups ) {
-   $this->addLogEntry( $user, $oldGroups, $newGroups, 
$reason );
+   $this->addLogEntry( $user, $oldGroups, $newGroups, 
$reason, $tags, [], [] );
}
return array( $add, $remove );
}
@@ -84,8 +90,12 @@
 
/**
 * Add a gblrights log entry
+* @param User|UserRightsProxy $user
+* @param array $oldGroups
+* @param array $newGroups
+* @param string $reason
 */
-   function addLogEntry( $user, $oldGroups, $newGroups, $reason ) {
+   function addLogEntry( $user, $oldGroups, $newGroups, $reason, $tags, 
$oldUGMs, $newUGMs ) {
$log = new LogPage( 'gblrights' );
 
$log->addEntry( 'rights',
@@ -116,11 +126,11 @@
}
}
 
-   protected function showEditUserGroupsForm( $user, $groups ) {
+   protected function showEditUserGroupsForm( $user, $groups, 
$groupMemberships ) {
// override the $groups that is passed, which will be
// the user's local groups
$groups = GlobalUserrightsHooks::getGroups( $user );
-   parent::showEditUserGroupsForm( $user, $groups );
+   parent::showEditUserGroupsForm( $user, $groups, 
$groupMemberships );
}
 
function changeableGroups() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e023b5d37fa2c3f791a1d92366a179c3407f767
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUserrights
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace calls to getText() on DBQueryError exceptions

2017-05-15 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353894 )

Change subject: Replace calls to getText() on DBQueryError exceptions
..

Replace calls to getText() on DBQueryError exceptions

The called method does not exist. Replaced with getMessage(),
similar to PostgresInstaller.php.

Bug: T165319
Change-Id: I900ec8c18307ce6f9e8c9f4cda79b1e33ed66dff
---
M includes/installer/MssqlInstaller.php
M includes/installer/MysqlInstaller.php
2 files changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/includes/installer/MssqlInstaller.php 
b/includes/installer/MssqlInstaller.php
index ba9818d..43d3574 100644
--- a/includes/installer/MssqlInstaller.php
+++ b/includes/installer/MssqlInstaller.php
@@ -577,7 +577,7 @@
$grantableNames[] = $dbUser;
} catch ( DBQueryError $dqe ) {
$this->db->rollback();
-   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getText() );
+   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getMessage() );
}
} elseif ( !$this->userExists( $dbUser ) ) {
try {
@@ -588,7 +588,7 @@
$grantableNames[] = $dbUser;
} catch ( DBQueryError $dqe ) {
$this->db->rollback();
-   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getText() );
+   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getMessage() );
}
} else {
$status->warning( 
'config-install-user-alreadyexists', $dbUser );
@@ -620,7 +620,7 @@
$this->db->commit();
} catch ( DBQueryError $dqe ) {
$this->db->rollback();
-   $status->fatal( 
'config-install-user-grant-failed', $dbUser, $dqe->getText() );
+   $status->fatal( 
'config-install-user-grant-failed', $dbUser, $dqe->getMessage() );
}
// Also try to grant SHOWPLAN on the db, but 
don't fail if we can't
// (just makes a couple things in mediawiki run 
slower since
@@ -646,7 +646,7 @@
$this->db->query( "CREATE FULLTEXT INDEX ON 
$searchindex (si_title, si_text) "
. "KEY INDEX si_page ON $schema" );
} catch ( DBQueryError $dqe ) {
-   $status->fatal( 'config-install-tables-failed', 
$dqe->getText() );
+   $status->fatal( 'config-install-tables-failed', 
$dqe->getMessage() );
}
}
 
diff --git a/includes/installer/MysqlInstaller.php 
b/includes/installer/MysqlInstaller.php
index 09051f4..64a4077 100644
--- a/includes/installer/MysqlInstaller.php
+++ b/includes/installer/MysqlInstaller.php
@@ -574,7 +574,7 @@
// If we couldn't 
create for some bizzare reason and the
// user probably 
doesn't exist, skip the grant
$this->db->rollback( 
__METHOD__ );
-   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getText() );
+   $status->warning( 
'config-install-user-create-failed', $dbUser, $dqe->getMessage() );
}
}
} else {
@@ -594,7 +594,7 @@
$this->db->commit( __METHOD__ );
} catch ( DBQueryError $dqe ) {
$this->db->rollback( __METHOD__ );
-   $status->fatal( 
'config-install-user-grant-failed', $dbUser, $dqe->getText() );
+   $status->fatal( 
'config-install-user-grant-failed', $dbUser, $dqe->getMessage() );
}
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I900ec8c18307ce6f9e8c9f4cda79b1e33ed66dff
Gerrit-PatchSet: 1
Gerrit-Pr

[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: First release of OrphanedTalkPages

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

Change subject: First release of OrphanedTalkPages
..


First release of OrphanedTalkPages

This adds the first version of OrphanedTalkPages

Change-Id: I3f9d5eaa1aac16dfd7b634d3dae4b7c6b8a24bc0
---
A COPYING
A OrphanedTalkPages.alias.php
A README
A extension.json
A i18n/en.json
A i18n/qqq.json
A specials/SpecialOrphanedTalkPages.php
7 files changed, 193 insertions(+), 0 deletions(-)

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



diff --git a/COPYING b/COPYING
new file mode 100644
index 000..31142cd
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,7 @@
+Copyright 2017 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
\ No newline at end of file
diff --git a/OrphanedTalkPages.alias.php b/OrphanedTalkPages.alias.php
new file mode 100644
index 000..9d8f431
--- /dev/null
+++ b/OrphanedTalkPages.alias.php
@@ -0,0 +1,21 @@
+ [ 'OrphanedTalkPages' ],
+];
+
+/** Nederlands (Dutch) */
+$specialPageAliases['nl'] = [
+   'OrphanedTalkPages' => [ 'WeesOverlegPaginas' ],
+];
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 000..ad84cdc
--- /dev/null
+++ b/README
@@ -0,0 +1,26 @@
+== About ==
+Orphaned talk pages adds a new Special page to MediaWiki: 
Special:OrphanedTalkPages. This special page lists all
+talk pages that do not have an accompanying page. The namespaces that are 
exempt from these checks is the user talk
+namespace by default, but this can be configured.
+
+== Installation instructions ==
+Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:OrphanedTalkPages
+
+To use this extension, add:
+wfLoadExtension( 'OrphanedTalkPages' );
+to your LocalSettings.php file.
+
+== Configuration instructions ==
+This extension introduces two new configuration variables:
+$wgOrphanedTalkPagesExemptedNamespaces and $wgOrphanedTalkPagesIgnoreUserTalk
+
+* $wgOrphanedTalkPagesExemptedNamespaces controls which talk namespaces should 
be ignored when looking for orphaned
+talk pages. This variable is an array of namespace ids and is empty by default.
+* $wgOrphanedTalkPagesIgnoreUserTalk determines if the user talk namespace (3, 
or NS_USER_TALK) should be ignored when
+looking for orphaned talk pages. This variable is a boolean and set to true by 
default.
+
+== Other important notes ==
+* The query that this special page uses is considered expensive. This means 
that when $wgMiserMode is enabled, the
+results will be served from cache.
+* The special page may report talk pages as orphaned when they are not. The 
most common situation where this happens
+is File talk pages when $wgUseInstantCommons or $wgForeignFileRepos is enabled.
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..cef9ba6
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,31 @@
+{
+   "name": "OrphanedTalkPages",
+   "version": "1.0.0",
+   "author": [
+   "Mainframe98"
+   ],
+   "url": "https://www.mediawiki.org/wiki/Extension:OrphanedTalkPages";,
+   "descriptionmsg": "orphanedtalkpages-desc",
+   "namemsg": "orphanedtalkpages-extensionname",
+   "license-name": "MIT",
+   "type": "specialpage",
+   "AutoloadClasses": {
+   "SpecialOrphanedTalkPages": 
"specials/SpecialOrphanedTalkPages.php"
+   },
+   "MessagesDirs": {
+   "OrphanedTalkPages": [
+   "i18n"
+   ]
+   },
+   "ExtensionMessagesFiles": {
+   "OrphanedTalkPagesAlias": "OrphanedTalkPages.alias.php"
+   },
+   "SpecialPages": {
+   "OrphanedTalkPages": "SpecialOrphanedTalkPages"
+   },
+   "config": {
+   "OrphanedTalkPagesExemptedNamespaces": [],
+   "OrphanedTalkPagesIgnoreUserTalk": true
+   },
+ 

[MediaWiki-commits] [Gerrit] mediawiki...OrphanedTalkPages[master]: First release of OrphanedTalkPages

2017-04-30 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351133 )

Change subject: First release of OrphanedTalkPages
..

First release of OrphanedTalkPages

This adds the first version of OrphanedTalkPages

Change-Id: I3f9d5eaa1aac16dfd7b634d3dae4b7c6b8a24bc0
---
A COPYING
A OrphanedTalkPages.alias.php
A README
A extension.json
A i18n/en.json
A i18n/qqq.json
A specials/SpecialOrphanedTalkPages.php
7 files changed, 193 insertions(+), 0 deletions(-)


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

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..31142cd
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,7 @@
+Copyright 2017 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
\ No newline at end of file
diff --git a/OrphanedTalkPages.alias.php b/OrphanedTalkPages.alias.php
new file mode 100644
index 000..9d8f431
--- /dev/null
+++ b/OrphanedTalkPages.alias.php
@@ -0,0 +1,21 @@
+ [ 'OrphanedTalkPages' ],
+];
+
+/** Nederlands (Dutch) */
+$specialPageAliases['nl'] = [
+   'OrphanedTalkPages' => [ 'WeesOverlegPaginas' ],
+];
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 000..ad84cdc
--- /dev/null
+++ b/README
@@ -0,0 +1,26 @@
+== About ==
+Orphaned talk pages adds a new Special page to MediaWiki: 
Special:OrphanedTalkPages. This special page lists all
+talk pages that do not have an accompanying page. The namespaces that are 
exempt from these checks is the user talk
+namespace by default, but this can be configured.
+
+== Installation instructions ==
+Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:OrphanedTalkPages
+
+To use this extension, add:
+wfLoadExtension( 'OrphanedTalkPages' );
+to your LocalSettings.php file.
+
+== Configuration instructions ==
+This extension introduces two new configuration variables:
+$wgOrphanedTalkPagesExemptedNamespaces and $wgOrphanedTalkPagesIgnoreUserTalk
+
+* $wgOrphanedTalkPagesExemptedNamespaces controls which talk namespaces should 
be ignored when looking for orphaned
+talk pages. This variable is an array of namespace ids and is empty by default.
+* $wgOrphanedTalkPagesIgnoreUserTalk determines if the user talk namespace (3, 
or NS_USER_TALK) should be ignored when
+looking for orphaned talk pages. This variable is a boolean and set to true by 
default.
+
+== Other important notes ==
+* The query that this special page uses is considered expensive. This means 
that when $wgMiserMode is enabled, the
+results will be served from cache.
+* The special page may report talk pages as orphaned when they are not. The 
most common situation where this happens
+is File talk pages when $wgUseInstantCommons or $wgForeignFileRepos is enabled.
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 000..cef9ba6
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,31 @@
+{
+   "name": "OrphanedTalkPages",
+   "version": "1.0.0",
+   "author": [
+   "Mainframe98"
+   ],
+   "url": "https://www.mediawiki.org/wiki/Extension:OrphanedTalkPages";,
+   "descriptionmsg": "orphanedtalkpages-desc",
+   "namemsg": "orphanedtalkpages-extensionname",
+   "license-name": "MIT",
+   "type": "specialpage",
+   "AutoloadClasses": {
+   "SpecialOrphanedTalkPages": 
"specials/SpecialOrphanedTalkPages.php"
+   },
+   "MessagesDirs": {
+   "OrphanedTalkPages": [
+   "i18n"
+   ]
+   },
+   "ExtensionMessagesFiles": {
+   "OrphanedTalkPagesAlias": "OrphanedTalkPages.alias.php"
+   },
+   "SpecialPages": {
+   "OrphanedTalkPages": "SpecialOrphanedTalkPages"
+   },
+   "config": {
+   "OrphanedTalkPagesExemptedNamespaces": [],
+   "OrphanedTalkPagesI

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: First version of AutoBlockList special page

2017-03-06 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341376 )

Change subject: First version of AutoBlockList special page
..

First version of AutoBlockList special page

This patch introduces a new special page named AutoBlockList.
Its design is reused from Special:BlockList.

Bug: T146414
Change-Id: I811d23c98be749d8df36700b07a295355691af77
---
M autoload.php
M includes/specialpage/SpecialPageFactory.php
A includes/specials/SpecialAutoBlockList.php
M languages/i18n/en.json
M languages/i18n/qqq.json
M languages/messages/MessagesEn.php
6 files changed, 164 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/76/341376/1

diff --git a/autoload.php b/autoload.php
index 8c63d4f..8df5a23 100644
--- a/autoload.php
+++ b/autoload.php
@@ -1308,6 +1308,7 @@
'SpecialApiHelp' => __DIR__ . '/includes/specials/SpecialApiHelp.php',
'SpecialApiSandbox' => __DIR__ . 
'/includes/specials/SpecialApiSandbox.php',
'SpecialBlankpage' => __DIR__ . 
'/includes/specials/SpecialBlankpage.php',
+   'SpecialAutoBlockList' => __DIR__ . 
'/includes/specials/SpecialAutoBlockList.php',
'SpecialBlock' => __DIR__ . '/includes/specials/SpecialBlock.php',
'SpecialBlockList' => __DIR__ . 
'/includes/specials/SpecialBlockList.php',
'SpecialBookSources' => __DIR__ . 
'/includes/specials/SpecialBooksources.php',
diff --git a/includes/specialpage/SpecialPageFactory.php 
b/includes/specialpage/SpecialPageFactory.php
index 33e1cc3..99e4d2f 100644
--- a/includes/specialpage/SpecialPageFactory.php
+++ b/includes/specialpage/SpecialPageFactory.php
@@ -96,6 +96,7 @@
'Block' => 'SpecialBlock',
'Unblock' => 'SpecialUnblock',
'BlockList' => 'SpecialBlockList',
+   'AutoBlockList' => 'SpecialAutoBlockList',
'ChangePassword' => 'SpecialChangePassword',
'BotPasswords' => 'SpecialBotPasswords',
'PasswordReset' => 'SpecialPasswordReset',
@@ -504,7 +505,7 @@
 * @param bool $including Bool output is being captured for use in 
{{special:whatever}}
 * @param LinkRenderer|null $linkRenderer (since 1.28)
 *
-* @return bool
+* @return bool|Title
 */
public static function executePath( Title &$title, IContextSource 
&$context, $including = false,
LinkRenderer $linkRenderer = null
diff --git a/includes/specials/SpecialAutoBlockList.php 
b/includes/specials/SpecialAutoBlockList.php
new file mode 100644
index 000..37ffe3e
--- /dev/null
+++ b/includes/specials/SpecialAutoBlockList.php
@@ -0,0 +1,148 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ */
+
+/**
+ * A special page that lists existing blocks
+ *
+ * @ingroup SpecialPage
+ */
+class SpecialAutoBlockList extends SpecialPage {
+
+   function __construct() {
+   parent::__construct( 'AutoBlockList' );
+   }
+
+   /**
+* Main execution point
+*
+* @param string $par Title fragment
+*/
+   public function execute( $par ) {
+   $this->setHeaders();
+   $this->outputHeader();
+   $out = $this->getOutput();
+   $lang = $this->getLanguage();
+   $out->setPageTitle( $this->msg( 'autoblocklist' ) );
+   $out->addModuleStyles( [ 'mediawiki.special' ] );
+
+   # setup BlockListPager here to get the actual default Limit
+   $pager = $this->getBlockListPager();
+
+   # Just show the block list
+   $fields = [
+   'Limit' => [
+   'type' => 'limitselect',
+   'label-message' => 'table_pager_limit_label',
+   'options' => [
+   $lang->formatNum( 20 ) => 20,
+   $lang->formatNum( 50 ) => 50,
+   $lang->formatNum( 100 ) => 100,
+   $lang->formatNum( 250 ) => 250,
+   $lang->formatNum( 500 ) => 500,
+   ],
+   'name' => 'limit',
+   'default' => $pager->getLimit(),
+   ]
+   ];
+
+   $context = new DerivativeContext( $this->getContext() );
+   $context->setTitle( $this->getPageTitle() ); // Remove subpage
+   $form = HTMLForm::factory( 'ooui', $fields, $context );
+   $form
+   ->setMethod( 'get' )
+   ->setFormIdentifier( 'blocklist' )
+   ->setWrapperLegendMsg( 'autoblocklist-legend' )
+   ->setSubmitTextMsg( 'autoblockli

[MediaWiki-commits] [Gerrit] mediawiki...Nuke[master]: add an API module for Nuke

2017-03-04 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341133 )

Change subject: add an API module for Nuke
..

add an API module for Nuke

This patch introduces an API module.
The pattern field is untested as it currently does not work on
the special page. See T154276. This should function after the
aforementioned bug is fixed, as it just passes the parameter
content to the function in the special page.

Also: please note that this patch is developed against 1.29, and
utilizes API methods provided since said version.

Bug: T35470
Change-Id: I1100fc6254fc353c95a51b0cc7af282dc75005e6
---
A Nuke.api.php
M Nuke_body.php
M extension.json
M i18n/en.json
M i18n/qqq.json
5 files changed, 235 insertions(+), 7 deletions(-)


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

diff --git a/Nuke.api.php b/Nuke.api.php
new file mode 100644
index 000..ec6b923
--- /dev/null
+++ b/Nuke.api.php
@@ -0,0 +1,201 @@
+getResult();
+   $params = $this->extractRequestParams();
+
+   // Check the user rights. You need both to use this module.
+   // nuke to restrict usage to privileged users, delete to do the 
actual deleting
+   $this->checkUserRightsAny( 'nuke' );
+   $this->checkUserRightsAny( 'delete' );
+
+   $this->requireMaxOneParameter( $params, 'username', 'userid' );
+
+   $pages = $this->getPages( $params );
+
+   $reason = $params['reason'];
+
+   if ( $reason === null ) {
+   if ( $params['username'] === null ) {
+   $reason = wfMessage( 'nuke-multiplepeople' 
)->inContentLanguage()->text();
+   } else {
+   $reason = wfMessage( 'nuke-defaultreason', 
$params['username'] )
+   
->inContentLanguage()->text();
+   }
+   }
+
+   $excludedTitles = [];
+
+   if ( $params['exclude'] !== null ) {
+   foreach ( $params['exclude'] as $page ) {
+   $title = Title::newFromText( $page );
+   if ( $title !== null ) {
+   $excludedTitles[] = $title;
+   }
+   }
+   }
+
+   $result = $this->doDelete( $pages, $excludedTitles, $reason );
+
+   if ( $params['username'] !== '' ) {
+   $apiResult->addValue( $this->getModuleName(), 'user', 
$params['username'] );
+   }
+
+   $apiResult->addValue( $this->getModuleName(), 'reason', $reason 
);
+   $apiResult->addValue( $this->getModuleName(), 'pages', $result 
);
+   $apiResult->addValue( $this->getModuleName(), 'excluded', 
$excludedTitles );
+
+   }
+
+   /**
+* Gets the set of pages to nuke.
+*
+* @param array $params parameters passed to this module
+* @return array
+*/
+   private function getPages( array $params ) {
+
+   if ( $params['userid'] !== null ) {
+   $username = User::whoIs( $params['userid'] );
+   if ( $username === false ) {
+   $this->dieWithError( [ 'apierror-nosuchuserid', 
$params['userid'] ], 'nosuchuserid' );
+   } else {
+   $params['username'] = $username;
+   }
+   } elseif ( $params['username'] !== null ) {
+   $target = User::newFromName( $params['username'] );
+
+   // Bug 38633 - if the target is a user (not an IP 
address), but it
+   // doesn't exist or is unusable, error.
+   if ( $target instanceof User &&
+   ( $target->isAnon() /* doesn't exist */ || 
!User::isUsableName( $target->getName() ) )
+   ) {
+   $this->dieWithError( [ 'nosuchusershort', 
$params['username'] ], 'nosuchuser' );
+   }
+   } else {
+   $params['username'] = '';
+   }
+
+   $pages = SpecialNuke::getNewPages( $params['username'], 
$params['limit'], $params['pattern'],
+   $params['namespace'] );
+
+   return $pages;
+   }
+
+   /**
+* Does the actual deletion of the pages.
+* Because the one in Nuke_body.php has integrated UI elements
+* and there's no way to specify pages skipped (due the way Special:Nuke
+* works), the api needs its own.
+*
+* @param array $pages The pages to delete
+* @param array $excludeTitles The pages to exclude from d

[MediaWiki-commits] [Gerrit] mediawiki...PageLanguageApi[master]: Note about becoming obsolete in 1.29

2017-02-26 Thread Mainframe98 (Code Review)
Mainframe98 has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/339935 )

Change subject: Note about becoming obsolete in 1.29
..


Note about becoming obsolete in 1.29

Change-Id: Ia2f1d7a1ec3610e460064ad5c8fbf58c0e930407
---
M README
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/README b/README
index 4a9c533..88540e2 100644
--- a/README
+++ b/README
@@ -1,4 +1,5 @@
 == Installation instructions ==
+Warning: The functionality of this extension is available in MediaWiki Core 
starting with MediaWiki 1.29, making this extension obsolete. Documentation for 
the MediaWiki counterpart is available on 
https://www.mediawiki.org/wiki/API:SetPageLanguage
 Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:PageLanguageApi
 
 To use this extension, you need three things:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2f1d7a1ec3610e460064ad5c8fbf58c0e930407
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageLanguageApi
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 
Gerrit-Reviewer: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...PageLanguageApi[master]: Note about becoming obsolete in 1.29

2017-02-26 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/339935 )

Change subject: Note about becoming obsolete in 1.29
..

Note about becoming obsolete in 1.29

Change-Id: Ia2f1d7a1ec3610e460064ad5c8fbf58c0e930407
---
M README
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/README b/README
index 4a9c533..88540e2 100644
--- a/README
+++ b/README
@@ -1,4 +1,5 @@
 == Installation instructions ==
+Warning: The functionality of this extension is available in MediaWiki Core 
starting with MediaWiki 1.29, making this extension obsolete. Documentation for 
the MediaWiki counterpart is available on 
https://www.mediawiki.org/wiki/API:SetPageLanguage
 Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:PageLanguageApi
 
 To use this extension, you need three things:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2f1d7a1ec3610e460064ad5c8fbf58c0e930407
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageLanguageApi
Gerrit-Branch: master
Gerrit-Owner: Mainframe98 

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


[MediaWiki-commits] [Gerrit] mediawiki...StaffPowers[master]: Make proper use of the unblockable right

2017-02-24 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/339623 )

Change subject: Make proper use of the unblockable right
..

Make proper use of the unblockable right

This commit rewrites the internals to make use of the
unblockable right. This replaces the check for the staff group.
To ensure maximum compatiblity with the previous versions, two
new global variables are introduced: wgStewardGroupName with the
default 'steward' and wgShoutWikiMessages with the default true.
wgStewardGroupName contains the groupname of the steward group, a
group only blockable by those who have the unblockable right. If
this global is set to false, NULL or an empty string, it will be
ignored.
wgShoutWikiMessages toggles the ShoutWiki specific messages when
blocking either stewards or those with the unblockable right. Its
functionality has also been fixed, as it previously didn't work.
In addition to these changes, the Dutch translation has also been
updated.

Change-Id: I1fccec3b74dd9b0b98994b81e3a3426efca898c0
---
M StaffPowers.class.php
M extension.json
M i18n/en.json
M i18n/nl.json
M i18n/qqq.json
5 files changed, 55 insertions(+), 33 deletions(-)


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

diff --git a/StaffPowers.class.php b/StaffPowers.class.php
index ae7a1d0..6a75057 100644
--- a/StaffPowers.class.php
+++ b/StaffPowers.class.php
@@ -5,10 +5,11 @@
  *
  * @file
  * @ingroup Extensions
- * @version 1.3
- * @date 20 November 2015
+ * @version 1.4
+ * @date 23 February 2017
  * @author Łukasz Garczewski 
  * @author Jack Phoenix 
+ * @author Mainframe98 
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
3.0 or later
  * @link https://www.mediawiki.org/wiki/Extension:StaffPowers Documentation
  */
@@ -16,52 +17,59 @@
 class StaffPowers {
 
/**
-* Makes staff members completely unblockable and stewards unblockable 
by
-* non-staff users.
+* Makes users with the unblockable right (staff members) completely 
unblockable and stewards
+* unblockable by non-staff users.
 *
 * @param Block $block The Block object about to be saved
 * @param User $user The user _doing_ the block (not the one being 
blocked)
 * @param array $reason Custom reason as to why blocking isn't possible
 * @return bool
 */
-   public static function makeUnblockable( $block, $user, $reason ) {
+   public static function makeUnblockable( &$block, &$user, &$reason ) {
+   global $wgStewardGroupName, $wgShoutWikiMessages;
$blockedUser = User::newFromName( $block->getRedactedName() );
 
-   if ( empty( $blockedUser ) ) {
+   if ( empty( $blockedUser ) || User::isIP( $blockedUser ) ) {
return true;
}
 
-   if ( User::isIP( $blockedUser ) ) {
-   return true;
+   $userIsSteward = false;
+   if ( !empty( $wgStewardGroupName ) ) {
+   $userIsSteward = in_array( $wgStewardGroupName, 
$blockedUser->getEffectiveGroups() );
}
 
-   $userIsSteward = in_array( 'steward', 
$blockedUser->getEffectiveGroups() );
-   if ( !$blockedUser->isAllowed( 'unblockable' ) && 
!$userIsSteward ) {
+   $userIsUnblockable = $blockedUser->isAllowed( 'unblockable' );
+   if ( !$userIsUnblockable && !$userIsSteward ) {
return true;
}
 
// This exists for interoperability purposes with Wikia's 
StaffLog extension
-   Hooks::run( 'BlockIpStaffPowersCancel', array( $block, $user ) 
);
+   Hooks::run( 'BlockIpStaffPowersCancel', [ $block, $user ] );
 
// Display a custom reason as to why blocking the specified 
user isn't
// possible instead of the totally unhelpful, default core 
message
-   $userIsStaff = in_array( 'staff', 
$blockedUser->getEffectiveGroups() );
-   $blockerIsStaff = in_array( 'staff', 
$user->getEffectiveGroups() );
 
-   // Don't allow staff to be blocked in any circumstances
-   if ( $userIsStaff ) {
-   $reason = array( 'staffpowers-ipblock-abort' );
-   } elseif ( $userIsSteward && !$blockerIsStaff ) {
-   // and also don't allow stewards to be blocked by 
non-staff, as per IRC
-   // discussion on 19 January 2014
-   $reason = array( 'staffpowers-steward-block-abort' );
-   } elseif ( $userIsSteward && $blockerIsStaff ) {
-   // This is a possible scenario - staff are allowed to 
block stewards.
-   // We need to address this situation 'cause this 
function returns 

[MediaWiki-commits] [Gerrit] mediawiki...PageLanguageApi[master]: Initial Commit

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

Change subject: Initial Commit
..


Initial Commit

This commit adds the first version of the PageLanguageApi extension,
based on the MediaWiki Api page API:PageLanguage, which was written for
an patch that was never merged.

Change-Id: I4564f03822cecc43ea4d7c9db7ead7c04759c92f
---
A COPYING
A LICENSE
A PageLanguageApi.php
A README
A extension.json
A i18n/en.json
A i18n/nl.json
A i18n/qqq.json
A includes/api/PageLanguageApi.php
9 files changed, 376 insertions(+), 0 deletions(-)

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



diff --git a/COPYING b/COPYING
new file mode 100644
index 000..8ab948f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..8ab948f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/PageLanguageApi.php b/PageLanguageApi.php
new file mode 100644
index 000..c539814
--- /dev/null
+++ b/PageLanguageApi.php
@@ -0,0 +1,33 @@
+https://www.mediawiki.org/wiki/Extension:PageLanguageAPI
+ * Documentation for the API can be found on 
https://www.mediawiki.org/wiki/API:PageLanguage
+ *
+ * @file
+ * @ingroup Extensions
+ * @author Klaas Skelte van der Werf(Mainframe98), 2016
+ * @version 0.0.1.0
+ * @license MIT
+ */
+/*
+ * This file is kept for 1.24 backwards compatibility. 1.25+ uses 
extension.json
+ * Editors are encouraged to edit that file instead and ensure that this file 
is updated accordingly
+ */
+
+$wgExtensionCredits['api'][] = array(
+   'path' => __FILE__,
+   'name' => 'PageLanguageApi',
+   'author' => 'Klaas Skelte van der Werf',
+   'url' => 'https://www.mediawiki.org/wiki/Extension:PageLanguageApi',
+   'descriptionmsg' => 'pagelanguageapi-desc',
+   'version'  => '1.0.0.0',
+   'license-name' => "MIT",
+'type' => 'api'
+);
+/* Setup */
+$wgMessagesDirs['PageLanguageApi'] = __DIR__ . '/i18n';
+
+$wgAutoloadClasses['PageLanguageApi'] = __DIR__ . 
'/includes/api/PageLanguageApi.php';
+$wgAPIModules['pagelang'] = 'PageLanguageApi';
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 000..30d66cc
--- /dev/null
+++ b/README
@@ -0,0 +1,23 @@
+== Installation instructions ==
+Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:PageLanguageApi
+
+To use this extension, you need three things:
+* $wgPageLanguageUseDB needs to be set to true, which is set to default to 
false
+* The 'pagelang' must be assigned to any group. DefaultSettings.php recommends 
sysops
+* Finally, you need to add wfLoadExtension( 'PageLanguageApi'

[MediaWiki-commits] [Gerrit] mediawiki...PageLanguageApi[master]: Initial Commit

2017-01-09 Thread Mainframe98 (Code Review)
Mainframe98 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/331335 )

Change subject: Initial Commit
..

Initial Commit

This commit adds the first version of the PageLanguageApi extension,
based on the MediaWiki Api page API:PageLanguage, which was written for
an patch that was never merged.

Change-Id: I4564f03822cecc43ea4d7c9db7ead7c04759c92f
---
A COPYING
A LICENSE
A PageLanguageApi.php
A README
A extension.json
A i18n/en.json
A i18n/nl.json
A i18n/qqq.json
A includes/api/PageLanguageApi.php
9 files changed, 376 insertions(+), 0 deletions(-)


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

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..8ab948f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..8ab948f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 Klaas Skelte van der Werf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/PageLanguageApi.php b/PageLanguageApi.php
new file mode 100644
index 000..c539814
--- /dev/null
+++ b/PageLanguageApi.php
@@ -0,0 +1,33 @@
+https://www.mediawiki.org/wiki/Extension:PageLanguageAPI
+ * Documentation for the API can be found on 
https://www.mediawiki.org/wiki/API:PageLanguage
+ *
+ * @file
+ * @ingroup Extensions
+ * @author Klaas Skelte van der Werf(Mainframe98), 2016
+ * @version 0.0.1.0
+ * @license MIT
+ */
+/*
+ * This file is kept for 1.24 backwards compatibility. 1.25+ uses 
extension.json
+ * Editors are encouraged to edit that file instead and ensure that this file 
is updated accordingly
+ */
+
+$wgExtensionCredits['api'][] = array(
+   'path' => __FILE__,
+   'name' => 'PageLanguageApi',
+   'author' => 'Klaas Skelte van der Werf',
+   'url' => 'https://www.mediawiki.org/wiki/Extension:PageLanguageApi',
+   'descriptionmsg' => 'pagelanguageapi-desc',
+   'version'  => '1.0.0.0',
+   'license-name' => "MIT",
+'type' => 'api'
+);
+/* Setup */
+$wgMessagesDirs['PageLanguageApi'] = __DIR__ . '/i18n';
+
+$wgAutoloadClasses['PageLanguageApi'] = __DIR__ . 
'/includes/api/PageLanguageApi.php';
+$wgAPIModules['pagelang'] = 'PageLanguageApi';
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 000..30d66cc
--- /dev/null
+++ b/README
@@ -0,0 +1,23 @@
+== Installation instructions ==
+Note: you can also find these on 
https://www.mediawiki.org/wiki/Extension:PageLanguageApi
+
+To use this extension, you need three things:
+* $wgPageLanguageUseDB needs to be set to true, which is set to default to 
false
+* The 'pagelang' must be assigned to any group. DefaultSettings.php recommends 
sysops
+* Finally, you need to ad