[MediaWiki-commits] [Gerrit] Add URL encoding to TOTP QR code URL - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/290965 Change subject: Add URL encoding to TOTP QR code URL .. Add URL encoding to TOTP QR code URL Add RFC 3986 URI encoding to the account label in accordance with the Google Authenticator specification to ensure the QR code is properly generated for usernames with special characters in them. Bug: T136269 Change-Id: I18175c9a3c9a45346fa7a227a5209194385c6696 --- M special/SpecialOATHEnable.php 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/65/290965/1 diff --git a/special/SpecialOATHEnable.php b/special/SpecialOATHEnable.php index a6e9290..02845ff 100644 --- a/special/SpecialOATHEnable.php +++ b/special/SpecialOATHEnable.php @@ -82,9 +82,9 @@ array( 'ext.oathauth' ), new XmlJsCode( 'function () {' -. '$("#qrcode").qrcode("otpauth://totp/' -. $this->OATHUser->getAccount() -. '?secret=' . $secret. '");' + . '$("#qrcode").qrcode("otpauth://totp/' + . rawurlencode( $this->OATHUser->getAccount() ) + . '?secret=' . $secret . '");' . '}' ) ) ) -- To view, visit https://gerrit.wikimedia.org/r/290965 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18175c9a3c9a45346fa7a227a5209194385c6696 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Implement logging for newsletter actions - change (mediawiki...Newsletter)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/280887 Change subject: Implement logging for newsletter actions .. Implement logging for newsletter actions Added logging triggers for important newsletter actions, such as creation, deletion, and changing of publishers. Also added the necessary formatters for the log page. Bug: T110552 Change-Id: I3dc6dacad5c286cd859d7fa58e98ac4b7098546e --- M extension.json M i18n/en.json M i18n/qqq.json M includes/NewsletterDb.php M includes/api/ApiNewsletterManage.php A includes/logging/NewsletterLogFormatter.php M includes/specials/SpecialNewsletter.php M includes/specials/SpecialNewsletterCreate.php 8 files changed, 154 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/87/280887/1 diff --git a/extension.json b/extension.json index 3810d2a..9d85052 100644 --- a/extension.json +++ b/extension.json @@ -22,8 +22,8 @@ "newsletter-delete": true, "newsletter-manage": true } - }, -"RateLimits": { + }, + "RateLimits": { "newsletter": { "user": [ 3, 3600 ] } @@ -42,6 +42,12 @@ "i18n" ] }, + "LogTypes": [ + "newsletter" + ], + "LogActionsHandlers": { + "newsletter/*": "NewsletterLogFormatter" + }, "ExtensionMessagesFiles": { "NewsletterAlias": "Newsletter.alias.php" }, @@ -50,6 +56,7 @@ "NewsletterDb": "includes/NewsletterDb.php", "NewsletterHooks": "Newsletter.hooks.php", "NewsletterValidator": "includes/NewsletterValidator.php", + "NewsletterLogFormatter": "includes/logging/NewsletterLogFormatter.php", "SpecialNewsletter": "includes/specials/SpecialNewsletter.php", "SpecialNewsletters": "includes/specials/SpecialNewsletters.php", "SpecialNewsletterCreate": "includes/specials/SpecialNewsletterCreate.php", diff --git a/i18n/en.json b/i18n/en.json index 67029d6..224f10b 100755 --- a/i18n/en.json +++ b/i18n/en.json @@ -17,7 +17,7 @@ "newslettercreate": "Create newsletter", "newslettercreate-text": "This page allows you to create a new newsletter. You will be added as a publisher and subscribed to the newsletter on its creation. All fields are required.", "newsletter-create-submit": "Create newsletter", - "newsletter-create-confirmation": "A [[[Special:Newsletter/$1|new newsletter]] has been created.", + "newsletter-create-confirmation": "A [[Special:Newsletter/$1|new newsletter]] has been created.", "newsletter-create-mainpage-error": "Invalid newsletter main page entered. Please try again.", "newsletter-mainpage-non-existent": "The newsletter main page does not exist. Please enter a valid existing page.", "newsletter-mainpage-in-use": "An existing newsletter has the same main page. Please enter another title.", @@ -134,5 +134,12 @@ "newsletter-list-go-button": "Go", "newsletter-notification-link-text-new-publisher": "Manage newsletter", "newsletter-notification-new-publisher-title": "You have been added as a publisher of $1 newsletter.", - "newsletter-notification-new-publisher-flyout": "You are now a publisher of $1 newsletter." + "newsletter-notification-new-publisher-flyout": "You are now a publisher of $1 newsletter.", + "log-name-newsletter": "Newsletter log", + "log-description-newsletter": "This is a log of changes made to newsletters.", + "logentry-newsletter-publisher-added": "$1 added $3 as a publisher on newsletter $4", + "logentry-newsletter-publisher-removed": "$1 removed $3 as a publisher on newsletter $4", + "logentry-newsletter-newsletter-added": "$1 created newsletter $4", + "logentry-newsletter-newsletter-removed": "$1 deleted newsletter $4", + "logentry-newsletter-issue-added": "$1 published a new issue of newsletter $4" } diff --git a/i18n/qqq.json b/i18n/qqq.json index e931497..7c0a74e 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -138,5 +138,12 @@ "newsletter-notification-link-text-new-publisher": "Label of the primary link of the newsletter-notification-new-publisher-flyout, which on clicking navigates the user to manage page of a newsletter.", "newsletter-notification-new-publisher-title": "Header text for a notification when a new publisher is added for a newsletter. Parameters:\n* $1 is the name of the newsletter.", "newsletter-notification-new-publisher-flyout": "Echo notification flyout message when a new publisher is added for a newsletter. \n* $1 is the name of the newsletter", -
[MediaWiki-commits] [Gerrit] Lock box version for VMWare Fusion - change (mediawiki/vagrant)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/262690 Change subject: Lock box version for VMWare Fusion .. Lock box version for VMWare Fusion For the Puppet Labs box on vmware_fusion, Puppet was upgraded to 4.2.1, which fails with the manifests_dir option. Locked the box version to 1.0.1 so it is still running Puppet 3, and the box can successfully provision on VMWare Fusion. Change-Id: Ia177e12a18ac9ddc8201abe0844467dc7473a968 --- M Vagrantfile 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant refs/changes/90/262690/1 diff --git a/Vagrantfile b/Vagrantfile index 43e34e5..2ff682c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -71,6 +71,7 @@ # VMWare Fusion provider. Enable with `--provider=vmware_fusion` config.vm.provider :vmware_fusion do |_vw, override| override.vm.box = 'puppetlabs/ubuntu-14.04-64-puppet' +override.vm.box_version = '1.0.1' override.vm.network :private_network, ip: settings[:static_ip] end -- To view, visit https://gerrit.wikimedia.org/r/262690 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia177e12a18ac9ddc8201abe0844467dc7473a968 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Parent5446___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added Mailgun extension for Mediawiki - change (mediawiki...Mailgun)
Parent5446 has submitted this change and it was merged. Change subject: Added Mailgun extension for Mediawiki .. Added Mailgun extension for Mediawiki Multiple $to address takes the Mailgun::BatchMessage() option Bug: T105781 Change-Id: I12951a9397d80b2a4929afaba1e170616e44473b --- A MailgunHooks.php A composer.json A extension.json 3 files changed, 108 insertions(+), 0 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/MailgunHooks.php b/MailgunHooks.php new file mode 100644 index 000..65510fc --- /dev/null +++ b/MailgunHooks.php @@ -0,0 +1,77 @@ +?php +/** + * Hooks for Mailgun extension for Mediawiki + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + * @author Tony Thomas 01tonytho...@gmail.com + * @license GPL-2.0+ + * @ingroup Extensions +*/ + +class MailgunHooks { + /** +* Function to be run on startup in $wgExtensionFunctions +*/ + public static function onRegistration() { + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + require_once __DIR__ . '/vendor/autoload.php'; + } + } + + /** +* Send a mail using Mailgun API +* +* @param array $headers +* @param array $to +* @param MailAddress $from +* @param string $subject +* @param string $body +* @return bool +*/ + public static function onAlternateUserMailer( + array $headers, array $to, MailAddress $from, $subject, $body + ) { + $conf = RequestContext::getMain()-getConfig(); + $mailgunTransport = new \Mailgun\Mailgun( $conf-get( 'MailgunAPIKey' ) ); + $message = $mailgunTransport-BatchMessage( $conf-get( 'MailgunDomain' ) ); + + $message-setFromAddress( $from ); + $message-setSubject( $subject ); + $message-setTextBody( $body ); + + foreach( $headers as $headerName = $headerValue ) { + $message-addCustomHeader( $headerName, $headerValue ); + } + + foreach( $to as $recip ) { + try { + $message-addToRecipient( $recip ); + } catch( Exception $e ) { + return $e-getMessage(); + } + } + + try { + $message-finalize(); + } catch ( Exception $e ) { + return $e-getMessage(); + } + + return false; + } +} \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 000..6acf437 --- /dev/null +++ b/composer.json @@ -0,0 +1,8 @@ +{ +name: mediawiki/mailgun, +require: { +mailgun/mailgun-php: 1.7.2 +}, +prepend-autoloader: false, +optimize-autoloader: true +} \ No newline at end of file diff --git a/extension.json b/extension.json new file mode 100644 index 000..3632874 --- /dev/null +++ b/extension.json @@ -0,0 +1,23 @@ +{ +name: Mailgun, +version: 1.0, +author: [ +Tony Thomas +], +url: https://www.mediawiki.org/wiki/Extension:Mailgun;, +AutoloadClasses: { +MailgunHooks: MailgunHooks.php +}, +Hooks: { +AlternateUserMailer: [ +MailgunHooks::onAlternateUserMailer +] +}, +callback: MailgunHooks::onRegistration, +config: { +MailgunAPIKey: key-asdfasdfasdf, +MailgunDomain: example.in +}, +manifest_version: 1 + +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/224984 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I12951a9397d80b2a4929afaba1e170616e44473b Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Mailgun Gerrit-Branch: master Gerrit-Owner: 01tonythomas 01tonytho...@gmail.com Gerrit-Reviewer: 01tonythomas 01tonytho...@gmail.com Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Parent5446
[MediaWiki-commits] [Gerrit] [WIP] Add initial code for extension - change (mediawiki...WikiPinger)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/216733 Change subject: [WIP] Add initial code for extension .. [WIP] Add initial code for extension Added code for extension, including an API module to receive registrations of 3rd-party wikis, and a special page to list all registered wikis and their information Change-Id: I6129f46c9ee4b601dfd8a90732d25b392b42 --- A .gitignore A LICENSE.txt A WikiPinger.alias.php A composer.json A composer.lock A extension.json A i18n/en.json A includes/ApiWikiPingerRegister.php A includes/SpecialListWikis.php A includes/WikiPager.php A includes/WikiPingerHooks.php A maintenance/pingWikis.php A maintenance/tables.sql 13 files changed, 1,787 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiPinger refs/changes/33/216733/1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000..0e4b6e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +compoer.phar +vendor/ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000..94a9ed0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + This License refers
[MediaWiki-commits] [Gerrit] Add user right for enabling two-factor auth - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213768 Change subject: Add user right for enabling two-factor auth .. Add user right for enabling two-factor auth Make new right oathauth-enable that the user must have to enable two factor authentication (disabling and logging in, of course, are still allowed). Bug: T100376 Change-Id: I18d43f8b2cf2c2ce9c2309a43961686498b5c999 --- M OATHAuth.hooks.php M OATHAuth.php M i18n/en.json M i18n/qqq.json M special/SpecialOATHEnable.php 5 files changed, 14 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/68/213768/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index 2f67911..9b6540a 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -82,6 +82,10 @@ * @return bool */ public static function manageOATH( User $user, array $preferences ) { + if ( $user-isAllowed( 'oathauth-enable' ) ) { + return true; + } + $oathrepo = new OATHUserRepository( wfGetLB() ); $oathUser = $oathrepo-findByUser( $user ); diff --git a/OATHAuth.php b/OATHAuth.php index 9a0b805..fbf2995 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -61,6 +61,9 @@ $wgSpecialPages['OATH'] = 'SpecialOATH'; $wgSpecialPageGroups['OATH'] = 'oath'; +$wgAvailableRights[] = 'oathauth-enable'; +$wgGroupPermissions['*']['oathauth-enable'] = true; + $wgResourceModules['ext.oathauth'] = array( 'scripts' = array( 'modules/jquery.qrcode.js', diff --git a/i18n/en.json b/i18n/en.json index 4559131..5f45332 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -44,5 +44,7 @@ oathauth-step2alt: Or enter the secret manually:, oathauth-step3: Step 3: Write down the scratch codes, oathauth-step4: Step 4: Verification, -oathauth-entertoken: Enter a code from your mobile app to verify: +oathauth-entertoken: Enter a code from your mobile app to verify:, +right-oathauth-enable: Enable two-factor authentication, +action-oathauth-enable: enable two-factor authentication } diff --git a/i18n/qqq.json b/i18n/qqq.json index 2a5cae8..b563ef1 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -47,5 +47,7 @@ oathauth-step2alt: Label for information on how to manually do step 2 on Special:OATH, oathauth-step3: Label for step 3 information on Special:OATH, oathauth-step4: Label for step 4 information on Special:OATH, -oathauth-entertoken: Label on input field on Special:OATH asking user to enter token +oathauth-entertoken: Label on input field on Special:OATH asking user to enter token, +right-oathauth-enable: {{doc-right|oathauth-enable}}, +action-oathauth-enable: {{doc-action|oathauth-enable}} } diff --git a/special/SpecialOATHEnable.php b/special/SpecialOATHEnable.php index 7b41045..1fc7a03 100644 --- a/special/SpecialOATHEnable.php +++ b/special/SpecialOATHEnable.php @@ -19,7 +19,7 @@ * @param OATHUser $user */ public function __construct( OATHUserRepository $repository, OATHUser $user ) { - parent::__construct( 'OATH', '', false ); + parent::__construct( 'OATH', 'oathauth-enable', false ); $this-OATHRepository = $repository; $this-OATHUser = $user; -- To view, visit https://gerrit.wikimedia.org/r/213768 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18d43f8b2cf2c2ce9c2309a43961686498b5c999 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Allow for using separate database for OATH creds - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213764 Change subject: Allow for using separate database for OATH creds .. Allow for using separate database for OATH creds Add configuration variable for specifying what database the OATH credentials are stored in, that way wikis that use CentralAuth can centralize their two-factor authentication data as well. Bug: T100374 Change-Id: I285e2fe29fee43ddc6c5a6e51823911d43c596f6 --- M OATHAuth.hooks.php M OATHAuth.php M special/SpecialOATH.php 3 files changed, 34 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/64/213764/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index 2f67911..cd29716 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -7,6 +7,23 @@ */ class OATHAuthHooks { /** +* Get the singleton OATH user repository +* +* @return OATHUserRepository +*/ + public static function getOATHUserRepository() { + global $wgOATHAuthDatabase; + + static $service = null; + + if ( $service !== null ) { + $service = new OATHUserRepository( wfGetLB( $wgOATHAuthDatabase ) ); + } + + return $service; + } + + /** * @param $extraFields array * @return bool */ @@ -28,8 +45,7 @@ global $wgRequest; $token = $wgRequest-getText( 'wpOATHToken' ); - $oathrepo = new OATHUserRepository( wfGetLB() ); - $oathuser = $oathrepo-findByUser( $user ); + $oathuser = self::getOATHUserRepository()-findByUser( $user ); # Though it's weird to default to true, we only want to deny # users who have two-factor enabled and have validated their # token. @@ -60,8 +76,7 @@ $request = $context-getRequest(); $output = $context-getOutput(); - $oathrepo = new OATHUserRepository( wfGetLB() ); - $oathuser = $oathrepo-findByUser( $user ); + $oathuser = self::getOATHUserRepository()-findByUser( $user ); if ( $oathuser-getKey() !== null !$request-getCheck( 'token' ) ) { $request-setSessionData( 'oath_login', $request-getValues() ); @@ -82,8 +97,7 @@ * @return bool */ public static function manageOATH( User $user, array $preferences ) { - $oathrepo = new OATHUserRepository( wfGetLB() ); - $oathUser = $oathrepo-findByUser( $user ); + $oathUser = self::getOATHUserRepository()-findByUser( $user ); $title = SpecialPage::getTitleFor( 'OATH' ); $msg = $oathUser-getKey() !== null ? 'oathauth-disable' : 'oathauth-enable'; diff --git a/OATHAuth.php b/OATHAuth.php index 9a0b805..156bc69 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -41,6 +41,17 @@ */ $wgOATHAuthWindowRadius = 4; +/** + * Database that OATH authentication data is kept in + * + * It is recommended that if you use CentralAuth or some other similar authentication + * mechanism that you either make the `oathauth_users` table a shared table, or use this + * variable to change the database, and make all the wikis share the same date. + * + * @var string|false + */ +$wgOATHAuthDatabase = false; + $dir = __DIR__ . '/'; $wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n'; diff --git a/special/SpecialOATH.php b/special/SpecialOATH.php index 6988a5c..b3194b1 100644 --- a/special/SpecialOATH.php +++ b/special/SpecialOATH.php @@ -11,13 +11,12 @@ * @return SpecialOATHDisable|SpecialOATHEnable|SpecialOATHLogin|SpecialPage */ protected function getTargetPage() { - $repo = new OATHUserRepository( wfGetLB() ); + $repo = OATHAuthHooks::getOATHUserRepository(); + /** @var SpecialOATHDisable|SpecialOATHEnable|SpecialOATHLogin|SpecialPage $page */ + $page = null; /** @var array $sessionUser */ $loginInfo = $this-getRequest()-getSessionData( 'oath_login' ); - - /** @var SpecialOATHDisable|SpecialOATHEnable|SpecialOATHLogin|SpecialPage $page */ - $page = null; if ( $this-getUser()-isAnon() $loginInfo !== null ) { // User is anonymous, so they are logging in $page = new SpecialOATHLogin( -- To view, visit https://gerrit.wikimedia.org/r/213764 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I285e2fe29fee43ddc6c5a6e51823911d43c596f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com
[MediaWiki-commits] [Gerrit] Make OATHAuth respect $wgSecureLogin - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213770 Change subject: Make OATHAuth respect $wgSecureLogin .. Make OATHAuth respect $wgSecureLogin If $wgSecureLogin is enabled, do not allow doing anything authentication-related over HTTP. Bug: T55197 Change-Id: Icfc4355b8bc1b43336bf3ada63a4a1c9c281deb0 --- M OATHAuth.php M special/SpecialOATH.php 2 files changed, 22 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/70/213770/1 diff --git a/OATHAuth.php b/OATHAuth.php index 9a0b805..29d42cf 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -76,5 +76,3 @@ $wgHooks['ChangePasswordForm'][] = 'OATHAuthHooks::ChangePasswordForm'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'OATHAuthHooks::OATHAuthSchemaUpdates'; $wgHooks['GetPreferences'][] = 'OATHAuthHooks::manageOATH'; - - diff --git a/special/SpecialOATH.php b/special/SpecialOATH.php index 6988a5c..24eec66 100644 --- a/special/SpecialOATH.php +++ b/special/SpecialOATH.php @@ -16,6 +16,28 @@ /** @var array $sessionUser */ $loginInfo = $this-getRequest()-getSessionData( 'oath_login' ); + // Check for secure login + global $wgSecureLogin; + $request = $this-getRequest(); + if ( $wgSecureLogin +$request-getProtocol() !== 'https' +wfCanIPUseHTTPS( $request-getIP() ) +!$request-getBool( 'fromhttp', false ) ) // Avoid infinite redirect + { + $query = array( + 'returnto' = $request-getVal( 'returnto', '' ) ?: null, + 'returntoquery' = $request-getVal( 'returntoquery', '' ) ?: null, + 'title' = null, + 'fromhttp' = 1, + ) + $request-getQueryValues(); + + $this-getOutput()-redirect( $this-getFullTitle()-getFullURL( $query, false, PROTO_HTTPS ) ); + // Since we only do this redir to change proto, always vary + $this-getOutput()-addVaryHeader( 'X-Forwarded-Proto' ); + + return new SpecialOATHEnable( $repo, new OATHUser( $this-getUser() ) ); + } + /** @var SpecialOATHDisable|SpecialOATHEnable|SpecialOATHLogin|SpecialPage $page */ $page = null; if ( $this-getUser()-isAnon() $loginInfo !== null ) { -- To view, visit https://gerrit.wikimedia.org/r/213770 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icfc4355b8bc1b43336bf3ada63a4a1c9c281deb0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added wiki tagline and description variables - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213336 Change subject: Added wiki tagline and description variables .. Added wiki tagline and description variables Made new site-info variables $wgSiteTagline and $wgSiteDescription, which are a one-line tagline and a longer description for the site that is published via the API. Also adjusted the installer to ask users for this information, and made the longer description the default content of the Project:About page, which is linked in the footer. Bug: T56430 Bug: T56431 Change-Id: I71c9d83d004109f9e0959f87d10b378dc733f06d --- M includes/DefaultSettings.php M includes/api/ApiQuerySiteinfo.php M includes/installer/CliInstaller.php M includes/installer/Installer.php M includes/installer/LocalSettingsGenerator.php M includes/installer/WebInstallerPage.php M includes/installer/i18n/en.json M includes/installer/i18n/qqq.json M maintenance/install.php 9 files changed, 59 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/36/213336/1 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2ea8b29..f10af2a 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -83,6 +83,18 @@ $wgSitename = 'MediaWiki'; /** + * Short tagline for the site + * @since 1.26 + */ +$wgSiteTagline = ''; + +/** + * Longer description of the wiki and what it is for + * @since 1.26 + */ +$wgSiteDescription = ''; + +/** * URL of the server. * * @par Example: diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 1dc9985..a5d0f41 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -132,6 +132,8 @@ $data['mainpage'] = $mainPage-getPrefixedText(); $data['base'] = wfExpandUrl( $mainPage-getFullURL(), PROTO_CURRENT ); $data['sitename'] = $config-get( 'Sitename' ); + $data['sitetagline'] = $config-get( 'SiteTagline' ); + $data['sitedescription'] = $config-get( 'SiteDescription' ); // wgLogo can either be a relative or an absolute path // make sure we always return an absolute path diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 7290740..5993636 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -44,6 +44,8 @@ 'dbpath' = 'wgSQLiteDataDir', 'server' = 'wgServer', 'scriptpath' = 'wgScriptPath', + 'tagline' = 'wgSiteTagline', + 'description' = 'wgSiteDescription', ); /** diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index f9c885d..3dbc1ee 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -160,6 +160,8 @@ */ protected $defaultVarNames = array( 'wgSitename', + 'wgSiteTagline', + 'wgSiteDescription', 'wgPasswordSender', 'wgLanguageCode', 'wgRightsIcon', @@ -1736,7 +1738,7 @@ } /** -* Insert Main Page with default content. +* Insert Main Page and about page with default content. * * @param DatabaseInstaller $installer * @return Status @@ -1744,6 +1746,7 @@ protected function createMainpage( DatabaseInstaller $installer ) { $status = Status::newGood(); try { + // First Main page $page = WikiPage::factory( Title::newMainPage() ); $content = new WikitextContent( wfMessage( 'mainpagetext' )-inContentLanguage()-text() . \n\n . @@ -1756,6 +1759,17 @@ false, User::newFromName( 'MediaWiki default' ) ); + + // And then about page + $page = WikiPage::factory( Title::makeTitle( NS_PROJECT, 'About' ) ); + $content = new WikitextContent( $this-getVar( 'wgSiteDescription' ) ); + + $page-doEditContent( $content, + '', + EDIT_NEW, + false, + User::newFromName( 'MediaWiki default' ) + ); } catch ( Exception $e ) { //using raw, because $wgShowExceptionDetails can not be set yet $status-fatal( 'config-install-mainpage-failed', $e-getMessage() ); diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 737c996..5bcc14b 100644 ---
[MediaWiki-commits] [Gerrit] Updated extension registration to new system - change (mediawiki...CleanChanges)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213309 Change subject: Updated extension registration to new system .. Updated extension registration to new system Added extension.json file and added shim to main entry point. Bug: T87896 Change-Id: I8b36c2691b4b388572d05b84ab40629a8bfa9468 --- A CleanChanges.hooks.php D CleanChanges.i18n.php M CleanChanges.php D Resources.php A extension.json 5 files changed, 107 insertions(+), 105 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CleanChanges refs/changes/09/213309/1 diff --git a/CleanChanges.hooks.php b/CleanChanges.hooks.php new file mode 100644 index 000..6f7bd2b --- /dev/null +++ b/CleanChanges.hooks.php @@ -0,0 +1,22 @@ +?php + +/** + * Hooks class for the CleanChangesHooks extension + */ +class CleanChangesHooks { + /** +* Function to set up filters (run in $wgExtensionFunctions) +*/ + public static function ccSetupFilters() { + global $wgCCUserFilter, $wgCCTrailerFilter, $wgHooks; + + if ( $wgCCUserFilter ) { + $wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::user'; + $wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::userForm'; + } + if ( $wgCCTrailerFilter ) { + $wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::trailer'; + $wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::trailerForm'; + } + } +} diff --git a/CleanChanges.i18n.php b/CleanChanges.i18n.php deleted file mode 100644 index 17bcda6..000 --- a/CleanChanges.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ -?php -/** - * This is a backwards-compatibility shim, generated by: - * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php - * - * Beginning with MediaWiki 1.23, translation strings are stored in json files, - * and the EXTENSION.i18n.php file only exists to provide compatibility with - * older releases of MediaWiki. For more information about this migration, see: - * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format - * - * This shim maintains compatibility back to MediaWiki 1.17. - */ -$messages = array(); -if ( !function_exists( 'wfJsonI18nShimd87671d4445e53f6' ) ) { - function wfJsonI18nShimd87671d4445e53f6( $cache, $code, $cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); - foreach ( $codeSequence as $csCode ) { - $fileName = dirname( __FILE__ ) . /i18n/$csCode.json; - if ( is_readable( $fileName ) ) { - $data = FormatJson::decode( file_get_contents( $fileName ), true ); - foreach ( array_keys( $data ) as $key ) { - if ( $key === '' || $key[0] === '@' ) { - unset( $data[$key] ); - } - } - $cachedData['messages'] = array_merge( $data, $cachedData['messages'] ); - } - - $cachedData['deps'][] = new FileDependency( $fileName ); - } - return true; - } - - $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShimd87671d4445e53f6'; -} diff --git a/CleanChanges.php b/CleanChanges.php index 414bccd..d648058 100644 --- a/CleanChanges.php +++ b/CleanChanges.php @@ -1,55 +1,13 @@ ?php -if ( !defined( 'MEDIAWIKI' ) ) die(); -/** - * An extension to show a nice compact changes list and few extra filters for - * Special:RecentChanges.php - * - * @file - * @ingroup Extensions - * - * @author Niklas Laxström - * @copyright Copyright © 2008-2012, Niklas Laxström - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later - */ - -/* Set up messages and includes */ -$dir = __DIR__; -$wgMessagesDirs['CleanChanges'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['CleanChanges'] = $dir/CleanChanges.i18n.php; -$wgAutoloadClasses['NCL'] = $dir/CleanChanges_body.php; - -require_once __DIR__ . '/Resources.php'; - -/* Hook into code */ -$wgHooks['FetchChangesList'][] = 'NCL::hook'; -$wgHooks['MakeGlobalVariablesScript'][] = 'NCL::addScriptVariables'; - -/* Extension information */ -$wgExtensionCredits['other'][] = array( - 'path' = __FILE__, - 'name' = 'Clean Changes', - 'version' = '2014-12-29', - 'author' = 'Niklas Laxström', - 'descriptionmsg' = 'cleanchanges-desc', - 'url' = 'https://www.mediawiki.org/wiki/Extension:CleanChanges', - 'license-name' = 'GPL-2.0+', -); - -$wgCCUserFilter = true; -$wgCCTrailerFilter = false; - -$wgExtensionFunctions[] = 'ccSetupFilters';
[MediaWiki-commits] [Gerrit] Updated extension registration to new system - change (mediawiki...Babel)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213300 Change subject: Updated extension registration to new system .. Updated extension registration to new system Added extension.json file and added shim to main entry point. Bug: T87883 Change-Id: I5653bc2c7a12251bf3a66f96ca1430ae641325b5 --- D Babel.i18n.php M Babel.php A extension.json 3 files changed, 69 insertions(+), 124 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Babel refs/changes/00/213300/1 diff --git a/Babel.i18n.php b/Babel.i18n.php deleted file mode 100644 index ad3c8f3..000 --- a/Babel.i18n.php +++ /dev/null @@ -1,35 +0,0 @@ -?php -/** - * This is a backwards-compatibility shim, generated by: - * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php - * - * Beginning with MediaWiki 1.23, translation strings are stored in json files, - * and the EXTENSION.i18n.php file only exists to provide compatibility with - * older releases of MediaWiki. For more information about this migration, see: - * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format - * - * This shim maintains compatibility back to MediaWiki 1.17. - */ -$messages = array(); -if ( !function_exists( 'wfJsonI18nShim746acc9867bbb334' ) ) { - function wfJsonI18nShim746acc9867bbb334( $cache, $code, $cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); - foreach ( $codeSequence as $csCode ) { - $fileName = dirname( __FILE__ ) . /i18n/$csCode.json; - if ( is_readable( $fileName ) ) { - $data = FormatJson::decode( file_get_contents( $fileName ), true ); - foreach ( array_keys( $data ) as $key ) { - if ( $key === '' || $key[0] === '@' ) { - unset( $data[$key] ); - } - } - $cachedData['messages'] = array_merge( $data, $cachedData['messages'] ); - } - - $cachedData['deps'][] = new FileDependency( $fileName ); - } - return true; - } - - $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim746acc9867bbb334'; -} diff --git a/Babel.php b/Babel.php index 83fd195..04df4be 100644 --- a/Babel.php +++ b/Babel.php @@ -1,91 +1,13 @@ ?php -/** - * Babel Extension - * - * Adds a parser function to allow automated generation of a babel userbox - * column with the ability to include custom templates. - * - * @file - * @ingroup Extensions - * - * @link http://www.mediawiki.org/wiki/Extension:Babel - * - * @author Robert Leverington rob...@rhl.me.uk - * @copyright Copyright © 2008 - 2011 Robert Leverington. - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - die( 'Invalid entry point.' ); -} - -$GLOBALS['wgExtensionCredits']['parserhook'][] = array( - 'path' = __FILE__, - 'name' = 'Babel', - 'version' = '1.9.1', - 'author' = 'Robert Leverington', - 'url' = 'https://www.mediawiki.org/wiki/Extension:Babel', - 'descriptionmsg' = 'babel-desc', - 'license-name' = 'GPL-2.0+', -); - -$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'BabelStatic::onParserFirstCallInit'; -$GLOBALS['wgHooks']['UserGetReservedNames'][] = 'BabelAutoCreate::onUserGetReservedNames'; - -$GLOBALS['wgMessagesDirs']['Babel'] = __DIR__ . '/i18n'; -$GLOBALS['wgExtensionMessagesFiles']['Babel'] = __DIR__ . '/Babel.i18n.php'; -$GLOBALS['wgExtensionMessagesFiles']['BabelMagic'] = __DIR__ . '/Babel.i18n.magic.php'; - -$GLOBALS['wgAutoloadClasses']['Babel'] = __DIR__ . '/Babel.class.php'; -$GLOBALS['wgAutoloadClasses']['BabelLanguageCodes'] = __DIR__ . '/BabelLanguageCodes.class.php'; -$GLOBALS['wgAutoloadClasses']['BabelStatic'] = __DIR__ . '/BabelStatic.class.php'; -$GLOBALS['wgAutoloadClasses']['BabelAutoCreate'] = __DIR__ . '/BabelAutoCreate.class.php'; - -$GLOBALS['wgResourceModules']['ext.babel'] = array( - 'position' = 'top', - 'styles' = 'resources/ext.babel.css', - 'localBasePath' = __DIR__, - 'remoteExtPath' = 'Babel', -); - -// Configuration setttings. -// Language names and codes constant database files, the defaults should suffice. -$GLOBALS['wgBabelLanguageCodesCdb'] = __DIR__ . '/codes.cdb'; -$GLOBALS['wgBabelLanguageNamesCdb'] = __DIR__ . '/names.cdb'; -// Array of possible levels, and their category name - variables: %code% %wikiname% %nativename% -// Set to false to disable categories for a particular level. -// Alphabetical levels should be in upper case. -$GLOBALS['wgBabelCategoryNames'] = array( - '0' =
[MediaWiki-commits] [Gerrit] Updated extension registration to new system - change (mediawiki...BounceHandler)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213305 Change subject: Updated extension registration to new system .. Updated extension registration to new system Added extension.json file and added shim to main entry point. Bug: T87885 Change-Id: I3687e7f016774be4636bac47e7676572d2dbf291 --- M BounceHandler.php M BounceHandlerHooks.php A extension.json 3 files changed, 91 insertions(+), 98 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BounceHandler refs/changes/05/213305/1 diff --git a/BounceHandler.php b/BounceHandler.php index e7b9d39..727ae75 100644 --- a/BounceHandler.php +++ b/BounceHandler.php @@ -1,99 +1,13 @@ ?php -/** - * BounceHandler Extension to handle email bounces in MediaWiki - * - * @file - * @ingroup Extensions - * @author Tony Thomas, Kunal Mehta, Jeff Green - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later - */ -$wgExtensionCredits['other'][] = array( - 'path' = __FILE__, - 'name' = 'BounceHandler', - 'author' = array( - 'Tony Thomas', - 'Kunal Mehta', - 'Jeff Green', - ), - 'url' = https://www.mediawiki.org/wiki/Extension:BounceHandler;, - 'descriptionmsg' = 'bouncehandler-desc', - 'version' = '1.0', - 'license-name' = 'GPL-2.0+', -); - -/* Setup*/ -$dir = __DIR__ ; - -//Hooks files -$wgAutoloadClasses['BounceHandlerHooks'] = $dir. '/BounceHandlerHooks.php'; - -//Register and Load BounceHandler API -$wgAutoloadClasses['ApiBounceHandler'] = $dir. '/includes/ApiBounceHandler.php'; -$wgAPIModules['bouncehandler'] = 'ApiBounceHandler'; - -//Register and Load Jobs -$wgAutoloadClasses['BounceHandlerJob'] = $dir. '/includes/BounceHandlerJob.php'; -$wgAutoloadClasses['ProcessBounceEmails'] = $dir. '/includes/ProcessBounceEmails.php'; -$wgAutoloadClasses['BounceHandlerActions'] = $dir. '/includes/BounceHandlerActions.php'; -$wgAutoloadClasses['ProcessUnRecognizedBounces'] = $dir. '/includes/ProcessUnRecognizedBounces.php'; -$wgAutoloadClasses['ProcessBounceWithPlancake'] = $dir. '/includes/ProcessBounceWithPlancake.php'; -$wgAutoloadClasses['ProcessBounceWithRegex'] = $dir. '/includes/ProcessBounceWithRegex.php'; -$wgAutoloadClasses['VerpAddressGenerator'] = $dir. '/includes/VerpAddressGenerator.php'; -$wgAutoloadClasses['PruneOldBounceRecords'] = $dir. '/includes/PruneOldBounceRecords.php'; - -$wgJobClasses['BounceHandlerJob'] = 'BounceHandlerJob'; - -//Register Hooks -$wgHooks['UserMailerChangeReturnPath'][] = 'BounceHandlerHooks::onVERPAddressGenerate'; -$wgHooks['UnitTestsList'][] = 'BounceHandlerHooks::registerUnitTests'; - -/*Messages Files */ -$wgMessagesDirs['BounceHandler'] = $dir. '/i18n'; - -# Schema updates for update.php -$wgHooks['LoadExtensionSchemaUpdates'][] = 'BounceHandlerHooks::loadExtensionSchemaUpdates'; - -/** - * VERP Configurations - * $wgGenerateVERP - Toggle VERP generation - * wgVERPprefix - The prefix of the VERP address. - * wgVERPdomainPart - The domain part of the VERP email address, defaults to $wgServerName - * wgVERPalgorithm - Algorithm to hash the return path address.Possible algorithms are - * md2. md4, md5, sha1, sha224, sha256, sha384, ripemd128, ripemd160, whirlpool and more. - * wgVERPsecret - The secret key to hash the return path address - * wgBounceHandlerUnconfirmUsers - Toggle the user un-subscribe action - */ -$wgGenerateVERP = true; -$wgVERPprefix = 'wiki'; -$wgVERPalgorithm = 'md5'; -$wgVERPsecret = 'MediawikiVERP'; -$wgBounceHandlerUnconfirmUsers = false; -$wgUnrecognizedBounceNotify = null; -$wgVERPdomainPart = null; // set this only if you want the domain part of your email different from your wgServerName -$wgVERPAcceptTime = 259200; //3 days time -$wgBounceRecordPeriod = 604800; // 60 * 60 * 24 * 7 - 7 days bounce activity are considered before un-subscribing -$wgBounceRecordLimit = 10; // If there are more than 10 bounces in the $wgBounceRecordPeriod, the user is un-subscribed - -/* Allow only internal IP range to do the POST request */ -$wgBounceHandlerInternalIPs = array( '127.0.0.1', '::1' ); - -/* Admin email address which should be notified in the case of an unprocessed valid bounce */ -$wgExtensionFunctions[] = function() { - global $wgNoReplyAddress, $wgServerName, $wgUnrecognizedBounceNotify, $wgVERPdomainPart; - $wgUnrecognizedBounceNotify = $wgUnrecognizedBounceNotify ? : array( $wgNoReplyAddress ); - $wgVERPdomainPart = $wgVERPdomainPart ? : $wgServerName; -}; - -# Alternative DB cluster to use for the bounce tables -$wgBounceHandlerCluster = false; - -# Central DB name to use if the bounce table is to be shared -$wgBounceHandlerSharedDB = false; - -# Maximum time in seconds until which a bounce record should be stored in the table -$wgBounceRecordMaxAge = 5184000; //60 * 24 * 60 *60 ( 60 Days time in seconds ) -
[MediaWiki-commits] [Gerrit] Updated extension registration to new system - change (mediawiki...ContributionTracking)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213315 Change subject: Updated extension registration to new system .. Updated extension registration to new system Added extension.json file and added shim to main entry point. Bug: T87903 Change-Id: Ib2f1c5f93b243ec79e25b580b3ba933a22d796ea --- A ContributionTracking.hooks.php D ContributionTracking.i18n.php M ContributionTracking.php A extension.json 4 files changed, 156 insertions(+), 197 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContributionTracking refs/changes/15/213315/1 diff --git a/ContributionTracking.hooks.php b/ContributionTracking.hooks.php new file mode 100644 index 000..6bc9605 --- /dev/null +++ b/ContributionTracking.hooks.php @@ -0,0 +1,69 @@ +?php + +class ContributionTrackingHooks { + public static function extensionFunction() { + global $wgDBserver, $wgDBname, $wgDBuser, $wgDBpassword, + $wgContributionTrackingDBserver, $wgContributionTrackingDBname, + $wgContributionTrackingDBuser, $wgContributionTrackingDBpassword; + + $wgContributionTrackingDBserver = $wgContributionTrackingDBserver ?: $wgDBserver; + $wgContributionTrackingDBname = $wgContributionTrackingDBname ?: $wgDBname; + $wgContributionTrackingDBuser = $wgContributionTrackingDBuser ?: $wgDBuser; + $wgContributionTrackingDBpassword = $wgContributionTrackingDBpassword ?: $wgDBpassword; + } + + public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { + $dir = dirname( __FILE__ ) . '/'; + if ( $updater === null ) { + global $wgExtNewTables, $wgExtNewFields; + + $wgExtNewTables[] = array( 'contribution_tracking', $dir . 'ContributionTracking.sql' ); + $wgExtNewTables[] = array( 'contribution_tracking_owa_ref', $dir . 'ContributionTracking_OWA_ref.sql' ); + + $wgExtNewFields[] = array( + 'contribution_tracking', + 'owa_session', + $dir . 'patch-owa.sql', + ); + } else { + global $wgContributionTrackingDBname; + + if( $updater-getDB()-getDBname() === $wgContributionTrackingDBname ) { + $updater-addExtensionTable( 'contribution_tracking', $dir . 'ContributionTracking.sql' ); + $updater-addExtensionTable( 'contribution_tracking_owa_ref', $dir . 'ContributionTracking_OWA_ref.sql' ); + $updater-addExtensionUpdate( array( 'addField', 'contribution_tracking', 'owa_session', + $dir . 'patches/patch-owa.sql', true ) ); + $updater-addExtensionUpdate( array( 'addField', 'contribution_tracking', 'utm_key', + $dir . 'patches/patch-owa.sql', true ) ); + + if ( $updater-getDB()-getType() !== 'sqlite' ) { + // Not sure how to do this in the other configurations, but I guess + // manually might be the answer. + $updater-addExtensionUpdate( array( 'modifyField', 'contribution_tracking', 'anonymous', + $dir . 'patches/make-null.patch.sql', true ) ); + } + } else { //We are configured not to use the main mediawiki db. + //Unless the updater is modified not to run + //'LoadExtensionSchemaUpdates' hooks in its constructor (or do so + //conditionally), we're going to have to do these manually. + $ctDB = ContributionTrackingProcessor::contributionTrackingConnection(); + if ( !$ctDB-tableExists( 'contribution_tracking' ) ){ + $ctDB-sourceFile( $dir . 'ContributionTracking.sql' ); + } + if ( !$ctDB-tableExists( 'contribution_tracking_owa_ref' ) ){ + $ctDB-sourceFile( $dir . 'ContributionTracking_OWA_ref.sql' ); + } + if ( !$ctDB-fieldExists( 'contribution_tracking', 'owa_session' ) ){ + $ctDB-sourceFile( $dir . 'patches/patch-owa.sql' ); + } + if ( !$ctDB-fieldExists( 'contribution_tracking', 'utm_key' ) ){ +
[MediaWiki-commits] [Gerrit] Made hooks register unconditionally - change (mediawiki...CleanChanges)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/213324 Change subject: Made hooks register unconditionally .. Made hooks register unconditionally Rather than have a function that registers the hook depending on a config variable, have the hook always registered, and just add a check in the hook itself. Change-Id: Ida3d4543a8184900e8b1b3623fdfd99acdcab13f --- M CleanChanges.php M Filters.php 2 files changed, 33 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CleanChanges refs/changes/24/213324/1 diff --git a/CleanChanges.php b/CleanChanges.php index 414bccd..0f4c7cf 100644 --- a/CleanChanges.php +++ b/CleanChanges.php @@ -23,6 +23,11 @@ /* Hook into code */ $wgHooks['FetchChangesList'][] = 'NCL::hook'; $wgHooks['MakeGlobalVariablesScript'][] = 'NCL::addScriptVariables'; +$wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::user'; +$wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::userForm'; +$wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::trailer'; +$wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::trailerForm'; + /* Extension information */ $wgExtensionCredits['other'][] = array( @@ -40,16 +45,3 @@ $wgExtensionFunctions[] = 'ccSetupFilters'; $wgAutoloadClasses['CCFilters'] = $dir/Filters.php; - -function ccSetupFilters() { - global $wgCCUserFilter, $wgCCTrailerFilter, $wgHooks; - - if ( $wgCCUserFilter ) { - $wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::user'; - $wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::userForm'; - } - if ( $wgCCTrailerFilter ) { - $wgHooks['SpecialRecentChangesQuery'][] = 'CCFilters::trailer'; - $wgHooks['SpecialRecentChangesPanel'][] = 'CCFilters::trailerForm'; - } -} diff --git a/Filters.php b/Filters.php index d6e9939..13e0858 100644 --- a/Filters.php +++ b/Filters.php @@ -10,7 +10,12 @@ * @return bool */ public static function user( $conds, $tables, $join_conds, FormOptions $opts ) { - global $wgRequest; + global $wgRequest, $wgCCUserFilter; + + if ( !$wgCCUserFilter ) { + return true; + } + $opts-add( 'users', '' ); $users = $wgRequest-getVal( 'users' ); if ( $users === null ) { @@ -40,8 +45,13 @@ * @return bool */ public static function userForm( $items, FormOptions $opts ) { + global $wgRequest, $wgCCUserFilter; + + if ( !$wgCCUserFilter ) { + return true; + } + $opts-consumeValue( 'users' ); - global $wgRequest; $default = $wgRequest-getVal( 'users', '' ); $items['users'] = Xml::inputLabelSep( wfMessage( 'cleanchanges-users' )-text(), 'users', @@ -57,7 +67,12 @@ * @return bool */ public static function trailer( $conds, $tables, $join_conds, FormOptions $opts ) { - global $wgRequest; + global $wgRequest, $wgCCTrailerFilter; + + if ( !$wgCCTrailerFilter ) { + return true; + } + $opts-add( 'trailer', '' ); $trailer = $wgRequest-getVal( 'trailer' ); if ( $trailer === null ) return true; @@ -75,14 +90,19 @@ * @return bool */ public static function trailerForm( $items, FormOptions $opts ) { - $opts-consumeValue( 'trailer' ); - - global $wgRequest; - $default = $wgRequest-getVal( 'trailer', '' ); /** * @var Language $wgLang */ - global $wgLang; + global $wgLang, $wgRequest, $wgCCTrailerFilter; + + if ( !$wgCCTrailerFilter ) { + return true; + } + + $opts-consumeValue( 'trailer' ); + + $default = $wgRequest-getVal( 'trailer', '' ); + if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) { $languages = LanguageNames::getNames( $wgLang-getCode(), LanguageNames::FALLBACK_NORMAL, -- To view, visit https://gerrit.wikimedia.org/r/213324 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ida3d4543a8184900e8b1b3623fdfd99acdcab13f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CleanChanges Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make ResourceLoader return 500 status on error - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/212935 Change subject: Make ResourceLoader return 500 status on error .. Make ResourceLoader return 500 status on error Bug: T87175 Change-Id: Iadd45d3cc667fedef4d7e77abf15a2aa26f7 --- M includes/resourceloader/ResourceLoader.php 1 file changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/35/212935/1 diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index b8a0acf..8cd40d7 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -726,6 +726,15 @@ * @return void */ protected function sendResponseHeaders( ResourceLoaderContext $context, $etag, $errors ) { + // Set proper HTTP response code + if ( $errors ) { + if ( function_exists( 'http_response_code' ) ) { + http_response_code( 500 ); + } else { + header( 'X-PHP-Response-Code: 500', true, 500 ); + } + } + $rlMaxage = $this-config-get( 'ResourceLoaderMaxage' ); // If a version wasn't specified we need a shorter expiry time for updates // to propagate to clients quickly -- To view, visit https://gerrit.wikimedia.org/r/212935 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iadd45d3cc667fedef4d7e77abf15a2aa26f7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Updated extension registration to new system - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/212956 Change subject: Updated extension registration to new system .. Updated extension registration to new system Added extension.json file and added shim to main entry point. Bug: T87949 Change-Id: I8bb26eb4f4c40eb50bb5c940892e14da1a537d8c --- M OATHAuth.php A extension.json M special/SpecialOATHDisable.php M special/SpecialOATHEnable.php M special/SpecialOATHLogin.php 5 files changed, 99 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/56/212956/1 diff --git a/OATHAuth.php b/OATHAuth.php index 360c9c4..d8f4fe1 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -15,6 +15,16 @@ if ( !defined( 'MEDIAWIKI' ) ) { echo This file is an extension to the MediaWiki software and cannot be used standalone.\n; die( 1 ); +} elseif ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'FooBar' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['FooBar'] = __DIR__ . '/i18n'; + $wgExtensionMessagesFiles['FooBar'] = __DIR__ . '/FooBar.alias.php'; + wfWarn( + 'Deprecated PHP entry point used for FooBar extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); + return; } $wgExtensionCredits['other'][] = array( diff --git a/extension.json b/extension.json new file mode 100644 index 000..32ced96 --- /dev/null +++ b/extension.json @@ -0,0 +1,68 @@ +{ + name: OATHAuth, + version: 0.5.0, + author: Ryan Lane, + url: http://mediawiki.org/wiki/Extension:OATHAuth;, + descriptionmsg: oathauth-desc, + type: other, + AutoloadClasses: { + OATHAuthHooks: OATHAuth.hooks.php, + OATHAuthKey: OATHAuthKey.php, + HOTP: lib/hotp.php, + HOTPResult: lib/hotp.php, + Base32: lib/base32.php, + OATHUser: OATHUser.php, + ProxySpecialPage: special/ProxySpecialPage.php, + SpecialOATH: special/SpecialOATH.php, + SpecialOATHEnable: special/SpecialOATHEnable.php, + SpecialOATHDisable: special/SpecialOATHDisable.php, + SpecialOATHLogin: special/SpecialOATHLogin.php + }, + ExtensionMessagesFiles: { + OATHAuthAlias: OATHAuth.alias.php + }, + Hooks: { + AbortChangePassword: [ + OATHAuthHooks::AbortChangePassword + ], + AbortLogin: [ + OATHAuthHooks::AbortLogin + ], + ChangePasswordForm: [ + OATHAuthHooks::ChangePasswordForm + ], + TwoFactorIsEnabled: [ + OATHAuthHooks::TwoFactorIsEnabled + ], + LoadExtensionSchemaUpdates: [ + OATHAuthHooks::OATHAuthSchemaUpdates + ], + GetPreferences: [ + OATHAuthHooks::manageOATH + ] + }, + MessagesDirs: { + OATHAuth: [ + i18n + ] + }, + config: { + OATHAuthWindowRadius: 4 + }, + ResourceModules: { + ext.oathauth: { + scripts: [ + modules/jquery.qrcode.js, + modules/qrcode.js + ], + position: top + } + }, + ResourceFileModulePaths: { + localBasePath: , + remoteExtPath: OATHAuth + }, + SpecialPages: { + OATH: SpecialOATH + } +} diff --git a/special/SpecialOATHDisable.php b/special/SpecialOATHDisable.php index adeb031..0c42e6c 100644 --- a/special/SpecialOATHDisable.php +++ b/special/SpecialOATHDisable.php @@ -32,6 +32,13 @@ /** * @return string */ + protected function getGroupName() { + return 'login'; + } + + /** +* @return string +*/ protected function getDisplayFormat() { return 'vform'; } diff --git a/special/SpecialOATHEnable.php b/special/SpecialOATHEnable.php index 0072ee9..2d4d536 100644 --- a/special/SpecialOATHEnable.php +++ b/special/SpecialOATHEnable.php @@ -32,6 +32,13 @@ /** * @return string */ + protected function getGroupName() { + return 'login'; + } + + /** +* @return string +*/ protected function getDisplayFormat() { return 'vform'; } diff --git a/special/SpecialOATHLogin.php b/special/SpecialOATHLogin.php index
[MediaWiki-commits] [Gerrit] [DO NOT MERGE] TEST COMMIT - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/206347 Change subject: [DO NOT MERGE] TEST COMMIT .. [DO NOT MERGE] TEST COMMIT Change-Id: I4e66553f4842fd6662166ed56c1fc16531220c01 --- M api.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/47/206347/1 diff --git a/api.php b/api.php index ea2f60a..42900f9 100644 --- a/api.php +++ b/api.php @@ -1,4 +1,5 @@ ?php +echo Helo; /** * This file is the entry point for all API queries. * -- To view, visit https://gerrit.wikimedia.org/r/206347 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4e66553f4842fd6662166ed56c1fc16531220c01 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed licensing messages - change (mediawiki...DeleteOwn)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/188763 Change subject: Fixed licensing messages .. Fixed licensing messages Fixed license in code to match LICENSE file. Also added license name to wgExtensionCredits so it appears on Special:Version. Bug: T88098 Change-Id: I6ff3879bae277855f822b4163211a02c4c5cd14d --- M DeleteOwn.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DeleteOwn refs/changes/63/188763/1 diff --git a/DeleteOwn.php b/DeleteOwn.php index 3f0dc3c..3b3727c 100644 --- a/DeleteOwn.php +++ b/DeleteOwn.php @@ -2,10 +2,11 @@ /** * Implements Extension:DeleteOwn for the MediaWiki software. + * Copyright (C) 2014-2015 Tyler Romeo tylerro...@gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -28,7 +29,8 @@ 'descriptionmsg' = 'deleteown-desc', 'version' = '1.1.0', 'author' = 'Tyler Romeo tylerro...@gmail.com', - 'url' = 'https://www.mediawiki.org/wiki/Extension:DeleteOwn' + 'url' = 'https://www.mediawiki.org/wiki/Extension:DeleteOwn', +'license-name' = 'GPL-3.0+', ); $dir = __DIR__ . '/'; -- To view, visit https://gerrit.wikimedia.org/r/188763 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ff3879bae277855f822b4163211a02c4c5cd14d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DeleteOwn Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed licensing messages - change (mediawiki...DeleteOwn)
Parent5446 has submitted this change and it was merged. Change subject: Fixed licensing messages .. Fixed licensing messages Fixed license in code to match LICENSE file. Also added license name to wgExtensionCredits so it appears on Special:Version. Bug: T88098 Change-Id: I6ff3879bae277855f822b4163211a02c4c5cd14d --- M DeleteOwn.php 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/DeleteOwn.php b/DeleteOwn.php index 3f0dc3c..a6b3123 100644 --- a/DeleteOwn.php +++ b/DeleteOwn.php @@ -2,10 +2,11 @@ /** * Implements Extension:DeleteOwn for the MediaWiki software. + * Copyright (C) 2014-2015 Tyler Romeo tylerro...@gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -28,7 +29,8 @@ 'descriptionmsg' = 'deleteown-desc', 'version' = '1.1.0', 'author' = 'Tyler Romeo tylerro...@gmail.com', - 'url' = 'https://www.mediawiki.org/wiki/Extension:DeleteOwn' + 'url' = 'https://www.mediawiki.org/wiki/Extension:DeleteOwn', + 'license-name' = 'GPL-3.0+', ); $dir = __DIR__ . '/'; -- To view, visit https://gerrit.wikimedia.org/r/188763 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ff3879bae277855f822b4163211a02c4c5cd14d Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/DeleteOwn Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert Changed some DatabaseBase type hints to IDatabase - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/178590 Change subject: Revert Changed some DatabaseBase type hints to IDatabase .. Revert Changed some DatabaseBase type hints to IDatabase None of these type hints are accurate. Also not sure why we even have an empty IDatabase class in the first place. It's more than a little strange. This reverts commit a4a44f7731483489a3798ad5859b56639f6613e3. Change-Id: I0c25729a2c20bec34fad40cfa1a3615a84a92d24 --- M includes/revisiondelete/RevDelArchiveList.php M includes/revisiondelete/RevDelArchivedFileList.php M includes/revisiondelete/RevDelFileList.php M includes/revisiondelete/RevDelLogList.php M includes/revisiondelete/RevDelRevisionList.php M includes/revisiondelete/RevisionDeleteUser.php M includes/specialpage/ChangesListSpecialPage.php M includes/specialpage/ImageQueryPage.php M includes/specialpage/PageQueryPage.php M includes/specialpage/QueryPage.php M includes/specialpage/WantedQueryPage.php 11 files changed, 15 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/178590/1 diff --git a/includes/revisiondelete/RevDelArchiveList.php b/includes/revisiondelete/RevDelArchiveList.php index 6ae0afc..e7aed73 100644 --- a/includes/revisiondelete/RevDelArchiveList.php +++ b/includes/revisiondelete/RevDelArchiveList.php @@ -32,7 +32,7 @@ } /** -* @param IDatabase $db +* @param DatabaseBase $db * @return mixed */ public function doQuery( $db ) { diff --git a/includes/revisiondelete/RevDelArchivedFileList.php b/includes/revisiondelete/RevDelArchivedFileList.php index f2b99ae..aec51b1 100644 --- a/includes/revisiondelete/RevDelArchivedFileList.php +++ b/includes/revisiondelete/RevDelArchivedFileList.php @@ -32,7 +32,7 @@ } /** -* @param IDatabase $db +* @param DatabaseBase $db * @return mixed */ public function doQuery( $db ) { diff --git a/includes/revisiondelete/RevDelFileList.php b/includes/revisiondelete/RevDelFileList.php index 2295eaa..57e15d8 100644 --- a/includes/revisiondelete/RevDelFileList.php +++ b/includes/revisiondelete/RevDelFileList.php @@ -49,7 +49,7 @@ } /** -* @param IDatabase $db +* @param DatabaseBase $db * @return mixed */ public function doQuery( $db ) { diff --git a/includes/revisiondelete/RevDelLogList.php b/includes/revisiondelete/RevDelLogList.php index 86c5af3..ad04042 100644 --- a/includes/revisiondelete/RevDelLogList.php +++ b/includes/revisiondelete/RevDelLogList.php @@ -55,7 +55,7 @@ } /** -* @param IDatabase $db +* @param DatabaseBase $db * @return mixed */ public function doQuery( $db ) { diff --git a/includes/revisiondelete/RevDelRevisionList.php b/includes/revisiondelete/RevDelRevisionList.php index 733fa97..2545072 100644 --- a/includes/revisiondelete/RevDelRevisionList.php +++ b/includes/revisiondelete/RevDelRevisionList.php @@ -54,7 +54,7 @@ } /** -* @param IDatabase $db +* @param DatabaseBase $db * @return mixed */ public function doQuery( $db ) { diff --git a/includes/revisiondelete/RevisionDeleteUser.php b/includes/revisiondelete/RevisionDeleteUser.php index 79802d6..55c46c5 100644 --- a/includes/revisiondelete/RevisionDeleteUser.php +++ b/includes/revisiondelete/RevisionDeleteUser.php @@ -36,14 +36,14 @@ * @param string $name Username * @param int $userId User id * @param string $op Operator '|' or '' -* @param null|IDatabase $dbw If you happen to have one lying around +* @param null|DatabaseBase $dbw If you happen to have one lying around * @return bool */ private static function setUsernameBitfields( $name, $userId, $op, $dbw ) { if ( !$userId || ( $op !== '|' $op !== '' ) ) { return false; // sanity check } - if ( !$dbw instanceof IDatabase ) { + if ( !$dbw instanceof DatabaseBase ) { $dbw = wfGetDB( DB_MASTER ); } diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 17a651f..c28aa86 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -317,9 +317,9 @@ } /** -* Return a IDatabase object for reading +* Return a DatabaseBase object for reading * -* @return IDatabase +* @return DatabaseBase */ protected function getDB() { return wfGetDB( DB_SLAVE ); diff --git a/includes/specialpage/ImageQueryPage.php b/includes/specialpage/ImageQueryPage.php index
[MediaWiki-commits] [Gerrit] Set password default to PBKDF2 - change (operations/mediawiki-config)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/158024 Change subject: Set password default to PBKDF2 .. Set password default to PBKDF2 Set $wgPasswordDefault to pbkdf2. Also raise the default number of iterations to a more secure number. Bug: 68766 Change-Id: Ic7f8bd320944f79a1a9547b1fb30a1f1c49427a0 --- M wmf-config/CommonSettings.php 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/24/158024/1 diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php index cc457a3..e3b2a4a 100644 --- a/wmf-config/CommonSettings.php +++ b/wmf-config/CommonSettings.php @@ -366,7 +366,9 @@ session_name( $lang . 'wikiSession' ); // Keep old MD5 password hashing as default (bug 68766) -$wgPasswordDefault = 'B'; +$wgPasswordDefault = 'pbkdf2'; +// This needs to be increased as allowable by server performance +$wgPasswordConfig['pbkdf2']['cost'] = '20'; # Not CLI, see http://bugs.php.net/bug.php?id=47540 if ( PHP_SAPI != 'cli' ) { -- To view, visit https://gerrit.wikimedia.org/r/158024 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic7f8bd320944f79a1a9547b1fb30a1f1c49427a0 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Set $wgPasswordDefault to old MD5 - change (operations/mediawiki-config)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/153850 Change subject: Set $wgPasswordDefault to old MD5 .. Set $wgPasswordDefault to old MD5 In order to unblock changes to core defaults, specifically set WMF wikis' password hashing to use the current MD5 scheme until we are ready to change over to PBKDF2. Bug: 68766 Change-Id: I92164509268ad5865c42493d74c26c238a68d228 --- M wmf-config/CommonSettings.php 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/50/153850/1 diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php index eb392bb..041c48a 100644 --- a/wmf-config/CommonSettings.php +++ b/wmf-config/CommonSettings.php @@ -361,6 +361,9 @@ $wgSessionsInObjectCache = true; session_name( $lang . 'wikiSession' ); +// Keep old MD5 password hashing as default (bug 68766) +$wgPasswordDefault = 'B'; + # Not CLI, see http://bugs.php.net/bug.php?id=47540 if ( PHP_SAPI != 'cli' ) { ignore_user_abort( true ); -- To view, visit https://gerrit.wikimedia.org/r/153850 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I92164509268ad5865c42493d74c26c238a68d228 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert Do not allow a user to delete a page they can't edit - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/153362 Change subject: Revert Do not allow a user to delete a page they can't edit .. Revert Do not allow a user to delete a page they can't edit Deleting a page is a separate action from editing, and permissions should generally be both atomic and independent in order to allow for simple customization by wiki administrators. In this specific case, there is a use case scenario for a wiki where only one group of users can create and edit pages, and another group of users can only delete pages, but not edit or create. This setup is useful in cases where only certain users are allowed to author content, but other users are given the ability to perform maintenance tasks. This reverts commit 002a27790137e91b124ffeed6efc8dbe833e1dab. Change-Id: I74a782b36e1ad1b4e162926fa02a89e079a6a4ff --- M includes/Title.php M includes/api/ApiBase.php M languages/i18n/en.json M languages/i18n/qqq.json 4 files changed, 0 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/62/153362/1 diff --git a/includes/Title.php b/includes/Title.php index a1b2352..8e06087 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2258,12 +2258,6 @@ $errors[] = array( 'immobile-target-page' ); } } elseif ( $action == 'delete' ) { - if ( count( $this-getUserPermissionsErrorsInternal( 'edit', - $user, $doExpensiveQueries, true ) ) - ) { - // If they can't edit, they shouldn't delete. - $errors[] = array( 'delete-cantedit' ); - } if ( $doExpensiveQueries $wgDeleteRevisionsLimit !$this-userCan( 'bigdelete', $user ) $this-isBigDeletion() ) { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index a280ddf..a3ada80 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1411,10 +1411,6 @@ 'code' = 'cantedit', 'info' = You can't protect this page because you can't edit it ), - 'delete-cantedit' = array( - 'code' = 'cantedit', - 'info' = You can't delete this page because you can't edit it - ), 'badaccess-group0' = array( 'code' = 'permissiondenied', 'info' = Permission denied diff --git a/languages/i18n/en.json b/languages/i18n/en.json index a43a742..8230d7f 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1876,7 +1876,6 @@ delete-edit-reasonlist: Edit deletion reasons, delete-toobig: This page has a large edit history, over $1 {{PLURAL:$1|revision|revisions}}.\nDeletion of such pages has been restricted to prevent accidental disruption of {{SITENAME}}., delete-warning-toobig: This page has a large edit history, over $1 {{PLURAL:$1|revision|revisions}}.\nDeleting it may disrupt database operations of {{SITENAME}};\nproceed with caution., - delete-cantedit: You cannot delete this page because you do not have permission to edit it., deleting-backlinks-warning: '''Warning:''' [[Special:WhatLinksHere/{{FULLPAGENAME}}|Other pages]] link to or transclude the page you are about to delete., rollback: Roll back edits, rollback_short: Rollback, diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 1b98ee3..9ac5b67 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2038,7 +2038,6 @@ delete-edit-reasonlist: Shown beneath the page deletion form on the right side. It is a link to {{msg-mw|Deletereason-dropdown|notext=1}}.\n\nSee also:\n* {{msg-mw|Ipb-edit-dropdown}}\n* {{msg-mw|Protect-edit-reasonlist}}.\n{{Identical|Edit delete reasons}}, delete-toobig: Parameters:\n* $1 - the upper limit of number of revisions\nSee also:\n* {{msg-mw|Delete-warning-toobig}}, delete-warning-toobig: Parameters:\n* $1 - the upper limit of number of revisions\nSee also:\n* {{msg-mw|Delete-toobig}}, - delete-cantedit: Used as error message when deleting the page., deleting-backlinks-warning: A warning shown when a page that is being deleted has at least one link to it or is transcluded in at least one page., rollback: {{Identical|Rollback}}, rollback_short: {{Identical|Rollback}}, -- To view, visit https://gerrit.wikimedia.org/r/153362 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74a782b36e1ad1b4e162926fa02a89e079a6a4ff Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master
[MediaWiki-commits] [Gerrit] Add loadPasswords() calls to User password mutators - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/151649 Change subject: Add loadPasswords() calls to User password mutators .. Add loadPasswords() calls to User password mutators In User::setPassword() and User::setNewpassword(), added calls to loadPasswords() so that the passwords are not overridden when they are eventually actually loaded. Bug: 69102 Change-Id: I0b881986323051abed7d1af816eae9eafdbd6782 --- M includes/User.php 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/49/151649/1 diff --git a/includes/User.php b/includes/User.php index 7edd93e..fe41187 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2294,6 +2294,8 @@ public function setPassword( $str ) { global $wgAuth; + $this-loadPasswords(); + if ( $str !== null ) { if ( !$wgAuth-allowPasswordChange() ) { throw new PasswordError( wfMessage( 'password-change-forbidden' )-text() ); @@ -2380,7 +2382,7 @@ * @param bool $throttle If true, reset the throttle timestamp to the present */ public function setNewpassword( $str, $throttle = true ) { - $this-load(); + $this-loadPasswords(); if ( $str === null ) { $this-mNewpassword = ''; -- To view, visit https://gerrit.wikimedia.org/r/151649 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0b881986323051abed7d1af816eae9eafdbd6782 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Create proper aliases file for Special:ClientSSL - change (mediawiki...SSLClientAuthentication)
Parent5446 has submitted this change and it was merged. Change subject: Create proper aliases file for Special:ClientSSL .. Create proper aliases file for Special:ClientSSL Bug: 69016 Change-Id: I50f76db1bb9bdecf0cfe65c23591105c96da78ce --- M ClientSSLAuth.alias.php 1 file changed, 14 insertions(+), 0 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/ClientSSLAuth.alias.php b/ClientSSLAuth.alias.php index e69de29..8380a27 100644 --- a/ClientSSLAuth.alias.php +++ b/ClientSSLAuth.alias.php @@ -0,0 +1,14 @@ +?php +/** + * Aliases for Special:ClientSSL + * + * @file + * @ingroup Extensions + */ + +$specialPageAliases = array(); + +/** English (English) */ +$specialPageAliases[ 'en' ] = array( +'ClientSSL' = array( 'ClientSSL' ), +); -- To view, visit https://gerrit.wikimedia.org/r/151197 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I50f76db1bb9bdecf0cfe65c23591105c96da78ce Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/SSLClientAuthentication Gerrit-Branch: master Gerrit-Owner: MegaAlex alexivano...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added explicit type-cast to hash_pbkdf2 - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/150240 Change subject: Added explicit type-cast to hash_pbkdf2 .. Added explicit type-cast to hash_pbkdf2 It seems HHVM does not like the use of dynamic typing in hash_pbkdf2() (also it's kind of not the best idea in general), so added explicit (int) casting to parameters. Change-Id: I8adae3cc2cdf8029be59e2d62a3ab0fbfb73b7aa --- M includes/password/Pbkdf2Password.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/40/150240/1 diff --git a/includes/password/Pbkdf2Password.php b/includes/password/Pbkdf2Password.php index 417753f..080e3b0 100644 --- a/includes/password/Pbkdf2Password.php +++ b/includes/password/Pbkdf2Password.php @@ -51,8 +51,8 @@ $this-params['algo'], $password, base64_decode( $this-args[0] ), - $this-params['rounds'], - $this-params['length'], + (int)$this-params['rounds'], + (int)$this-params['length'], true ); } else { -- To view, visit https://gerrit.wikimedia.org/r/150240 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8adae3cc2cdf8029be59e2d62a3ab0fbfb73b7aa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add aliases file for Special:TwoFactorAuth - change (mediawiki...TwoFactorAuthentication)
Parent5446 has submitted this change and it was merged. Change subject: Add aliases file for Special:TwoFactorAuth .. Add aliases file for Special:TwoFactorAuth Bug: 68698 Change-Id: I37eb96a6f5a74fcb72518a009f0a544edeb14647 --- A TwoFactorAuth.alias.php M TwoFactorAuth.php 2 files changed, 15 insertions(+), 0 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/TwoFactorAuth.alias.php b/TwoFactorAuth.alias.php new file mode 100644 index 000..00ff14c --- /dev/null +++ b/TwoFactorAuth.alias.php @@ -0,0 +1,14 @@ +?php +/** + * Aliases for Special:TwoFactorAuth + * + * @file + * @ingroup Extensions + */ + +$specialPageAliases = array(); + +/** English (English) */ +$specialPageAliases[ 'en' ] = array( +'TwoFactorAuth' = array( 'TwoFactorAuth' ), +); diff --git a/TwoFactorAuth.php b/TwoFactorAuth.php index 779fc26..4b30c20 100644 --- a/TwoFactorAuth.php +++ b/TwoFactorAuth.php @@ -56,6 +56,7 @@ $wgMessagesDirs['TwoFactorAuth'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['TwoFactorAuth'] = __DIR__ . '/TwoFactorAuth.i18n.php'; +$wgExtensionMessagesFiles[ 'TwoFactorAuthAlias' ] = __DIR__ . '/TwoFactorAuth.alias.php'; $wgSpecialPages['TwoFactorAuth'] = 'SpecialTwoFactorAuth'; $wgResourceModules['ext.twofactorauth'] = array( -- To view, visit https://gerrit.wikimedia.org/r/149848 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I37eb96a6f5a74fcb72518a009f0a544edeb14647 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TwoFactorAuthentication Gerrit-Branch: master Gerrit-Owner: MegaAlex alexivano...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed hook documentation for removed hooks - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/150028 Change subject: Fixed hook documentation for removed hooks .. Fixed hook documentation for removed hooks Removed hook definitions for UserComparePasswords and UserCryptPassword, rather than keep them in the file. Bug: 28419 Change-Id: I7bfda155986d1407caef4e3890024c5b8a66fdcc Follows-up: I0a9c972931a0eff0cfb2619cef3ddffd03710285 --- M docs/hooks.txt 1 file changed, 0 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/28/150028/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index dd9f905..83f5136 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2788,25 +2788,8 @@ $user: User (object) that will clear the message $oldid: ID of the talk page revision being viewed (0 means the most recent one) -'UserComparePasswords': Called when checking passwords, return false to -override the default password checks. REMOVED since 1.23, use Password class instead. -$hash: String of the password hash (from the database) -$password: String of the plaintext password the user entered -$userId: Integer of the user's ID or Boolean false if the user ID was not - supplied -$result: If the hook returns false, this Boolean value will be checked to - determine if the password was valid - 'UserCreateForm': change to manipulate the login form $template: SimpleTemplate instance for the form - -'UserCryptPassword': Called when hashing a password, return false to implement -your own hashing method. REMOVED since 1.23, use Password class instead. -$password: String of the plaintext password to encrypt -$salt: String of the password salt or Boolean false if no salt is provided -$wgPasswordSalt: Boolean of whether the salt is used in the default hashing - method -$hash: If the hook returns false, this String will be used as the hash 'UserEffectiveGroups': Called in User::getEffectiveGroups(). $user: User to get groups for -- To view, visit https://gerrit.wikimedia.org/r/150028 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7bfda155986d1407caef4e3890024c5b8a66fdcc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Changed password default to PBKDF2 - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/149658 Change subject: Changed password default to PBKDF2 .. Changed password default to PBKDF2 Bug: 28419 Change-Id: I096a862c884f6a6adbb381c0fcc70844bf007c63 --- M RELEASE-NOTES-1.24 M includes/DefaultSettings.php 2 files changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/58/149658/1 diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index a6bad2c..2a6bf39 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -42,6 +42,12 @@ * $wgEnableSorbs and $wgSorbsUrl have been removed. * The UserCryptPassword and UserComparePassword hooks are no longer called. Any extensions using them must be updated to use the Password Hashing API. +* The default password type for MediaWiki has been changed from MD5 to PBKDF2. + Password hashes will automatically be updated as users log in. If necessary, the + old MD5 hashing can be restored by changing $wgPasswordDefault to 'B'. In addition, + there is a maintenance script wrapOldPassword.php that can wrap all passwords in + PBKDF2 (or the hashing algorithm of your choice) if you don't want to wait for your + users to log in. === New features in 1.24 === * Added a new hook, WhatLinksHereProps, to allow extensions to annotate diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4e1aeb1..b73ada6 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4038,7 +4038,7 @@ * * @since 1.24 */ -$wgPasswordDefault = 'B'; +$wgPasswordDefault = 'pbkdf2'; /** * Configuration for built-in password types. Maps the password type -- To view, visit https://gerrit.wikimedia.org/r/149658 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I096a862c884f6a6adbb381c0fcc70844bf007c63 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replaced hash_equals with a custom function - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/148442 Change subject: Replaced hash_equals with a custom function .. Replaced hash_equals with a custom function As recommended by iSEC, it is better to just double-HMAC for timing-safe comparisons, in case PHP internals somehow give something away. This removes the hash_equals compatibility function, and adds a function wfHashEquals(), which hashes the strings with a random nonce and then does yet another timing-safe comparison on the hash results. Bug: 28419 Change-Id: Icb2394716d6559d75704c6782f10f36bf8b67895 --- M includes/GlobalFunctions.php M includes/User.php M includes/password/Password.php M includes/specials/SpecialRunJobs.php 4 files changed, 37 insertions(+), 47 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/42/148442/1 diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index cb5b7fd..1ac4844 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -105,53 +105,43 @@ } } -// hash_equals function only exists in PHP = 5.6.0 -if ( !function_exists( 'hash_equals' ) ) { - /** -* Check whether a user-provided string is equal to a fixed-length secret without -* revealing bytes of the secret through timing differences. -* -* This timing guarantee -- that a partial match takes the same time as a complete -* mismatch -- is why this function is used in some security-sensitive parts of the code. -* For example, it shouldn't be possible to guess an HMAC signature one byte at a time. -* -* Longer explanation: http://www.emerose.com/timing-attacks-explained -* -* @codeCoverageIgnore -* @param string $known_string Fixed-length secret to compare against -* @param string $user_string User-provided string -* @return bool True if the strings are the same, false otherwise -*/ - function hash_equals( $known_string, $user_string ) { - // Strict type checking as in PHP's native implementation - if ( !is_string( $known_string ) ) { - trigger_error( 'hash_equals(): Expected known_string to be a string, ' . - gettype( $known_string ) . ' given', E_USER_WARNING ); +/** + * Securely compare two strings in a timing-safe manner + * + * In an effort at extreme paranoia (although at little cost to performance), this + * function will HMAC both strings with a transient, random nonce, and then perform + * a timing-safe comparison on those hashes. + * + * The HMAC strategy is preferred because PHP internals may or may not guarantee + * the actual algorithm is timing-safe, even if the source code looks that way. HMAC, + * however, is a PRF, and has the same effect: thwarting side-channel timing attacks. + * + * @warning This function is implemented differently than PHP's hash_equals. This is + * the preferred function. Do not use PHP's hash_equals. + * @since 1.24 + * @see http://www.emerose.com/timing-attacks-explained + * @see https://www.isecpartners.com/blog/2011/february/double-hmac-verification.aspx + * + * @param string $knownString The application-derived secret + * @param string $userString Response from the user + * + * @return bool True if equal, false otherwise + */ +function wfHashEquals( $knownString, $userString ) { + // Use a random nonce and a sufficient PRF so the attacker + // cannot guess the strings + $nonce = MWCryptRand::generate( 16 ); + $knownString = hash_hmac( 'sha512', $knownString, $nonce, true ); + $userString = hash_hmac( 'sha512', $userString, $nonce, true ); - return false; - } - - if ( !is_string( $user_string ) ) { - trigger_error( 'hash_equals(): Expected user_string to be a string, ' . - gettype( $user_string ) . ' given', E_USER_WARNING ); - - return false; - } - - // Note that we do one thing PHP doesn't: try to avoid leaking information about - // relative lengths of $known_string and $user_string, and of multiple $known_strings. - // However, lengths may still inevitably leak through, for example, CPU cache misses. - $known_string_len = strlen( $known_string ); - $user_string_len = strlen( $user_string ); - $result = $known_string_len ^ $user_string_len; - for ( $i = 0; $i $user_string_len; $i++ ) { - $result |= ord( $known_string[$i % $known_string_len] ) ^ ord( $user_string[$i] ); - } - - return ( $result === 0 ); + // For paranoia, also do a timing-safe comparison on the hashes + $result = 0;
[MediaWiki-commits] [Gerrit] Make UserNotLoggedIn redirect to login page - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/148144 Change subject: Make UserNotLoggedIn redirect to login page .. Make UserNotLoggedIn redirect to login page For pages like Special:Watchlist that throw a UserNotLoggedIn exception when the user is anonymous, this patch makes the page redirect to the login page automatically. This is instead of the current behavior of showing a link to the login page that the user must click. (Also, Special:Userlogin has existing functionality that will redirect the user back once they are logged in.) Bug: 15484 Change-Id: Idd9325374cb5dc13c4c057f45f88a33bdff523a9 --- M includes/exception/UserNotLoggedIn.php 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/44/148144/1 diff --git a/includes/exception/UserNotLoggedIn.php b/includes/exception/UserNotLoggedIn.php index 9d89009..f7a56b5 100644 --- a/includes/exception/UserNotLoggedIn.php +++ b/includes/exception/UserNotLoggedIn.php @@ -62,4 +62,20 @@ ) { parent::__construct( $titleMsg, $reasonMsg, $params ); } + + /** +* Redirect to Special:Userlogin +*/ + public function report() { + $context = RequestContext::getMain(); + + $output = $context-getOutput(); + $output-redirect( SpecialPage::getTitleFor( 'Userlogin' )-getFullURL( array( + // Return to this page when the user logs in + 'returnto' = $context-getTitle()-getText(), + 'returntoquery' = wfArrayToCgi( $context-getRequest()-getValues() ) + ) ) ); + + $output-output(); + } } -- To view, visit https://gerrit.wikimedia.org/r/148144 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd9325374cb5dc13c4c057f45f88a33bdff523a9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Unify sub-page logic in Title and MWNamespace - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/147229 Change subject: Unify sub-page logic in Title and MWNamespace .. Unify sub-page logic in Title and MWNamespace Makes sure the Special: namespace is always treated as having sub-pages, since that is an inherent behavior of all all special pages. Fixes two Title functions (Title::getSubpage, Title::isSubpageOf) so that they check if sub-pages are enabled for the namespace. Change-Id: Idd06ef0661875756fd3ce94c86b575edf63f0579 --- M includes/MWNamespace.php M includes/Title.php 2 files changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/29/147229/1 diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php index 392f558..c7b95ea 100644 --- a/includes/MWNamespace.php +++ b/includes/MWNamespace.php @@ -314,7 +314,7 @@ */ public static function hasSubpages( $index ) { global $wgNamespacesWithSubpages; - return !empty( $wgNamespacesWithSubpages[$index] ); + return $index === NS_SPECIAL || !empty( $wgNamespacesWithSubpages[$index] ); } /** diff --git a/includes/Title.php b/includes/Title.php index 746ffab..24be98a 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1539,10 +1539,14 @@ * @endcode * * @param string $text The subpage name to add to the title -* @return Title Subpage title +* @return Title|null Subpage title or false if the namespace does not have subpages * @since 1.20 */ public function getSubpage( $text ) { + if ( !MWNamespace::hasSubpages( $this-mNamespace ) ) { + return null; + } + return Title::makeTitleSafe( $this-getNamespace(), $this-getText() . '/' . $text ); } @@ -4511,6 +4515,7 @@ public function isSubpageOf( Title $title ) { return $this-getInterwiki() === $title-getInterwiki() $this-getNamespace() == $title-getNamespace() +MWNamespace::hasSubpages( $this-getNamespace() ) strpos( $this-getDBkey(), $title-getDBkey() . '/' ) === 0; } -- To view, visit https://gerrit.wikimedia.org/r/147229 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd06ef0661875756fd3ce94c86b575edf63f0579 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make UserNotLoggedIn redirect to login page - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/146515 Change subject: Make UserNotLoggedIn redirect to login page .. Make UserNotLoggedIn redirect to login page For pages like Special:Watchlist that throw a UserNotLoggedIn exception when the user is anonymous, this patch makes the page redirect to the login page automatically. This is instead of the current behavior of showing a link to the login page that the user must click. (Also, Special:Userlogin has existing functionality that will redirect the user back once they are logged in.) Bug: 15484 Change-Id: Ic7e1d5a8984e1b42c8f2ebceff094106a3ed1efa --- M includes/exception/UserNotLoggedIn.php 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/15/146515/1 diff --git a/includes/exception/UserNotLoggedIn.php b/includes/exception/UserNotLoggedIn.php index 9d89009..f7a56b5 100644 --- a/includes/exception/UserNotLoggedIn.php +++ b/includes/exception/UserNotLoggedIn.php @@ -62,4 +62,20 @@ ) { parent::__construct( $titleMsg, $reasonMsg, $params ); } + + /** +* Redirect to Special:Userlogin +*/ + public function report() { + $context = RequestContext::getMain(); + + $output = $context-getOutput(); + $output-redirect( SpecialPage::getTitleFor( 'Userlogin' )-getFullURL( array( + // Return to this page when the user logs in + 'returnto' = $context-getTitle()-getText(), + 'returntoquery' = wfArrayToCgi( $context-getRequest()-getValues() ) + ) ) ); + + $output-output(); + } } -- To view, visit https://gerrit.wikimedia.org/r/146515 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic7e1d5a8984e1b42c8f2ebceff094106a3ed1efa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added parent directory creation for /var/lib/cloud/instance - change (mediawiki/vagrant)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/138610 Change subject: Added parent directory creation for /var/lib/cloud/instance .. Added parent directory creation for /var/lib/cloud/instance Made sure to ensure parent directory exists when creating /var/lib/cloud/instance for boxes that may not already have the parent directory. Change-Id: Ibc0dd5e45d97bc7f72bfde6f090f2ad8ae41013d --- M puppet/modules/misc/manifests/init.pp 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant refs/changes/10/138610/1 diff --git a/puppet/modules/misc/manifests/init.pp b/puppet/modules/misc/manifests/init.pp index d4c0f41..ad24038 100644 --- a/puppet/modules/misc/manifests/init.pp +++ b/puppet/modules/misc/manifests/init.pp @@ -5,6 +5,10 @@ # command-line tools, like 'ack' and 'curl'. # class misc { +file { '/var/lib/cloud': +ensure = directory, +} + file { '/var/lib/cloud/instance/': ensure = directory, } -- To view, visit https://gerrit.wikimedia.org/r/138610 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc0dd5e45d97bc7f72bfde6f090f2ad8ae41013d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Corrected some language issues - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/137982 Change subject: Corrected some language issues .. Corrected some language issues Template:ISOdate on Commons revealed a number of interesting missing details from various languages. This adds some fallbacks, missing digit transformation tables, and language code aliases to fix the behavior. Change-Id: I33b9438835cf241d4e6c290330926e8f0f54fabf --- A languages/messages/MessagesArabic_indic.php A languages/messages/MessagesMl_old.php M languages/messages/MessagesMn.php M languages/messages/MessagesSl.php M languages/messages/MessagesTe.php M languages/messages/MessagesTh.php M languages/messages/MessagesUr.php 7 files changed, 77 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/82/137982/1 diff --git a/languages/messages/MessagesArabic_indic.php b/languages/messages/MessagesArabic_indic.php new file mode 100644 index 000..f4b3bb5 --- /dev/null +++ b/languages/messages/MessagesArabic_indic.php @@ -0,0 +1,11 @@ +?php +/** Kashmiri (Arabic script) (کٲشُر) + * + * See MessagesQqq.php for message documentation incl. usage of parameters + * To improve a translation please visit http://translatewiki.net + * + * @ingroup Language + * @file + */ + +$fallback = 'ks'; diff --git a/languages/messages/MessagesMl_old.php b/languages/messages/MessagesMl_old.php new file mode 100644 index 000..9052111 --- /dev/null +++ b/languages/messages/MessagesMl_old.php @@ -0,0 +1,11 @@ +?php +/** Malayalam old (മലയാളം) + * + * See MessagesQqq.php for message documentation incl. usage of parameters + * To improve a translation please visit http://translatewiki.net + * + * @ingroup Language + * @file + */ + +$fallback = 'ml'; diff --git a/languages/messages/MessagesMn.php b/languages/messages/MessagesMn.php index 667108a..e042a8c 100644 --- a/languages/messages/MessagesMn.php +++ b/languages/messages/MessagesMn.php @@ -42,5 +42,22 @@ 'Зургийн_хэлэлцүүлэг' = NS_FILE_TALK, ); +$digitTransformTable = array( + '0' = '᠐', + '1' = '᠑', + '2' = '᠒', + '3' = '᠓', + '4' = '᠔', + '5' = '᠕', + '6' = '᠖', + '7' = '᠗', + '8' = '᠘', + '9' = '᠙', + # '%' = '', + # '.' = '', + # ',' = '', +); + + $linkTrail = '/^([a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя“»]+)(.*)$/sDu'; diff --git a/languages/messages/MessagesSl.php b/languages/messages/MessagesSl.php index ea6b569..1fdea6d 100644 --- a/languages/messages/MessagesSl.php +++ b/languages/messages/MessagesSl.php @@ -172,13 +172,13 @@ $defaultDateFormat = 'dmy full'; $dateFormats = array( - 'dmy short time' = 'H:i', + 'dmy short time' = 'H.i', 'dmy short date' = 'j. F Y', - 'dmy short both' = 'H:i, j. M Y', + 'dmy short both' = 'H.inbsp;ob j. M Y', - 'dmy full time' = 'H:i', + 'dmy full time' = 'H.i', 'dmy full date' = 'j. F Y', - 'dmy full both' = 'H:i, j. F Y', + 'dmy full both' = 'H.inbsp;ob j. F Y', ); $fallback8bitEncoding = iso-8859-2; diff --git a/languages/messages/MessagesTe.php b/languages/messages/MessagesTe.php index b5f131a..15e51f5 100644 --- a/languages/messages/MessagesTe.php +++ b/languages/messages/MessagesTe.php @@ -137,6 +137,22 @@ 'special' = array( '0', 'ప్రత్యేక', 'special' ), ); +$digitTransformTable = array( + '0' = '౦', + '1' = '౧', + '2' = '౨', + '3' = '౩', + '4' = '౪', + '5' = '౫', + '6' = '౬', + '7' = '౭', + '8' = '౮', + '9' = '౯', + # '%' = '', + # '.' = '', + # ',' = '', +); + $linkTrail = /^([\xE0\xB0\x81-\xE0\xB1\xAF]+)(.*)$/sDu; $digitGroupingPattern = ##,##,###; diff --git a/languages/messages/MessagesTh.php b/languages/messages/MessagesTh.php index 7825ae9..a3fdb4c 100644 --- a/languages/messages/MessagesTh.php +++ b/languages/messages/MessagesTh.php @@ -167,6 +167,22 @@ 'ISO 8601', ); +$digitTransformTable = array( + '0' = '๐', + '1' = '๑', + '2' = '๒', + '3' = '๓', + '4' = '๔', + '5' = '๕', + '6' = '๖', + '7' = '๗', + '8' = '๘', + '9' = '๙', + # '%' = '', + # '.' = '', + # ',' = '', +); + $defaultDateFormat = 'thai'; $dateFormats = array( diff --git a/languages/messages/MessagesUr.php b/languages/messages/MessagesUr.php index 7ee1fe8..aac146a 100644 --- a/languages/messages/MessagesUr.php +++ b/languages/messages/MessagesUr.php @@ -25,6 +25,8 @@ * @author පසිඳු කාවින්ද */ +$fallback = 'fa'; + $fallback8bitEncoding = 'windows-1256'; $rtl = true; -- To view, visit https://gerrit.wikimedia.org/r/137982 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33b9438835cf241d4e6c290330926e8f0f54fabf Gerrit-PatchSet: 1
[MediaWiki-commits] [Gerrit] Move token login to separate page - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/135597 Change subject: Move token login to separate page .. Move token login to separate page Rather than have an extraneous form on the login page, move the token input to a separate page. The actual logic for logging in is identical, the only difference is that the token is added to the form data on a second page request. Bug: 53195 Change-Id: I39859cc59f1811de42b72f6167d332ea48812f97 --- M OATHAuth.hooks.php M OATHAuth.php M i18n/en.json M i18n/qqq.json M special/SpecialOATH.php M special/SpecialOATHDisable.php M special/SpecialOATHEnable.php A special/SpecialOATHLogin.php 8 files changed, 154 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/97/135597/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index 33cc905..fde74d8 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -5,23 +5,6 @@ */ class OATHAuthHooks { /** -* @param $template UserloginTemplate -* @return bool -*/ - static function ModifyUITemplate( $template ) { - $input = 'divlabel for=wpOATHToken' - . wfMessage( 'oathauth-token' )-escaped() - . '/label' - . Html::input( 'wpOATHToken', null, 'text', array( - 'class' = 'loginText', 'id' = 'wpOATHToken', 'tabindex' = '3', 'size' = '20' - ) ) . '/div'; - - $template-set( 'extrafields', $template-get( 'extrafields', '' ) . $input ); - - return true; - } - - /** * @param $extraFields array * @return bool */ @@ -58,13 +41,18 @@ * @return bool */ static function AbortLogin( $user, $password, $abort, $errorMsg ) { - $result = self::authenticate( $user ); - if ( $result ) { - return true; - } else { - $abort = LoginForm::ABORTED; - $errorMsg = 'oathauth-abortlogin'; + $context = RequestContext::getMain(); + $request = $context-getRequest(); + $output = $context-getOutput(); + $oathuser = OATHUser::newFromUser( $user ); + + if ( $oathuser-getKey() !== null !$request-getCheck( 'token' ) ) { + $request-setSessionData( 'oath_login', $request-getValues() ); + $output-redirect( SpecialPage::getTitleFor( 'OATH' )-getFullURL( '', false, PROTO_CURRENT ) ); + return false; + } else { + return true; } } diff --git a/OATHAuth.php b/OATHAuth.php index 81944c4..18ddae1 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -67,6 +67,7 @@ $wgAutoloadClasses['SpecialOATH'] = $dir . 'special/SpecialOATH.php'; $wgAutoloadClasses['SpecialOATHEnable'] = $dir . 'special/SpecialOATHEnable.php'; $wgAutoloadClasses['SpecialOATHDisable'] = $dir . 'special/SpecialOATHDisable.php'; +$wgAutoloadClasses['SpecialOATHLogin'] = $dir . 'special/SpecialOATHLogin.php'; $wgSpecialPages['OATH'] = 'SpecialOATH'; $wgSpecialPageGroups['OATH'] = 'oath'; @@ -85,7 +86,6 @@ $wgHooks['AbortChangePassword'][] = 'OATHAuthHooks::AbortChangePassword'; $wgHooks['AbortLogin'][] = 'OATHAuthHooks::AbortLogin'; -$wgHooks['UserLoginForm'][] = 'OATHAuthHooks::ModifyUITemplate'; $wgHooks['ChangePasswordForm'][] = 'OATHAuthHooks::ChangePasswordForm'; $wgHooks['TwoFactorIsEnabled'][] = 'OATHAuthHooks::TwoFactorIsEnabled'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'OATHAuthHooks::OATHAuthSchemaUpdates'; diff --git a/i18n/en.json b/i18n/en.json index c45c7db..8a269be 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -22,6 +22,7 @@ oathauth-currenttoken: Current Token, oathauth-newtoken: New Token, oathauth-disable: Disable Two Factor Authentication, +oathauth-login: Login with Two Factor Authentication, oathauth-displayoathinfo: Two Factor Authentication Options, oathauth-validatedoath: Validated two factor credentials. Two factor authentication will now be enforced., oathauth-backtopreferences: Back to preferences., diff --git a/i18n/qqq.json b/i18n/qqq.json index 062fbf1..0095402 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -24,6 +24,7 @@ oathauth-currenttoken: HTMLForm label, found on Special:OATH, when verifying OATH., oathauth-newtoken: HTMLForm label, found on Special:OATH, when verifying OATH., oathauth-disable: Page title on Special:OATH while disabling OATH., + oathauth-login: Page title on Special:OATH while loggin in with OATH., oathauth-displayoathinfo: Page title on Special:OATH when no parameters are passed.,
[MediaWiki-commits] [Gerrit] Add non-MySQL database support - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/135618 Change subject: Add non-MySQL database support .. Add non-MySQL database support Created patch files for other database types. Note that some types, such as Oracle, are not guaranteed to work, since not even MW core works with them yet anyway. Bug: 65658 Change-Id: Ie9ce8a4d1140d16017c1aa83865f79d8b0986528 --- M OATHAuth.hooks.php A sql/mssql/tables.sql A sql/oracle/tables.sql A sql/postgres/tables.sql 4 files changed, 68 insertions(+), 29 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/18/135618/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index 33cc905..a4d1864 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -166,39 +166,42 @@ * @return bool */ public static function OATHAuthSchemaUpdates( $updater ) { - $base = dirname( __FILE__ ); - switch ( $updater-getDB()-getType() ) { - case 'mysql': - $updater-addExtensionTable( 'oathauth_users', - $base/sql/mysql/tables.sql ); - $updater-addExtensionUpdate( array( function ( DatabaseUpdater $updater ) { - $db = $updater-getDB(); + $base = __DIR__; + $type = $updater-getDB()-getType(); - if ( !$db-fieldExists( 'oathauth_users', 'scratch_tokens' ) ) { - return true; - } + $updater-addExtensionTable( 'oathauth_users', + $base/sql/$type/tables.sql ); + $updater-addExtensionUpdate( array( function ( DatabaseUpdater $updater ) { + $db = $updater-getDB(); - $res = $db-select( - 'oathauth_users', - array( 'id', 'secret', 'scratch_tokens' ) - ); + if ( !$db-fieldExists( 'oathauth_users', 'scratch_tokens' ) ) { + return true; + } - foreach ( $res as $row ) { - $scratchTokens = unserialize( base64_decode( $row-scratch_tokens ) ); - $key = new OATHAuthKey( $row-secret, $scratchTokens ); - $db-update( - 'oathauth_users', - array( 'secret' = serialize( $key ) ), - array( 'id' = $row-id ), - __METHOD__ - ); - } + $res = $db-select( + 'oathauth_users', + array( 'id', 'secret', 'scratch_tokens' ) + ); - return true; - } ) ); - $updater-dropExtensionField( 'oathauth_users', 'secret_reset', - $base/sql/mysql/patch-remove_reset.sql ); - break; + foreach ( $res as $row ) { + $scratchTokens = unserialize( base64_decode( $row-scratch_tokens ) ); + $key = new OATHAuthKey( $row-secret, $scratchTokens ); + $db-update( + 'oathauth_users', + array( 'secret' = serialize( $key ) ), + array( 'id' = $row-id ), + __METHOD__ + ); + } + + return true; + } ) ); + + // Patch for MySQL only, since other DB support was added after + // this patch became applicable + if ( $type === 'mysql' ) { + $updater-dropExtensionField( 'oathauth_users', 'secret_reset', + $base/sql/$type/patch-remove_reset.sql ); } return true; diff --git a/sql/mssql/tables.sql b/sql/mssql/tables.sql new file mode 100644 index 000..56bcedb --- /dev/null +++ b/sql/mssql/tables.sql @@ -0,0 +1,8 @@ +CREATE TABLE /*_*/oathauth_users ( + -- User ID + id INT NOT NULL PRIMARY KEY IDENTITY(0,1), + +
[MediaWiki-commits] [Gerrit] Make abstract Config class truly implementation-agnostic - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/135504 Change subject: Make abstract Config class truly implementation-agnostic .. Make abstract Config class truly implementation-agnostic Follow up to I13baec0b6 (Config: Add Config and GlobalConfig classes): Config: * Rather than returning Status objects, Config::set will now throw an exception if an error is encountered * Config::factory was moved into it's own ConfigFactory class. * Since there are no more functions in it, Config was turned into an interface. GlobalConfig: * Remove $prefix args from Config::set and ::get. The idea of having an abstract Config class is to abstract some notion of configuration data from the particular way in which it is currently implemented (global variables). So the abstract base class has no business dealing with variable name prefixes. ** Instead GlobalVarConfig's implementations of get and set call getWithPrefix and setWithPrefix internally, which are now protected * Rename GlobalConfig to GlobalVarConfig, which makes it clearer that it isn't referring to the scope of the configuration value, but to the scope of the variable name which provides it. ConfigFactory: * ConfigFactory is where Config objects are registered, and later constructed. * Config objects are registered with a given name, and a callback factory function. This allows for implementations to construct the object with the parameters they want, and avoids the overhead of needing an entire class. ** The name 'main' is the default object returned by RequestContext::getConfig(), and is intended to be used by core. * This is a singleton class, the main instance can be obtained with: ConfigFactory::getDefaultInstance() In addition to the above: * $wgConfigClass was removed, and $wgConfigRegistry was introduced, which stores a name = callback. The name is to be what the Config instance is registered with, and the callback should return an implementation of Config. * Tests were written for the new ConfigFactory, and GlobalVarConfig's tests were improved. Co-Authored-By: Ori Livneh o...@wikimedia.org Co-Authored-By: Chad Horohoe ch...@wikimedia.org Co-Authored-By: Mattflaschen mflasc...@wikimedia.org Co-Authored-By: Parent5446 tylerro...@gmail.com Co-Authored-By: Reedy re...@wikimedia.org Co-Authored-By: Daniel Kinzler daniel.kinz...@wikimedia.de Change-Id: I5a5857fcfa07598ba4ce9ae5bbb4ce54a567d31e (cherry picked from commit 8977e56a6b71e10e6046537cd82a3e32aea12f86) --- M includes/AutoLoader.php M includes/DefaultSettings.php M includes/config/Config.php R includes/config/ConfigException.php A includes/config/ConfigFactory.php A includes/config/GlobalVarConfig.php M includes/context/RequestContext.php A tests/phpunit/includes/config/ConfigFactoryTest.php D tests/phpunit/includes/config/GlobalConfigTest.php A tests/phpunit/includes/config/GlobalVarConfigTest.php 10 files changed, 292 insertions(+), 86 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/04/135504/1 diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 6675860..dc923f0 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -392,7 +392,9 @@ # includes/config 'Config' = 'includes/config/Config.php', - 'GlobalConfig' = 'includes/config/GlobalConfig.php', + 'ConfigException' = 'includes/config/ConfigException.php', + 'ConfigFactory' = 'includes/config/ConfigFactory.php', + 'GlobalVarConfig' = 'includes/config/GlobalVarConfig.php', # includes/content 'AbstractContent' = 'includes/content/AbstractContent.php', diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ffd15bd..2fe8271 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -60,11 +60,14 @@ $wgConf = new SiteConfiguration; /** - * Class name to use for accessing Config. - * Currently only 'GlobalConfig' is available + * Registry of factory functions to create config objects: + * The 'main' key must be set, and the value should be a valid + * callable. * @since 1.23 */ -$wgConfigClass = 'GlobalConfig'; +$wgConfigRegistry = array( + 'main' = 'GlobalVarConfig::newInstance' +); /** * MediaWiki version number diff --git a/includes/config/Config.php b/includes/config/Config.php index 04afdda..68e90b4 100644 --- a/includes/config/Config.php +++ b/includes/config/Config.php @@ -21,37 +21,27 @@ */ /** - * Abstract class for get settings for + * Interface for configuration instances * * @since 1.23 */ -abstract class Config { - /** -* @param string $name configuration variable name without prefix -* @param string $prefix of the variable name -* @return mixed -*/ - abstract public function get( $name, $prefix = 'wg' ); +interface Config { /** -*
[MediaWiki-commits] [Gerrit] DerivativeContext::setConfig should take a Config object - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/135510 Change subject: DerivativeContext::setConfig should take a Config object .. DerivativeContext::setConfig should take a Config object Change-Id: Icc16a9c206c57fac2d26547cb874e02ef09c0485 Follows-Up: I13baec0b6d4ea7badf20b9c5f9b40846348838e4 (cherry picked from commit 07c748343cfe389b3c1a74b7aaa9bc222d588c94) --- M includes/context/DerivativeContext.php 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/10/135510/1 diff --git a/includes/context/DerivativeContext.php b/includes/context/DerivativeContext.php index f5616e0..f1644d3 100644 --- a/includes/context/DerivativeContext.php +++ b/includes/context/DerivativeContext.php @@ -66,7 +66,7 @@ private $skin; /** -* @var SiteConfiguration +* @var Config */ private $config; @@ -81,9 +81,9 @@ /** * Set the SiteConfiguration object * -* @param SiteConfiguration $s +* @param Config $s */ - public function setConfig( SiteConfiguration $s ) { + public function setConfig( Config $s ) { $this-config = $s; } -- To view, visit https://gerrit.wikimedia.org/r/135510 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icc16a9c206c57fac2d26547cb874e02ef09c0485 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_23 Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed hook names and code style - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/135520 Change subject: Fixed hook names and code style .. Fixed hook names and code style Made all hook functions reflect the names of the hooks they go into for clarity. Also fixed documentation and added type hints where applicable. Change-Id: I12fec1e8a27ca0d13c265c17f442103e135bb6ff --- M OATHAuth.hooks.php M OATHAuth.php M OATHUser.php M special/SpecialOATH.php 4 files changed, 118 insertions(+), 47 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/20/135520/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index d6ed142..e98360a 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -1,14 +1,34 @@ ?php +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * + * @file + * @author Ryan Lane rl...@wikimedia.org + * @copyright © 2012 Ryan Lane + * @license GNU General Public Licence 2.0 or later + */ /** * Hooks for Extension:OATHAuth */ class OATHAuthHooks { /** -* @param $template UserloginTemplate +* @param UserloginTemplate $template * @return bool */ - static function ModifyUITemplate( $template ) { + public static function onUserLoginForm( UserloginTemplate $template ) { $input = 'divlabel for=wpOATHToken' . wfMessage( 'oathauth-token' )-escaped() . '/label' @@ -22,10 +42,10 @@ } /** -* @param $extraFields array +* @param array $extraFields * @return bool */ - static function ChangePasswordForm( $extraFields ) { + public static function onChangePasswordForm( array $extraFields ) { $tokenField = array( 'wpOATHToken', 'oathauth-token', 'password', '' ); array_push( $extraFields, $tokenField ); @@ -33,13 +53,13 @@ } /** -* @param $user User -* @param $password string -* @param $newpassword string -* @param $errorMsg string +* @param User $user +* @param string $password +* @param string $newpassword +* @param string $errorMsg * @return bool */ - static function AbortChangePassword( $user, $password, $newpassword, $errorMsg ) { + public static function onAbortChangePassword( User $user, $password, $newpassword, $errorMsg ) { $result = self::authenticate( $user ); if ( $result ) { return true; @@ -51,13 +71,13 @@ } /** -* @param $user User -* @param $password string -* @param $abort int -* @param $errorMsg string +* @param User $user +* @param string $password +* @param int $abort +* @param string $errorMsg * @return bool */ - static function AbortLogin( $user, $password, $abort, $errorMsg ) { + public static function onAbortLogin( User $user, $password, $abort, $errorMsg ) { $result = self::authenticate( $user ); if ( $result ) { return true; @@ -69,17 +89,17 @@ } /** -* @param $user User +* @param User $user * @return bool */ - static function authenticate( $user ) { + static function authenticate( User $user ) { global $wgRequest; $token = $wgRequest-getText( 'wpOATHToken' ); $oathuser = OATHUser::newFromUser( $user ); - # Though it's weird to default to true, we only want to deny - # users who have two-factor enabled and have validated their - # token. + // Though it's weird to default to true, we only want to deny + // users who have two-factor enabled and have validated their + // token. $result = true; if ( $oathuser $oathuser-isEnabled() $oathuser-isValidated() ) { $result = $oathuser-verifyToken( $token ); @@ -94,19 +114,19 @@ * * @return bool False if enabled, true otherwise
[MediaWiki-commits] [Gerrit] Refactored special pages into HTMLForm and proxy - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/134789 Change subject: Refactored special pages into HTMLForm and proxy .. Refactored special pages into HTMLForm and proxy Made new class ProxySpecialPage, which acts as a proxy object to another SpecialPage object that is determined based on context information other than the title. Then Special:OATH has been split into two separate special page classes (both FormSpecialPages using HTMLForm) that are routed to by a ProxySpecialPage object. In addition, the form for enabling two-factor auth has been refactored into vform style, with some better instructions on how to enable two-factor authentication. Change-Id: Ib9117cbc9d7f044de9607db81a157e1b472b5ec0 --- A special/ProxySpecialPage.php M special/SpecialOATH.php A special/SpecialOATHDisable.php A special/SpecialOATHEnable.php 4 files changed, 417 insertions(+), 237 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/89/134789/1 diff --git a/special/ProxySpecialPage.php b/special/ProxySpecialPage.php new file mode 100644 index 000..ec62807 --- /dev/null +++ b/special/ProxySpecialPage.php @@ -0,0 +1,11 @@ +?php +/** + * Created by PhpStorm. + * User: parent5446 + * Date: 5/21/14 + * Time: 16:44 + */ + +class ProxySpecialPage { + +} \ No newline at end of file diff --git a/special/SpecialOATH.php b/special/SpecialOATH.php index b9465be..4e79246 100644 --- a/special/SpecialOATH.php +++ b/special/SpecialOATH.php @@ -1,242 +1,11 @@ ?php - /** - * Special page to display key information to the user - * - * @file - * @ingroup Extensions + * Created by PhpStorm. + * User: parent5446 + * Date: 5/21/14 + * Time: 21:07 */ -class SpecialOATH extends UnlistedSpecialPage { - /** @var OATHUser|null */ - private $OATHUser; +class SpecialOATH { - /** -* Initialize the OATH user based on the current local User object in the context -*/ - public function __construct() { - parent::__construct( 'OATH' ); - - $this-OATHUser = OATHUser::newFromUser( $this-getUser() ); - } - - /** -* Perform the correct form based on the action -* -* @param null|string $par Sub-page -*/ - public function execute( $par ) { - if ( !$this-getUser()-isLoggedIn() ) { - $this-setHeaders(); - $this-getOutput()-setPagetitle( $this-msg( 'oathauth-notloggedin' ) ); - $this-getOutput()-addWikiMsg( 'oathauth-mustbeloggedin' ); - return; - } - - $action = $this-getRequest()-getVal( 'action' ); - if ( $action == enable ) { - $this-enable(); - } elseif ( $action == disable ) { - $this-disable(); - } - } - - /** -* @return bool -*/ - private function enable() { - $this-setHeaders(); - $this-getOutput()-setPagetitle( $this-msg( 'oathauth-enable' ) ); - $returnto = $this-getRequest()-getVal( 'returnto' ); - - if ( $this-OATHUser-getKey() ) { - $this-getOutput()-addWikiMsg( 'oathauth-alreadyenabled' ); - - return true; - } - - if ( null === $this-getRequest()-getSessionData( 'oathauth_key' ) ) { - $this-getRequest()-setSessionData( 'oathauth_key', OATHAuthKey::newFromRandom() ); - } - - $info['token'] = array( - 'type' = 'text', - 'default' = '', - 'label-message' = 'oathauth-token', - 'name' = 'token', - ); - $info['mode'] = array( - 'type' = 'hidden', - 'default' = 'enable', - 'name' = 'mode', - ); - $info['returnto'] = array( - 'type' = 'hidden', - 'default' = $returnto, - 'name' = 'returnto', - ); - $info['action'] = array( - 'type' = 'hidden', - 'default' = 'enable', - 'name' = 'action', - ); - $form = new HTMLForm( - $info, - $this-getContext(), - 'oathauth-verify' - ); - $form-setSubmitID( 'oathauth-validate-submit' ); - $form-setSubmitCallback( array( $this, 'tryValidateSubmit' ) ); - if ( !$form-show() ) { - $this-displaySecret(); - } - - return true; - } - - private function
[MediaWiki-commits] [Gerrit] Refactor extension key storage - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/134050 Change subject: Refactor extension key storage .. Refactor extension key storage This takes out the actual key information from OATHUser and puts it into an OATHKey class, which OATHUser depends on. This allows easily swapping keys in/out from a user. In addition, the reset functionality of Special:OATH is temporarily removed. It will be re-added in another commit. Change-Id: Ife5f1bae4ad65b66c5e20017cc43c0576b4aba19 --- M OATHAuth.hooks.php M OATHAuth.php A OATHAuthKey.php M OATHUser.php M lib/hotp.php M special/SpecialOATH.php 6 files changed, 222 insertions(+), 530 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/50/134050/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index c52a2b2..2b0643c 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -48,14 +48,15 @@ } /** -* @param $user User -* @param $password string -* @param $abort int -* @param $errorMsg string +* @param User $user +* @param string $password +* @param int $abort +* @param string $errorMsg * @return bool */ - static function AbortLogin( $user, $password, $abort, $errorMsg ) { + static function AbortLogin( User $user, $password, $abort, $errorMsg ) { $result = self::authenticate( $user ); + if ( $result ) { return true; } else { @@ -66,20 +67,22 @@ } /** -* @param $user User +* @param User $user * @return bool */ - static function authenticate( $user ) { + static function authenticate( User $user ) { global $wgRequest; + $token = $wgRequest-getText( 'wpOATHToken' ); $oathuser = OATHUser::newFromUser( $user ); # Though it's weird to default to true, we only want to deny # users who have two-factor enabled and have validated their # token. $result = true; - if ( $oathuser $oathuser-isEnabled() $oathuser-isValidated() ) { - $result = $oathuser-verifyToken( $token ); + if ( $oathuser-getKey() !== null ) { + $result = $oathuser-getKey()-verifyToken( $token ); } + return $result; } @@ -94,7 +97,7 @@ global $wgUser; $user = OATHUser::newFromUser( $wgUser ); - if ( $user $user-isEnabled() $user-isValidated() ) { + if ( $user $user-getKey() !== null ) { $isEnabled = true; # This two-factor extension is enabled by the user, # we don't need to check others. @@ -119,7 +122,7 @@ $oathUser = OATHUser::newFromUser( $user ); $title = SpecialPage::getTitleFor( 'OATH' ); - if ( $oathUser-isEnabled() $oathUser-isValidated() ) { + if ( $oathUser-getKey() !== null ) { $preferences['oath-disable'] = array( 'type' = 'info', 'raw' = 'true', @@ -133,20 +136,6 @@ ) ), 'label-message' = 'oathauth-prefs-label', - 'section' = 'personal/info', - ); - $preferences['oath-reset'] = array( - 'type' = 'info', - 'raw' = 'true', - 'default' = Linker::link( - $title, - wfMessage( 'oathauth-reset' )-escaped(), - array(), - array( - 'action' = 'reset', - 'returnto' = SpecialPage::getTitleFor( 'Preferences' )-getPrefixedText() - ) - ), 'section' = 'personal/info', ); } else { @@ -181,6 +170,7 @@ $updater-addExtensionTable( 'oathauth_users', $base/oathauth.sql ); break; } + return true; } } diff --git a/OATHAuth.php b/OATHAuth.php index fa79c7f..cf772ec 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -35,7 +35,7 @@ * * @var int */ -$wgOAUTHAuthWindowSize = 30; +$wgOATHAuthWindowSize = 30; /** * The number of token windows in each direction that
[MediaWiki-commits] [Gerrit] Code-base cleanup - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/132775 Change subject: Code-base cleanup .. Code-base cleanup * Removed use of deprecated core features * Made code style fixes * Made pass phpcs-strict * Fixed special page aliases Change-Id: Iae2a0a7d6f0fb2ea5080795a06ae257af96dfaf6 --- M OATHAuth.alias.php M OATHAuth.i18n.php M OATHAuth.php M OATHUser.php M lib/base32.php M lib/hotp.php M special/SpecialOATH.php 7 files changed, 412 insertions(+), 262 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/75/132775/1 diff --git a/OATHAuth.alias.php b/OATHAuth.alias.php index 7945eb7..3069bb2 100644 --- a/OATHAuth.alias.php +++ b/OATHAuth.alias.php @@ -11,8 +11,7 @@ /** English (English) */ $specialPageAliases['en'] = array( - 'OATHAuth' = array( 'OATHAuth' ), - 'OATHAuthDisplay' = array( 'Display Token OATH Information' ), + 'OATH' = array( 'OATH', 'OATHAuth' ), ); /** Arabic (العربية) */ diff --git a/OATHAuth.i18n.php b/OATHAuth.i18n.php index d7579e6..a78d608 100644 --- a/OATHAuth.i18n.php +++ b/OATHAuth.i18n.php @@ -12,6 +12,7 @@ */ $messages = array(); if ( !function_exists( 'wfJsonI18nShim886e5f466d60' ) ) { + /** @noinspection PhpMissingDocCommentInspection */ function wfJsonI18nShim886e5f466d60( $cache, $code, $cachedData ) { $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { diff --git a/OATHAuth.php b/OATHAuth.php index 5e7d7f4..e7e1c1b 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -13,7 +13,7 @@ */ if ( !defined( 'MEDIAWIKI' ) ) { - echo( This file is an extension to the MediaWiki software and cannot be used standalone.\n ); + echo This file is an extension to the MediaWiki software and cannot be used standalone.\n; die( 1 ); } diff --git a/OATHUser.php b/OATHUser.php index dc8f665..a172eba 100644 --- a/OATHUser.php +++ b/OATHUser.php @@ -8,8 +8,29 @@ */ class OATHUser { + /** @var int User ID */ + private $id; - private $id, $secret, $secretReset, $scratchTokens, $scratchTokensReset, $account, $isEnabled, $isValidated; + /** @var string Two factor binary secret */ + private $secret; + + /** @var string New two factor secret when resetting */ + private $secretReset; + + /** @var string[] List of scratch tokens */ + private $scratchTokens; + + /** @var string[] New scratch tokens when resetting */ + private $scratchTokensReset; + + /** @var string Name for the two-factor account */ + private $account; + + /** @var bool Whether two-factor is enabled */ + private $isEnabled; + + /** @var bool Whether two-factor is validated */ + private $isValidated; /** * Constructor. Can't be called directly. Call one of the static NewFrom* methods @@ -20,8 +41,11 @@ * @param $scratchTokens * @param $scratchTokensReset * @param bool $isValidated bool +* @todo Get rid of telescoping constructor anti-pattern */ - public function __construct( $id, $account, $secret = null, $secretReset = null, $scratchTokens = null, $scratchTokensReset = null, $isValidated = false ) { + public function __construct( $id, $account, $secret = null, $secretReset = null, + $scratchTokens = null, $scratchTokensReset = null, $isValidated = false + ) { $this-id = $id; $this-account = $account; $this-isEnabled = true; @@ -120,7 +144,7 @@ * @return Boolean */ public function verifyToken( $token, $reset = false ) { - if ( $reset ) { + if ( $reset ) { $secret = $this-secretReset; } else { $secret = $this-secret; @@ -134,7 +158,8 @@ } } # See if the user is using a scratch token - for ( $i = 0; $i count( $this-scratchTokens ); $i++ ) { + $length = count( $this-scratchTokens ); + for ( $i = 0; $i $length; $i++ ) { if ( $token === $this-scratchTokens[$i] ) { # If there is a scratch token, remove it from the scratch token list unset( $this-scratchTokens[$i] ); @@ -219,8 +244,10 @@ $dbw = wfGetDB( DB_MASTER ); return $dbw-update( 'oathauth_users', - array( 'secret_reset' = $this-secretReset, - 'scratch_tokens_reset' = base64_encode( serialize( $this-scratchTokensReset ) ) ), + array( +
[MediaWiki-commits] [Gerrit] Make OAUTHAuth more friendly with other authnz extensions - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/132776 Change subject: Make OAUTHAuth more friendly with other authnz extensions .. Make OAUTHAuth more friendly with other authnz extensions When setting QuickTemplate fields, query to see what is already there, and append to it. That way if another extension adds more fields, it won't be overridden. Bug: 53198 Change-Id: Ib0d67e450e8de372f875536abf82653ede2cdfda --- M OATHAuth.hooks.php 1 file changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/76/132776/1 diff --git a/OATHAuth.hooks.php b/OATHAuth.hooks.php index c12432c..b85ddcd 100644 --- a/OATHAuth.hooks.php +++ b/OATHAuth.hooks.php @@ -15,7 +15,8 @@ . Html::input( 'wpOATHToken', null, 'text', array( 'class' = 'loginText', 'id' = 'wpOATHToken', 'tabindex' = '3', 'size' = '20' ) ) . '/div'; - $template-set( 'extrafields', $input ); + + $template-set( 'extrafields', $template-get( 'extrafields', '' ) . $input ); return true; } @@ -27,6 +28,7 @@ static function ChangePasswordForm( $extraFields ) { $tokenField = array( 'wpOATHToken', 'oathauth-token', 'password', '' ); array_push( $extraFields, $tokenField ); + return true; } @@ -43,6 +45,7 @@ return true; } else { $errorMsg = 'oathauth-abortlogin'; + return false; } } @@ -71,6 +74,7 @@ */ static function authenticate( $user ) { global $wgRequest; + $token = $wgRequest-getText( 'wpOATHToken' ); $oathuser = OATHUser::newFromUser( $user ); # Though it's weird to default to true, we only want to deny -- To view, visit https://gerrit.wikimedia.org/r/132776 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0d67e450e8de372f875536abf82653ede2cdfda Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Cache OATH tokens to avoid replay - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/132783 Change subject: Cache OATH tokens to avoid replay .. Cache OATH tokens to avoid replay Once a token is used, cache it in memcached for a brief amount of time (specifically, until the window in which it is valid ends). That way once a token is used it cannot be re-used in a replay attack. Bug: 53196 Change-Id: I7b8e92875a573f3ac95e13c881ef85464bcecf85 --- M OATHUser.php 1 file changed, 30 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/83/132783/1 diff --git a/OATHUser.php b/OATHUser.php index 355df2f..3606639 100644 --- a/OATHUser.php +++ b/OATHUser.php @@ -143,31 +143,43 @@ * @return Boolean */ public function verifyToken( $token, $reset = false ) { - if ( $reset ) { - $secret = $this-secretReset; - } else { - $secret = $this-secret; + global $wgMemc; + + // Prevent replay attacks + $memcKey = wfMemcKey( 'oauthauth', 'usedtokens', $reset ? 'reset' : null, $token ); + if ( $wgMemc-get( $memcKey ) ) { + return false; } + + $retval = false; + $secret = $reset ? $this-secretReset : $this-secret; $results = HOTP::generateByTimeWindow( Base32::decode( $secret ), 30, -4, 4 ); - # Check to see if the user's given token is in the list of tokens generated - # for the time window. + // Check to see if the user's given token is in the list of tokens generated + // for the time window. foreach ( $results as $result ) { if ( $result-toHOTP( 6 ) === $token ) { - return true; - } - } - # See if the user is using a scratch token - $length = count( $this-scratchTokens ); - for ( $i = 0; $i $length; $i++ ) { - if ( $token === $this-scratchTokens[$i] ) { - # If there is a scratch token, remove it from the scratch token list - unset( $this-scratchTokens[$i] ); - # Only return true if we removed it from the database - return $this-updateScratchTokens(); + $retval = true; + break; } } - return false; + // See if the user is using a scratch token + $length = count( $this-scratchTokens ); + for ( $i = 0; $i $length; $i++ ) { + if ( $token === $this-scratchTokens[$i] ) { + // If there is a scratch token, remove it from the scratch token list + unset( $this-scratchTokens[$i] ); + // Only return true if we removed it from the database + $retval = $this-updateScratchTokens(); + break; + } + } + + if ( $retval ) { + $wgMemc-set( $memcKey, true, 30 * 8 ); + } + + return $retval; } /** -- To view, visit https://gerrit.wikimedia.org/r/132783 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7b8e92875a573f3ac95e13c881ef85464bcecf85 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make authentication window size and leniency configurable - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/132784 Change subject: Make authentication window size and leniency configurable .. Make authentication window size and leniency configurable Make window size and radius configurable by the system administrator, rather than hardcoded. Bug: 53194 Change-Id: I7fe1bfdfa1e7bfc07646a9704084977e17c65313 --- M OATHAuth.php M OATHUser.php 2 files changed, 31 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/84/132784/1 diff --git a/OATHAuth.php b/OATHAuth.php index d5c8c61..fa79c7f 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -26,6 +26,32 @@ 'descriptionmsg' = 'oathauth-desc', ); +/** + * The size of a window to which a token belongs, in seconds + * + * In OATHAuth, every number of seconds, a new token is generated. + * The number of tokens that are valid at a given time is determined + * by $wgOATHAuthWindowRange + * + * @var int + */ +$wgOAUTHAuthWindowSize = 30; + +/** + * The number of token windows in each direction that should be valid + * + * This tells OATH to accept tokens for a range of $wgOAUTHAuthWindowRadius * 2 windows + * (which is effectively ((1 + 2 * $wgOAUTHAuthWindowRadius) * $wgOATHAuthWindowSize) seconds). + * This range of valid windows is centered around the current time. + * + * The purpose of this configuration variable is to account for differences between + * the user's clock and the server's clock. However, it is recommended to keep it as + * low as possible. + * + * @var int + */ +$wgOAUTHAuthWindowRadius = 4; + $dir = __DIR__ . '/'; $wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n'; diff --git a/OATHUser.php b/OATHUser.php index 3606639..7eeeaa6 100644 --- a/OATHUser.php +++ b/OATHUser.php @@ -143,7 +143,7 @@ * @return Boolean */ public function verifyToken( $token, $reset = false ) { - global $wgMemc; + global $wgMemc, $wgOATHAuthWindowSize, $wgOAUTHAuthWindowRadius; // Prevent replay attacks $memcKey = wfMemcKey( 'oauthauth', 'usedtokens', $reset ? 'reset' : null, $token ); @@ -153,7 +153,9 @@ $retval = false; $secret = $reset ? $this-secretReset : $this-secret; - $results = HOTP::generateByTimeWindow( Base32::decode( $secret ), 30, -4, 4 ); + $results = HOTP::generateByTimeWindow( + Base32::decode( $secret ), + $wgOATHAuthWindowSize, -$wgOAUTHAuthWindowRadius, $wgOAUTHAuthWindowRadius ); // Check to see if the user's given token is in the list of tokens generated // for the time window. foreach ( $results as $result ) { @@ -176,7 +178,7 @@ } if ( $retval ) { - $wgMemc-set( $memcKey, true, 30 * 8 ); + $wgMemc-set( $memcKey, true, $wgOATHAuthWindowSize * (1 + 2 * $wgOAUTHAuthWindowRadius) ); } return $retval; -- To view, visit https://gerrit.wikimedia.org/r/132784 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7fe1bfdfa1e7bfc07646a9704084977e17c65313 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Forgot autoload for hooks class - change (mediawiki...OATHAuth)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/132796 Change subject: Forgot autoload for hooks class .. Forgot autoload for hooks class Minor fix Change-Id: I0193877f1c691d4fbe7afd4440ab462e5667268b --- M OATHAuth.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/96/132796/1 diff --git a/OATHAuth.php b/OATHAuth.php index d5c8c61..fbb9738 100644 --- a/OATHAuth.php +++ b/OATHAuth.php @@ -31,6 +31,7 @@ $wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['OATHAuth'] = $dir . 'OATHAuth.i18n.php'; $wgExtensionMessagesFiles['OATHAuthAlias'] = $dir . 'OATHAuth.alias.php'; +$wgAutoloadClasses['OATHAuthHooks] = $dir . 'OATHAuth.hooks.php'; $wgAutoloadClasses['HOTP'] = $dir . 'lib/hotp.php'; $wgAutoloadClasses['HOTPResult'] = $dir . 'lib/hotp.php'; $wgAutoloadClasses['Base32'] = $dir . 'lib/base32.php'; -- To view, visit https://gerrit.wikimedia.org/r/132796 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0193877f1c691d4fbe7afd4440ab462e5667268b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Set ThrottledError's response code to 429 - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: Set ThrottledError's response code to 429 .. Set ThrottledError's response code to 429 ThrottledError currently returns a 503, which in turn results into badly-written spambots occasionally flooding our 5xx logs and graphs. There is no reason, however, for ThrottledError to return a 5xx in the first place: it's a user-generated error (user hitting a rate limit and being throttled), not a server error. 5xx error codes in general have many other implications, such as frontend caches treating this as a backend failure and potentially retrying the same request, so they are unsuitable and undesirable for the ThrottledError exception. RFC 6585 (April 2012, updates: 2616) has added a special 4xx code specifically for rate-limiting, 429 Too Many Requests. As the description of that code matches exactly what ThrottledError was meant for, switch it to using 429 instead. Note that there is a chance 429 might be mistreated and not showed by older or badly-written user agents as it's fairly new and not part of RFC 2616, the original HTTP/1.1 spec. However, the last paragraph of section 6.1.1 of RFC 2616, specifically covers the issue of UAs unknown status codes: it dictates that applications MUST understand the class of any status code and treat them as the x00 status code of that class (here: 400), MUST NOT be cached, and SHOULD present to the user the entity returned with the response, since that entity is likely to include human-readable information which will explain the unusual status. Change-Id: I46335a76096ec800ee8ce5471bacffd41d2dc4f6 --- M includes/exception/ThrottledError.php M tests/phpunit/includes/exception/ThrottledErrorTest.php 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/includes/exception/ThrottledError.php b/includes/exception/ThrottledError.php index ce5d52e..bec0d90 100644 --- a/includes/exception/ThrottledError.php +++ b/includes/exception/ThrottledError.php @@ -34,7 +34,7 @@ public function report() { global $wgOut; - $wgOut-setStatusCode( 503 ); + $wgOut-setStatusCode( 429 ); parent::report(); } } diff --git a/tests/phpunit/includes/exception/ThrottledErrorTest.php b/tests/phpunit/includes/exception/ThrottledErrorTest.php index 8995a0d..bdb143f 100644 --- a/tests/phpunit/includes/exception/ThrottledErrorTest.php +++ b/tests/phpunit/includes/exception/ThrottledErrorTest.php @@ -37,7 +37,7 @@ -getMock(); $mock-expects( $this-once() ) -method( 'setStatusCode' ) - -with( 503 ); + -with( 429 ); return $mock; } -- To view, visit https://gerrit.wikimedia.org/r/120765 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I46335a76096ec800ee8ce5471bacffd41d2dc4f6 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Faidon Liambotis fai...@wikimedia.org Gerrit-Reviewer: Faidon Liambotis fai...@wikimedia.org Gerrit-Reviewer: Nemo bis federicol...@tiscali.it Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: PleaseStand pleasest...@live.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Allow to optionally set language in Message constructor - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: Allow to optionally set language in Message constructor .. Allow to optionally set language in Message constructor This helps with testability to not have to rely on $wgLang and setting globals in tests. This also provides convenience, so one does not necessarily need to call Message::inLanguage() if language is known at time of constructing the message object. Also added tests to cover this change. Change-Id: I14ee98972c7be954e04398ece9e6103f96ab60dd --- M includes/Message.php M tests/phpunit/includes/MessageTest.php 2 files changed, 39 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved Daniel Kinzler: Looks good to me, but someone else must approve diff --git a/includes/Message.php b/includes/Message.php index 7c9b095..9ffd9aa 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -223,12 +223,14 @@ * @param string|string[] $key Message key or array of message keys to try and use the first * non-empty message for. * @param array $params Message parameters. +* @param Language $language Optional language of the message, defaults to $wgLang. */ - public function __construct( $key, $params = array() ) { + public function __construct( $key, $params = array(), Language $language = null ) { global $wgLang; + $this-key = $key; $this-parameters = array_values( $params ); - $this-language = $wgLang; + $this-language = $language ? $language : $wgLang; } /** diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php index 930a7f6..914f235 100644 --- a/tests/phpunit/includes/MessageTest.php +++ b/tests/phpunit/includes/MessageTest.php @@ -1,6 +1,7 @@ ?php class MessageTest extends MediaWikiLangTestCase { + protected function setUp() { parent::setUp(); @@ -10,6 +11,40 @@ ) ); } + /** +* @covers Message::__construct +* @dataProvider provideConstructor +*/ + public function testConstructor( $expectedLang, $key, $params, $language ) { + $reflection = new ReflectionClass( 'Message' ); + + $keyProperty = $reflection-getProperty( 'key' ); + $keyProperty-setAccessible( true ); + + $paramsProperty = $reflection-getProperty( 'parameters' ); + $paramsProperty-setAccessible( true ); + + $langProperty = $reflection-getProperty( 'language' ); + $langProperty-setAccessible( true ); + + $message = new Message( $key, $params, $language ); + + $this-assertEquals( $key, $keyProperty-getValue( $message ) ); + $this-assertEquals( $params, $paramsProperty-getValue( $message ) ); + $this-assertEquals( $expectedLang, $langProperty-getValue( $message ) ); + } + + public function provideConstructor() { + $langDe = Language::factory( 'de' ); + $langEn = Language::factory( 'en' ); + + return array( + array( $langDe, 'foo', array(), $langDe ), + array( $langDe, 'foo', array( 'bar' ), $langDe ), + array( $langEn, 'foo', array( 'bar' ), null ) + ); + } + public function provideTestParams() { return array( array( array() ), -- To view, visit https://gerrit.wikimedia.org/r/121113 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I14ee98972c7be954e04398ece9e6103f96ab60dd Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Amire80 amir.ahar...@mail.huji.ac.il Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Nikerabbit niklas.laxst...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Siebrand siebr...@kitano.nl Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add getLanguage method to Message - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: Add getLanguage method to Message .. Add getLanguage method to Message This allows to more easily test code where language is set, Message::inLanguage() is called, etc. Change-Id: If8f9697480f5d084f755990fdc0f2a1e18f056bc --- M includes/Message.php M tests/phpunit/includes/MessageTest.php 2 files changed, 29 insertions(+), 0 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/includes/Message.php b/includes/Message.php index 9ffd9aa..d0ce482 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -273,6 +273,17 @@ } /** +* Returns the Language of the Message. +* +* @since 1.23 +* +* @return Language +*/ + public function getLanguage() { + return $this-language; + } + + /** * Factory function that is just wrapper for the real constructor. It is * intended to be used instead of the real constructor, because it allows * chaining method calls, while new objects don't. diff --git a/tests/phpunit/includes/MessageTest.php b/tests/phpunit/includes/MessageTest.php index 914f235..44ca3d2 100644 --- a/tests/phpunit/includes/MessageTest.php +++ b/tests/phpunit/includes/MessageTest.php @@ -59,6 +59,24 @@ ); } + public function getLanguageProvider() { + return array( + array( 'foo', array( 'bar' ), 'en' ), + array( 'foo', array( 'bar' ), 'de' ) + ); + } + + /** +* @covers Message::getLanguage +* @dataProvider getLanguageProvider +*/ + public function testGetLanguageCode( $key, $params, $languageCode ) { + $language = Language::factory( $languageCode ); + $message = new Message( $key, $params, $language ); + + $this-assertEquals( $language, $message-getLanguage() ); + } + /** * @covers Message::params * @dataProvider provideTestParams -- To view, visit https://gerrit.wikimedia.org/r/121118 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If8f9697480f5d084f755990fdc0f2a1e18f056bc Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Amire80 amir.ahar...@mail.huji.ac.il Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Nikerabbit niklas.laxst...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Siebrand siebr...@kitano.nl Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use session_id() instead of $wgSessionStarted to check for s... - change (mediawiki...SecureSessions)
Parent5446 has submitted this change and it was merged. Change subject: Use session_id() instead of $wgSessionStarted to check for session existence .. Use session_id() instead of $wgSessionStarted to check for session existence More reliable check and so that $wgSessionStarted can be removed at some point. Change-Id: Ia60e49a127183796d1d9c34ef3d57916891d72c1 --- M SecureSessions.hooks.php 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/SecureSessions.hooks.php b/SecureSessions.hooks.php index f71c0a9..444880c 100644 --- a/SecureSessions.hooks.php +++ b/SecureSessions.hooks.php @@ -56,13 +56,13 @@ * the necessary hooks for the extension. */ public static function setup() { - global $wgEnhancedSessionAuth, $wgSessionCycleId, $wgSessionStarted; + global $wgEnhancedSessionAuth, $wgSessionCycleId; $request = RequestContext::getMain()-getRequest(); // Regenerate session ID to avoid fixation, but don't trash // the old session immediately in case there are some asynchronous // requests still using it. - if ( $wgSessionCycleId $wgSessionStarted $request-getSessionData( 'wsExpiry' ) === null ) { + if ( $wgSessionCycleId session_id() != '' $request-getSessionData( 'wsExpiry' ) === null ) { // Set obsolete and expiration time. $data = $_SESSION; $request-setSessionData( 'wsObsolete', true ); -- To view, visit https://gerrit.wikimedia.org/r/121246 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia60e49a127183796d1d9c34ef3d57916891d72c1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SecureSessions Gerrit-Branch: master Gerrit-Owner: IAlex coderev...@emsenhuber.ch Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix JavaScript to be jslint compliant - change (mediawiki...Persona)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/120684 Change subject: Fix JavaScript to be jslint compliant .. Fix JavaScript to be jslint compliant Change formatting so that jslint tests can pass. Change-Id: I4d0b84ce0d2854946a29543e6ee4d2f4bc1d8fc3 --- M js/persona_hooks.js M js/persona_hooks_old.js 2 files changed, 5 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Persona refs/changes/84/120684/1 diff --git a/js/persona_hooks.js b/js/persona_hooks.js index 1272c7f..d3bdc46 100644 --- a/js/persona_hooks.js +++ b/js/persona_hooks.js @@ -25,7 +25,6 @@ } ) .done( function ( data ) { if ( data.login.status !== 'okay' ) { - console.log( 'Persona login failed.', data ); mw.notify( mw.message( 'persona-error-' + data.login.status ).text() ); navigator.id.logout(); return; @@ -33,13 +32,12 @@ var vars, url, queryPos, fragPos, hash, q, title, lowercaseTitle; - console.log( 'Persona login result:', data ); vars = []; url = document.URL; queryPos = url.indexOf( '?' ) + 1; fragPos = url.indexOf( '#', queryPos ); q = document.URL.substring( queryPos, fragPos ); - if ( queryPos fragPos q !== ){ + if ( queryPos fragPos q !== '' ){ q = q.split( '' ); for ( var i = 0; i q.length; i++ ) { hash = q[i].split( '=' ); @@ -63,7 +61,6 @@ } } ) .fail( function ( error ) { - console.log( 'Persona login failed.', error ); mw.notify( mw.message( error ).text() ); navigator.id.logout(); } ); diff --git a/js/persona_hooks_old.js b/js/persona_hooks_old.js index b0a09e2..d40b67a 100644 --- a/js/persona_hooks_old.js +++ b/js/persona_hooks_old.js @@ -33,24 +33,22 @@ }, { 'ok': function ( data ) { - if ( data.login.status !== okay ) { - console.log( 'Persona login failed.', data ); + if ( data.login.status !== 'okay' ) { mw.util.jsMessage( mw.msg( 'persona-error-' + data.login.status ) ); navigator.id.logout(); return; } - var vars, url, queryPos, fragPos, hash, q, title, lowercaseTitle; + var i, vars, url, queryPos, fragPos, hash, q, title, lowercaseTitle; - console.log( 'Persona login result:', data ); vars = []; url = document.URL; queryPos = url.indexOf( '?' ) + 1; fragPos = url.indexOf( '#', queryPos ); q = document.URL.substring( queryPos, fragPos ); - if ( queryPos fragPos q !== ){ + if ( queryPos fragPos q !== '' ){ q = q.split( '' ); - for ( var i = 0; i q.length; i++ ) { + for ( i = 0; i q.length; i++ ) { hash = q[i].split( '=' );
[MediaWiki-commits] [Gerrit] Test commit (DO NOT MERGE) - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/118423 Change subject: Test commit (DO NOT MERGE) .. Test commit (DO NOT MERGE) Change-Id: I14dd0918cfbabecec3c72405224d9346dc68344b --- M README 1 file changed, 0 insertions(+), 33 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/23/118423/1 diff --git a/README b/README index a4185ba..e69de29 100644 --- a/README +++ b/README @@ -1,33 +0,0 @@ -== MediaWiki == - -MediaWiki is a popular and free, open-source wiki software package written in -PHP. It serves as the platform for Wikipedia and the other projects of the Wikimedia -Foundation, which deliver content in over 280 languages to more than half a billion -people each month. MediaWiki's reliability and robust feature set have earned it a -large and vibrant community of third-party users and developers. - -MediaWiki is: - -* feature-rich and extensible, both on-wiki and with over 2,000 extensions; -* scalable and suitable for both small and large sites; -* available in your language; and -* simple to install, working on most hardware/software combinations. - -For system requirements, installation, and upgrade details, see the files -RELEASE-NOTES, INSTALL, and UPGRADE. - -* Ready to get started? -** https://www.mediawiki.org/wiki/Download -* Looking for the technical manual? -** https://www.mediawiki.org/wiki/Manual:Contents -* Seeking help from a person? -** https://www.mediawiki.org/wiki/Communication -* Looking to file a bug report or a feature request? -** https://bugs.mediawiki.org/ -* Interested in helping out? -** https://www.mediawiki.org/wiki/How_to_contribute - -MediaWiki is the result of global collaboration and cooperation. The CREDITS -file lists technical contributors to the project. The COPYING file explains -MediaWiki's copyright and license (GNU General Public License, version 2 or -later). Many thanks to the Wikimedia community for testing and suggestions. -- To view, visit https://gerrit.wikimedia.org/r/118423 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I14dd0918cfbabecec3c72405224d9346dc68344b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add projects for Persona and OpenBadges extensions - change (integration/zuul-config)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/115092 Change subject: Add projects for Persona and OpenBadges extensions .. Add projects for Persona and OpenBadges extensions Added template extensions for the Persona and OpenBadges extensions. Note that jslint was not set as non-voting because this is an empty project and I think our team can hold themselves to good standards with new code. Change-Id: Ie1518ba5ea44ce608e4b58b209c879b1f1b859d7 --- M layout.yaml 1 file changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/integration/zuul-config refs/changes/92/115092/1 diff --git a/layout.yaml b/layout.yaml index 3898922..b85faba 100644 --- a/layout.yaml +++ b/layout.yaml @@ -9,7 +9,7 @@ # - jobs: Override the pipeline configuration on a per job basis. #This is how we specificy behaviour for individual projects and jobs. # -# - projects: For each project we specify what jobs to run, in what order jobs +# - projects: For each project we specify what tor to run, in what order jobs #should depend on each other and for which pipelines the jobs should run. # # See also upstream documentation: @@ -2698,6 +2698,16 @@ - name: extension-unittests extname: TwoFactorAuthentication + - name: mediawiki/extensions/Persona +template: + - name: extension-unittests + extname: Persona + + - name: mediawiki/extensions/OpenBadges +template: + - name: extension-unittests + extname: OpenBadges + - name: mediawiki/extensions/UnicodeConverter template: - name: extension-checks -- To view, visit https://gerrit.wikimedia.org/r/115092 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie1518ba5ea44ce608e4b58b209c879b1f1b859d7 Gerrit-PatchSet: 1 Gerrit-Project: integration/zuul-config Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Revert Removed Justify paragraphs from MW user Preference. - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/112151 Change subject: Revert Removed Justify paragraphs from MW user Preference. .. Revert Removed Justify paragraphs from MW user Preference. Consensus seems to have determined that users actually want this user preference. This reverts commit 2f9cfa3d26fd11e4d816502df9f3e4a68b5bc4c4. Change-Id: Id86ff80350944d0db395cf63d9fdb9043242b7a1 --- M RELEASE-NOTES-1.23 M includes/DefaultSettings.php M includes/Preferences.php M includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php M languages/messages/MessagesEn.php M maintenance/language/messages.inc 6 files changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/51/112151/1 diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 6b70ce6..fdefa0b 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -193,7 +193,6 @@ * (bug 52811) Preference Enable section editing via [edit] links was removed. * (bug 52813) Preference Show table of contents (for pages with more than 3 headings) was removed. -* (bug 52810) Preference Justify paragraphs was removed. Removed classes * FakeMemCachedClient (deprecated in 1.18) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 63883ab..9264947 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3989,6 +3989,7 @@ 'hideminor' = 0, 'hidepatrolled' = 0, 'imagesize' = 2, + 'justify' = 0, 'math' = 1, 'minordefault' = 0, 'newpageshidepatrolled' = 0, diff --git a/includes/Preferences.php b/includes/Preferences.php index dbf4346..04e9114 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -761,6 +761,14 @@ 'label-message' = 'tog-showhiddencats' ); + if ( $wgAllowUserCssPrefs ) { + $defaultPreferences['justify'] = array( + 'type' = 'toggle', + 'section' = 'rendering/advancedrendering', + 'label-message' = 'tog-justify', + ); + } + $defaultPreferences['numberheadings'] = array( 'type' = 'toggle', 'section' = 'rendering/advancedrendering', diff --git a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php index 8ce0ca7..424afce 100644 --- a/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php +++ b/includes/resourceloader/ResourceLoaderUserCSSPrefsModule.php @@ -74,6 +74,9 @@ $rules[] = 'a:lang(ar), a:lang(kk-arab), a:lang(mzn), ' . 'a:lang(ps), a:lang(ur) { text-decoration: none; }'; } + if ( $options['justify'] ) { + $rules[] = #article, #bodyContent, #mw_content { text-align: justify; }\n; + } if ( $options['editfont'] !== 'default' ) { // Double-check that $options['editfont'] consists of safe characters only if ( preg_match( '/^[a-zA-Z0-9_, -]+$/', $options['editfont'] ) ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index ca1e2b2..21f73cc 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -658,6 +658,7 @@ # User preference toggles 'tog-underline' = 'Link underlining:', +'tog-justify' = 'Justify paragraphs', 'tog-hideminor' = 'Hide minor edits in recent changes', 'tog-hidepatrolled' = 'Hide patrolled edits in recent changes', 'tog-newpageshidepatrolled' = 'Hide patrolled pages from new page list', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 8fbb778..ea45ee6 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -28,6 +28,7 @@ ), 'toggles' = array( 'tog-underline', + 'tog-justify', 'tog-hideminor', 'tog-hidepatrolled', 'tog-newpageshidepatrolled', -- To view, visit https://gerrit.wikimedia.org/r/112151 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id86ff80350944d0db395cf63d9fdb9043242b7a1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added more filter options to $wgRCFeeds - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/111736 Change subject: Added more filter options to $wgRCFeeds .. Added more filter options to $wgRCFeeds Changed RecentChange::notifyRCFeeds() to allow more filter options than just omit_bots. In order to mirror the on-wiki Special:RecentChanges UI, the options omit_anon, omit_user, omit_minor, omit_patrolled were added, which omits anonymous, registered, minor, and patrolled edits, respectively. Bug: 60941 Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c --- M includes/DefaultSettings.php M includes/changes/RecentChange.php 2 files changed, 18 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/36/111736/1 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d0ceafc..70862a4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5577,6 +5577,10 @@ * * 'formatter' -- the class name (implementing RCFeedFormatter) which will * produce the text to send. * * 'omit_bots' -- whether the bot edits should be in the feed + * * 'omit_anon' -- whether anonymous edits should be in the feed + * * 'omit_user' -- whether edits by registered users should be in the feed + * * 'omit_minor' -- whether minor edits should be in the feed + * * 'omit_patrolled' -- whether patrolled edits should be in the feed * The IRC-specific options are: * * 'add_interwiki_prefix' -- whether the titles should be prefixed with * $wgLocalInterwiki. diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 01ad724..bb23ec9 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -333,11 +333,23 @@ public function notifyRCFeeds() { global $wgRCFeeds; + $performer = $this-getPerformer(); + foreach ( $wgRCFeeds as $feed ) { - $omitBots = isset( $feed['omit_bots'] ) ? $feed['omit_bots'] : false; + $feed += array( + 'omit_bots' = false, + 'omit_anon' = false, + 'omit_user' = false, + 'omit_minor' = false, + 'omit_patrolled' = false, + ); if ( - ( $omitBots $this-mAttribs['rc_bot'] ) || + ( $feed['omit_bots'] $this-mAttribs['rc_bot'] ) || + ( $feed['omit_anon'] $performer-isAnon() ) || + ( $feed['omit_user'] !$performer-isAnon() ) || + ( $feed['omit_minor'] $this-mAttribs['rc_minor'] ) || + ( $feed['omit_patrolled'] $this-mAttribs['rc_patrolled'] ) || $this-mAttribs['rc_type'] == RC_EXTERNAL ) { continue; -- To view, visit https://gerrit.wikimedia.org/r/111736 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Code, style, and doc fixes for benchmarkParse.php - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/111400 Change subject: Code, style, and doc fixes for benchmarkParse.php .. Code, style, and doc fixes for benchmarkParse.php Fixes database query semantics, various documentation issues, and unused variables. Change-Id: Ic2c2d4d3912a9cd6703f7690f9d08df8ea08cd5c Follows-up: I3bf3366a5ff58942 (dfd481e113f2cf5aaa) --- M maintenance/benchmarks/benchmarkParse.php 1 file changed, 57 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/00/111400/1 diff --git a/maintenance/benchmarks/benchmarkParse.php b/maintenance/benchmarks/benchmarkParse.php index 79af911..158d9b6 100644 --- a/maintenance/benchmarks/benchmarkParse.php +++ b/maintenance/benchmarks/benchmarkParse.php @@ -1,11 +1,40 @@ ?php +/** + * Benchmark script for parse operations + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + * @author Tim Starling tstarl...@wikimedia.org + * @ingroup Benchmark + */ require __DIR__ . '/../Maintenance.php'; +/** + * Maintenance script to benchmark how long it takes to parse a given title at an optionally + * specified timestamp + * + * @since 1.23 + */ class BenchmarkParse extends Maintenance { /** @var string MediaWiki concatenated string timestamp (MMDDHHMMSS) */ - private $templateTimestamp; + private $templateTimestamp = null; + /** @var array Cache that maps a Title DB key to revision ID for the requested timestamp */ private $idCache = array(); function __construct() { @@ -17,22 +46,23 @@ 'Use the version of the page which was current at the given time', false, true ); $this-addOption( 'tpl-time', - 'Use templates which were current at the given time (except that moves and deletes are not handled properly)', + 'Use templates which were current at the given time (except that moves and ' . + 'deletes are not handled properly)', false, true ); } function execute() { - global $wgParser; - if ( $this-hasOption( 'tpl-time' ) ) { $this-templateTimestamp = wfTimestamp( TS_MW, strtotime( $this-getOption( 'tpl-time' ) ) ); Hooks::register( 'BeforeParserFetchTemplateAndtitle', array( $this, 'onFetchTemplate' ) ); } + $title = Title::newFromText( $this-getArg() ); if ( !$title ) { $this-error( Invalid title ); exit( 1 ); } + if ( $this-hasOption( 'page-time' ) ) { $pageTimestamp = wfTimestamp( TS_MW, strtotime( $this-getOption( 'page-time' ) ) ); $id = $this-getRevIdForTime( $title, $pageTimestamp ); @@ -45,13 +75,16 @@ } else { $revision = Revision::newFromTitle( $title ); } + if ( !$revision ) { $this-error( Unable to load revision, incorrect title? ); exit( 1 ); } + if ( !$this-hasOption( 'cold' ) ) { $this-runParser( $revision ); } + $startUsage = getrusage(); $startTime = microtime( true ); $this-runParser( $revision ); @@ -59,49 +92,60 @@ $endTime = microtime( true ); printf( CPU time = %.3f s, wall clock time = %.3f s\n, + // CPU time $endUsage['ru_utime.tv_sec'] + $endUsage['ru_utime.tv_usec'] * 1e-6 - - $startUsage['ru_utime.tv_sec'] - $startUsage['ru_utime.tv_usec'] * 1e-6, + - $startUsage['ru_utime.tv_sec'] - $startUsage['ru_utime.tv_usec'] * 1e-6, + // Wall clock time $endTime - $startTime ); } /** +* Fetch the ID of the revision of a Title that
[MediaWiki-commits] [Gerrit] Code style fixes to ApiBase::requireAtLeastOneParameter - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/109321 Change subject: Code style fixes to ApiBase::requireAtLeastOneParameter .. Code style fixes to ApiBase::requireAtLeastOneParameter Fixes to patch that introduced ApiBase::requireAtLeastOneParameter. Includes line breaks, code formatting, and documentation fixes. Change-Id: I1a2faebf7cc9a2126def66d8a4ce64dbfa84059b Follows-Up: Iae6649ed503fdbf14 (5e7a9c6f8e66de344e) --- M includes/api/ApiBase.php 1 file changed, 16 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/21/109321/1 diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index c1a4cd3..e610d19 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -803,25 +803,32 @@ /** * Die if none of a certain set of parameters is set and not false. -* @param array $params of parameter names +* +* @since 1.23 +* @param array $params User provided set of parameters +* @param string ... List of parameter names to check */ public function requireAtLeastOneParameter( $params ) { $required = func_get_args(); array_shift( $required ); $p = $this-getModulePrefix(); - $intersection = array_intersect( array_keys( array_filter( $params, - array( $this, parameterNotEmpty ) ) ), $required ); + $intersection = array_intersect( + array_keys( array_filter( $params, array( $this, parameterNotEmpty ) ) ), + $required + ); if ( count( $intersection ) == 0 ) { - $this-dieUsage( At least one of the parameters {$p} . implode( , {$p}, $required ) . ' is required', {$p}missingparam ); + $this-dieUsage( At least one of the parameters {$p} . + implode( , {$p}, $required ) . ' is required', {$p}missingparam ); } } /** * Generates the possible errors requireAtLeastOneParameter() can die with * -* @param $params array +* @since 1.23 +* @param $params array Array of parameter key names * @return array */ public function getRequireAtLeastOneParameterErrorMessages( $params ) { @@ -829,7 +836,10 @@ $params = implode( , {$p}, $params ); return array( - array( 'code' = {$p}missingparam, 'info' = At least one of the parameters {$p}{$params} is required ), + array( + 'code' = {$p}missingparam, + 'info' = At least one of the parameters {$p}{$params} is required, + ), ); } -- To view, visit https://gerrit.wikimedia.org/r/109321 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a2faebf7cc9a2126def66d8a4ce64dbfa84059b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed filtering for target field on Special:ThrottleOverride - change (mediawiki...ThrottleOverride)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/109442 Change subject: Fixed filtering for target field on Special:ThrottleOverride .. Fixed filtering for target field on Special:ThrottleOverride Unfortunately, HTMLForm's filtering feature is pretty terrible and does not work as expected. This patch removes filtering on the target field in Special:ThrottleOverride and does the filtering manually in the onSubmit() function. This also simultaneously adds a variable and check to make sure range exemptions are not too large. Bug: 60409 Change-Id: I9f2d4a5830ddcf69fecac87900412fb55b21ee7b --- M SpecialOverrideThrottle.php M ThrottleOverride.php 2 files changed, 75 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ThrottleOverride refs/changes/42/109442/1 diff --git a/SpecialOverrideThrottle.php b/SpecialOverrideThrottle.php index f9440af..2232a93 100644 --- a/SpecialOverrideThrottle.php +++ b/SpecialOverrideThrottle.php @@ -56,7 +56,6 @@ 'type' = 'text', 'label-message' = 'throttleoverride-ipaddress', 'required' = true, - 'filter-callback' = 'IP::parseRange', 'validation-callback' = __CLASS__ . '::validateTargetField' ), 'Expiry' = array( @@ -82,6 +81,8 @@ } function onSubmit( array $data ) { + $data['Target'] = IP::parseRange( $data['Target'] ); + return wfGetDB( DB_MASTER )-insert( 'throttle_override', array( @@ -100,13 +101,69 @@ } /** -* @param $value -* @param array $allData +* @param $target +* @param $allData * @param HTMLForm $form -* @return bool +* +* @return bool|mixed */ - public static function validateTargetField( $value, array $allData, HTMLForm $form ) { - return $value !== array( false, false ); + public static function validateTargetField( $target, $allData, HTMLForm $form ) { + $status = self::validateTarget( $target ); + + if ( !$status-isOK() ) { + $errors = $status-getErrorsArray(); + + return call_user_func_array( array( $form, 'msg' ), $errors[0] ); + } else { + return true; + } + } + + /** +* @param $target +* +* @return Status +*/ + public static function validateTarget( $target ) { + global $wgThrottleOverrideCIDRLimit; + + $status = Status::newGood(); + $target = IP::parseRange( trim( $target ) ); + + if ( $target === array( false, false ) ) { + $status-fatal( 'badipaddress' ); + } else { + # Can't create a User from an IP range + $target = IP::sanitizeRange( $target ); + + list( $ip, $range ) = explode( '/', $target, 2 ); + + if ( + ( IP::isIPv4( $ip ) $wgThrottleOverrideCIDRLimit['IPv4'] == 32 ) || + ( IP::isIPv6( $ip ) $wgThrottleOverrideCIDRLimit['IPv6'] == 128 ) + ) { + // Range block effectively disabled + $status-fatal( 'range_block_disabled' ); + } + + if ( + ( IP::isIPv4( $ip ) $range 32 ) || + ( IP::isIPv6( $ip ) $range 128 ) + ) { + // Dodgy range + $status-fatal( 'ip_range_invalid' ); + } + + if ( IP::isIPv4( $ip ) $range $wgThrottleOverrideCIDRLimit['IPv4'] ) { + $status-fatal( 'ip_range_toolarge', $wgThrottleOverrideCIDRLimit['IPv4'] ); + } + + if ( IP::isIPv6( $ip ) $range $wgThrottleOverrideCIDRLimit['IPv6'] ) { + $status-fatal( 'ip_range_toolarge', $wgThrottleOverrideCIDRLimit['IPv6'] ); + } + } + + return $status; } /** @@ -118,4 +175,5 @@ public static function validateExpiryField( $value, array $allDatam, HTMLForm $form ) { return (bool)$value; } + } diff --git a/ThrottleOverride.php b/ThrottleOverride.php index 5bf25af..1d463d7 100644 --- a/ThrottleOverride.php +++ b/ThrottleOverride.php @@ -28,6 +28,17 @@ 'version' = 0.5, ); +/** + * Limits to be sit
[MediaWiki-commits] [Gerrit] Changed permission needed for throttle override - change (mediawiki...ThrottleOverride)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/109443 Change subject: Changed permission needed for throttle override .. Changed permission needed for throttle override Moved permission for throttle override to a new throttleoverride permission, rather than re-using the noratelimit permission. Bug: 25000 Change-Id: I03680dee7db2c10eb8c5aad2eb2cf5a515db275b --- M SpecialOverrideThrottle.php M ThrottleOverride.i18n.php M ThrottleOverride.php 3 files changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ThrottleOverride refs/changes/43/109443/1 diff --git a/SpecialOverrideThrottle.php b/SpecialOverrideThrottle.php index 2232a93..794a107 100644 --- a/SpecialOverrideThrottle.php +++ b/SpecialOverrideThrottle.php @@ -20,7 +20,7 @@ class SpecialOverrideThrottle extends FormSpecialPage { function __construct() { - parent::__construct( 'OverrideThrottle', 'noratelimit' ); + parent::__construct( 'OverrideThrottle', 'throttleoverride' ); } function getMessagePrefix() { diff --git a/ThrottleOverride.i18n.php b/ThrottleOverride.i18n.php index 6b007b9..06a3307 100644 --- a/ThrottleOverride.i18n.php +++ b/ThrottleOverride.i18n.php @@ -39,6 +39,7 @@ 'throttleoverride-list-reason' = 'Reason', 'throttleoverride-list-search' = 'Search', 'throttleoverride-list-noresults' = 'The throttle override list is empty.', + 'action-throttleoverride' = 'override rate limits', ); /** Message documentation (Message documentation) @@ -74,6 +75,7 @@ 'throttleoverride-list-search' = 'Label for the sumbit button on [[Special:ThrottleOverrideList]]. {{Identical|Search}}', 'throttleoverride-list-noresults' = 'Message displayed on [[Special:ThrottleOverrideList]] when the pager returns no results', + 'action-throttleoverride' = 'Explains what throttleoverride permission does; displayed when user gets a permission denied error', ); /** Breton (brezhoneg) diff --git a/ThrottleOverride.php b/ThrottleOverride.php index 1d463d7..80d9c8b 100644 --- a/ThrottleOverride.php +++ b/ThrottleOverride.php @@ -49,6 +49,8 @@ $wgSpecialPages['ThrottleOverrideList'] = 'SpecialThrottleOverrideList'; $wgSpecialPageGroups['OverrideThrottle'] = 'users'; +$wgAvailableRights[] = 'throttleoverride'; + Hooks::register( 'PingLimiter', 'ThrottleOverrideHooks::onPingLimiter' ); Hooks::register( 'ExemptFromAccountCreationThrottle', 'ThrottleOverrideHooks::onExemptFromAccountCreationThrottle' ); Hooks::register( 'LoadExtensionSchemaUpdates', 'ThrottleOverrideHooks::onLoadExtensionSchemaUpdates' ); -- To view, visit https://gerrit.wikimedia.org/r/109443 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I03680dee7db2c10eb8c5aad2eb2cf5a515db275b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ThrottleOverride Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Cleanup to ThrottleOverrideHooks::onPingLimiter - change (mediawiki...ThrottleOverride)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/109444 Change subject: Cleanup to ThrottleOverrideHooks::onPingLimiter .. Cleanup to ThrottleOverrideHooks::onPingLimiter * Replaced assert() with an exception * Removed excess makeList() call * Made use of supplied User object to get IP address Bug: 25000 Change-Id: I7545444e0cf71802ae41312e6ff1453020349270 --- M ThrottleOverride.hooks.php 1 file changed, 20 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ThrottleOverride refs/changes/44/109444/1 diff --git a/ThrottleOverride.hooks.php b/ThrottleOverride.hooks.php index 17f0ce3..1e850da 100644 --- a/ThrottleOverride.hooks.php +++ b/ThrottleOverride.hooks.php @@ -30,35 +30,40 @@ } /** +* @throws InvalidArgumentException If $action is invalid +* * @param User $user * @param string $action * @param $result * @param null|string $ip +* * @return bool */ public static function onPingLimiter( User $user, $action, $result, $ip = null ) { global $wgRateLimits; - assert( $action == 'actcreate' || isset( $wgRateLimits[$action] ) ); + + if ( $action !== 'actcreate' !isset( $wgRateLimits[$action] ) ) { + throw new InvalidArgumentException( 'Invalid action passed to ' . __METHOD__ ); + } $dbr = wfGetDB( DB_SLAVE ); - if( $ip === null ) { + if ( $user-isAnon() IP::isValid( $user-getName() ) ) { + $ip = $user-getName(); + } elseif ( $ip === null ) { $ip = RequestContext::getMain()-getRequest()-getIP(); } + $quotedIp = $dbr-addQuotes( IP::toHex( $ip ) ); - $cond = $dbr-makeList( + + $expiry = $dbr-selectField( + 'throttle_override', + 'thr_expiry', array( thr_range_start = $quotedIp, thr_range_end = $quotedIp, 'thr_type' . $dbr-buildLike( $dbr-anyString(), $action, $dbr-anyString() ) ), - LIST_AND - ); - - $expiry = $dbr-selectField( - 'throttle_override', - 'thr_expiry', - $cond, __METHOD__, array( 'ORDER BY' = 'thr_expiry DESC' ) ); @@ -71,7 +76,11 @@ // Expired exemption. Delete it from the DB. wfGetDB( DB_MASTER )-delete( 'throttle_override', - $cond, + array( + thr_range_start = $quotedIp, + thr_range_end = $quotedIp, + 'thr_type' . $dbr-buildLike( $dbr-anyString(), $action, $dbr-anyString() ) + ), __METHOD__ ); } -- To view, visit https://gerrit.wikimedia.org/r/109444 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7545444e0cf71802ae41312e6ff1453020349270 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ThrottleOverride Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace deprecated wfGenerateToken (1.20) - change (mediawiki...ArticleCreationWorkflow)
Parent5446 has submitted this change and it was merged. Change subject: Replace deprecated wfGenerateToken (1.20) .. Replace deprecated wfGenerateToken (1.20) Change-Id: I49af49630e0175124085b632481420b995f1ed96 --- M includes/ArticleCreationUtil.php 1 file changed, 8 insertions(+), 8 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/includes/ArticleCreationUtil.php b/includes/ArticleCreationUtil.php index 7260d6e..f547cef 100644 --- a/includes/ArticleCreationUtil.php +++ b/includes/ArticleCreationUtil.php @@ -8,7 +8,7 @@ /** * Is ArticleCreation enabled for the current user? * -* +* * @return bool whether or not it is. */ public static function isEnabled() { @@ -44,14 +44,14 @@ global $wgExtensionCredits; return 'ext.articleCreationWorkflow@' . $wgExtensionCredits['other'][0]['version'] . '-'; } - + /** * Generate a tracking code bucket for this campaign * @return string */ public static function trackingBucket() { global $wgRequest, $wgUser; - + if ( $wgUser-isAnon() ) { return 'anon'; } else { @@ -62,15 +62,15 @@ } } } - + /** * Valid tracking bucket * @return array */ public static function getValidTrackingBucket() { - return array( 'anon', 'new', 'reg' ); + return array( 'anon', 'new', 'reg' ); } - + /** * Valid tracking source * @return array @@ -85,7 +85,7 @@ * @param $par string - the title for the non-existing article */ public static function TrackSpecialLandingPage( $par ) { - + $event = self::trackingBucket() . '-impression'; self::clickTracking( $event, Title::newFromText( $par ) ); @@ -108,7 +108,7 @@ $token = $wgRequest-getCookie( 'clicktracking-session', '' ); if ( !$token ) { - $token = wfGenerateToken(); + $token = MWCryptRand::generateHex( 32, true ); } $revId = $title-getLatestRevID(); -- To view, visit https://gerrit.wikimedia.org/r/106917 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I49af49630e0175124085b632481420b995f1ed96 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ArticleCreationWorkflow Gerrit-Branch: master Gerrit-Owner: Siebrand siebr...@wikimedia.org Gerrit-Reviewer: Chad ch...@wikimedia.org Gerrit-Reviewer: IAlex coderev...@emsenhuber.ch Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Reedy re...@wikimedia.org Gerrit-Reviewer: Siebrand siebr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace deprecated SpecialPage::resolveAlias() - change (mediawiki...ShoutWikiAds)
Parent5446 has submitted this change and it was merged. Change subject: Replace deprecated SpecialPage::resolveAlias() .. Replace deprecated SpecialPage::resolveAlias() Change-Id: Iafea45ac086acc4b570c62768ea303d574bcb015 --- M ShoutWikiAds.class.php 1 file changed, 10 insertions(+), 9 deletions(-) Approvals: Legoktm: Looks good to me, but someone else must approve Parent5446: Verified; Looks good to me, approved diff --git a/ShoutWikiAds.class.php b/ShoutWikiAds.class.php index 1c6986d..061124b 100644 --- a/ShoutWikiAds.class.php +++ b/ShoutWikiAds.class.php @@ -20,10 +20,9 @@ /** * Can we show ads on the current page? * -* @return Boolean: false if ads aren't enabled or the current page is -* Special:UserLogin (login page) or if the user is -* autoconfirmed and the forceads parameter is NOT in the -* URL, otherwise true +* @return bool False if ads aren't enabled or the current page is +* Special:UserLogin (login page) or if the user is autoconfirmed and the +* forceads parameter is NOT in the URL, otherwise true. */ public static function canShowAds() { global $wgAdConfig, $wgTitle, $wgUser, $wgRequest; @@ -32,8 +31,9 @@ return false; } + list( $alias, /*..*/ ) = SpecialPageFactory::resolveAlias( $wgTitle-getDBkey() ); if( $wgTitle instanceof Title - SpecialPage::resolveAlias( $wgTitle-getDBkey() ) == 'Userlogin' || + $alias === 'Userlogin' || in_array( 'staff', $wgUser-getEffectiveGroups() ) !$wgRequest-getVal( 'forceads' ) ) { @@ -413,9 +413,9 @@ * This just adds the relevant ad CSS file under certain conditions. * The actual logic is elsewhere. * -* @param $out Object: OutputPage instance -* @param $sk Object: instance of Skin or one of its child classes -* @return Boolean: true +* @param OutputPage $out +* @param Skin $sk +* @return bool */ public static function setupAdCSS( $out, $sk ) { global $wgAdConfig, $wgRequest, $wgUser; @@ -436,8 +436,9 @@ $namespace = $title-getNamespace(); // Okay, the variable name sucks but anyway...normal page != not login page + list( $alias, /*..*/ ) = SpecialPageFactory::resolveAlias( $title-getDBkey() ); $isNormalPage = $title instanceof Title - SpecialPage::resolveAlias( $title-getDBkey() ) !== 'Userlogin'; + $alias !== 'Userlogin'; // Load ad CSS file when ads are enabled if( -- To view, visit https://gerrit.wikimedia.org/r/104380 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iafea45ac086acc4b570c62768ea303d574bcb015 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ShoutWikiAds Gerrit-Branch: master Gerrit-Owner: Siebrand siebr...@wikimedia.org Gerrit-Reviewer: IAlex coderev...@emsenhuber.ch Gerrit-Reviewer: Jack Phoenix j...@countervandalism.net Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Lewis Cawte le...@lewiscawte.me Gerrit-Reviewer: NormalUser c...@anyonecanedit.org Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Reedy re...@wikimedia.org Gerrit-Reviewer: Siebrand siebr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Call Linker methods statically - change (mediawiki...SolrStore)
Parent5446 has submitted this change and it was merged. Change subject: Call Linker methods statically .. Call Linker methods statically Change-Id: I7796ed1a285bfe50b6701bf1d2738c40fb01ff6f --- M SpecialSolrSearch.php 1 file changed, 12 insertions(+), 21 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/SpecialSolrSearch.php b/SpecialSolrSearch.php index 220e670..f98068d 100644 --- a/SpecialSolrSearch.php +++ b/SpecialSolrSearch.php @@ -2,14 +2,13 @@ /** * SolrStore: The SolrStore Extesion is Semantic Mediawiki Searchprovieder based on Apache Solr. - * + * * This is the SpecialPage, displaying the SearchSets and Results - * + * * @defgroup SolrStore * @author Simon Bachenberg, Sascha Schueller */ class SpecialSolrSearch extends SpecialPage { - /** * Set up basic search parameters from the request and user settings. * Typically you'll pass $wgRequest and $wgUser. @@ -19,12 +18,10 @@ */ public function __construct() { parent::__construct( SolrSearch ); - global $wgRequest, $wgUser; - $user = $wgUser; + global $wgRequest; $request = $wgRequest; list( $this-limit, $this-offset ) = $request-getLimitOffset( 20, 'searchlimit' ); - $this-sk = $user-getSkin(); $this-didYouMeanHtml = ''; # html of did you mean... link } @@ -79,9 +76,6 @@ global $wgOut, $wgUser, $wgScript, $wgSolrFields; wfProfileIn( __METHOD__ ); - //$sk = $wgUser-getSkin (); - - $wgOut-setPageTitle( wfMsg( 'solrstore-searchFieldSets-title' ) ); $wgOut-setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'solrstore-searchFieldSets-title', 'SolrSearch: Select FieldSet' ) ) ); @@ -105,10 +99,8 @@ * @param $fieldSet String */ public function showResults( $fieldSet ) { - global $wgOut, $wgUser, $wgContLang, $wgScript, $wgSolrShowRelated, $wgSolrDebug; + global $wgOut, $wgContLang, $wgScript, $wgSolrShowRelated, $wgSolrDebug; wfProfileIn( __METHOD__ ); - - $sk = $wgUser-getSkin(); $this-searchEngine = SearchEngine::create(); $search = $this-searchEngine; @@ -166,7 +158,7 @@ if ( $suggestionSnippet == '' ) $suggestionSnippet = null; - $suggestLink = $sk-linkKnown( + $suggestLink = Linker::linkKnown( $st, $suggestionSnippet, array( ), $stParams ); @@ -369,7 +361,7 @@ * @param $fieldSets Array: terms to highlight */ protected function showHit( $result, $fieldSets ) { - global $wgLang, $wgUser; + global $wgLang; wfProfileIn( __METHOD__ ); if ( $result-isBrokenTitle() ) { @@ -377,7 +369,6 @@ return !-- Broken link in search result --\n; } - $sk = $wgUser-getSkin(); $t = $result-getTitle(); $titleSnippet = $result-getTitleSnippet( $fieldSets ); @@ -389,7 +380,7 @@ wfRunHooks( 'ShowSearchHitTitle', array( $link_t, $titleSnippet, $result, $fieldSets, $this ) ); - $link = $this-sk-linkKnown( + $link = Linker::linkKnown( $link_t, $titleSnippet ); // FÜLLEN @@ -423,7 +414,7 @@ $redirectText = null; $redirect = span class='searchalttitle' . - wfMsg( 'search-redirect', $this-sk-linkKnown( $redirectTitle, $redirectText ) ) . + wfMsg( 'search-redirect', Linker::linkKnown( $redirectTitle, $redirectText ) ) . /span; } @@ -435,7 +426,7 @@ $sectionText = null; $section = span class='searchalttitle' . - wfMsg( 'search-section', $this-sk-linkKnown( $sectionTitle, $sectionText ) ) . + wfMsg( 'search-section', Linker::linkKnown( $sectionTitle, $sectionText ) ) . /span; } @@ -455,7 +446,7 @@ $byteSize = $result-getByteSize(); $wordCount = $result-getWordCount(); $timestamp = $result-getTimestamp(); - $size = wfMsgExt( 'search-result-size', array( 'parsemag', 'escape' ), $this-sk-formatSize( $byteSize ), $wgLang-formatNum( $wordCount ) ); +
[MediaWiki-commits] [Gerrit] Maintenance script to migrate legacy Oversight data - change (mediawiki...Oversight)
Parent5446 has submitted this change and it was merged. Change subject: Maintenance script to migrate legacy Oversight data .. Maintenance script to migrate legacy Oversight data New maintenance script to convert Oversight revisions to suppressed revisions. Bug: 18598 Change-Id: I3ede67651e98bfc8c79e9263ed7526b5985d3601 --- A migrateToRevDel.php 1 file changed, 209 insertions(+), 0 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/migrateToRevDel.php b/migrateToRevDel.php new file mode 100644 index 000..ed81857 --- /dev/null +++ b/migrateToRevDel.php @@ -0,0 +1,209 @@ +?php +/** + * Migrate revisions hidden with the Oversight extension to revdel. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + * @ingroup Maintenance + */ + +// Detect $IP +$IP = getenv( 'MW_INSTALL_PATH' ); +if ( $IP === false ) { +$IP = __DIR__ . '/../..'; +} + +// Require base maintenance class +require_once( $IP/maintenance/Maintenance.php ); + +/** + * Migrate revisions hidden with the Oversight extension to revdel. + * + * @ingroup Maintenance + */ +class MigrateOversightRevisions extends Maintenance { + public function __construct() { + parent::__construct(); + $this-setBatchSize( 20 ); + $this-mDescription = Migrate revisions hidden with the Oversight extension to revdel.; + } + + public function execute() { + $this-output( Migrating oversighted revisions to suppressed revisions. This will not add anything to recentchanges.\n ); + $count = 0; + $dbw = wfGetDB( DB_MASTER ); + + $so = new SpecialOversight; // PHP 5.3 back-compat, ugh + $selectFields = array_merge( $so-getSelectFields(), array( 'hidden.*' ) ); + $lastRevId = -1; + do { + $hiddenRows = $dbw-select( + array( 'hidden', 'user' ), + $selectFields, + array( 'hidden.hidden_rev_id ' . $dbw-addQuotes( $lastRevId ) ), + __METHOD__, + array( 'LIMIT' = $this-mBatchSize, 'ORDER BY' = 'hidden_rev_id' ), + array( 'user' = array( 'INNER JOIN', 'user.user_id = hidden.hidden_by_user' ) ) + ); + $insertLoggingData = array(); + $insertRevisionData = array(); + $insertArchiveData = array(); + foreach ( $hiddenRows as $hiddenRow ) { + if ( Revision::newFromId( $hiddenRow-hidden_rev_id ) ) { + $this-output( Ignoring revision {$hiddenRow-hidden_rev_id} as it is already in the revision table.\n ); + continue; + } + $insertData = array(); + + $latestRevision = Revision::newFromPageId( $hiddenRow-hidden_page ); + $pageExists = $latestRevision !== null; + if ( $pageExists $latestRevision-getTimestamp() wfTimestamp( TS_MW, $hiddenRow-hidden_timestamp ) ) { + $this-output( Warning: Revision ID {$hiddenRow-hidden_rev_id} will be inserted into the archive (like a deleted page) instead of revision to avoid revealing suppressed information (it is newer than any live revision). ); + $pageExists = false; + } + + $fieldPrefix = $pageExists ? 'rev_' : 'ar_'; + $tableName = $pageExists ? 'revision' : 'archive'; + + $revIdFieldName = $tableName == 'archive' ? 'ar_rev_id' : 'rev_id'; + $pageIdFieldName = $fieldPrefix . 'page' . ( $tableName == 'archive' ? '_id' : '' ); + + $insertData[$pageIdFieldName] = $hiddenRow-hidden_page; +
[MediaWiki-commits] [Gerrit] Changed temporary password system to use tokens. - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/106218 Change subject: Changed temporary password system to use tokens. .. Changed temporary password system to use tokens. Changes password reset flow. The old method was to have the user copy their temporary password into the login form, and then after logging in they would be presented with the change password form. The new method gives the user a link (with a token embedded in the query) rather than a temporary password. Special:ChangePassword then checks that token. Now it is no longer possible to log in with temporary passwords on the login page. It can only be done from Special:ChangePassword, and the token must be supplied using a specific field allocated for it, rather than passing it off as if it were a temporary password. The length of temporary passwords has been increased now that they are tokens. Also the default expiry has been reduced to one day. Change-Id: Idb82b912e6bf8cbbc7710a330388edfbd8807b38 --- M RELEASE-NOTES-1.23 M includes/DefaultSettings.php M includes/specials/SpecialChangePassword.php M includes/specials/SpecialPasswordReset.php M includes/specials/SpecialUserlogin.php M languages/messages/MessagesEn.php M languages/messages/MessagesQqq.php 7 files changed, 125 insertions(+), 169 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/18/106218/1 diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 13d9ff8..5e57098 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -28,6 +28,8 @@ should be updated if LBFactory_Simple or LBFactory_Multi is configured. * $wgPasswordSenderName has been deprecated. To set a custom mailer name, the system message 'emailsender' should be modified (default: {{SITENAME}}). +* Changed expiry of temporary passwords from one week to one day because of + the new token-based password reset system. === New features in 1.23 === * ResourceLoader can utilize the Web Storage API to cache modules client-side. @@ -72,6 +74,9 @@ * WikitextContent will now render redirects with the expected redirect header, rather than as an ordered list. Code calling Article::viewRedirect can probably be changed to no longer special-case redirects. +* The temporary password-based password reset system has been replaced with + a token system, i.e., instead of using a temporary password, the user clicks + a link in the email. === Bug fixes in 1.23 === * (bug 41759) The updated since last visit markers (on history pages, recent diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 9b2b676..ddc4fbc 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1363,7 +1363,7 @@ /** * The time, in seconds, when an emailed temporary password expires. */ -$wgNewPasswordExpiry = 3600 * 24 * 7; +$wgNewPasswordExpiry = 3600 * 24; /** * The time, in seconds, when an email confirmation email expires diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index d54828a..c617b57 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -27,48 +27,87 @@ * @ingroup SpecialPage */ class SpecialChangePassword extends FormSpecialPage { + /** +* @var string A temporary password reset token optionally provided by the user +*/ + private $token = ''; - protected $mUserName, $mDomain; + /** +* @var User The user whose password is being changed +*/ + private $user; public function __construct() { parent::__construct( 'ChangePassword', 'editmyprivateinfo' ); $this-listed( false ); + $this-user = $this-getUser(); } - /** -* Main execution point -*/ - function execute( $par ) { + public function execute( $par ) { + global $wgSecureLogin; + + // If secure login is enabled, only allow password changes over HTTPS + if ( + $this-getRequest()-getProtocol() !== 'https' + $wgSecureLogin + wfCanIPUseHTTPS( $this-getRequest()-getIP() ) + ) { + $request = $this-getRequest(); + $title = $this-getFullTitle(); + + $query = array( + 'fromhttp' = '1', + 'returnto' = $request-getVal( 'returnto' ), + 'returntoquery' = $request-getVal( 'returntoquery' ), + 'title' = null, + ) + $this-mRequest-getQueryValues(); + + $url = $title-getFullURL( $query, false, PROTO_HTTPS ); + +
[MediaWiki-commits] [Gerrit] More 1.19 backwards compatibility fixes - change (mediawiki...Persona)
Parent5446 has submitted this change and it was merged. Change subject: More 1.19 backwards compatibility fixes .. More 1.19 backwards compatibility fixes Fixed dependencies for 1.19 and made sure POST HTTP method is uppercase since it has to be in 1.19. Also removed {{SITENAME}} magic from JavaScript messages, since it is way more difficult making that work in 1.19. Bug: 55975 Change-Id: Ia8c0004242cd1ed69b69b626de6ed4d8e23790a9 --- M ApiPersona.php M Persona.i18n.php M Persona.php 3 files changed, 5 insertions(+), 7 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/ApiPersona.php b/ApiPersona.php index 4283cad..fa683f9 100644 --- a/ApiPersona.php +++ b/ApiPersona.php @@ -136,18 +136,18 @@ // Contact the verification server. $assertion = $params['assertion']; $request = MWHttpRequest::factory( 'https://login.persona.org/verify', array( - 'method' = 'post', + 'method' = 'POST', 'caInfo' = __DIR__ . '/persona.crt', 'sslVerifyHost' = true, 'sslVerifyCert' = true, - 'postData' = wfArrayToCgi( array( + 'postData' = FormatJson::encode( array( 'assertion' = $assertion, 'audience' = wfExpandUrl( '/', $wgSecureLogin ? PROTO_HTTPS : PROTO_HTTP ) ) ), ) ); - $request-setHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); + $request-setHeader( 'Content-Type', 'application/json' ); - $status = $request-execute(); + $request-execute(); $response = $request-getContent(); $result = (array)FormatJson::decode( $response ); diff --git a/Persona.i18n.php b/Persona.i18n.php index fca9e51..2b422a9 100644 --- a/Persona.i18n.php +++ b/Persona.i18n.php @@ -26,7 +26,7 @@ 'persona-error-insecure' = 'Logging in over an insecure connection is not allowed.', 'persona-error-failure' = 'Persona failed to verify your identity.', 'persona-error-dberror' = 'An internal database error occurred.', - 'persona-error-invaliduser' = 'There is no user on {{SITENAME}} matching your Persona account.', + 'persona-error-invaliduser' = 'There is no user matching your Persona account.', 'persona-error-multipleusers' = 'There are multiple users with the same email address as your Persona account. Your account must have a unique email address to log in with Persona.', ); diff --git a/Persona.php b/Persona.php index 1a67c4f..a90cfd4 100644 --- a/Persona.php +++ b/Persona.php @@ -57,7 +57,6 @@ 'mediawiki.api', 'mediawiki.Title', 'mediawiki.notify', - 'mediawiki.jqueryMsg', ), 'localBasePath' = __DIR__, 'remoteExtPath' = 'Persona' @@ -76,7 +75,6 @@ 'dependencies' = array( 'mediawiki.api', 'mediawiki.Title', - 'mediawiki.notify', 'mediawiki.jqueryMsg', ), 'localBasePath' = __DIR__, -- To view, visit https://gerrit.wikimedia.org/r/105242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia8c0004242cd1ed69b69b626de6ed4d8e23790a9 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Persona Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Siebrand siebr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] More 1.19 backwards compatibility fixes - change (mediawiki...Persona)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/105242 Change subject: More 1.19 backwards compatibility fixes .. More 1.19 backwards compatibility fixes Fixed dependencies for 1.19 and made sure POST HTTP method is uppercase since it has to be in 1.19. Also removed {{SITENAME}} magic from JavaScript messages, since it is way more difficult making that work in 1.19. Change-Id: Ia8c0004242cd1ed69b69b626de6ed4d8e23790a9 --- M ApiPersona.php M Persona.i18n.php M Persona.php M js/persona_hooks_old.js 4 files changed, 9 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Persona refs/changes/42/105242/1 diff --git a/ApiPersona.php b/ApiPersona.php index 4283cad..fa683f9 100644 --- a/ApiPersona.php +++ b/ApiPersona.php @@ -136,18 +136,18 @@ // Contact the verification server. $assertion = $params['assertion']; $request = MWHttpRequest::factory( 'https://login.persona.org/verify', array( - 'method' = 'post', + 'method' = 'POST', 'caInfo' = __DIR__ . '/persona.crt', 'sslVerifyHost' = true, 'sslVerifyCert' = true, - 'postData' = wfArrayToCgi( array( + 'postData' = FormatJson::encode( array( 'assertion' = $assertion, 'audience' = wfExpandUrl( '/', $wgSecureLogin ? PROTO_HTTPS : PROTO_HTTP ) ) ), ) ); - $request-setHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); + $request-setHeader( 'Content-Type', 'application/json' ); - $status = $request-execute(); + $request-execute(); $response = $request-getContent(); $result = (array)FormatJson::decode( $response ); diff --git a/Persona.i18n.php b/Persona.i18n.php index fca9e51..2b422a9 100644 --- a/Persona.i18n.php +++ b/Persona.i18n.php @@ -26,7 +26,7 @@ 'persona-error-insecure' = 'Logging in over an insecure connection is not allowed.', 'persona-error-failure' = 'Persona failed to verify your identity.', 'persona-error-dberror' = 'An internal database error occurred.', - 'persona-error-invaliduser' = 'There is no user on {{SITENAME}} matching your Persona account.', + 'persona-error-invaliduser' = 'There is no user matching your Persona account.', 'persona-error-multipleusers' = 'There are multiple users with the same email address as your Persona account. Your account must have a unique email address to log in with Persona.', ); diff --git a/Persona.php b/Persona.php index 1a67c4f..a90cfd4 100644 --- a/Persona.php +++ b/Persona.php @@ -57,7 +57,6 @@ 'mediawiki.api', 'mediawiki.Title', 'mediawiki.notify', - 'mediawiki.jqueryMsg', ), 'localBasePath' = __DIR__, 'remoteExtPath' = 'Persona' @@ -76,7 +75,6 @@ 'dependencies' = array( 'mediawiki.api', 'mediawiki.Title', - 'mediawiki.notify', 'mediawiki.jqueryMsg', ), 'localBasePath' = __DIR__, diff --git a/js/persona_hooks_old.js b/js/persona_hooks_old.js index b0a09e2..161a0dc 100644 --- a/js/persona_hooks_old.js +++ b/js/persona_hooks_old.js @@ -21,6 +21,10 @@ navigator.id.logout(); } ); + mw.loader.using( 'mediawiki.jqueryMsg', function() { + mw.jqueryMsg.default + } ); + navigator.id.watch( { loggedInUser: mw.config.get( 'wgPersonaUserEmail' ), onlogin: function( assertion ) { -- To view, visit https://gerrit.wikimedia.org/r/105242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia8c0004242cd1ed69b69b626de6ed4d8e23790a9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Persona Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace usage of SpecialPage::getTitle with getPageTitle - change (mediawiki...SecureSessions)
Parent5446 has submitted this change and it was merged. Change subject: Replace usage of SpecialPage::getTitle with getPageTitle .. Replace usage of SpecialPage::getTitle with getPageTitle Was deprecated in 1.23, see Icdcf5d5295ef5e7f08b1d403e0c123f78738fd40 Change-Id: Icb34eff9669e0974b43a2c77b097e9e1beea674b --- M SpecialSessions.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/SpecialSessions.php b/SpecialSessions.php index 04b100a..d3acb42 100644 --- a/SpecialSessions.php +++ b/SpecialSessions.php @@ -167,6 +167,6 @@ * information is updated. */ function onSuccess() { - $this-getOutput()-redirect( $this-getTitle()-getFullURL() ); + $this-getOutput()-redirect( $this-getPageTitle()-getFullURL() ); } } -- To view, visit https://gerrit.wikimedia.org/r/103982 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icb34eff9669e0974b43a2c77b097e9e1beea674b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SecureSessions Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix case problem for class reference. - change (mediawiki...TwoFactorAuthentication)
Parent5446 has submitted this change and it was merged. Change subject: Fix case problem for class reference. .. Fix case problem for class reference. Change-Id: I108542ad09069bc1d216d6dfdd334123ed680a79 --- M SpecialTwoFactorAuth.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/SpecialTwoFactorAuth.php b/SpecialTwoFactorAuth.php index 8a8c6c9..ba88f88 100644 --- a/SpecialTwoFactorAuth.php +++ b/SpecialTwoFactorAuth.php @@ -165,7 +165,7 @@ public function onSubmit( array $formData ) { // If the action is 'auth', let LoginForm do the processing. if ( $this-action !== 'auth' ) { - $verify = $this-TwoFactorUser-verifyToken( $formData['token'] ); + $verify = $this-twoFactorUser-verifyToken( $formData['token'] ); if ( !$verify ) { $this-getOutput()-addWikiMsg( 'twofactorauth-authfailed' ); return false; -- To view, visit https://gerrit.wikimedia.org/r/103319 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I108542ad09069bc1d216d6dfdd334123ed680a79 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TwoFactorAuthentication Gerrit-Branch: master Gerrit-Owner: Jamie Thingelstad ja...@thingelstad.com Gerrit-Reviewer: Jamie Thingelstad ja...@thingelstad.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix ordering of scripts for Persona - change (mediawiki...Persona)
Parent5446 has submitted this change and it was merged. Change subject: Fix ordering of scripts for Persona .. Fix ordering of scripts for Persona The Persona login JS needs to load before the MediaWiki hooks do, otherwise the navigator API will not be available. Unfortunately, MediaWiki throws all non-Resource Loader script files at the end of all scripts, so the only way to make sure it is loaded before is to put is as a head item. Bug: 57525 Change-Id: I86e5b2484aaae2d3001dc03c333be7d32ee078f2 --- M Persona.php 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/Persona.php b/Persona.php index 6e053c2..1a67c4f 100644 --- a/Persona.php +++ b/Persona.php @@ -105,9 +105,11 @@ $out-addMeta( 'http:X-UA-Compatible', 'IE=Edge' ); if ( ResourceLoader::inDebugMode() ) { - $out-addScriptFile( 'https://login.persona.org/include.orig.js' ); + $out-addHeadItem( 'persona', + Html::linkedScript( 'https://login.persona.org/include.orig.js' ) ); } else { - $out-addScriptFile( 'https://login.persona.org/include.js' ); + $out-addHeadItem( 'persona', + Html::linkedScript( 'https://login.persona.org/include.js' ) ); } if ( version_compare( $wgVersion, '1.20', '' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/97478 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I86e5b2484aaae2d3001dc03c333be7d32ee078f2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Persona Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix ordering of scripts for Persona - change (mediawiki...Persona)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/97478 Change subject: Fix ordering of scripts for Persona .. Fix ordering of scripts for Persona The Persona login JS needs to load before the MediaWiki hooks do, otherwise the navigator API will not be available. Unfortunately, MediaWiki throws all non-Resource Loader script files at the end of all scripts, so the only way to make sure it is loaded before is to put is as a head item. Bug: 57525 Change-Id: I86e5b2484aaae2d3001dc03c333be7d32ee078f2 --- M Persona.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Persona refs/changes/78/97478/1 diff --git a/Persona.php b/Persona.php index 6e053c2..1a67c4f 100644 --- a/Persona.php +++ b/Persona.php @@ -105,9 +105,11 @@ $out-addMeta( 'http:X-UA-Compatible', 'IE=Edge' ); if ( ResourceLoader::inDebugMode() ) { - $out-addScriptFile( 'https://login.persona.org/include.orig.js' ); + $out-addHeadItem( 'persona', + Html::linkedScript( 'https://login.persona.org/include.orig.js' ) ); } else { - $out-addScriptFile( 'https://login.persona.org/include.js' ); + $out-addHeadItem( 'persona', + Html::linkedScript( 'https://login.persona.org/include.js' ) ); } if ( version_compare( $wgVersion, '1.20', '' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/97478 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I86e5b2484aaae2d3001dc03c333be7d32ee078f2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Persona Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix extension functionality and backwards compatibility - change (mediawiki...Persona)
Parent5446 has submitted this change and it was merged. Change subject: Fix extension functionality and backwards compatibility .. Fix extension functionality and backwards compatibility This updates the CA certificate and login endpoint to match Mozilla. Also changes some things to make the extension backwards-compatible with version 1.19 of MediaWiki. Finally, this fixes a few minor bugs: * Infinite looping when authentication is unsuccessful * Non-internationalized error messages Bug: 55975 Change-Id: If61cf139256e411440eb5a327f32f37bd6dfb962 --- M ApiPersona.php M Persona.i18n.php M Persona.php D js/persona.js M js/persona_hooks.js A js/persona_hooks_old.js M persona.crt 7 files changed, 340 insertions(+), 132 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/ApiPersona.php b/ApiPersona.php index dfbaa5b..4283cad 100644 --- a/ApiPersona.php +++ b/ApiPersona.php @@ -8,12 +8,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - + * * Extension:Persona is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with Extension:Persona. If not, see http://www.gnu.org/licenses/. */ @@ -114,7 +114,8 @@ function execute() { global $wgSecureLogin; - if( $wgSecureLogin WebRequest::detectProtocol() !== 'https' ) { + + if ( $wgSecureLogin WebRequest::detectProtocol() !== 'https' ) { $this-dieUsage( 'Secure login is enabled, and an insecure (non-HTTPS) request was made.', 'insecure' ); } @@ -123,50 +124,62 @@ // Check login token and throttling as is done in LoginForm::authenticateUserData. // Note that since we do not yet know the username of the login target, the throttle // is set for an empty user, effectively making this a per-IP only throttle. - if( !LoginForm::getLoginToken() ) { + if ( !LoginForm::getLoginToken() ) { LoginForm::setLoginToken(); $this-dieUsageMsg( 'sessionfailure' ); - } elseif( LoginForm::incLoginThrottle( '' ) === true ) { + } elseif ( LoginForm::incLoginThrottle( '' ) === true ) { $this-dieUsageMsg( 'actionthrottledtext' ); - } elseif( $params['token'] !== LoginForm::getLoginToken() ) { + } elseif ( $params['token'] !== LoginForm::getLoginToken() ) { $this-dieUsageMsg( 'sessionfailure' ); } // Contact the verification server. $assertion = $params['assertion']; - $response = Http::post( - 'https://verifier.login.persona.org/verify', - array( - 'caInfo' = __DIR__ . '/persona.crt', - 'postData' = wfArrayToCgi( array( - 'assertion' = $assertion, - 'audience' = wfExpandUrl( '/', $wgSecureLogin ? PROTO_HTTPS : PROTO_HTTP ) - ) ) - ) - ); - $result = (array) FormatJson::decode( $response ); + $request = MWHttpRequest::factory( 'https://login.persona.org/verify', array( + 'method' = 'post', + 'caInfo' = __DIR__ . '/persona.crt', + 'sslVerifyHost' = true, + 'sslVerifyCert' = true, + 'postData' = wfArrayToCgi( array( + 'assertion' = $assertion, + 'audience' = wfExpandUrl( '/', $wgSecureLogin ? PROTO_HTTPS : PROTO_HTTP ) + ) ), + ) ); + $request-setHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); - if( !isset( $result['status'] ) || $result['status'] !== 'okay' ) { + $status = $request-execute(); + $response = $request-getContent(); + $result = (array)FormatJson::decode( $response ); + + if ( !isset( $result['status'] ) || $result['status'] !== 'okay' ) { // Bad assertion. Do nothing, as the response itself has // sufficient information. $result['status'] = 'failure'; - } elseif( $result['audience'] != wfExpandUrl( '/', $wgSecureLogin ?
[MediaWiki-commits] [Gerrit] Fixed stream wrapper in PhpHttpRequest - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/91393 Change subject: Fixed stream wrapper in PhpHttpRequest .. Fixed stream wrapper in PhpHttpRequest Issue introduced when SSL verification was added to PHPHttpRequest. For HTTP and HTTPS stream, PHP expects http as the steam context name, regardless of SSL. Change-Id: I12c5d3d9aded6e704ebabe85b86e556fd0e99479 Follows-Up: 1c927b1df2a (Iab2bda1ebc) Bug: 56047 --- M includes/HttpFunctions.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/93/91393/1 diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 78c2ac7..640e924 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -901,7 +901,7 @@ } $scheme = $this-parsedUrl['scheme']; - $context = stream_context_create( array( $scheme = $options ) ); + $context = stream_context_create( array( http = $options ) ); $this-headerList = array(); $reqCount = 0; -- To view, visit https://gerrit.wikimedia.org/r/91393 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12c5d3d9aded6e704ebabe85b86e556fd0e99479 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added DatabaseBase::startAtomic and endAtomic - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/90856 Change subject: Added DatabaseBase::startAtomic and endAtomic .. Added DatabaseBase::startAtomic and endAtomic Added new functions to ensure certain groups of statements are atomic without having to go through the trouble of starting a new transaction if one has already been opened. Change-Id: I5328fb337e5544bf28ea282860ef8f81e19ac43c --- M includes/db/Database.php 1 file changed, 55 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/56/90856/1 diff --git a/includes/db/Database.php b/includes/db/Database.php index c3850b9..5cd914d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -282,6 +282,20 @@ private $mTrxAutomatic = false; /** +* Array of levels of atomicity within transactions +* +* @var Array +*/ + private $mTrxAtomicLevels = array(); + + /** +* Record if the current transaction was started implicitly by DatabaseBase::startAtomic +* +* @var Bool +*/ + private $mTrxAutomaticAtomic = false; + + /** * @since 1.21 * @var file handle for upgrade */ @@ -3185,6 +3199,28 @@ } /** +* Begin an atomic section of statements +* +* If a transaction has been started already, just keep track of the given +* section name to make sure the transaction is not committed pre-maturely. +* If there is no transaction, start one. +* +* The goal of this function is to create an atomic section of SQL queries +* without having to start a new transaction if it already exists. +* +* @param string $fname +*/ + final public function startAtomic( $fname = __METHOD__ ) { + array_push( $this-mTrxAtomicLevels, $fname ); + + if ( !$this-mTrxLevel ) { + $this-begin( $fname ); + $this-mTrxAutomatic = true; + $this-mTrxAutomaticAtomic = true; + } + } + + /** * Begin a transaction. If a transaction is already in progress, that transaction will be committed before the * new transaction is started. * @@ -3243,6 +3279,25 @@ } /** +* Ends an atomic section of SQL statements +* +* Ends the next section of atomic SQL statements and commits the transaction +* if necessary. +* +* @param string $fname +*/ + final public function endAtomic( $fname = __METHOD__ ) { + $lastFname = array_pop( $this-mTrxAtomicLevels ); + if ( $lastFname !== $fname ) { + throw new MWException( 'Invalid atomic section ended.' ); + } + + if ( !$this-mTrxAtomicLevels $this-mTrxAutomaticAtomic ) { + $this-commit( $fname, 'flush' ); + } + } + + /** * Commits a transaction previously started using begin(). * If no transaction is in progress, a warning is issued. * -- To view, visit https://gerrit.wikimedia.org/r/90856 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5328fb337e5544bf28ea282860ef8f81e19ac43c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix error in call to wfRunHooks() - change (mediawiki...GlobalBlocking)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/86107 Change subject: Fix error in call to wfRunHooks() .. Fix error in call to wfRunHooks() Change-Id: I6bdaebc1f13a9334aec618a45f34eff99a9efe45 Follows-up: I447afd1fe (a115fad2e) Bug: 54628 --- M GlobalBlocking.class.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalBlocking refs/changes/07/86107/1 diff --git a/GlobalBlocking.class.php b/GlobalBlocking.class.php index 4539a77..95d8399 100644 --- a/GlobalBlocking.class.php +++ b/GlobalBlocking.class.php @@ -76,7 +76,7 @@ $blockingUser = self::maybeLinkUserpage( $block-gb_by_wiki, $block-gb_by ); // Allow site customization of blocked message. $blockedIpMsg = 'globalblocking-ipblocked'; - wfRunHooks( 'GlobalBlockingBlockedIpMsg', $blockedIpMsg ); + wfRunHooks( 'GlobalBlockingBlockedIpMsg', array( $blockedIpMsg ) ); return $result = array( $blockedIpMsg, $blockingUser, $display_wiki, $block-gb_reason, $blockTimestamp, $blockExpiry, $ip ); } -- To view, visit https://gerrit.wikimedia.org/r/86107 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6bdaebc1f13a9334aec618a45f34eff99a9efe45 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GlobalBlocking Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix error in call to wfRunHooks() - change (mediawiki...TorBlock)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/86109 Change subject: Fix error in call to wfRunHooks() .. Fix error in call to wfRunHooks() Change-Id: I4fefbdfdfbc820f25a8a62a5424644433303e31b Follows-up: Id429e0145 (55301f03e3) Bug: 54628 --- M TorBlock.class.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TorBlock refs/changes/09/86109/1 diff --git a/TorBlock.class.php b/TorBlock.class.php index 0de15ce..806b6ce 100644 --- a/TorBlock.class.php +++ b/TorBlock.class.php @@ -70,7 +70,7 @@ // Allow site customization of blocked message. $blockedMsg = 'torblock-blocked'; - wfRunHooks( 'TorBlockBlockedMsg', $blockedMsg ); + wfRunHooks( 'TorBlockBlockedMsg', array( $blockedMsg ) ); $result = array( $blockedMsg, $ip ); return false; -- To view, visit https://gerrit.wikimedia.org/r/86109 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4fefbdfdfbc820f25a8a62a5424644433303e31b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TorBlock Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] doc: Fix grammar in GitInfo documentation comment - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: doc: Fix grammar in GitInfo documentation comment .. doc: Fix grammar in GitInfo documentation comment Change-Id: I67da49398f1281b83700884475d364f6b30c05c8 --- M includes/GitInfo.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 407b3cb..f49f9be 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -162,7 +162,7 @@ /** * Get an URL to a web viewer link to the HEAD revision. * -* @return string|bool string if an URL is available or false otherwise. +* @return string|bool string if a URL is available or false otherwise. */ public function getHeadViewUrl() { $config = {$this-basedir}/config; -- To view, visit https://gerrit.wikimedia.org/r/84992 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I67da49398f1281b83700884475d364f6b30c05c8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle krinklem...@gmail.com Gerrit-Reviewer: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Reedy re...@wikimedia.org Gerrit-Reviewer: Siebrand siebr...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace e-mail by email - change (mediawiki...SSLClientAuthentication)
Parent5446 has submitted this change and it was merged. Change subject: Replace e-mail by email .. Replace e-mail by email For consistency Change-Id: I57ed89a9d58f1ae9629092f38320d51e3017b13d --- M ClientSSLAuth.i18n.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/ClientSSLAuth.i18n.php b/ClientSSLAuth.i18n.php index 79761fa..acb386c 100644 --- a/ClientSSLAuth.i18n.php +++ b/ClientSSLAuth.i18n.php @@ -27,7 +27,7 @@ 'sslauth-enable' = 'Enable', 'sslauth-disable' = 'Disable', 'sslauth-cn' = 'Common name', - 'sslauth-email' = 'E-mail address', + 'sslauth-email' = 'Email address', 'sslauth-serial' = 'Serial number', 'sslauth-response-enable' = 'SSL Authentication has been successfully enabled. Now whenever you connect to {{SITENAME}} over HTTPS with your client certificate, you will be automatically logged in.', 'sslauth-response-disable' = 'SSL Authentication has been successfully disabled.', -- To view, visit https://gerrit.wikimedia.org/r/81917 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I57ed89a9d58f1ae9629092f38320d51e3017b13d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SSLClientAuthentication Gerrit-Branch: master Gerrit-Owner: Shirayuki shirayuk...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add wgRevisionId variable to ResourceLoader - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/81032 Change subject: Add wgRevisionId variable to ResourceLoader .. Add wgRevisionId variable to ResourceLoader mw.config provides wgCurRevisionId, which has the latest revision number. This adds wgRevisionId, which indicates the revision number currently being viewed. This is useful when looking at old revisions. Bug: 51594 Change-Id: Ie0d00f3a9a8af8533ab28204b5bb483a0092c710 --- M includes/OutputPage.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/32/81032/1 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 83a7d3f..a6b01a4 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3022,6 +3022,7 @@ 'wgPageName' = $title-getPrefixedDBkey(), 'wgTitle' = $title-getText(), 'wgCurRevisionId' = $latestRevID, + 'wgRevisionId' = $this-getRevisionId(), 'wgArticleId' = $pageID, 'wgIsArticle' = $this-isArticle(), 'wgIsRedirect' = $title-isRedirect(), -- To view, visit https://gerrit.wikimedia.org/r/81032 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie0d00f3a9a8af8533ab28204b5bb483a0092c710 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added more Message parameter functions - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/80663 Change subject: Added more Message parameter functions .. Added more Message parameter functions Similar to numParams(), added functions for other parameters that can be formatted by the Language class. Adds functions for expiry, size, timePeriod, duration, and bitrate parameters so that the formatting doesn't have to be done at the caller. Change-Id: I7b435fcc11824ead55e4c0f5512418187eae9a6f --- M includes/Message.php 1 file changed, 160 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/63/80663/1 diff --git a/includes/Message.php b/includes/Message.php index 74b4021..bfd2de3 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -357,6 +357,96 @@ } /** +* Add parameters that are durations of time and will be passed through +* Language::formatDuration before substitution +* @since 1.22 +* @param Varargs: numeric parameters (or single argument that is array of numeric parameters) +* @return Message: $this +*/ + public function durationParams( /*...*/ ) { + $params = func_get_args(); + if ( isset( $params[0] ) is_array( $params[0] ) ) { + $params = $params[0]; + } + foreach ( $params as $param ) { + $this-parameters[] = self::durationParam( $param ); + } + return $this; + } + + /** +* Add parameters that are expiration times and will be passed through +* Language::formatExpiry before substitution +* @since 1.22 +* @param Varargs: numeric parameters (or single argument that is array of numeric parameters) +* @return Message: $this +*/ + public function expiryParams( /*...*/ ) { + $params = func_get_args(); + if ( isset( $params[0] ) is_array( $params[0] ) ) { + $params = $params[0]; + } + foreach ( $params as $param ) { + $this-parameters[] = self::expiryParam( $param ); + } + return $this; + } + + /** +* Add parameters that are time periods and will be passed through +* Language::formatTimePeriod before substitution +* @since 1.22 +* @param Varargs: numeric parameters (or single argument that is array of numeric parameters) +* @return Message: $this +*/ + public function timeperiodParams( /*...*/ ) { + $params = func_get_args(); + if ( isset( $params[0] ) is_array( $params[0] ) ) { + $params = $params[0]; + } + foreach ( $params as $param ) { + $this-parameters[] = self::timeperiodParam( $param ); + } + return $this; + } + + /** +* Add parameters that are file sizes and will be passed through +* Language::formatSize before substitution +* @since 1.22 +* @param Varargs: numeric parameters (or single argument that is array of numeric parameters) +* @return Message: $this +*/ + public function sizeParams( /*...*/ ) { + $params = func_get_args(); + if ( isset( $params[0] ) is_array( $params[0] ) ) { + $params = $params[0]; + } + foreach ( $params as $param ) { + $this-parameters[] = self::sizeParam( $param ); + } + return $this; + } + + /** +* Add parameters that are bitrates and will be passed through +* Language::formatBitrate before substitution +* @since 1.22 +* @param Varargs: numeric parameters (or single argument that is array of numeric parameters) +* @return Message: $this +*/ + public function bitrateParams( /*...*/ ) { + $params = func_get_args(); + if ( isset( $params[0] ) is_array( $params[0] ) ) { + $params = $params[0]; + } + foreach ( $params as $param ) { + $this-parameters[] = self::bitrateParam( $param ); + } + return $this; + } + + /** * Set the language and the title from a context object * @since 1.19 * @param $context IContextSource @@ -639,6 +729,51 @@ } /** +* @since 1.22 +* @param $value +* @return array +*/ + public static function durationParam( $value ) { + return array( 'duration' = $value ); + } + + /** +* @since 1.22 +* @param $value +* @return
[MediaWiki-commits] [Gerrit] Changed logged out tokens to use session if already there - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/76458 Change subject: Changed logged out tokens to use session if already there .. Changed logged out tokens to use session if already there MediaWiki doesn't start sessions for anonymous users unless absolutely necessary. Because of this, current logic does not give anonymous users any sort of edit token. However, if for some reason the user already has a session, there's no reason to not given them an edit token. This changes edit token logic so that anonymous users who already have a session started will get a legitimate edit token. Bug: 38417 Change-Id: Ie59ff9cb4f78844781cf14757f11c538cdd432e0 --- M includes/HTMLForm.php M includes/User.php 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/58/76458/1 diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index cd440a9..92b9bd2 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -345,7 +345,7 @@ $submit = true; // no session check needed } elseif ( $request-wasPosted() $request-checkCSRF() ) { $editToken = $request-getVal( 'wpEditToken' ); - if ( $this-getUser()-isLoggedIn() || $editToken != null ) { + if ( isset( $_SESSION ) || $editToken != null ) { // Session tokens for logged-out users have no security value. // However, if the user gave one, check it in order to give a nice // session expired error instead of permission denied or such. diff --git a/includes/User.php b/includes/User.php index a2d438c..119de90 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3543,7 +3543,7 @@ $request = $this-getRequest(); } - if ( $this-isAnon() ) { + if ( !isset( $_SESSION ) ) { return EDIT_TOKEN_SUFFIX; } else { $token = $request-getSessionData( 'wsEditToken' ); -- To view, visit https://gerrit.wikimedia.org/r/76458 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie59ff9cb4f78844781cf14757f11c538cdd432e0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed case in i18n messages - change (mediawiki...ThrottleOverride)
Parent5446 has submitted this change and it was merged. Change subject: Fixed case in i18n messages .. Fixed case in i18n messages Change-Id: I243f0c847638b55ca3c96ee13b717b80a8e7 --- M ThrottleOverride.i18n.php 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, but someone else must approve Santhosh: Looks good to me, approved diff --git a/ThrottleOverride.i18n.php b/ThrottleOverride.i18n.php index 4c531b0..5ccba6e 100644 --- a/ThrottleOverride.i18n.php +++ b/ThrottleOverride.i18n.php @@ -32,8 +32,8 @@ 'throttleoverride-types-emailuser' = 'User emails', 'throttleoverride-list-throttletype' = 'Throttle type:', 'throttleoverride-list-legend' = 'Exemption filtering', - 'throttleoverride-list-rangestart' = 'Start of IP Range', - 'throttleoverride-list-rangeend' = 'End of IP Range', + 'throttleoverride-list-rangestart' = 'Start of IP range', + 'throttleoverride-list-rangeend' = 'End of IP range', 'throttleoverride-list-expiry' = 'Expiry', 'throttleoverride-list-type' = 'Allowed actions', 'throttleoverride-list-reason' = 'Reason', -- To view, visit https://gerrit.wikimedia.org/r/75057 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I243f0c847638b55ca3c96ee13b717b80a8e7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ThrottleOverride Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Nemo bis federicol...@tiscali.it Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Santhosh santhosh.thottin...@gmail.com Gerrit-Reviewer: Siebrand siebr...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed case in i18n messages - change (mediawiki...ThrottleOverride)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/75057 Change subject: Fixed case in i18n messages .. Fixed case in i18n messages Change-Id: I243f0c847638b55ca3c96ee13b717b80a8e7 --- M ThrottleOverride.i18n.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ThrottleOverride refs/changes/57/75057/1 diff --git a/ThrottleOverride.i18n.php b/ThrottleOverride.i18n.php index 4c531b0..5ccba6e 100644 --- a/ThrottleOverride.i18n.php +++ b/ThrottleOverride.i18n.php @@ -32,8 +32,8 @@ 'throttleoverride-types-emailuser' = 'User emails', 'throttleoverride-list-throttletype' = 'Throttle type:', 'throttleoverride-list-legend' = 'Exemption filtering', - 'throttleoverride-list-rangestart' = 'Start of IP Range', - 'throttleoverride-list-rangeend' = 'End of IP Range', + 'throttleoverride-list-rangestart' = 'Start of IP range', + 'throttleoverride-list-rangeend' = 'End of IP range', 'throttleoverride-list-expiry' = 'Expiry', 'throttleoverride-list-type' = 'Allowed actions', 'throttleoverride-list-reason' = 'Reason', -- To view, visit https://gerrit.wikimedia.org/r/75057 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I243f0c847638b55ca3c96ee13b717b80a8e7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ThrottleOverride Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix issue with images not being uploaded - change (mediawiki...AWS)
Parent5446 has submitted this change and it was merged. Change subject: Fix issue with images not being uploaded .. Fix issue with images not being uploaded Change-Id: If7a8bc9582bac286674a2cf839538973d748415a --- M s3/AmazonS3FileBackend.php 1 file changed, 5 insertions(+), 2 deletions(-) Approvals: Thaiphan: Looks good to me, but someone else must approve Parent5446: Verified; Looks good to me, approved diff --git a/s3/AmazonS3FileBackend.php b/s3/AmazonS3FileBackend.php index 851c8cc..0c0d688 100644 --- a/s3/AmazonS3FileBackend.php +++ b/s3/AmazonS3FileBackend.php @@ -53,6 +53,8 @@ */ private $useHTTPS; + private $containerPaths; + /** * Construct the backend. Doesn't take any extra config parameters. * @@ -197,6 +199,7 @@ return $status; } + $params['headers'] = isset( $params['headers'] ) ? $params['headers'] : array(); $params['headers'] += array_fill_keys( array( 'Cache-Control', 'Content-Disposition', @@ -210,7 +213,7 @@ try { $res = $this-client-copyObject( array_filter( array( - 'ACL' = $this-isSecure( $container ) ? CannedAcl::PRIVATE_ACCESS : CannedAcl::PUBLIC_READ, + 'ACL' = $this-isSecure( $dstContainer ) ? CannedAcl::PRIVATE_ACCESS : CannedAcl::PUBLIC_READ, 'Bucket' = $dstContainer, 'CacheControl' = $params['headers']['Cache-Control'], 'ContentDisposition' = $params['headers']['Content-Disposition'], @@ -485,7 +488,7 @@ } foreach( $acl['Grants'] as $grant ) { - if( $grant['Grantee']['URI'] == $pubUrl ) { + if( isset( $grant['Grantee']['URI'] ) $grant['Grantee']['URI'] == $pubUrl ) { return false; } } -- To view, visit https://gerrit.wikimedia.org/r/73737 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If7a8bc9582bac286674a2cf839538973d748415a Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/AWS Gerrit-Branch: master Gerrit-Owner: Thaiphan t...@outlook.com Gerrit-Reviewer: Aaron Schulz asch...@wikimedia.org Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Thaiphan t...@outlook.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added fallback information to LocalisationCache - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/72866 Change subject: Added fallback information to LocalisationCache .. Added fallback information to LocalisationCache For values that are fallbacks, the actual localisation cached value is wrapped in a small object with a property representing the language code of that value. That way it can be detected in the cache whether the returned value is a fallback or not. Change-Id: Iaf0cb1bdbdf1c0d47881a1133164820cd64401d0 --- M includes/cache/LocalisationCache.php M languages/Language.php 2 files changed, 69 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/66/72866/1 diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 1bfd17b..24f2a86 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -251,9 +251,10 @@ * need to fetch all of the subitems from the cache individually. * @param $code * @param $key +* @param[out] $actualCode * @return mixed */ - public function getItem( $code, $key ) { + public function getItem( $code, $key, $actualCode = null ) { if ( !isset( $this-loadedItems[$code][$key] ) ) { wfProfileIn( __METHOD__ . '-load' ); $this-loadItem( $code, $key ); @@ -261,10 +262,25 @@ } if ( $key === 'fallback' isset( $this-shallowFallbacks[$code] ) ) { - return $this-shallowFallbacks[$code]; + $value = $this-shallowFallbacks[$code]; + } else { + $value = $this-data[$code][$key]; } - return $this-data[$code][$key]; + $actualCode = $code; + if ( $value instanceof LCValue ) { + $actualCode = $value-code; + return $value-val; + } elseif ( is_array( $value ) ) { + array_walk_recursive( $value, function( $item ) { + if ( $item instanceof LCValue ) { + $item = $item-val; + } + } ); + return $value; + } else { + return $value; + } } /** @@ -272,9 +288,10 @@ * @param $code * @param $key * @param $subkey +* @param[out] $actualCode * @return null */ - public function getSubitem( $code, $key, $subkey ) { + public function getSubitem( $code, $key, $subkey, $actualCode = null ) { if ( !isset( $this-loadedSubitems[$code][$key][$subkey] ) !isset( $this-loadedItems[$code][$key] ) ) { wfProfileIn( __METHOD__ . '-load' ); @@ -282,10 +299,15 @@ wfProfileOut( __METHOD__ . '-load' ); } - if ( isset( $this-data[$code][$key][$subkey] ) ) { - return $this-data[$code][$key][$subkey]; - } else { + $actualCode = $code; + if ( !isset( $this-data[$code][$key][$subkey] ) ) { return null; + } elseif ( $this-data[$code][$key][$subkey] instanceof LCValue ) { + $value = $this-data[$code][$key][$subkey]; + $actualCode = $value-code; + return $value-val; + } else { + return $this-data[$code][$key][$subkey]; } } @@ -340,7 +362,7 @@ if ( isset( $this-data[$code][$key][$subkey] ) ) { continue; } - $this-data[$code][$key][$subkey] = $this-getSubitem( $code, $key, $subkey ); + $this-loadSubitem( $code, $key, $subkey ); } } else { $this-data[$code][$key] = $this-store-get( $code, $key ); @@ -642,8 +664,19 @@ * @param $key * @param $value * @param $fallbackValue +* @param $code */ - protected function mergeItem( $key, $value, $fallbackValue ) { + protected function mergeItem( $key, $value, $fallbackValue, $code = null ) { + if ( $code !== null ) { + if ( is_array( $fallbackValue ) ) { + array_walk_recursive( $fallbackValue, function( $item ) use ( $code ) { + $item = new LCValue( $item, $code ); + } ); + } else { +
[MediaWiki-commits] [Gerrit] Complete usage of message fallback chain - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/72867 Change subject: Complete usage of message fallback chain .. Complete usage of message fallback chain Finish up the implementation of proper message fallback chaining by checking the actual code of the CDB cache before using it. This means that the MessageCache now has a proper fallback process by checking first the DB and then the CDB cache for each language, beginning with the requested language. Bug: 1495 Bug: 46579 Bug: 48956 Change-Id: I44fd4d1b0b194ce62be10215699883f87abc431b --- M includes/cache/MessageCache.php 1 file changed, 21 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/67/72867/1 diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index fcefc06..69df689 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -726,6 +726,9 @@ // Loop through each language in the fallback list until we find something useful $lang = wfGetLangObj( $langcode ); + if ( !StubObject::isRealObject( $lang ) ) { + $lang = wfGetLangObj( $lang-getCode() ); + } $message = $this-getMessageFromFallbackChain( $lang, $lckey, $uckey, !$this-mDisable $useDB ); // If we still have no message, maybe the key was in fact a full key so try that @@ -799,8 +802,9 @@ } // Check the CDB cache - $message = $lang-getMessage( $lckey ); - if ( $message !== null ) { + $actualCode = null; + $message = $lang-getMessage( $lckey, $actualCode ); + if ( $message !== null $actualCode === $langcode ) { return $message; } @@ -811,13 +815,16 @@ foreach ( $fallbackChain as $code ) { if ( $code === $wgLanguageCode ) { // Messages created in the content language will not have the /lang extension - $message = $this-getMsgFromNamespace( $uckey, $code ); + $dbMessage = $this-getMsgFromNamespace( $uckey, $code ); } else { - $message = $this-getMsgFromNamespace( $uckey/$code, $code ); + $dbMessage = $this-getMsgFromNamespace( $uckey/$code, $code ); } - if ( $message !== false ) { + if ( $dbMessage !== false ) { // Found the message. + return $dbMessage; + } elseif ( $actualCode === $code ) { + // This language was what the CDB cache entry was for return $message; } } @@ -831,22 +838,25 @@ } } - $message = $wgContLang-getMessage( $lckey ); - if ( $message !== null ) { + $actualCode = null; + $message = $wgContLang-getMessage( $lckey, $actualCode ); + if ( $message !== null $actualCode === $wgLanguageCode ) { return $message; } // Finally try the DB for the site language's fallbacks. if ( $useDB ) { foreach ( $siteFallbackChain as $code ) { - $message = $this-getMsgFromNamespace( $uckey/$code, $code ); - if ( $message === false $code === $wgLanguageCode ) { + $dbMessage = $this-getMsgFromNamespace( $uckey/$code, $code ); + if ( $dbMessage === false $code === $wgLanguageCode ) { // Messages created in the content language will not have the /lang extension - $message = $this-getMsgFromNamespace( $uckey, $code ); + $dbMessage = $this-getMsgFromNamespace( $uckey, $code ); } - if ( $message !== false ) { + if ( $dbMessage !== false ) { // Found the message. + return $dbMessage; + } elseif ( $actualCode === $code ) { return $message; } } -- To view, visit
[MediaWiki-commits] [Gerrit] Changed MWTimestamp to extend DateTime for ease of use - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/72453 Change subject: Changed MWTimestamp to extend DateTime for ease of use .. Changed MWTimestamp to extend DateTime for ease of use Changed the MWTimestamp class to inherit PHP's DateTime class. This allows calling of internal native functions without any wrapping mutator functions. Change-Id: I0868f89214de750d207457258e68158f2d8d949b --- M includes/Timestamp.php 1 file changed, 67 insertions(+), 70 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/53/72453/1 diff --git a/includes/Timestamp.php b/includes/Timestamp.php index c77f9a4..9018bab 100644 --- a/includes/Timestamp.php +++ b/includes/Timestamp.php @@ -28,7 +28,7 @@ * * @since 1.20 */ -class MWTimestamp { +class MWTimestamp extends DateTime { /** * Standard gmdate() formats for the different timestamp types. */ @@ -57,9 +57,21 @@ * @since 1.20 * * @param bool|string $timestamp Timestamp to set, or false for current time +* @param string|DateTimeZone|bool $tz Timezone to set, or false for GMT */ - public function __construct( $timestamp = false ) { - $this-setTimestamp( $timestamp ); + public function __construct( $timestamp = false, $tz = 'GMT' ) { + $timestamp = $this-parseTimestamp( $timestamp ); + + try { + if ( !$tz instanceof DateTimeZone ) { + $tz = new DateTimeZone( $tz ); + } + parent::__construct( $timestamp, $tz ); + } catch ( Exception $e ) { + throw new TimestampException( __METHOD__ . ' Invalid constructor arguments.', $e-getCode(), $e ); + } + + $this-timestamp = $this; } /** @@ -71,9 +83,28 @@ * @since 1.20 * * @param string|bool $ts Timestamp to store, or false for now +* @param string|DateTimeZone|bool $tz Timezone to set, or false for GMT * @throws TimestampException */ - public function setTimestamp( $ts = false ) { + public function setTimestamp( $ts = false, $tz = false ) { + $ts = $this-parseTimestamp( $ts ); + + $success = $this-modify( $strtime ); + $this-setTimezone( $tz ); + + if ( !$success ) { + throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); + } + } + + /** +* Normalize a string or integer timestamp into something recognizeable by +* the DateTime class. +* +* @param mixed $ts Timestamp to parse +* @return string +*/ + public function parseTimestamp( $ts = false ) { $da = array(); $strtime = ''; @@ -114,7 +145,8 @@ # asctime $strtime = $ts; } else { - throw new TimestampException( __METHOD__ . : Invalid timestamp - $ts ); + // Unknown format. See if the DateTime class knows it + $strtime = $ts; } if ( !$strtime ) { @@ -123,16 +155,7 @@ $strtime = call_user_func_array( sprintf, $da ); } - try { - $final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) ); - } catch ( Exception $e ) { - throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); - } - - if ( $final === false ) { - throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); - } - $this-timestamp = $final; + return $strtime; } /** @@ -152,13 +175,36 @@ throw new TimestampException( __METHOD__ . ' : Illegal timestamp output type.' ); } - $output = $this-timestamp-format( self::$formats[$style] ); + $output = $this-format( self::$formats[$style] ); if ( ( $style == TS_RFC2822 ) || ( $style == TS_POSTGRES ) ) { $output .= ' GMT'; } return $output; + } + + /** +* Set the timezone of this timestamp to the specified timezone. +* +* @since 1.22 +* @param string|false $timezone Timezone to set +* @throws TimestampException +*/ + public function setTimezone( $timezone ) { + if ( !$timezone instanceof DateTimeZone ) { + try { + $timezone = new DateTimeZone( $timezone ); + }
[MediaWiki-commits] [Gerrit] Add special page for listing throttle overrides - change (mediawiki...ThrottleOverride)
Parent5446 has submitted this change and it was merged. Change subject: Add special page for listing throttle overrides .. Add special page for listing throttle overrides Created Special:ThrottleOverrideList to list and describe all throttle overrides in the database. Bug: 48954 Change-Id: I902ef4e8db765fc90720c2cc054a34f2995ab9e1 --- A SpecialThrottleOverrideList.php M ThrottleOverride.hooks.php M ThrottleOverride.i18n.php M ThrottleOverride.php A patches/expiry_index.sql R patches/table.sql 6 files changed, 219 insertions(+), 2 deletions(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/SpecialThrottleOverrideList.php b/SpecialThrottleOverrideList.php new file mode 100644 index 000..9e9e9e2 --- /dev/null +++ b/SpecialThrottleOverrideList.php @@ -0,0 +1,184 @@ +?php + +/** + * MediaWiki extension to temporarily lift throttles. + * Copyright (C) 2013 Tyler Romeo tylerro...@gmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + + /** + * Special page for viewing the list of current throttle overrides + */ +class SpecialThrottleOverrideList extends FormSpecialPage { + function __construct() { + parent::__construct( 'ThrottleOverrideList' ); + } + + function getMessagePrefix() { + return 'throttleoverride-list'; + } + + function getFormFields() { + global $wgRateLimits; + + foreach ( array( 'all', 'actcreate', 'edit', 'move', 'mailpassword', 'emailuser' ) as $type ) { + if ( $type == 'all' || $type == 'actcreate' || isset( $wgRateLimits[$type] ) ) { + // For grepping. The following messages are used here: + // throttleoverride-types-all + // throttleoverride-types-actcreate, throttleoverride-types-edit, + // throttleoverride-types-moves, throttleoverride-types-mailpassword, + // throttleoverride-types-emailuser + $throttles[$this-msg( throttleoverride-types-$type )-text()] = $type; + } + } + + return array( + 'ThrottleType' = array( + 'type' = 'select', + 'default' = 'all', + 'label-message' = 'throttleoverride-list-throttletype', + 'options' = $throttles + ) + ); + } + + function alterForm( HTMLForm $form ) { + $form-setMethod( 'get' ); + $form-setSubmitTextMsg( 'throttleoverride-list-search' ); + } + + function onSubmit( array $data, HTMLForm $form = null ) { + if ( !wfReadOnly() !mt_rand( 0, 10 ) ) { + // Purge expired entries on one in every 10 queries + $dbw = wfGetDB( DB_MASTER ); + $method = __METHOD__; + $dbw-onTransactionIdle( function() use ( $dbw, $method ) { + $dbw-delete( + 'throttle_override', + array( + $dbw-addIdentifierQuotes( 'thr_expiry' ) . + ' ' . + $dbw-addQuotes( $dbw-timestamp() ) + ), + $method + ); + } ); + } + + $pager = new ThrottleOverridePager( $this, array( + 'throttleType' = $data['ThrottleType'], + ) ); + + // Add the result as post text so it appears after the form + if ( !$pager-getNumRows() ) { + $form-addPostText( $this-msg( 'throttleoverride-list-noresults' )-escaped() ); + } else { + $form-addPostText( + $pager-getNavigationBar() . + $pager-getBody() . + $pager-getNavigationBar() +
[MediaWiki-commits] [Gerrit] Add new special page to alias file - change (mediawiki...ThrottleOverride)
Parent5446 has submitted this change and it was merged. Change subject: Add new special page to alias file .. Add new special page to alias file Introduced with I902ef4e8db765fc90720c2cc054a34f2995ab9e1 Change-Id: I9d635b07aaa9db89a6ce801d64320f5d2a83d4ab --- M ThrottleOverride.i18n.alias.php 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/ThrottleOverride.i18n.alias.php b/ThrottleOverride.i18n.alias.php index 074e484..3af2e7b 100644 --- a/ThrottleOverride.i18n.alias.php +++ b/ThrottleOverride.i18n.alias.php @@ -1,6 +1,6 @@ ?php /** - * Aliases for Special:OverrideThrottle + * Aliases for extension Throttle Override * * @file * @ingroup Extensions @@ -11,6 +11,7 @@ /** English (English) */ $specialPageAliases['en'] = array( 'ThrottleOverride' = array( 'ThrottleOverride', 'Throttle Override' ), + 'ThrottleOverrideList' = array( 'ThrottleOverrideList', 'Throttle Override List' ), ); /** German (Deutsch) */ -- To view, visit https://gerrit.wikimedia.org/r/72154 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9d635b07aaa9db89a6ce801d64320f5d2a83d4ab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ThrottleOverride Gerrit-Branch: master Gerrit-Owner: Raimond Spekking raimond.spekk...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] benchmarks: README file having run recommendations - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: benchmarks: README file having run recommendations .. benchmarks: README file having run recommendations In a wikitech thread about benchmarking, Tim Starling has been running benchmarks using CPU binding and raised priority. This patch copy paste Tim recommendations so we do not forget about them. Change-Id: Ic6f2803c005f70a2f0400f28fafc3c8d209e0667 --- A maintenance/benchmarks/README 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Parent5446: Looks good to me, approved diff --git a/maintenance/benchmarks/README b/maintenance/benchmarks/README new file mode 100644 index 000..c021abd --- /dev/null +++ b/maintenance/benchmarks/README @@ -0,0 +1,7 @@ +This directory hold several benchmarking scripts used as a proof of speed +or to track PHP performances over time. + +To get somehow accurate result, you might want to bound the PHP process +to a specific CPU with `taskset` and raise its priority with `nice`. Example: + + $ taskset 1 nice -n-10 php bench_wfIsWindows.php -- To view, visit https://gerrit.wikimedia.org/r/66066 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic6f2803c005f70a2f0400f28fafc3c8d209e0667 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Hashar has...@free.fr Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Hashar has...@free.fr Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Tim Starling tstarl...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Changed FOR UPDATE handling in Postgresql - change (mediawiki/core)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/69767 Change subject: Changed FOR UPDATE handling in Postgresql .. Changed FOR UPDATE handling in Postgresql Postgresql cannot handle FOR UPDATE with outer joins, but it allows specifying which tables can be locked. This changes DatabasePostgresql to render proper FOR UPDATE statements that only include the main table and any tables in inner joins. Bug: 47055 Change-Id: I1ac587ac39f448b9e7f4befb44826b43044ad6f0 --- M includes/db/DatabasePostgres.php 1 file changed, 27 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/67/69767/1 diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index e564a16..073f34a 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -721,6 +721,29 @@ } /** +* Change the FOR UPDATE option as necessary based on the join conditions. Then pass +* to the parent function to get the actual SQL text. +* +* In Postgres when using FOR UPDATE, only the main table and tables that are inner joined +* can be locked. That means tables in an outer join cannot be FOR UPDATE locked. Trying to do +* so causes a DB error. This wrapper checks which tables can be locked and adjusts it accordingly. +*/ + function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__, $options = array(), $join_conds = array() ) { + $forUpdateKey = array_search( 'FOR UPDATE', $options ); + if ( $forUpdateKey !== false $join_conds ) { + unset( $options[$forUpdateKey] ); + + foreach ( $join_conds as $table = $join_cond ) { + if ( 0 === preg_match( '/^(?:LEFT|RIGHT|FULL)(?: OUTER)? JOIN$/i', $join_cond[0] ) ) { + $options['FOR UPDATE'][] = $table; + } + } + } + + return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds ); + } + + /** * INSERT wrapper, inserts an array into a table * * $args may be a single associative array, or an array of these with numeric keys, @@ -1399,9 +1422,12 @@ // : false ); //} - if ( isset( $noKeyOptions['FOR UPDATE'] ) ) { + if ( isset( $options['FOR UPDATE'] ) ) { + $postLimitTail .= ' FOR UPDATE OF ' . implode( ', ', $options['FOR UPDATE'] ); + } else if ( isset( $noKeyOptions['FOR UPDATE'] ) ) { $postLimitTail .= ' FOR UPDATE'; } + if ( isset( $noKeyOptions['DISTINCT'] ) || isset( $noKeyOptions['DISTINCTROW'] ) ) { $startOpts .= 'DISTINCT'; } -- To view, visit https://gerrit.wikimedia.org/r/69767 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1ac587ac39f448b9e7f4befb44826b43044ad6f0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] displaytitle: Pass-by-reference fix for PHP 5.4 - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: displaytitle: Pass-by-reference fix for PHP 5.4 .. displaytitle: Pass-by-reference fix for PHP 5.4 PHP 5.4 includes some pass-by-reference changes which apparently make the '' sigil necessary here. Spotted by Mormegil morme...@centrum.cz. Followup to Ie162535b. Change-Id: I038fa7f8e1559c95dba7b9b498fc1d1f5eb76887 --- M includes/parser/CoreParserFunctions.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Parent5446: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 2cdfc6e..8b513a6 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -377,7 +377,7 @@ // disallow some styles that could be used to bypass $wgRestrictDisplayTitle if ( $wgRestrictDisplayTitle ) { - $htmlTagsCallback = function ( $params ) { + $htmlTagsCallback = function ( $params ) { $decoded = Sanitizer::decodeTagAttributes( $params ); if ( isset( $decoded['style'] ) ) { -- To view, visit https://gerrit.wikimedia.org/r/69807 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I038fa7f8e1559c95dba7b9b498fc1d1f5eb76887 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Matmarex matma@gmail.com Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Mormegil morme...@centrum.cz Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Do not output numberofviews, if $wgDisableCounters = true - change (mediawiki/core)
Parent5446 has submitted this change and it was merged. Change subject: Do not output numberofviews, if $wgDisableCounters = true .. Do not output numberofviews, if $wgDisableCounters = true Follow up I9975dceedeffafadf560ed71238c51b94eb8c3ad But now for the parser function Change-Id: I18261b884b7f3be57a42c0b10594384fab6f9c9a --- M includes/parser/CoreParserFunctions.php 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Parent5446: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index a7820d4..2cdfc6e 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -456,7 +456,8 @@ return self::formatRaw( SiteStats::edits(), $raw ); } static function numberofviews( $parser, $raw = null ) { - return self::formatRaw( SiteStats::views(), $raw ); + global $wgDisableCounters; + return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : ''; } static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) { return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw ); -- To view, visit https://gerrit.wikimedia.org/r/69143 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I18261b884b7f3be57a42c0b10594384fab6f9c9a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender umherirrender_de...@web.de Gerrit-Reviewer: Aaron Schulz asch...@wikimedia.org Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Combine text and ID update fields - change (mediawiki...UserMerge)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/69017 Change subject: Combine text and ID update fields .. Combine text and ID update fields Reduce the number of expensive database queries performed while merging by combining the updates of text fields with their corresponding ID fields. Bug: 49520 Change-Id: Ibb36ef49e99246e502835f51ab6776422b62438d --- M UserMerge_body.php 1 file changed, 36 insertions(+), 27 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UserMerge refs/changes/17/69017/1 diff --git a/UserMerge_body.php b/UserMerge_body.php index 9573213..d3e61a4 100644 --- a/UserMerge_body.php +++ b/UserMerge_body.php @@ -215,41 +215,50 @@ * @return bool Always returns true - throws exceptions on failure. */ private function mergeUser( $objNewUser, $newuser_text, $newuserID, $objOldUser, $olduser_text, $olduserID ) { - $idUpdateFields = array( - array( 'archive', 'ar_user' ), - array( 'revision', 'rev_user' ), - array( 'filearchive', 'fa_user' ), - array( 'image', 'img_user' ), - array( 'oldimage', 'oi_user' ), - array( 'recentchanges', 'rc_user' ), + // Fields to update with the format: + // array( tableName, idField, textField ) + $updateFields = array( + array( 'archive', 'ar_user', 'ar_user_text' ), + array( 'revision', 'rev_user', 'rev_user_text' ), + array( 'filearchive', 'fa_user', 'fa_user_text' ), + array( 'image', 'img_user', 'img_user_text' ), + array( 'oldimage', 'oi_user', 'oi_user_text' ), + array( 'recentchanges', 'rc_user', 'rc_user_text' ), array( 'logging', 'log_user' ), - array( 'ipblocks', 'ipb_user' ), - array( 'ipblocks', 'ipb_by' ), + array( 'ipblocks', 'ipb_user', 'ipb_address' ), + array( 'ipblocks', 'ipb_by', 'ipb_by_text' ), array( 'watchlist', 'wl_user' ), - ); - - $textUpdateFields = array( - array( 'archive', 'ar_user_text' ), - array( 'revision', 'rev_user_text' ), - array( 'filearchive', 'fa_user_text' ), - array( 'image', 'img_user_text' ), - array( 'oldimage', 'oi_user_text' ), - array( 'recentchanges', 'rc_user_text' ), - array( 'ipblocks', 'ipb_address' ), - array( 'ipblocks', 'ipb_by_text' ), ); $dbw = wfGetDB( DB_MASTER ); $out = $this-getOutput(); - foreach ( $idUpdateFields as $idUpdateField ) { - $dbw-update( $idUpdateField[0], array( $idUpdateField[1] = $newuserID ), array( $idUpdateField[1] = $olduserID ) ); - $out-addHTML( $this-msg( 'usermerge-updating', $idUpdateField[0], $olduserID, $newuserID )-escaped() . br /\n ); - } + foreach ( $updateFields as $fieldInfo ) { + $tableName = array_shift( $fieldInfo ); + $idField = array_shift( $fieldInfo ); - foreach ( $textUpdateFields as $textUpdateField ) { - $dbw-update( $textUpdateField[0], array( $textUpdateField[1] = $newuser_text ), array( $textUpdateField[1] = $olduser_text ) ); - $out-addHTML( $this-msg( 'usermerge-updating', $textUpdateField[0], $olduser_text, $newuser_text )-escaped() . br /\n ); + $dbw-update( + $tableName, + array( $idField = $newuserID ) + array_fill_keys( $fieldInfo, $newuser_text ), + array( $idField = $olduserID ), + __METHOD__ + ); + + $out-addHTML( $this-msg( + 'usermerge-updating', + $tableName, + $olduserID, + $newuserID + )-escaped() . br /\n ); + + foreach ( $fieldInfo as $textField ) { + $out-addHTML( $this-msg( + 'usermerge-updating', + $tableName, + $olduser_text, + $newuser_text + )-escaped() . br /\n ); + } }
[MediaWiki-commits] [Gerrit] Updated and added default configuration - change (mediawiki...AWS)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/69018 Change subject: Updated and added default configuration .. Updated and added default configuration Some parts of the configuration must be a certain way, so let those be defaults so that the end user doesn't have to configure them manually. Change-Id: I66952eecb1f7ce619c1e2f203a485446712c2d11 --- M AWS.php 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AWS refs/changes/18/69018/1 diff --git a/AWS.php b/AWS.php index ff65e5a..76d5b20 100644 --- a/AWS.php +++ b/AWS.php @@ -55,6 +55,15 @@ $wgExtensionMessagesFiles['AWS'] = __DIR__ . '/AWS.i18n.php'; $wgAutoloadClasses['JobQueueAmazonSqs'] = __DIR__ . '/sqs/JobQueueAmazonSqs.php'; $wgAutoloadClasses['AmazonS3FileBackend'] = __DIR__ . '/s3/AmazonS3FileBackend.php'; -$wgJobTypeConf['sqs'] = array( 'class' = 'JobQueueAmazonSqs', 'order' = 'random' ); + +$wgJobTypeConf['sqs'] = array( + 'class' = 'JobQueueAmazonSqs', + 'order' = 'random' +); +$wgFileBackends['s3'] = array( + 'name' = 'AmazonS3', + 'class' = 'AmazonS3FileBackend', + 'lockManager' = 'nullLockManager', +); require_once __DIR__ . '/vendor/autoload.php'; -- To view, visit https://gerrit.wikimedia.org/r/69018 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66952eecb1f7ce619c1e2f203a485446712c2d11 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AWS Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Updated and added default configuration - change (mediawiki...AWS)
Parent5446 has submitted this change and it was merged. Change subject: Updated and added default configuration .. Updated and added default configuration Some parts of the configuration must be a certain way, so let those be defaults so that the end user doesn't have to configure them manually. Change-Id: I66952eecb1f7ce619c1e2f203a485446712c2d11 --- M AWS.php 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: Parent5446: Verified; Looks good to me, approved diff --git a/AWS.php b/AWS.php index ff65e5a..76d5b20 100644 --- a/AWS.php +++ b/AWS.php @@ -55,6 +55,15 @@ $wgExtensionMessagesFiles['AWS'] = __DIR__ . '/AWS.i18n.php'; $wgAutoloadClasses['JobQueueAmazonSqs'] = __DIR__ . '/sqs/JobQueueAmazonSqs.php'; $wgAutoloadClasses['AmazonS3FileBackend'] = __DIR__ . '/s3/AmazonS3FileBackend.php'; -$wgJobTypeConf['sqs'] = array( 'class' = 'JobQueueAmazonSqs', 'order' = 'random' ); + +$wgJobTypeConf['sqs'] = array( + 'class' = 'JobQueueAmazonSqs', + 'order' = 'random' +); +$wgFileBackends['s3'] = array( + 'name' = 'AmazonS3', + 'class' = 'AmazonS3FileBackend', + 'lockManager' = 'nullLockManager', +); require_once __DIR__ . '/vendor/autoload.php'; -- To view, visit https://gerrit.wikimedia.org/r/69018 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I66952eecb1f7ce619c1e2f203a485446712c2d11 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AWS Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com Gerrit-Reviewer: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Enabling secure login (HTTPS), second attempt - change (operations/mediawiki-config)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/68937 Change subject: Enabling secure login (HTTPS), second attempt .. Enabling secure login (HTTPS), second attempt Set $wgSecureLogin to true in order to enable HTTPS for logins on WMF wikis. (cherry picked from commit a5af13cc615b85b3e396247c1920587ee5df6856) Bug: 39380 Change-Id: I17c902ae8d5e6845c938f7d6643b3d469d6e9a57 --- M wmf-config/CommonSettings.php 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/37/68937/1 diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php index 3702e89..798a2f8 100644 --- a/wmf-config/CommonSettings.php +++ b/wmf-config/CommonSettings.php @@ -454,6 +454,8 @@ # This converter will only work when rsvg has a suitable security patch $wgSVGConverters['rsvg-secure'] = '$path/rsvg-convert --no-external-files -w $width -h $height -o $output $input'; +$wgSecureLogin = true; + ### # Squid Configuration ### -- To view, visit https://gerrit.wikimedia.org/r/68937 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I17c902ae8d5e6845c938f7d6643b3d469d6e9a57 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed bug in Special:Sessions with variable name - change (mediawiki...SecureSessions)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/68320 Change subject: Fixed bug in Special:Sessions with variable name .. Fixed bug in Special:Sessions with variable name Variable name in SpecialSessions was using $sessions rather than the foreach loop variable. Change-Id: I2aee590bff2bdca16fc205131a0856ea1d770399 --- M SpecialSessions.php 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecureSessions refs/changes/20/68320/1 diff --git a/SpecialSessions.php b/SpecialSessions.php index b5f0a09..6965713 100644 --- a/SpecialSessions.php +++ b/SpecialSessions.php @@ -77,8 +77,9 @@ // Use a separate ID variable because the cache array may have // missing indexes and whatnot from logged out sessions. $id = 1; - foreach( $sessions as $sId = $session ) { - $timestamp = new MWTimestamp( $sessions['time'] ); + + foreach( $sessions as $sId = $session ) { + $timestamp = new MWTimestamp( $session['time'] ); // Make a table describing the session. $description = Html::rawElement( 'table', array(), -- To view, visit https://gerrit.wikimedia.org/r/68320 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2aee590bff2bdca16fc205131a0856ea1d770399 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SecureSessions Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed incorrect variable name in SpecialSessions - change (mediawiki...SecureSessions)
Parent5446 has uploaded a new change for review. https://gerrit.wikimedia.org/r/68321 Change subject: Fixed incorrect variable name in SpecialSessions .. Fixed incorrect variable name in SpecialSessions Change-Id: I5819b742c507839959428c4698b9c9426f0f8d3b --- M SpecialSessions.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecureSessions refs/changes/21/68321/1 diff --git a/SpecialSessions.php b/SpecialSessions.php index b51e036..04b100a 100644 --- a/SpecialSessions.php +++ b/SpecialSessions.php @@ -77,8 +77,8 @@ // Use a separate ID variable because the cache array may have // missing indexes and whatnot from logged out sessions. $id = 1; - foreach ( array_filter( (array)$sessions ) as $sId = $session ) { - $timestamp = new MWTimestamp( $sessions['time'] ); + foreach ( array_filter( (array)$sessions ) as $sId = $session ) { + $timestamp = new MWTimestamp( $session['time'] ); // Make a table describing the session. $description = Html::rawElement( 'table', array(), -- To view, visit https://gerrit.wikimedia.org/r/68321 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5819b742c507839959428c4698b9c9426f0f8d3b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SecureSessions Gerrit-Branch: master Gerrit-Owner: Parent5446 tylerro...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits