[MediaWiki-commits] [Gerrit] Removed not needed imports. - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Removed not needed imports. .. Removed not needed imports. * catlib * config Change-Id: I5608de3fc9366c9a5fd33506016ca082645c133f --- M scripts/replace.py 1 file changed, 0 insertions(+), 1 deletion(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/replace.py b/scripts/replace.py index acc6da0..5a32c3a 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -127,7 +127,6 @@ import pywikibot from pywikibot import pagegenerators from pywikibot import editor as editarticle -from pywikibot import catlib, config from pywikibot import i18n import webbrowser -- To view, visit https://gerrit.wikimedia.org/r/104196 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5608de3fc9366c9a5fd33506016ca082645c133f Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch Gerrit-Reviewer: Ladsgroup Gerrit-Reviewer: Merlijn van Deen Gerrit-Reviewer: Xqt Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 59078) clean_sandbox.py for arz WP. - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: (bug 59078) clean_sandbox.py for arz WP. .. (bug 59078) clean_sandbox.py for arz WP. Change-Id: I5848e9311e1da2a8f1f40fdf89754f6e2ba23182 --- M scripts/clean_sandbox.py 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py index 8ee5e85..12ed851 100755 --- a/scripts/clean_sandbox.py +++ b/scripts/clean_sandbox.py @@ -51,6 +51,7 @@ 'commons': u'{{Sandbox}}\n', 'als': u'{{subst:/Vorlage}}', 'ar': u'{{عنوان الملعب}}\n', +'arz': '{{عنوان السبوره}}\n', 'az': u'\n{{Qaralama dəftəri}}\n', 'bar': u'{{Bitte erst NACH dieser Zeile schreiben! (Begrüßungskasten)}}\r\n', 'cs': u'{{subst:/uhrabat}}', @@ -86,6 +87,7 @@ 'commons': u'Project:Sandbox', 'als': u'Project:Sandchaschte', 'ar': u'Project:ملعب', +'arz': u'Project:السبوره', 'az': u'Vikipediya:Qaralama dəftəri', 'bar': u'Project:Spuiwiesn', 'cs': u'Project:Pískoviště', -- To view, visit https://gerrit.wikimedia.org/r/104212 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5848e9311e1da2a8f1f40fdf89754f6e2ba23182 Gerrit-PatchSet: 3 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch Gerrit-Reviewer: Ladsgroup Gerrit-Reviewer: Merlijn van Deen Gerrit-Reviewer: Xqt Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] On "File does not exist" disable edit, enable upload - change (mediawiki...MobileFrontend)
Jcf2000 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104324 Change subject: On "File does not exist" disable edit, enable upload .. On "File does not exist" disable edit, enable upload Locked the edit button on file pages when the file doesn't exist, enabled the upload button, and modified the upload API to use the same filename as the non-existent file Bug: 58311 Change-Id: Iebe136bac97abbc81e62e76057a8b41fc62b909f --- M javascripts/modules/editor/editor.js M javascripts/modules/uploads/PhotoApi.js M javascripts/modules/uploads/PhotoUploader.js M javascripts/modules/uploads/lead-photo-init.js 4 files changed, 26 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/24/104324/1 diff --git a/javascripts/modules/editor/editor.js b/javascripts/modules/editor/editor.js index b5bec97..aa07624 100644 --- a/javascripts/modules/editor/editor.js +++ b/javascripts/modules/editor/editor.js @@ -4,13 +4,14 @@ inStable = mw.config.get( 'wgMFMode' ) === 'stable', user = M.require( 'user' ), popup = M.require( 'notifications' ), + isExistingFile = $( document ).find( '#mw-imagepage-nofile' ).length === 0, isUserBlocked = mw.config.get( 'wgMFIsUserBlocked' ), // FIXME: Disable on IE < 10 for time being blacklisted = /MSIE \d\./.test( navigator.userAgent ), isEditingSupported = M.router.isSupported() && !blacklisted, // FIXME: Should we consider default site options and user prefs? // FIXME: This also needs to check that VisualEditor is actually installed. - isVisualEditorEnabled = M.isWideScreen() && mw.config.get( 'wgMFMode' ) === 'alpha', + isVisualEditorEnabled = M.isWideScreen() && isExistingFile && mw.config.get( 'wgMFMode' ) === 'alpha', CtaDrawer = M.require( 'CtaDrawer' ), drawer = new CtaDrawer( { queryParams: { @@ -147,6 +148,9 @@ } else if ( !isEditingSupported ) { // Editing is disabled (or browser is blacklisted) showSorryToast( 'mobile-frontend-editor-unavailable' ); + } else if ( !isExistingFile ) { + //File doesn't exist + showSorryToast( 'mobile-frontend-editor-disabled' ); } else { if ( user.isAnon() ) { if ( mw.config.get( 'wgMFAnonymousEditing' ) && mw.config.get( 'wgIsPageEditable' ) ) { diff --git a/javascripts/modules/uploads/PhotoApi.js b/javascripts/modules/uploads/PhotoApi.js index 5533185..619e1bc 100644 --- a/javascripts/modules/uploads/PhotoApi.js +++ b/javascripts/modules/uploads/PhotoApi.js @@ -2,6 +2,7 @@ var Api = M.require( 'api' ).Api, user = M.require( 'user' ), endpoint = mw.config.get( 'wgMFPhotoUploadEndpoint' ), + needsFile = $( document ).find( '#mw-imagepage-nofile' ).length !== 0, PhotoApi; // Originally written by Brion for WikiLovesMonuments app @@ -129,7 +130,11 @@ ext = options.file.name.slice( options.file.name.lastIndexOf( '.' ) + 1 ), request; - options.fileName = generateFileName( options.description, '.' + ext ); + if ( needsFile ) { + options.fileName = mw.config.get( 'wgTitle' ); + } else { + options.fileName = generateFileName( options.description, '.' + ext ); + } formData.append( 'action', 'upload' ); formData.append( 'format', 'json' ); @@ -182,7 +187,7 @@ if ( data.upload.imageinfo ) { descriptionUrl = data.upload.imageinfo.descriptionurl; } - if ( options.insertInPage ) { + if ( options.insertInPage && !needsFile ) { self.updatePage( options, function( data ) { if ( !data || data.error ) { // error updating page's wikitext diff --git a/javascripts/modules/uploads/PhotoUploader.js b/javascripts/modules/uploads/PhotoUploader.js index cbedce4..d3b7063 100644 --- a/javascripts/modules/uploads/PhotoUploader.js +++ b/javascripts/modules/uploads/PhotoUploader.js @@ -3,6 +3,7 @@ user = M.require( 'user' ), popup =
[MediaWiki-commits] [Gerrit] Fixed silly regression with $job not being set in runJobs.php - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Fixed silly regression with $job not being set in runJobs.php .. Fixed silly regression with $job not being set in runJobs.php Change-Id: I2dae31574e5822b7b76bf1b04aba0063bed17944 --- M maintenance/runJobs.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index deea5ed..7c896d2 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -91,7 +91,7 @@ $blacklist = array_keys( $backoffs ); $job = $group->pop( JobQueueGroup::TYPE_DEFAULT, $flags, $blacklist ); } else { - $group->pop( $type ); // job from a single queue + $job = $group->pop( $type ); // job from a single queue } if ( $job ) { // found a job ++$jobsRun; -- To view, visit https://gerrit.wikimedia.org/r/104323 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2dae31574e5822b7b76bf1b04aba0063bed17944 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz Gerrit-Reviewer: Aaron Schulz Gerrit-Reviewer: Parent5446 Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fixed silly regression with $job not being set in runJobs.php - change (mediawiki/core)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104323 Change subject: Fixed silly regression with $job not being set in runJobs.php .. Fixed silly regression with $job not being set in runJobs.php Change-Id: I2dae31574e5822b7b76bf1b04aba0063bed17944 --- M maintenance/runJobs.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/23/104323/1 diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index deea5ed..7c896d2 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -91,7 +91,7 @@ $blacklist = array_keys( $backoffs ); $job = $group->pop( JobQueueGroup::TYPE_DEFAULT, $flags, $blacklist ); } else { - $group->pop( $type ); // job from a single queue + $job = $group->pop( $type ); // job from a single queue } if ( $job ) { // found a job ++$jobsRun; -- To view, visit https://gerrit.wikimedia.org/r/104323 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2dae31574e5822b7b76bf1b04aba0063bed17944 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add redis config for keystone in labs - change (operations/puppet)
Ryan Lane has uploaded a new change for review. https://gerrit.wikimedia.org/r/104322 Change subject: Add redis config for keystone in labs .. Add redis config for keystone in labs For testing the redis token driver with replication for tokens this change adds a redis server for keystone. Change-Id: Ia2a3bbc7dc6e02aa223b9bde780843f8a3f10322 --- M manifests/role/keystone.pp 1 file changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/22/104322/1 diff --git a/manifests/role/keystone.pp b/manifests/role/keystone.pp index e1d44d3..1fefb70 100644 --- a/manifests/role/keystone.pp +++ b/manifests/role/keystone.pp @@ -66,3 +66,16 @@ class { "openstack::keystone-service": openstack_version => $openstack_version, keystoneconfig => $keystoneconfig } } + +class role::keystone::redis::labs { +include passwords::openstack::keystone + +class { "::redis": +maxmemory => "250mb", +persist => "aof", +redis_replication => { 'nova-precise2' => 'nova-precise3' }, +password => $passwords::openstack::keystone::keystone_db_pass, +dir => "/var/lib/redis/", +auto_aof_rewrite_min_size => "64mb", +} +} -- To view, visit https://gerrit.wikimedia.org/r/104322 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2a3bbc7dc6e02aa223b9bde780843f8a3f10322 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ryan Lane ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] i18n: replace "article" by "page" - change (mediawiki...MobileFrontend)
Shirayuki has uploaded a new change for review. https://gerrit.wikimedia.org/r/104321 Change subject: i18n: replace "article" by "page" .. i18n: replace "article" by "page" Spotted by Siebrand http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Mobile-frontend-mainpage-cta-button/en http://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Mobile-frontend-mainpage-cta-prompt/en Change-Id: Ie4de56e931879e8230593ddb07287315dbdc9f90 --- M MobileFrontend.i18n.php 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/21/104321/1 diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php index 0002827..f5b7be0 100644 --- a/MobileFrontend.i18n.php +++ b/MobileFrontend.i18n.php @@ -252,7 +252,7 @@ 'mobile-frontend-changeslist-ip' => 'Anonymous user', 'mobile-frontend-changeslist-nocomment' => 'no edit summary', 'mobile-frontend-watchlist-filter-all' => 'All', - 'mobile-frontend-watchlist-filter-articles' => 'Articles', + 'mobile-frontend-watchlist-filter-articles' => 'Pages', 'mobile-frontend-watchlist-filter-talk' => 'Talk', 'mobile-frontend-watchlist-filter-other' => 'Other', 'mobile-frontend-watchlist-modified' => 'Modified $1', @@ -406,8 +406,8 @@ 'beta-feature-geonotahack-description' => 'Discover pages which are geographically nearby to the content page you are currently reading.', // Main Page - 'mobile-frontend-mainpage-cta-prompt' => 'This article needs your help!', - 'mobile-frontend-mainpage-cta-button' => 'Improve this article', + 'mobile-frontend-mainpage-cta-prompt' => 'This page needs your help!', + 'mobile-frontend-mainpage-cta-button' => 'Improve this page', ); /** Message documentation (Message documentation) -- To view, visit https://gerrit.wikimedia.org/r/104321 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie4de56e931879e8230593ddb07287315dbdc9f90 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Shirayuki ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Refactor pub/priv DNS for multi-region support - change (mediawiki...OpenStackManager)
Ryan Lane has uploaded a new change for review. https://gerrit.wikimedia.org/r/104320 Change subject: Refactor pub/priv DNS for multi-region support .. Refactor pub/priv DNS for multi-region support Public and private DNS was mostly segregated in the last refactor, but this refactoring fully segregates them into two subclasses of OpenStackNovaHost. This refactor was necessary because the code was previously getting private DNS by specifying the instanceid, but no region, which would return the incorrect record if the instanceid was identical. By splitting the classes apart it made it easier to modify the constructor for private DNS without changing the public DNS code. This change also modifies how private DNS domains are fetched. Rather than fetching a domain based on the instance ID. It fetches the domain based on the region, which simplifies the logic and number of LDAP queries. Change-Id: Idf2cc62d8916eb9e6cac218c16be76e0087d1333 --- M OpenStackManager.php M nova/OpenStackNovaController.php M nova/OpenStackNovaDomain.php M nova/OpenStackNovaHost.php M nova/OpenStackNovaInstance.php A nova/OpenStackNovaPrivateHost.php A nova/OpenStackNovaPublicHost.php M special/SpecialNovaInstance.php 8 files changed, 320 insertions(+), 336 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager refs/changes/20/104320/1 diff --git a/OpenStackManager.php b/OpenStackManager.php index 8b006b9..3077643 100644 --- a/OpenStackManager.php +++ b/OpenStackManager.php @@ -149,6 +149,8 @@ $wgAutoloadClasses['OpenStackNovaUser'] = $dir . 'nova/OpenStackNovaUser.php'; $wgAutoloadClasses['OpenStackNovaDomain'] = $dir . 'nova/OpenStackNovaDomain.php'; $wgAutoloadClasses['OpenStackNovaHost'] = $dir . 'nova/OpenStackNovaHost.php'; +$wgAutoloadClasses['OpenStackNovaPublicHost'] = $dir . 'nova/OpenStackNovaPublicHost.php'; +$wgAutoloadClasses['OpenStackNovaPrivateHost'] = $dir . 'nova/OpenStackNovaPrivateHost.php'; $wgAutoloadClasses['OpenStackNovaAddress'] = $dir . 'nova/OpenStackNovaAddress.php'; $wgAutoloadClasses['OpenStackNovaSecurityGroup'] = $dir . 'nova/OpenStackNovaSecurityGroup.php'; $wgAutoloadClasses['OpenStackNovaSecurityGroupRule'] = $dir . 'nova/OpenStackNovaSecurityGroupRule.php'; diff --git a/nova/OpenStackNovaController.php b/nova/OpenStackNovaController.php index b5cfaa6..10603b4 100644 --- a/nova/OpenStackNovaController.php +++ b/nova/OpenStackNovaController.php @@ -149,7 +149,7 @@ if ( $ret['code'] === 200 ) { $server = self::_get_property( $ret['body'], 'server' ); if ( $server ) { - return new OpenStackNovaInstance( $server, true ); + return new OpenStackNovaInstance( $server, $this->getRegion(), true ); } } return null; @@ -243,7 +243,7 @@ return $instancesarr; } foreach ( $instances as $instance ) { - $instance = new OpenStackNovaInstance( $instance, true ); + $instance = new OpenStackNovaInstance( $instance, $this->getRegion(), true ); $id = $instance->getInstanceOSId(); $instancesarr[$id] = $instance; } @@ -457,7 +457,7 @@ if ( $ret['code'] !== 202 ) { return null; } - $instance = new OpenStackNovaInstance( $ret['body']->server ); + $instance = new OpenStackNovaInstance( $ret['body']->server, $this->getRegion() ); return $instance; } diff --git a/nova/OpenStackNovaDomain.php b/nova/OpenStackNovaDomain.php index 1871456..f895f4d 100644 --- a/nova/OpenStackNovaDomain.php +++ b/nova/OpenStackNovaDomain.php @@ -190,34 +190,21 @@ } /** -* Get a domain by an instance's ID. Return null if the instance ID entry +* Get a domain by a region. Return null if the region * does not exist. * * @static * @param $instanceid * @return null|OpenStackNovaDomain */ - static function getDomainByInstanceId( $instanceid ) { - global $wgAuth; - global $wgOpenStackManagerLDAPInstanceBaseDN; - - OpenStackNovaLdapConnection::connect(); - - $result = LdapAuthenticationPlugin::ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPInstanceBaseDN, - '(associateddomain=' . $instanceid . '.*)' ); - $hostInfo = LdapAuthenticationPlugin::ldap_get_entries( $wgAuth->ldapconn, $result ); - if ( $hostInfo['count'] == "0" ) { - return null; + static function getDomainByRegion( $region ) { +
[MediaWiki-commits] [Gerrit] add templatedata api check - change (mediawiki...GWToolset)
Dan-nl has uploaded a new change for review. https://gerrit.wikimedia.org/r/104319 Change subject: add templatedata api check .. add templatedata api check based on the bug report, i have added an api check for templatedata that allows the extension to work without it. i have also updated the INSTALL instructions to reflect the current intent and limited MediaWiki tempalte use. Bug: 59085 Change-Id: Ia9d10b6de48a54f803699d296f11b177ab2174b4 --- M INSTALL M includes/Adapters/Php/MediawikiTemplatePhpAdapter.php 2 files changed, 41 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset refs/changes/19/104319/1 diff --git a/INSTALL b/INSTALL index 78c5828..30e27dd 100644 --- a/INSTALL +++ b/INSTALL @@ -2,8 +2,11 @@ = 1. Licensing -2. Requirements -3. Configuration +2. Target Wiki +3. Required Software +4. Required MediaWiki Templates +5. Recommended Extensions +6. Configuration a. php.ini b. DefaultSettings.php c. LocalSettings.php @@ -14,7 +17,7 @@ d. FileBackend Security e. Assign Users f. Image Folder Permissions -4. Hidden Categories +7. Hidden Categories Licensing @@ -22,14 +25,43 @@ Licensed under GNU GPL. See LICENSE.txt for more license information. -Requirements - +Target Wiki +--- +GWToolset was designed with the intention of running on http://commons.wikimedia.org, thus, if +you are installing it on another wiki you may need to first install extensions and import +MediaWiki templates used on Commons. + + +Required Software +- * MediaWiki >= 1.21 * PHP >= 5.3.3 * [PHP cURL support]( http://www.php.net/manual/en/curl.setup.php ) * [PHP finfo extension]( http://www.php.net/manual/en/fileinfo.setup.php ) +Required MediaWiki Templates + +In order for GWToolset to map metadata with a MediaWiki template, the MediaWiki template must be +installed in the wiki. Currently, GWToolset is limited to mapping with the following, Commons, +MediaWiki templates which should be imported or available in the wiki: + +* [Artwork] ( http://commons.wikimedia.org/wiki/Template:Artwork ) +* [Book] ( http://commons.wikimedia.org/wiki/Template:Book ) +* [Musical work] ( http://commons.wikimedia.org/wiki/Template:Muscial_work ) +* [Photograph] ( http://commons.wikimedia.org/wiki/Template:Photograph ) +* [Specimen] ( http://commons.wikimedia.org/wiki/Template:Specimen ) + + +Recommended Extensions +-- +Installing these extensions will give GWToolset the ability to use the most up to date +MediaWiki template parameters as long as that template provides TemplateData. + +* [Scribunto] ( http://www.mediawiki.org/wiki/Extension:Scribunto ) +* [TemplateData] ( http://www.mediawiki.org/wiki/Extension:TemplateData ) + + Configuration - ### `php.ini` diff --git a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php index 3fa1413..5f60d3b 100644 --- a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php +++ b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php @@ -98,8 +98,11 @@ */ protected function retrieveTemplateData( Title $Title ) { $result = null; + global $wgAPIModules, $wgRequest; - global $wgRequest; + if ( !array_key_exists( 'templatedata', $wgAPIModules ) ) { + return $result; + } $Api = new ApiMain( new DerivativeRequest( -- To view, visit https://gerrit.wikimedia.org/r/104319 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9d10b6de48a54f803699d296f11b177ab2174b4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GWToolset Gerrit-Branch: master Gerrit-Owner: Dan-nl ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Debug toolbar profiler timeline - change (mediawiki/core)
EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/104318 Change subject: Debug toolbar profiler timeline .. Debug toolbar profiler timeline This adds a new pane for the debug toolbar labeled Profiler. It groups together events sent to wfProfileIn/Out and draws a timeline giving a visual representation of what the page was doing at a particular point in time. This is mostly inspired by, and some code reused from, the WebProfilerBundle for symfony2. Change-Id: I23a0ce4137abcd74ad87967fb263214c08cb9685 --- M includes/debug/Debug.php M includes/profiler/Profiler.php M resources/Resources.php M resources/mediawiki/mediawiki.debug.js A resources/mediawiki/mediawiki.profile.js 5 files changed, 345 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/18/104318/1 diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index d0f8916..1ee541b 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -547,6 +547,7 @@ 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ), 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ), 'includes' => self::getFilesIncluded( $context ), + 'profile' => Profiler::instance()->getRawData(), ); } } diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 235a5ad..ef84bc0 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -96,7 +96,7 @@ */ class Profiler { protected $mStack = array(), $mWorkStack = array(), $mCollated = array(), - $mCalls = array(), $mTotals = array(); + $mCalls = array(), $mTotals = array(), $mPeriods = array(); protected $mTimeMetric = 'wall'; protected $mProfileID = false, $mCollateDone = false, $mTemplated = false; @@ -556,6 +556,7 @@ $this->mMin[$fname] = 1 << 24; $this->mMax[$fname] = 0; $this->mOverhead[$fname] = 0; + $this->mPeriods[$fname] = array(); } $this->mCollated[$fname] += $elapsed; @@ -564,6 +565,7 @@ $this->mMin[$fname] = min( $this->mMin[$fname], $elapsed ); $this->mMax[$fname] = max( $this->mMax[$fname], $elapsed ); $this->mOverhead[$fname] += $subcalls; + $this->mPeriods[$fname][] = compact( 'start', 'end' ); } $this->mCalls['-overhead-total'] = $profileCount; @@ -608,6 +610,33 @@ return $prof; } + function getRawData() { + $this->collateData(); + + $output = array(); + $total = isset( $this->mCollated['-total'] ) ? $this->mCollated['-total'] : 0; + foreach ( $this->mCollated as $fname => $elapsed ) { + $periods = array(); + foreach ( $this->mPeriods[$fname] as $period ) { + $periods[] = array( + 'start' => $period['start'] * 1000, + 'end' => $period['end'] * 1000, + ); + } + $output[$fname] = array( + 'calls' => $this->mCalls[$fname], + 'elapsed' => $elapsed * 1000, + 'percent' => $total ? 100. * $elapsed / $total : 0, + 'memory' => $this->mMemory[$fname], + 'min' => $this->mMin[$fname] * 1000, + 'max' => $this->mMax[$fname] * 1000, + 'overhead' => $this->mOverhead[$fname], + 'periods' => $periods, + ); + } + return $output; + } + /** * Dummy calls to wfProfileIn/wfProfileOut to calculate its overhead */ diff --git a/resources/Resources.php b/resources/Resources.php index d79b29b..e8ba975 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -700,7 +700,7 @@ ), ), 'mediawiki.debug' => array( - 'scripts' => 'resources/mediawiki/mediawiki.debug.js', + 'scripts' => array( 'resources/mediawiki/mediawiki.debug.js', 'resources/mediawiki/mediawiki.profile.js' ), 'styles' => 'resources/mediawiki/mediawiki.debug.css', 'dependencies' => 'jquery.footHovzer', 'position' => 'bottom', diff --git a/resources/mediawiki/mediawiki.debug.js b/resources/mediawiki/
[MediaWiki-commits] [Gerrit] i18n: consistency tweaks - change (mediawiki...MobileFrontend)
jenkins-bot has submitted this change and it was merged. Change subject: i18n: consistency tweaks .. i18n: consistency tweaks * remove full-stops * add GENDER support and use an output mode per https://www.mediawiki.org/wiki/Manual:Messages_API Spotted by Siebrand * https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Mobile-frontend-history-no-results/en * https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Mobile-frontend-profile-usertalk/en Spotted by Ebraminio * https://translatewiki.net/wiki/Thread:Support/MediaWiki:Mobile-frontend-last-modified-with-user-minutes/en Change-Id: I27767f015c83996765ca5381cee56e76e7e73fcc --- M MobileFrontend.i18n.php 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php index 3154f0a..9a50c32 100644 --- a/MobileFrontend.i18n.php +++ b/MobileFrontend.i18n.php @@ -98,7 +98,7 @@ 'mobile-frontend-history' => 'View edit history of this page.', 'mobile-frontend-history-404-title' => 'No such page', 'mobile-frontend-history-404-desc' => "Cannot look at history for a page that doesn't exist. It may have been deleted or you may have followed a bad link.", - 'mobile-frontend-history-no-results' => 'No history matches the filter provided.', + 'mobile-frontend-history-no-results' => 'The filter provided no history matches.', 'mobile-frontend-contribution-summary' => 'All edits made by {{GENDER:$1|[[Special:UserProfile/$1|$1]]}}', 'mobile-frontend-history-summary' => 'Page history for [[:$1]]', 'mobile-frontend-last-modified-date' => 'Last modified on $1, at $2', @@ -110,12 +110,12 @@ 'mobile-frontend-last-modified-years' => 'Last modified {{PLURAL:$1|$1 year|$1 years}} ago', 'mobile-frontend-last-modified-just-now' => 'Last modified just now', 'mobile-frontend-last-modified-with-user-seconds' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 second|$3 seconds}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', - 'mobile-frontend-last-modified-with-user-minutes' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 minute|$3 minutes}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}.', + 'mobile-frontend-last-modified-with-user-minutes' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 minute|$3 minutes}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', 'mobile-frontend-last-modified-with-user-hours' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 hour|$3 hours}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', 'mobile-frontend-last-modified-with-user-days' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 day|$3 days}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', 'mobile-frontend-last-modified-with-user-months' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 month|$3 months}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', 'mobile-frontend-last-modified-with-user-years' => '[$4 Last {{GENDER:$1|edited}} {{PLURAL:$3|$3 year|$3 years}} ago] by {{PLURAL:$5|[$6 $2]|0=an anonymous user}}', - 'mobile-frontend-last-modified-with-user-just-now' => '[$3 Last {{GENDER:$1|edited}}] just now by {{PLURAL:$4|[$5 $2]|0=an anonymous user}}.', + 'mobile-frontend-last-modified-with-user-just-now' => '[$3 Last {{GENDER:$1|edited}}] just now by {{PLURAL:$4|[$5 $2]|0=an anonymous user}}', 'mobile-frontend-learn-more' => 'Learn more', 'mobile-frontend-view-source' => 'View source', // account creation @@ -383,7 +383,7 @@ // Special:UserProfile 'mobile-frontend-profile-title' => 'User profile', 'mobile-frontend-profile-last-upload-caption' => '{{GENDER:$2|Uploaded}} {{PLURAL:$1|yesterday|$1 days ago|0=today}}.', - 'mobile-frontend-profile-usertalk' => 'Talk to $1', + 'mobile-frontend-profile-usertalk' => 'Talk to {{GENDER:$1|$1}}', 'mobile-frontend-profile-error' => "Oh no!", 'mobile-frontend-profile-noargs' => 'No username was given. Please provide a username to view a profile.', 'mobile-frontend-profile-nouser' => 'No user with this name exists. Usernames are case sensitive so please check if it has been typed correctly.', -- To view, visit https://gerrit.wikimedia.org/r/103643 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I27767f015c83996765ca5381cee56e76e7e73fcc Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Shirayuki Gerrit-Reviewer: JGonera Gerrit-Reviewer: Jdlrobson Gerrit-Reviewer: MaxSem Gerrit-Reviewer: Shirayuki Gerrit-Reviewer: Siebrand Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.or
[MediaWiki-commits] [Gerrit] Setup and enabled redisLockManager for all file backends in use - change (operations/mediawiki-config)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104317 Change subject: Setup and enabled redisLockManager for all file backends in use .. Setup and enabled redisLockManager for all file backends in use Change-Id: I35446d660426c067fbb2e0b1ee34d33d7aa8dfac --- M wmf-config/filebackend.php 1 file changed, 20 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/17/104317/1 diff --git a/wmf-config/filebackend.php b/wmf-config/filebackend.php index 16c4177..52da277 100644 --- a/wmf-config/filebackend.php +++ b/wmf-config/filebackend.php @@ -136,7 +136,7 @@ 'class' => 'FileBackendMultiWrite', 'name'=> 'local-multiwrite', 'wikiId' => "{$site}-{$lang}", - 'lockManager' => 'nullLockManager', # LocalFile uses FOR UPDATE + 'lockManager' => 'redisLockManager', 'fileJournal' => array( 'class' => 'DBFileJournal', 'wiki' => $wgDBname, 'ttlDays' => $wmfFileJournalTTL ), 'backends'=> array( # DO NOT change the master backend unless it is fully trusted or autoRsync is off @@ -150,7 +150,7 @@ 'class' => 'FileBackendMultiWrite', 'name'=> 'shared-multiwrite', 'wikiId' => "wikipedia-commons", - 'lockManager' => 'nullLockManager', // just thumbnails + 'lockManager' => 'redisLockManager', 'fileJournal' => array( 'class' => 'DBFileJournal', 'wiki' => 'commonswiki', 'ttlDays' => $wmfFileJournalTTL ), 'backends'=> array( # DO NOT change the master backend unless it is fully trusted or autoRsync is off @@ -164,7 +164,7 @@ 'class' => 'FileBackendMultiWrite', 'name'=> 'global-multiwrite', 'wikiId' => "global-data", - 'lockManager' => 'nullLockManager', + 'lockManager' => 'redisLockManager', 'backends'=> array( # DO NOT change the master backend unless it is fully trusted or autoRsync is off array( 'template' => 'global-swift', 'isMultiMaster' => false ), @@ -175,6 +175,23 @@ ); /* end multiwrite backend config */ +$wgLockManagers[] = array( + 'name' => 'redisLockManager', + 'class'=> 'RedisLockManager', + 'lockServers' => array( + 'rdb1' => '10.64.0.180', + 'rdb2' => '10.64.0.181', + 'rdb3' => '10.64.0.182' + ), + 'srvsByBucket' => array( + 0 => array( 'rdb1', 'rdb2', 'rdb3' ) + ), + 'redisConfig' => array( + 'connectTimeout' => 2, + 'password' => $wmgRedisPassword + ) +); + $wgLocalFileRepo = array( 'class' => 'LocalRepo', 'name' => 'local', -- To view, visit https://gerrit.wikimedia.org/r/104317 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I35446d660426c067fbb2e0b1ee34d33d7aa8dfac Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add limitation to the zoom scale factor - change (mediawiki...ProofreadPage)
jenkins-bot has submitted this change and it was merged. Change subject: Add limitation to the zoom scale factor .. Add limitation to the zoom scale factor Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9 --- M modules/jquery/jquery.prpZoom.js 1 file changed, 13 insertions(+), 1 deletion(-) Approvals: Phe: Looks good to me, but someone else must approve Tpt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/jquery/jquery.prpZoom.js b/modules/jquery/jquery.prpZoom.js index 79b1ef6..4423c81 100644 --- a/modules/jquery/jquery.prpZoom.js +++ b/modules/jquery/jquery.prpZoom.js @@ -25,7 +25,9 @@ options: { zoomStep: 6, - animationDuration: 10 + animationDuration: 10, + minScaleFactor: 0.2, + maxScaleFactor: 10 }, defaultDimensions: { @@ -54,6 +56,10 @@ width: Math.round( position.width ), height: Math.round( position.height ) }, this.options.animationDuration ); + }, + + _getScaleFactor: function( position ) { + return position.width / this.defaultDimensions.width; }, _create: function() { @@ -134,6 +140,12 @@ position.top -= proportion * this.zoomStep.height; position.width += 2 * proportion * this.zoomStep.width; position.height += 2 * proportion * this.zoomStep.height; + + var scaleFactor = this._getScaleFactor( position ); + if( this.options.minScaleFactor > scaleFactor || scaleFactor > this.options.maxScaleFactor ) { + return; + } + this._applyPosition( position ); }, -- To view, visit https://gerrit.wikimedia.org/r/104313 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ProofreadPage Gerrit-Branch: master Gerrit-Owner: Tpt Gerrit-Reviewer: Phe Gerrit-Reviewer: Tpt Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Removed fileJournal config; this has been used for some time - change (operations/mediawiki-config)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104316 Change subject: Removed fileJournal config; this has been used for some time .. Removed fileJournal config; this has been used for some time Change-Id: I3c4bc698e5132fec4ec0b8ea36ecd68e51cd51e5 --- M wmf-config/filebackend.php 1 file changed, 0 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/16/104316/1 diff --git a/wmf-config/filebackend.php b/wmf-config/filebackend.php index 16c4177..927f257 100644 --- a/wmf-config/filebackend.php +++ b/wmf-config/filebackend.php @@ -23,7 +23,6 @@ 'name' => 'local-swift-eqiad', 'wikiId' => "{$site}-{$lang}", 'lockManager'=> 'nullLockManager', // LocalFile uses FOR UPDATE - 'fileJournal'=> array( 'class' => 'DBFileJournal', 'wiki' => $wgDBname, 'ttlDays' => $wmfFileJournalTTL ), 'swiftAuthUrl' => $wmfSwiftEqiadConfig['authUrl'], 'swiftUser' => $wmfSwiftEqiadConfig['user'], 'swiftKey' => $wmfSwiftEqiadConfig['key'], @@ -43,7 +42,6 @@ 'name' => 'shared-swift-eqiad', 'wikiId' => "wikipedia-commons", 'lockManager'=> 'nullLockManager', // just thumbnails - 'fileJournal'=> array( 'class' => 'DBFileJournal', 'wiki' => 'commonswiki', 'ttlDays' => $wmfFileJournalTTL ), 'swiftAuthUrl' => $wmfSwiftEqiadConfig['authUrl'], 'swiftUser' => $wmfSwiftEqiadConfig['user'], 'swiftKey' => $wmfSwiftEqiadConfig['key'], @@ -80,7 +78,6 @@ 'name' => 'local-swift', 'wikiId' => "{$site}-{$lang}", 'lockManager'=> 'nullLockManager', // LocalFile uses FOR UPDATE - 'fileJournal'=> array( 'class' => 'DBFileJournal', 'wiki' => $wgDBname, 'ttlDays' => $wmfFileJournalTTL ), 'swiftAuthUrl' => $wmfSwiftConfig['authUrl'], 'swiftUser' => $wmfSwiftConfig['user'], 'swiftKey' => $wmfSwiftConfig['key'], @@ -100,7 +97,6 @@ 'name' => 'shared-swift', 'wikiId' => "wikipedia-commons", 'lockManager'=> 'nullLockManager', // just thumbnails - 'fileJournal'=> array( 'class' => 'DBFileJournal', 'wiki' => 'commonswiki', 'ttlDays' => $wmfFileJournalTTL ), 'swiftAuthUrl' => $wmfSwiftConfig['authUrl'], 'swiftUser' => $wmfSwiftConfig['user'], 'swiftKey' => $wmfSwiftConfig['key'], @@ -137,7 +133,6 @@ 'name'=> 'local-multiwrite', 'wikiId' => "{$site}-{$lang}", 'lockManager' => 'nullLockManager', # LocalFile uses FOR UPDATE - 'fileJournal' => array( 'class' => 'DBFileJournal', 'wiki' => $wgDBname, 'ttlDays' => $wmfFileJournalTTL ), 'backends'=> array( # DO NOT change the master backend unless it is fully trusted or autoRsync is off array( 'template' => 'local-swift', 'isMultiMaster' => false ), @@ -151,7 +146,6 @@ 'name'=> 'shared-multiwrite', 'wikiId' => "wikipedia-commons", 'lockManager' => 'nullLockManager', // just thumbnails - 'fileJournal' => array( 'class' => 'DBFileJournal', 'wiki' => 'commonswiki', 'ttlDays' => $wmfFileJournalTTL ), 'backends'=> array( # DO NOT change the master backend unless it is fully trusted or autoRsync is off array( 'template' => 'shared-swift', 'isMultiMaster' => false ), -- To view, visit https://gerrit.wikimedia.org/r/104316 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3c4bc698e5132fec4ec0b8ea36ecd68e51cd51e5 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] migrate; adopt DB config and SQL queries, create needed user... - change (pywikibot...drtrigonbot)
DrTrigon has submitted this change and it was merged. Change subject: migrate; adopt DB config and SQL queries, create needed user DBs on demand .. migrate; adopt DB config and SQL queries, create needed user DBs on demand Change-Id: I5d511b02fef2c0976706dfab8686a6ba090e4f06 --- M public_html/cgi-bin/sum_cat_disc.py 1 file changed, 36 insertions(+), 4 deletions(-) Approvals: DrTrigon: Verified; Looks good to me, approved diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index 94522d5..79ba434 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -186,8 +186,9 @@ """SELECT VERSION();""", ] -# https://wiki.toolserver.org/view/Database_access#wiki -_SQL_query_wiki_info = \ +if style.host(os.environ) == 'ts': +# https://wiki.toolserver.org/view/Database_access#wiki +_SQL_query_wiki_info = \ """SELECT lang, CONCAT("sql-s", server) AS dbserver, @@ -196,6 +197,20 @@ FROM toolserver.wiki WHERE family = "wikipedia" ORDER BY SIZE DESC LIMIT %s;""" +else: +# https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Help#Metadata_database +_SQL_query_wiki_info = \ +"""SELECT + lang, + slice, + dbname, + url + FROM meta_p.wiki + WHERE family = "wikipedia" + ORDER BY SIZE DESC LIMIT %s;""" + +_SQL_create_database = \ +"""CREATE DATABASE IF NOT EXISTS %s""" # === variables === === === @@ -205,6 +220,16 @@ wikitime= "%Y%m%d%H%M%S" asctime_fmt = "%a %b %d %H:%M:%S %Y" + +cnf_file= os.path.join(bot_path, "../.my.cnf") + +db_name = db_conf[0] +if style.host(os.environ) == 'labs': +import ConfigParser +config = ConfigParser.RawConfigParser() +config.read(cnf_file) +user_name = config.get('client', 'user').replace("'", "") +db_name = '%s__%s' % (user_name, db_name) # === code === === === @@ -311,7 +336,7 @@ def get_wikiinfo_db(wiki, limit=SQL_LIMIT_max): for item in read_db(_SQL_query_wiki_info, (limit,), limit): - if item[2] == (wiki + "wiki_p"): + if item[0] == wiki: return item return None @@ -416,11 +441,18 @@ site = pywikibot.getSite(wiki) +# check existence of user database (for temporary table to join with) +db = MySQLdb.connect(host=wiki+db_conf[1], read_default_file=cnf_file) +cursor = db.cursor() +call_db(_SQL_create_database % db_name) +cursor.close() +db.close() + # Establich a connection #db = MySQLdb.connect(db='enwiki_p', host="enwiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db=wiki+'wiki_p', host=wiki+"wiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") -db = MySQLdb.connect(db=db_conf[0], host=wiki+db_conf[1], read_default_file=os.path.join(bot_path, "../.my.cnf")) +db = MySQLdb.connect(db=db_name, host=wiki+db_conf[1], read_default_file=cnf_file) # prepare a cursor object using cursor() method cursor = db.cursor() -- To view, visit https://gerrit.wikimedia.org/r/104315 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5d511b02fef2c0976706dfab8686a6ba090e4f06 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon Gerrit-Reviewer: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] migrate; adopt DB config and SQL queries, create needed user... - change (pywikibot...drtrigonbot)
DrTrigon has uploaded a new change for review. https://gerrit.wikimedia.org/r/104315 Change subject: migrate; adopt DB config and SQL queries, create needed user DBs on demand .. migrate; adopt DB config and SQL queries, create needed user DBs on demand Change-Id: I5d511b02fef2c0976706dfab8686a6ba090e4f06 --- M public_html/cgi-bin/sum_cat_disc.py 1 file changed, 36 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot refs/changes/15/104315/1 diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index 94522d5..79ba434 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -186,8 +186,9 @@ """SELECT VERSION();""", ] -# https://wiki.toolserver.org/view/Database_access#wiki -_SQL_query_wiki_info = \ +if style.host(os.environ) == 'ts': +# https://wiki.toolserver.org/view/Database_access#wiki +_SQL_query_wiki_info = \ """SELECT lang, CONCAT("sql-s", server) AS dbserver, @@ -196,6 +197,20 @@ FROM toolserver.wiki WHERE family = "wikipedia" ORDER BY SIZE DESC LIMIT %s;""" +else: +# https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Help#Metadata_database +_SQL_query_wiki_info = \ +"""SELECT + lang, + slice, + dbname, + url + FROM meta_p.wiki + WHERE family = "wikipedia" + ORDER BY SIZE DESC LIMIT %s;""" + +_SQL_create_database = \ +"""CREATE DATABASE IF NOT EXISTS %s""" # === variables === === === @@ -205,6 +220,16 @@ wikitime= "%Y%m%d%H%M%S" asctime_fmt = "%a %b %d %H:%M:%S %Y" + +cnf_file= os.path.join(bot_path, "../.my.cnf") + +db_name = db_conf[0] +if style.host(os.environ) == 'labs': +import ConfigParser +config = ConfigParser.RawConfigParser() +config.read(cnf_file) +user_name = config.get('client', 'user').replace("'", "") +db_name = '%s__%s' % (user_name, db_name) # === code === === === @@ -311,7 +336,7 @@ def get_wikiinfo_db(wiki, limit=SQL_LIMIT_max): for item in read_db(_SQL_query_wiki_info, (limit,), limit): - if item[2] == (wiki + "wiki_p"): + if item[0] == wiki: return item return None @@ -416,11 +441,18 @@ site = pywikibot.getSite(wiki) +# check existence of user database (for temporary table to join with) +db = MySQLdb.connect(host=wiki+db_conf[1], read_default_file=cnf_file) +cursor = db.cursor() +call_db(_SQL_create_database % db_name) +cursor.close() +db.close() + # Establich a connection #db = MySQLdb.connect(db='enwiki_p', host="enwiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db=wiki+'wiki_p', host=wiki+"wiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") -db = MySQLdb.connect(db=db_conf[0], host=wiki+db_conf[1], read_default_file=os.path.join(bot_path, "../.my.cnf")) +db = MySQLdb.connect(db=db_name, host=wiki+db_conf[1], read_default_file=cnf_file) # prepare a cursor object using cursor() method cursor = db.cursor() -- To view, visit https://gerrit.wikimedia.org/r/104315 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d511b02fef2c0976706dfab8686a6ba090e4f06 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix section hash url lost after reloading page in alpha - change (mediawiki...MobileFrontend)
jenkins-bot has submitted this change and it was merged. Change subject: Fix section hash url lost after reloading page in alpha .. Fix section hash url lost after reloading page in alpha Bug: 57329 Change-Id: I4ff941de8663557009fda4fe46ae4bbf82074015 --- M javascripts/common/history-alpha.js 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jdlrobson: Looks good to me, approved jenkins-bot: Verified diff --git a/javascripts/common/history-alpha.js b/javascripts/common/history-alpha.js index daacd71..5f299cd 100644 --- a/javascripts/common/history-alpha.js +++ b/javascripts/common/history-alpha.js @@ -28,7 +28,7 @@ currentUrl = mw.util.getUrl( title, M.query ); // initial history state does not contain title // run before binding to avoid nasty surprises - History.replaceState( null, title, currentUrl ); + History.replaceState( null, title, currentUrl + location.hash ); // Bind to future StateChange Events History.Adapter.bind( window, 'statechange', function(){ -- To view, visit https://gerrit.wikimedia.org/r/104314 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4ff941de8663557009fda4fe46ae4bbf82074015 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: M4tx Gerrit-Reviewer: Jdlrobson 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 insertables matching - change (mediawiki...Translate)
jenkins-bot has submitted this change and it was merged. Change subject: Fix insertables matching .. Fix insertables matching * Variable names containing hyphen aren't truncated now Bug: 58746 Change-Id: I292f0ba6195bd3a49408a90284e1c507910c83e5 --- M insertables/TranslatablePageInsertablesSuggester.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/insertables/TranslatablePageInsertablesSuggester.php b/insertables/TranslatablePageInsertablesSuggester.php index 9836cc2..7acc35c 100644 --- a/insertables/TranslatablePageInsertablesSuggester.php +++ b/insertables/TranslatablePageInsertablesSuggester.php @@ -17,7 +17,7 @@ // allowed in a variable name, but here we are stricter to avoid too many // false positives. $matches = array(); - preg_match_all( '/\$([a-z0-9])+/', $text, $matches, PREG_SET_ORDER ); + preg_match_all( '/\$([a-z0-9-])+/', $text, $matches, PREG_SET_ORDER ); $new = array_map( function ( $match ) { // Numerical ones are already handled by parent if ( ctype_digit( $match[1] ) ) { -- To view, visit https://gerrit.wikimedia.org/r/103743 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I292f0ba6195bd3a49408a90284e1c507910c83e5 Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: M4tx Gerrit-Reviewer: Amire80 Gerrit-Reviewer: KartikMistry Gerrit-Reviewer: M4tx Gerrit-Reviewer: Nemo bis Gerrit-Reviewer: Nikerabbit Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Some test readme changes and cleanup dup tests - change (mediawiki...CirrusSearch)
jenkins-bot has submitted this change and it was merged. Change subject: Some test readme changes and cleanup dup tests .. Some test readme changes and cleanup dup tests Change-Id: Icd314a89401fea86d254bf86fe8a84f62c981546 --- M tests/browser/README M tests/browser/features/full_text.feature 2 files changed, 45 insertions(+), 55 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/browser/README b/tests/browser/README index 82e5cdb..60b46e3 100644 --- a/tests/browser/README +++ b/tests/browser/README @@ -26,47 +26,70 @@ mediawiki directory: php maintenance/createAndPromote.php --force --sysop Selenium_user selenium123 -You can override the password by creating /private/wmf/secret.yml or -config/secret.yml in the format: - mediawiki_username: Selenium_user - mediawiki_password: selenium123 -While you could technically just change config.yml that wouldn't be a good idea -because it'd be too easy to accidentally commit your password. +Back on the machine that will be running the tests you'll have to setup the +environment variables that contain connection information. In bash you'd do +this: + export MEDIAWIKI_USER=Selenium_user + export MEDIAWIKI_PASSWORD=selenium123 + export MEDIAWIKI_URL=http:///wiki/ -Some tests use instant commans. You should make sure mediawiki is configured -to allow this. If you are using this: -https://wikitech.wikimedia.org/wiki/Help:Single_Node_MediaWiki -then you'll just need to switch - $wgUseInstantCommons = false; -to - $wgUseInstantCommons = true; -in orig/LocalSettings.php - -And some tests require Ogg support. Install it too On single node -mediawiki you can do this: - pushd /srv/ +You'll have to install a bunch of plugins and set up the search index for all +the tests to pass. In bash you'd do this (assuming your mediawiki install path +is /srv/mediawiki and you are using debian/ubuntu): + export MW_INSTALL_PATH=/srv/mediawiki + pushd $MW_INSTALL_PATH/.. + if [ ! -d Elastica ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Elastica; fi + pushd Elastica + git submodule update --init --recursive + popd + if [ ! -d CirrusSearch ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CirrusSearch; fi if [ ! -d TimedMediaHandler ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TimedMediaHandler; fi if [ ! -d MwEmbedSupport ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MwEmbedSupport; fi - if [ ! -d PdfHander ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHander; fi + if [ ! -d PdfHandler ]; then git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler; fi pushd mediawiki/extensions + if [ ! -d Elastica ]; then ln -s ../../Elastica; fi + if [ ! -d CirrusSearch ]; then ln -s ../../CirrusSearch; fi if [ ! -d TimedMediaHandler ]; then ln -s ../../TimedMediaHandler; fi if [ ! -d MwEmbedSupport ]; then ln -s ../../MwEmbedSupport; fi - if [ ! -d PdfHander ]; then ln -s ../../PdfHander; fi + if [ ! -d PdfHandler ]; then ln -s ../../PdfHandler; fi sudo su -c 'crontab -u www-data -l' > /tmp/www-data-crontab echo '* * * * * php /srv/mediawiki/maintenance/runJobs.php --type webVideoTranscode --maxjobs 1 >> /tmp/mw-transcode-log' >> /tmp/www-data-crontab echo '0 0 * * * rm /tmp/mw-transcode-log' >> /tmp/www-data-crontab sort /tmp/www-data-crontab | uniq | sudo su -c 'crontab -u www-data -' rm /tmp/www-data-crontab - sudo apt-get install -y oggvideotools ffmpeg ffmpeg2theora libav-tools libavcodec-extra-53 imagemagick ghostscript xpdf-utils + sudo apt-get install -y oggvideotools ffmpeg ffmpeg2theora libav-tools libavcodec-extra-53 imagemagick ghostscript xpdf-utils php5-curl popd + php CirrusSearch/maintenance/updateSearchIndexConfig.php + php CirrusSearch/maintenance/forceSearchIndex.php --forceUpdate --skipLinks --indexOnSkip + php CirrusSearch/maintenance/forceSearchIndex.php --forceUpdate --skipParse popd -Then add this to your localsettings: + sudo /etc/init.d/apache2 restart + + +Then add this to your LocalSettings.php: + require( "$IP/extensions/Elastica/Elastica.php" ); + require( "$IP/extensions/CirrusSearch/CirrusSearch.php" ); require( "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php" ); require( "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php" ); require_once("$IP/extensions/PdfHandler/PdfHandler.php"); + $wgSearchType = 'CirrusSearch'; $wgOggThumbLocation = '/usr/bin/oggThumb'; $wgGroupPermissions['*']['deleterevision'] = true; $wgFileExtensions[] = 'pdf'; + $wgShowExceptionDetails = true; + $wgDebugLogFile = '/tmp/mw-log'; + +Replace: + $wgUseInstantCommons = false +with + $wgUseInstantCommons = true; +and replace: + $wgEnableUploads = false +with + $wgEnableUploads = true; + +And add an Elasticsearch server, for example: + $wgCirrusSearchServers = array( '10.4.1.5
[MediaWiki-commits] [Gerrit] Fix section hash url lost after reloading page in alpha - change (mediawiki...MobileFrontend)
M4tx has uploaded a new change for review. https://gerrit.wikimedia.org/r/104314 Change subject: Fix section hash url lost after reloading page in alpha .. Fix section hash url lost after reloading page in alpha Bug: 57329 Change-Id: I4ff941de8663557009fda4fe46ae4bbf82074015 --- M javascripts/common/history-alpha.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/14/104314/1 diff --git a/javascripts/common/history-alpha.js b/javascripts/common/history-alpha.js index daacd71..5f299cd 100644 --- a/javascripts/common/history-alpha.js +++ b/javascripts/common/history-alpha.js @@ -28,7 +28,7 @@ currentUrl = mw.util.getUrl( title, M.query ); // initial history state does not contain title // run before binding to avoid nasty surprises - History.replaceState( null, title, currentUrl ); + History.replaceState( null, title, currentUrl + location.hash ); // Bind to future StateChange Events History.Adapter.bind( window, 'statechange', function(){ -- To view, visit https://gerrit.wikimedia.org/r/104314 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4ff941de8663557009fda4fe46ae4bbf82074015 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: M4tx ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add limitation to the zoom scale factor - change (mediawiki...ProofreadPage)
Tpt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104313 Change subject: Add limitation to the zoom scale factor .. Add limitation to the zoom scale factor Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9 --- M modules/jquery/jquery.prpZoom.js 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage refs/changes/13/104313/1 diff --git a/modules/jquery/jquery.prpZoom.js b/modules/jquery/jquery.prpZoom.js index 79b1ef6..4423c81 100644 --- a/modules/jquery/jquery.prpZoom.js +++ b/modules/jquery/jquery.prpZoom.js @@ -25,7 +25,9 @@ options: { zoomStep: 6, - animationDuration: 10 + animationDuration: 10, + minScaleFactor: 0.2, + maxScaleFactor: 10 }, defaultDimensions: { @@ -54,6 +56,10 @@ width: Math.round( position.width ), height: Math.round( position.height ) }, this.options.animationDuration ); + }, + + _getScaleFactor: function( position ) { + return position.width / this.defaultDimensions.width; }, _create: function() { @@ -134,6 +140,12 @@ position.top -= proportion * this.zoomStep.height; position.width += 2 * proportion * this.zoomStep.width; position.height += 2 * proportion * this.zoomStep.height; + + var scaleFactor = this._getScaleFactor( position ); + if( this.options.minScaleFactor > scaleFactor || scaleFactor > this.options.maxScaleFactor ) { + return; + } + this._applyPosition( position ); }, -- To view, visit https://gerrit.wikimedia.org/r/104313 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8a9e6059dfa13506b12b878c279ca6192918fde9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ProofreadPage Gerrit-Branch: master Gerrit-Owner: Tpt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Tools: Remove obsolete tyrant class/role - change (operations/puppet)
coren has submitted this change and it was merged. Change subject: Tools: Remove obsolete tyrant class/role .. Tools: Remove obsolete tyrant class/role Change-Id: I639206cbfb03a705f9861134eae819ca8d630bad --- M manifests/role/labs.pp M modules/toollabs/manifests/exec_environ.pp D modules/toollabs/manifests/tyrant.pp 3 files changed, 0 insertions(+), 37 deletions(-) Approvals: coren: Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/role/labs.pp b/manifests/role/labs.pp index 58e1f8f..418bc0f 100644 --- a/manifests/role/labs.pp +++ b/manifests/role/labs.pp @@ -80,12 +80,5 @@ } } - class tyrant inherits role::labs::tools::config { -system::role { "role::labs::tools::tyrant": description => "Tool Labs UWSGI emperor" } -class { 'toollabs::tyrant': - gridmaster => $grid_master, -} - } - } # class role::labs::tools diff --git a/modules/toollabs/manifests/exec_environ.pp b/modules/toollabs/manifests/exec_environ.pp index c4ff43b..5327e9c 100644 --- a/modules/toollabs/manifests/exec_environ.pp +++ b/modules/toollabs/manifests/exec_environ.pp @@ -156,7 +156,6 @@ 'python-sqlalchemy', 'python-twitter', 'python-twisted', -'python-uwsgi', 'python-virtualenv', 'python-wadllib', 'python-webpy', diff --git a/modules/toollabs/manifests/tyrant.pp b/modules/toollabs/manifests/tyrant.pp deleted file mode 100644 index 8c9298b..000 --- a/modules/toollabs/manifests/tyrant.pp +++ /dev/null @@ -1,29 +0,0 @@ -# Class: toollabs::tyrant -# -# This role sets up a node as an UWSGI tyrant -# -# Parameters: -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -class toollabs::tyrant($gridmaster) inherits toollabs { -include toollabs::infrastructure, -toollabs::exec_environ -class { 'gridengine::submit_host': -gridmaster => $gridmaster, -} - -file { "${store}/submithost-${fqdn}": -ensure => file, -owner => 'root', -group => 'root', -mode=> '0444', -require => File[$store], -content => "${ipaddress}\n", -} -} - -- To view, visit https://gerrit.wikimedia.org/r/104219 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I639206cbfb03a705f9861134eae819ca8d630bad Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Tim Landscheidt Gerrit-Reviewer: Tim Landscheidt Gerrit-Reviewer: Yuvipanda Gerrit-Reviewer: coren Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Tools: Remove obsolete tyrant class/role - change (operations/puppet)
Tim Landscheidt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104219 Change subject: Tools: Remove obsolete tyrant class/role .. Tools: Remove obsolete tyrant class/role Change-Id: I639206cbfb03a705f9861134eae819ca8d630bad --- M manifests/role/labs.pp M modules/toollabs/manifests/exec_environ.pp D modules/toollabs/manifests/tyrant.pp 3 files changed, 0 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/19/104219/1 diff --git a/manifests/role/labs.pp b/manifests/role/labs.pp index 58e1f8f..418bc0f 100644 --- a/manifests/role/labs.pp +++ b/manifests/role/labs.pp @@ -80,12 +80,5 @@ } } - class tyrant inherits role::labs::tools::config { -system::role { "role::labs::tools::tyrant": description => "Tool Labs UWSGI emperor" } -class { 'toollabs::tyrant': - gridmaster => $grid_master, -} - } - } # class role::labs::tools diff --git a/modules/toollabs/manifests/exec_environ.pp b/modules/toollabs/manifests/exec_environ.pp index c4ff43b..5327e9c 100644 --- a/modules/toollabs/manifests/exec_environ.pp +++ b/modules/toollabs/manifests/exec_environ.pp @@ -156,7 +156,6 @@ 'python-sqlalchemy', 'python-twitter', 'python-twisted', -'python-uwsgi', 'python-virtualenv', 'python-wadllib', 'python-webpy', diff --git a/modules/toollabs/manifests/tyrant.pp b/modules/toollabs/manifests/tyrant.pp deleted file mode 100644 index 8c9298b..000 --- a/modules/toollabs/manifests/tyrant.pp +++ /dev/null @@ -1,29 +0,0 @@ -# Class: toollabs::tyrant -# -# This role sets up a node as an UWSGI tyrant -# -# Parameters: -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -class toollabs::tyrant($gridmaster) inherits toollabs { -include toollabs::infrastructure, -toollabs::exec_environ -class { 'gridengine::submit_host': -gridmaster => $gridmaster, -} - -file { "${store}/submithost-${fqdn}": -ensure => file, -owner => 'root', -group => 'root', -mode=> '0444', -require => File[$store], -content => "${ipaddress}\n", -} -} - -- To view, visit https://gerrit.wikimedia.org/r/104219 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I639206cbfb03a705f9861134eae819ca8d630bad Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Tim Landscheidt ___ 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...WikiLexicalData)
Kipcool 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: I705bf4f592a20ada7d5d79b3ea1af7df4c673e2d --- M SpecialLanguages.php M includes/specials/SpecialDatasearch.php 2 files changed, 3 insertions(+), 3 deletions(-) Approvals: Kipcool: Verified; Looks good to me, approved diff --git a/SpecialLanguages.php b/SpecialLanguages.php index ffca153..c36a0cb 100644 --- a/SpecialLanguages.php +++ b/SpecialLanguages.php @@ -64,7 +64,7 @@ } function showForm() { global $wgOut; - $action = $this->getTitle()->escapeLocalURL( 'action=submit' ); + $action = $this->getPageTitle()->escapeLocalURL( 'action=submit' ); $wgOut->addHTML( << diff --git a/includes/specials/SpecialDatasearch.php b/includes/specials/SpecialDatasearch.php index 6e55349..4cf60c1 100644 --- a/includes/specials/SpecialDatasearch.php +++ b/includes/specials/SpecialDatasearch.php @@ -459,7 +459,7 @@ unset( $prevQuery['offset'] ); } $prevLink = Linker::linkKnown( - $this->getTitle(), + $this->getPageTitle(), $prevText, array(), $prevQuery @@ -485,7 +485,7 @@ $nextOffset = $this->offset + $this->limit; $nextQuery['offset'] = $nextOffset; $nextLink = Linker::linkKnown( - $this->getTitle(), + $this->getPageTitle(), $nextText, array(), $nextQuery -- To view, visit https://gerrit.wikimedia.org/r/104002 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I705bf4f592a20ada7d5d79b3ea1af7df4c673e2d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikiLexicalData Gerrit-Branch: master Gerrit-Owner: Legoktm Gerrit-Reviewer: Kipcool ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update nginx configuration for improved security and SSL per... - change (translatewiki)
Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/104218 Change subject: Update nginx configuration for improved security and SSL performance .. Update nginx configuration for improved security and SSL performance Change-Id: Iaae263230e251757b892709c90774f4d9257078f --- M puppet/modules/nginx/files/nginx.conf M puppet/modules/nginx/files/translatewiki.net 2 files changed, 53 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/18/104218/1 diff --git a/puppet/modules/nginx/files/nginx.conf b/puppet/modules/nginx/files/nginx.conf index 713d1ff..318a5a0 100644 --- a/puppet/modules/nginx/files/nginx.conf +++ b/puppet/modules/nginx/files/nginx.conf @@ -4,6 +4,36 @@ worker_processes 1; pid /var/run/nginx.pid; +# Some settings thanks to https://gist.github.com/plentz/6737338 +# Blog post: http://tautt.com/best-nginx-configuration-for-security/ + +#don't send the nginx version number in error pages and Server header +server_tokens off; + +# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security +# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping +add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; + +# config to don't allow the browser to render the page inside an frame or iframe +# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking +# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri +# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options +add_header X-Frame-Options SAMEORIGIN; + +# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, +# to disable content-type sniffing on some browsers. +# https://www.owasp.org/index.php/List_of_useful_HTTP_headers +# currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx +# http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx +# 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020 +add_header X-Content-Type-Options nosniff; + +# This header enables the Cross-site scripting (XSS) filter built into most recent web browsers. +# It's usually enabled by default anyway, so the role of this header is to re-enable the filter for +# this particular website if it was disabled by the user. +# https://www.owasp.org/index.php/List_of_useful_HTTP_headers +add_header X-XSS-Protection "1; mode=block"; + events { worker_connections 2048; } diff --git a/puppet/modules/nginx/files/translatewiki.net b/puppet/modules/nginx/files/translatewiki.net index d291e1e..45f3b73 100644 --- a/puppet/modules/nginx/files/translatewiki.net +++ b/puppet/modules/nginx/files/translatewiki.net @@ -8,9 +8,30 @@ ssl_certificate /etc/ssl/private/translatewiki.net.pem; ssl_certificate_key /etc/ssl/private/translatewiki.net.key; - ssl_ciphers RC4:HIGH:!aNULL:!MD5; + + # enable session resumption to improve https performance + # http://vincent.bernat.im/en/blog/2011-ssl-session-reuse-rfc5077.html + ssl_session_cache shared:SSL:50m; + ssl_session_timeout 5m; + + # Diffie-Hellman parameter for DHE ciphersuites, 2048 bits + ssl_dhparam /etc/nginx/ssl/dhparam.pem; + ssl_session_timeout 5m; + + # enables server-side protection from BEAST attacks + # http://blog.ivanristic.com/2013/09/is-beast-still-a-threat.html ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:1m; + # disable SSLv3(enabled by default since nginx 0.8.19) since it's less secure then TLS http://en.wikipedia.org/wiki/Secure_Sockets_Layer#SSL_3.0 + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + # ciphers chosen for forward secrecy and compatibility + # http://blog.ivanristic.com/2013/08/configuring-apache-nginx-and-openssl-for-forward-secrecy.html + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK'; + + # enable ocsp stapling (mechanism by which a site can convey certificate revocation information to visitors in a privacy-preserving, scalable manner) + # http://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox/ + ssl_stapling on; + ssl_trusted_certificate /etc/nginx/ssl/star_forgott_co
[MediaWiki-commits] [Gerrit] Replace some deprecated functions - change (mediawiki...SemanticPageMaker)
Hoo man has submitted this change and it was merged. Change subject: Replace some deprecated functions .. Replace some deprecated functions Most notibly remove the use of WikiError classes. Change-Id: Ib5e9bc7f21c41d98783dc9b48744b526e8ce79b2 --- M specials/WidgetAssembler/SPM_UploadWindow.php 1 file changed, 22 insertions(+), 21 deletions(-) Approvals: Hoo man: Verified; Looks good to me, approved diff --git a/specials/WidgetAssembler/SPM_UploadWindow.php b/specials/WidgetAssembler/SPM_UploadWindow.php index a87827c..e3fd5c6 100644 --- a/specials/WidgetAssembler/SPM_UploadWindow.php +++ b/specials/WidgetAssembler/SPM_UploadWindow.php @@ -262,16 +262,15 @@ if ( !$wgUser->isAllowed( 'upload' ) ) { if ( !$wgUser->isLoggedIn() ) { $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); + return; } else { - $wgOut->permissionRequired( 'upload' ); + throw new PermissionsError( 'upload' ); } - return; } # Check blocks if ( $wgUser->isBlocked() ) { - $wgOut->blockedPage(); - return; + throw new UserBlockedError( $wgUser->mBlock ); } if ( wfReadOnly() ) { @@ -380,8 +379,9 @@ * In some cases we may forbid overwriting of existing files. */ $overwrite = $this->checkOverwrite( $this->mDestName ); - if ( WikiError::isError( $overwrite ) ) { - return $this->uploadError( $overwrite->toString() ); + if ( $overwrite !== true ) { + $wgOut->showErrorPage( 'uploaderror', $overwrite ); + return; } /* Don't allow users to override the blacklist (check file extension) */ @@ -405,8 +405,8 @@ $this->checkMacBinary(); $veri = $this->verify( $this->mTempPath, $finalExt ); - if ( $veri !== true ) { // it's a wiki error... - return $this->uploadError( $veri->toString() ); + if ( $veri !== true ) { + return $this->uploadError( $veri->parse() ); } /** @@ -1104,7 +1104,7 @@ * * @param string $tmpfile the full path of the temporary file to verify * @param string $extension The filename extension that the file is to be served with -* @return mixed true of the file is verified, a WikiError object otherwise. +* @return bool|Message true of the file is verified, a Message object otherwise. */ function verify( $tmpfile, $extension ) { # magically determine mime type @@ -1118,20 +1118,20 @@ wfDebug ( "\n\nmime: <$mime> extension: <$extension>\n\n" ); # check mime type against file extension if ( !$this->verifyExtension( $mime, $extension ) ) { - return new WikiErrorMsg( 'uploadcorrupt' ); + return wfMessage( 'uploadcorrupt' ); } # check mime type blacklist global $wgMimeTypeBlacklist; if ( isset( $wgMimeTypeBlacklist ) && !is_null( $wgMimeTypeBlacklist ) && $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) { - return new WikiErrorMsg( 'filetype-badmime', htmlspecialchars( $mime ) ); + return wfMessage( 'filetype-badmime', htmlspecialchars( $mime ) ); } } # check for htmlish code and javascript if ( $this->detectScript ( $tmpfile, $mime, $extension ) ) { - return new WikiErrorMsg( 'uploadscripted' ); + return wfMessage( 'uploadscripted' ); } /** @@ -1139,7 +1139,7 @@ */ $virus = $this->detectVirus( $tmpfile ); if ( $virus ) { - return new WikiErrorMsg( 'uploadvirus', htmlspecialchars( $virus ) ); + return wfMessage( 'uploadvirus', htmlspecialchars( $virus ) ); } wfDebug( __METHOD__ . ": all clear; passing.\n" ); @@ -1425,30 +1425,31 @@ * Check if there's an overwrite conflict and, if so, if restrictions * forbid this user from performing the upload. * -* @return mixed true on success, WikiError on fail
[MediaWiki-commits] [Gerrit] bugfix; adopt DB config and access code to tool-labs - change (pywikibot...drtrigonbot)
DrTrigon has submitted this change and it was merged. Change subject: bugfix; adopt DB config and access code to tool-labs .. bugfix; adopt DB config and access code to tool-labs Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d --- M fabfile.py M public_html/cgi-bin/ps_wikinew.py M public_html/cgi-bin/sum_cat_disc.py 3 files changed, 7 insertions(+), 1 deletion(-) Approvals: DrTrigon: Verified; Looks good to me, approved diff --git a/fabfile.py b/fabfile.py index 9ad7693..9c1dca0 100644 --- a/fabfile.py +++ b/fabfile.py @@ -172,6 +172,7 @@ local('ln -s pywikibot-drtrigonbot/.forward .forward') if LABS:# labs-tools local('ln -s pywikibot-drtrigonbot/.description .description') +local('ln -s replica.my.cnf .my.cnf') # DB config else: # toolserver local('ln -s pywikibot-drtrigonbot/warnuserquota.py warnuserquota.py') local('ln -s pywikibot-drtrigonbot/.forward+subster .forward+subster') diff --git a/public_html/cgi-bin/ps_wikinew.py b/public_html/cgi-bin/ps_wikinew.py index a3bcc88..ab2eb86 100644 --- a/public_html/cgi-bin/ps_wikinew.py +++ b/public_html/cgi-bin/ps_wikinew.py @@ -118,3 +118,6 @@ bot_path = { 'ts': ["../../pywikipedia/", "../../rewrite/"], 'labs': ["../pywikibot-compat/", "../pywikibot-core/"], } + +db_conf = { 'ts': ['u_drtrigon', "wiki-p.userdb.toolserver.org"], +'labs': ['u_drtrigon', "wiki.labsdb"], } diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index d36c7b1..94522d5 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -54,6 +54,7 @@ import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) +db_conf = style.db_conf[style.host(os.environ)] # === pywikibot framework === === === @@ -418,7 +419,8 @@ # Establich a connection #db = MySQLdb.connect(db='enwiki_p', host="enwiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db=wiki+'wiki_p', host=wiki+"wiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") -db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") +#db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") +db = MySQLdb.connect(db=db_conf[0], host=wiki+db_conf[1], read_default_file=os.path.join(bot_path, "../.my.cnf")) # prepare a cursor object using cursor() method cursor = db.cursor() -- To view, visit https://gerrit.wikimedia.org/r/104217 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon Gerrit-Reviewer: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] bugfix; adopt DB config and access code to tool-labs - change (pywikibot...drtrigonbot)
DrTrigon has uploaded a new change for review. https://gerrit.wikimedia.org/r/104217 Change subject: bugfix; adopt DB config and access code to tool-labs .. bugfix; adopt DB config and access code to tool-labs Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d --- M fabfile.py M public_html/cgi-bin/ps_wikinew.py M public_html/cgi-bin/sum_cat_disc.py 3 files changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot refs/changes/17/104217/1 diff --git a/fabfile.py b/fabfile.py index 9ad7693..9c1dca0 100644 --- a/fabfile.py +++ b/fabfile.py @@ -172,6 +172,7 @@ local('ln -s pywikibot-drtrigonbot/.forward .forward') if LABS:# labs-tools local('ln -s pywikibot-drtrigonbot/.description .description') +local('ln -s replica.my.cnf .my.cnf') # DB config else: # toolserver local('ln -s pywikibot-drtrigonbot/warnuserquota.py warnuserquota.py') local('ln -s pywikibot-drtrigonbot/.forward+subster .forward+subster') diff --git a/public_html/cgi-bin/ps_wikinew.py b/public_html/cgi-bin/ps_wikinew.py index a3bcc88..ab2eb86 100644 --- a/public_html/cgi-bin/ps_wikinew.py +++ b/public_html/cgi-bin/ps_wikinew.py @@ -118,3 +118,6 @@ bot_path = { 'ts': ["../../pywikipedia/", "../../rewrite/"], 'labs': ["../pywikibot-compat/", "../pywikibot-core/"], } + +db_conf = { 'ts': ['u_drtrigon', "wiki-p.userdb.toolserver.org"], +'labs': ['u_drtrigon', "wiki.labsdb"], } diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index d36c7b1..94522d5 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -54,6 +54,7 @@ import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) +db_conf = style.db_conf[style.host(os.environ)] # === pywikibot framework === === === @@ -418,7 +419,8 @@ # Establich a connection #db = MySQLdb.connect(db='enwiki_p', host="enwiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") #db = MySQLdb.connect(db=wiki+'wiki_p', host=wiki+"wiki-p.rrdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") -db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") +#db = MySQLdb.connect(db='u_drtrigon', host=wiki+"wiki-p.userdb.toolserver.org", read_default_file="/home/drtrigon/.my.cnf") +db = MySQLdb.connect(db=db_conf[0], host=wiki+db_conf[1], read_default_file=os.path.join(bot_path, "../.my.cnf")) # prepare a cursor object using cursor() method cursor = db.cursor() -- To view, visit https://gerrit.wikimedia.org/r/104217 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia18ee4de27c5d844f89e4de4bf20d78214c2001d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replaced catlib.Category with pywikibot.Category. - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Replaced catlib.Category with pywikibot.Category. .. Replaced catlib.Category with pywikibot.Category. Change-Id: Ib8ed2ecbcef0b7dcdaf08e9fc4b55ad817d6e280 --- M scripts/commons_link.py 1 file changed, 4 insertions(+), 5 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/commons_link.py b/scripts/commons_link.py index b318042..5b7f883 100644 --- a/scripts/commons_link.py +++ b/scripts/commons_link.py @@ -41,7 +41,6 @@ import re import pywikibot from pywikibot import pagegenerators, i18n -from pywikibot import catlib class CommonsLinkBot: @@ -108,8 +107,8 @@ try: pywikibot.output(u'\n %s ' % page.title()) commons = pywikibot.getSite().image_repository() -commonsCategory = catlib.Category(commons, - 'Category:%s' % page.title()) +commonsCategory = pywikibot.Category(commons, + 'Category:%s' % page.title()) try: getcommonscat = commonsCategory.get(get_redirect=True) commonsCategoryTitle = commonsCategory.title() @@ -178,8 +177,8 @@ namespace=start.namespace(), includeredirects=False) elif arg.startswith('-cat:'): -cat = catlib.Category(pywikibot.getSite(), - 'Category:%s' % arg[5:]) +cat = pywikibot.Category(pywikibot.getSite(), + 'Category:%s' % arg[5:]) gen = pagegenerators.CategorizedPageGenerator(cat) elif arg.startswith('-ref:'): ref = pywikibot.Page(pywikibot.getSite(), arg[5:]) -- To view, visit https://gerrit.wikimedia.org/r/104197 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib8ed2ecbcef0b7dcdaf08e9fc4b55ad817d6e280 Gerrit-PatchSet: 3 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch Gerrit-Reviewer: Ladsgroup Gerrit-Reviewer: Merlijn van Deen Gerrit-Reviewer: Xqt Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 59078) clean_sandbox.py for arz WP. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104212 Change subject: (bug 59078) clean_sandbox.py for arz WP. .. (bug 59078) clean_sandbox.py for arz WP. Change-Id: I5848e9311e1da2a8f1f40fdf89754f6e2ba23182 --- M scripts/clean_sandbox.py 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/12/104212/1 diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py index 8ee5e85..74e80af 100755 --- a/scripts/clean_sandbox.py +++ b/scripts/clean_sandbox.py @@ -51,6 +51,9 @@ 'commons': u'{{Sandbox}}\n', 'als': u'{{subst:/Vorlage}}', 'ar': u'{{عنوان الملعب}}\n', +'arz': u'{{عنوان السبوره}}\n', 'az': u'\n{{Qaralama dəftəri}}\n', 'bar': u'{{Bitte erst NACH dieser Zeile schreiben! (Begrüßungskasten)}}\r\n', 'cs': u'{{subst:/uhrabat}}', @@ -86,6 +89,7 @@ 'commons': u'Project:Sandbox', 'als': u'Project:Sandchaschte', 'ar': u'Project:ملعب', +'arz': u'Project:السبوره', 'az': u'Vikipediya:Qaralama dəftəri', 'bar': u'Project:Spuiwiesn', 'cs': u'Project:Pískoviště', -- To view, visit https://gerrit.wikimedia.org/r/104212 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5848e9311e1da2a8f1f40fdf89754f6e2ba23182 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Bug 58944 - site.mediawiki_message: support multiple messages - change (pywikibot/core)
Mpaa has uploaded a new change for review. https://gerrit.wikimedia.org/r/104211 Change subject: Bug 58944 - site.mediawiki_message: support multiple messages .. Bug 58944 - site.mediawiki_message: support multiple messages site.mediawiki_message() has been expanded to handle request of several messages. https://bugzilla.wikimedia.org/show_bug.cgi?id=58944 Change-Id: I64710f67c04a0d2b93c70d9edd472f8bab4ce309 --- M pywikibot/site.py M tests/site_tests.py 2 files changed, 54 insertions(+), 122 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/11/104211/1 diff --git a/pywikibot/site.py b/pywikibot/site.py index a090d04..85614dd 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -34,9 +34,6 @@ from pywikibot.data import api from pywikibot.exceptions import * -if sys.version_info[0] > 2: -basestring = (str,) - _logger = "wiki.site" @@ -64,7 +61,7 @@ @classmethod def name(cls, search_value): -for key, value in cls.__dict__.items(): +for key, value in cls.__dict__.iteritems(): if key == key.upper() and value == search_value: return key raise KeyError("Value %r could not be found in this enum" @@ -138,7 +135,7 @@ raise NoSuchSite("Language %s in family %s is obsolete" % (self.__code, self.__family.name)) if self.__code not in self.languages(): -if self.__family.name in list(self.__family.langs.keys()) and \ +if self.__family.name in self.__family.langs.keys() and \ len(self.__family.langs) == 1: oldcode = self.__code self.__code = self.__family.name @@ -261,12 +258,12 @@ def languages(self): """Return list of all valid language codes for this site's Family.""" -return list(self.family.langs.keys()) +return self.family.langs.keys() def validLanguageLinks(self): """Return list of language codes that can be used in interwiki links.""" -nsnames = [name for name in self.namespaces().values()] +nsnames = [name for name in self.namespaces().itervalues()] return [lang for lang in self.languages() if lang[:1].upper() + lang[1:] not in nsnames] @@ -997,20 +994,29 @@ self.login(sysop) return 'hasmsg' in self._userinfo -def mediawiki_message(self, key): -"""Return the MediaWiki message text for key "key" """ -if not key in self._msgcache: +def mediawiki_message(self, *key): +"""Return the MediaWiki message text for each key in "key". + A single message (string) is returned if only one key is requested; + a dict of messages is returned otherwise.""" +if not all(_key in self._msgcache for _key in key): msg_query = api.QueryGenerator(site=self, meta="allmessages", - ammessages=key) -for msg in msg_query: -if msg['name'] == key and not 'missing' in msg: -self._msgcache[key] = msg['*'] -break -else: -raise KeyError("Site %(self)s has no message '%(key)s'" + ammessages='|'.join(key)) +for _key in key: +for msg in msg_query: +if msg['name'] == _key and not 'missing' in msg: +self._msgcache[_key] = msg['*'] +break +else: +raise KeyError("Site %(self)s has no message '%(_key)s'" % locals()) -return self._msgcache[key] - + +if len(key) == 1: +#only one message is requested +return self._msgcache[key[0]] +else: +#several messages are requested +return dict((_key, self._msgcache[_key]) for _key in key) + def has_mediawiki_message(self, key): """Return True iff this site defines a MediaWiki message for 'key'.""" try: @@ -1381,7 +1387,6 @@ def page_isredirect(self, page): """Return True if and only if page is a redirect.""" if not hasattr(page, "_isredir"): -page._isredir = False # bug 54684 self.loadpageinfo(page) return page._isredir @@ -1411,7 +1416,7 @@ if target_title == title or "pages" not in result['query']: # no "pages" element indicates a circular redirect raise pywikibot.CircularRedirect(redirmap[title]) -pagedata = list(result['query']['pages'].values())[0] +pagedata = result['query']['pages'].values()[0] # there should be only one value in 'pages', and it is the target if self.sametitle(pagedata['title'], ta
[MediaWiki-commits] [Gerrit] Warn user when attempting to switch to desktop without cookies - change (mediawiki...MobileFrontend)
Theopolisme has uploaded a new change for review. https://gerrit.wikimedia.org/r/104210 Change subject: Warn user when attempting to switch to desktop without cookies .. Warn user when attempting to switch to desktop without cookies If user has JavaScript enabled, a warning will be shown when they click on the "Desktop" link. If JavaScript is not enabled, current behavior is for the the page to refresh in place with the mobileaction parameter set to "toggle_view_desktop" -- we watch for this and display an appropriate error. This is currently only enabled in the beta. Bug: 51277 Please enter the commit message for your changes. Lines starting Change-Id: Iaa61dee1a285249ba662f935dd257ebdfc8ca10d --- M MobileFrontend.i18n.php M includes/Resources.php M includes/skins/MinervaTemplate.php M includes/skins/SkinMobileBeta.php M javascripts/common/settings.js M javascripts/modules/mf-stop-mobile-redirect.js 6 files changed, 38 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/10/104210/1 diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php index 3154f0a..2a14ca2 100644 --- a/MobileFrontend.i18n.php +++ b/MobileFrontend.i18n.php @@ -65,6 +65,7 @@ 'mobile-frontend-view' => 'Mobile view', 'mobile-frontend-view-desktop' => 'Desktop', 'mobile-frontend-view-mobile' => 'Mobile', + 'mobile-frontend-cookies-required' => 'Cookies are required to switch to the desktop site. Please enable them and try again.', 'mobile-frontend-opt-in-explain' => 'By joining the beta, you will get access to experimental features, at the risk of encountering bugs and issues.', 'mobile-frontend-images-status' => 'Images', 'mobile-frontend-disable-images' => 'Disable images on mobile site', @@ -515,6 +516,7 @@ {{Identical|Desktop}}', 'mobile-frontend-view-mobile' => 'This appears at the bottom of the mobile page, meaning that the current view is mobile. It appears near the message {{msg-mw|Mobile-frontend-view-desktop}} and should be worded similarly. {{Identical|Mobile}}', + 'mobile-frontend-cookies-required' => 'Error message shown when user attempts to switch to the desktop site and cookies are not enabled.', 'mobile-frontend-opt-in-explain' => 'Used as description for the "Beta" in [[Special:MobileOptions]], if the beta is not enabled.', 'mobile-frontend-images-status' => 'On settings page label for turning on/off images. {{Identical|Image}}', diff --git a/includes/Resources.php b/includes/Resources.php index 7c9eeef..187b894 100644 --- a/includes/Resources.php +++ b/includes/Resources.php @@ -196,6 +196,9 @@ 'javascripts/common/settings.js', 'javascripts/modules/mf-stop-mobile-redirect.js', ), + 'messages' => array( + 'mobile-frontend-cookies-required', + ), 'position' => 'bottom', ), diff --git a/includes/skins/MinervaTemplate.php b/includes/skins/MinervaTemplate.php index c8414b8..cac3248 100644 --- a/includes/skins/MinervaTemplate.php +++ b/includes/skins/MinervaTemplate.php @@ -159,6 +159,10 @@ getOutput(); + // Warning if viewing an old revision if ( $out->getRequest()->getText( 'oldid' ) ) { $subtitle = $out->getSubtitle(); $tpl->set( '_old_revision_warning', @@ -179,5 +180,13 @@ $subtitle . Html::closeElement( 'div' ) ); } + // Warning if an attempted switch to desktop mode was unsuccessful + if ( $out->getRequest()->getText( 'mobileaction' ) === 'toggle_view_desktop' ) { + $tpl->set( '_desktop_view_error', + Html::openElement( 'div', array( 'class' => 'alert error' ) ) . + Html::element( 'p', array(), + $this->msg( 'mobile-frontend-cookies-required' )->text() ) . + Html::closeElement( 'div' ) ); + } } } diff --git a/javascripts/common/settings.js b/javascripts/common/settings.js index 29cca26..16e7dc8 100644 --- a/javascripts/common/settings.js +++ b/javascripts/common/settings.js @@ -10,6 +10,17 @@ supportsLocalStorage = false; } + function cookiesEnabled() { + $.cookie( 'TEST_COOKIE', 'test_value', { path: '/' } ); + if ( $.cookie( 'TEST_COOKIE' ) === 'test_value' ) { + $.removeCookie( 'TEST_COOKIE', { path: '/' } ); + return true; + } else { + return false; + } + + } + // FIXME: Deprecate -
[MediaWiki-commits] [Gerrit] Add 'You need cookies' message to 'Switch to desktop' link - change (mediawiki...MobileFrontend)
M4tx has uploaded a new change for review. https://gerrit.wikimedia.org/r/104209 Change subject: Add 'You need cookies' message to 'Switch to desktop' link .. Add 'You need cookies' message to 'Switch to desktop' link * When user has JavaScript enabled, an alert is shown * Otherwise, (s)he is redirected to Special:MobileEnableCookies Bug: 51277 Change-Id: I29adc92c357f0e4a5ec0df95e77a951b0c29c50a --- M MobileFrontend.i18n.php M MobileFrontend.php M includes/MobileContext.php M includes/skins/SkinMobile.php A includes/specials/SpecialMobileEnableCookies.php M javascripts/modules/mf-stop-mobile-redirect.js 6 files changed, 42 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/09/104209/1 diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php index 3154f0a..b30278d 100644 --- a/MobileFrontend.i18n.php +++ b/MobileFrontend.i18n.php @@ -398,6 +398,10 @@ 'mobile-frontend-profile-description-placeholder' => 'Why do {{GENDER:$1|you}} edit? What do {{GENDER:$1|you}} want to improve? Share {{GENDER:$1|your}} interests with others.', 'mobile-frontend-profile-edit-summary' => 'Updating user profile introduction', + // Special:MobileEnableCookies + 'mobile-frontend-enable-cookies' => 'Cookies are not enabled!', + 'mobile-frontend-enable-cookies-message' => 'You don\'t seem to have cookies enabled. Please, enable them and try again.', + // geo not a hack 'mobile-frontend-geonotahack' => 'Near this page', diff --git a/MobileFrontend.php b/MobileFrontend.php index e5b9596..a762a78 100644 --- a/MobileFrontend.php +++ b/MobileFrontend.php @@ -68,6 +68,7 @@ 'SpecialUploads' => 'specials/SpecialUploads', 'SpecialUserProfile' => 'specials/SpecialUserProfile', + 'SpecialMobileEnableCookies' => 'specials/SpecialMobileEnableCookies', 'SpecialMobileHistory' => 'specials/SpecialMobileHistory', 'SpecialMobileUserlogin' => 'specials/SpecialMobileUserlogin', 'SpecialMobileDiff' => 'specials/SpecialMobileDiff', @@ -142,6 +143,7 @@ $wgHooks['OutputPageParserOutput'][] = 'MobileFrontendHooks::onOutputPageParserOutput'; $wgSpecialPages['MobileDiff'] = 'SpecialMobileDiff'; +$wgSpecialPages['MobileEnableCookies'] = 'SpecialMobileEnableCookies'; $wgSpecialPages['MobileEditor'] = 'SpecialMobileEditor'; $wgSpecialPages['MobileOptions'] = 'SpecialMobileOptions'; $wgSpecialPages['MobileMenu'] = 'SpecialMobileMenu'; diff --git a/includes/MobileContext.php b/includes/MobileContext.php index 2427584..824ae3f 100644 --- a/includes/MobileContext.php +++ b/includes/MobileContext.php @@ -793,6 +793,11 @@ * and set a cookie to keep them on that view for subsequent requests. */ public function toggleView( $view, $temporary = false ) { + if ( !$this->getRequest()->getCookie( 'mf_cookies_enabled' ) ) { + $this->getOutput()->redirect( SpecialPage::getTitleFor( 'MobileEnableCookies' )->getFullURL() ); + return; + } + global $wgMobileUrlTemplate; $url = $this->getTitle()->getFullURL(); @@ -839,7 +844,7 @@ /** * Determine whether or not we need to toggle the view, and toggle it */ - public function checkToggleView() { + public function checkToggleView() { $mobileAction = $this->getMobileAction(); if ( $mobileAction == 'toggle_view_desktop' ) { $this->toggleView( 'desktop' ); diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php index dd19524..c4e558b 100644 --- a/includes/skins/SkinMobile.php +++ b/includes/skins/SkinMobile.php @@ -114,6 +114,8 @@ $desktop = wfMessage( 'mobile-frontend-view-desktop' )->escaped(); $mobile = wfMessage( 'mobile-frontend-view-mobile' )->escaped(); + setcookie('mf_cookies_enabled', 'true', time()+60*60*24*30); + $switcherHtml = <<{$this->getSitename()} diff --git a/includes/specials/SpecialMobileEnableCookies.php b/includes/specials/SpecialMobileEnableCookies.php new file mode 100644 index 000..d85892f --- /dev/null +++ b/includes/specials/SpecialMobileEnableCookies.php @@ -0,0 +1,14 @@ +setHeaders(); + $out = $this->getOutput(); + $out->setPageTitle( wfMessage( 'mobile-frontend-enable-cookies' )->text() ); + $out->addHTML( wfMessage( 'mobile-frontend-enable-cookies-message' )->text() ); + } +} diff --git a/javascripts/modules/mf-stop-mobile-redirect.js b/javascripts/modules/mf-stop-mobile-redirect.js index 8d7b485..1a04b1e 100644 --- a/javascripts/modules/mf-stop-mobile-redirect.js +++ b/javascripts/modules/mf-stop-mobile-redirect.js @@ -17,7 +17,21 @@ var
[MediaWiki-commits] [Gerrit] Bug 52343 - change (mediawiki...BookManagerv2)
Geek400 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104208 Change subject: Bug 52343 .. Bug 52343 Change-Id: Ia2cbae8ca3df14da8adbeeec849c52dd85822043 --- M JsonEditor.php 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2 refs/changes/08/104208/1 diff --git a/JsonEditor.php b/JsonEditor.php index 59b6b6f..cbc271b 100644 --- a/JsonEditor.php +++ b/JsonEditor.php @@ -533,6 +533,8 @@ $data[ 'sections' ] = FormatJson::decode( $this->safeUnicodeInput( $request, 'json-editor-sections' ) ); $jsonData = FormatJson::encode( (object)$data ); + /*Invalidate all constituent pages in a book - Bug 52343 */ + Title::makeTitle(1, 'foo')->purgeSquid(); return $jsonData; } } -- To view, visit https://gerrit.wikimedia.org/r/104208 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2cbae8ca3df14da8adbeeec849c52dd85822043 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BookManagerv2 Gerrit-Branch: master Gerrit-Owner: Geek400 Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 59078) clean_sandbox.py for arz WP. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104207 Change subject: (bug 59078) clean_sandbox.py for arz WP. .. (bug 59078) clean_sandbox.py for arz WP. Change-Id: If875581cebb4733b9ca3ba281ac80f6ee013c1e5 --- M scripts/clean_sandbox.py 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/07/104207/1 diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py index 8ee5e85..74e80af 100755 --- a/scripts/clean_sandbox.py +++ b/scripts/clean_sandbox.py @@ -51,6 +51,9 @@ 'commons': u'{{Sandbox}}\n', 'als': u'{{subst:/Vorlage}}', 'ar': u'{{عنوان الملعب}}\n', +'arz': u'{{عنوان السبوره}}\n', 'az': u'\n{{Qaralama dəftəri}}\n', 'bar': u'{{Bitte erst NACH dieser Zeile schreiben! (Begrüßungskasten)}}\r\n', 'cs': u'{{subst:/uhrabat}}', @@ -86,6 +89,7 @@ 'commons': u'Project:Sandbox', 'als': u'Project:Sandchaschte', 'ar': u'Project:ملعب', +'arz': u'Project:السبوره', 'az': u'Vikipediya:Qaralama dəftəri', 'bar': u'Project:Spuiwiesn', 'cs': u'Project:Pískoviště', -- To view, visit https://gerrit.wikimedia.org/r/104207 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If875581cebb4733b9ca3ba281ac80f6ee013c1e5 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [SYNC] Synchronize with compat, code improvements, enable -x... - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: [SYNC] Synchronize with compat, code improvements, enable -xml option .. [SYNC] Synchronize with compat, code improvements, enable -xml option - use mediawiki's comma-separator - remove obsolete config and catlib import - remove unused variables Change-Id: I19a6b377022e00491ba50d3d3e4a01ea0c36f507 --- M scripts/template.py 1 file changed, 18 insertions(+), 18 deletions(-) Approvals: Ladsgroup: Looks good to me, approved Huji: Checked; Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/scripts/template.py b/scripts/template.py index 3400c60..7a74685 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -98,9 +98,9 @@ """ # # (C) Daniel Herding, 2004 -# (C) Rob W.W. Hooft, 2003 -# (C) xqt, 2009-2011 -# (C) Pywikibot team, 2004-2010 +# (C) Rob W.W. Hooft, 2003-2005 +# (C) xqt, 2009-2013 +# (C) Pywikibot team, 2004-2013 # # Distributed under the terms of the MIT license. # @@ -110,7 +110,8 @@ import re import pywikibot from pywikibot import i18n -from pywikibot import config, pagegenerators, catlib +from pywikibot import pagegenerators +from pywikibot import xmlreader from scripts import replace @@ -155,14 +156,13 @@ * templateNames - A list of Page object representing the searched templates * xmlfilename - The dump's path, either absolute or relative + """ -raise NotImplementedError("Sorry, no XML reader in rewrite yet.") self.templates = templates self.xmlfilename = xmlfilename def __iter__(self): """Yield page objects until the entire XML dump has been read.""" -from pywikibot import xmlreader mysite = pywikibot.getSite() dump = xmlreader.XmlDump(self.xmlfilename) # regular expression to find the original template. @@ -171,7 +171,7 @@ # TODO: check site.nocapitalize() templatePatterns = [] for template in self.templates: -templatePattern = template.titleWithoutNamespace() +templatePattern = template.title(withNamespace=False) if not pywikibot.getSite().nocapitalize: templatePattern = '[%s%s]%s' % (templatePattern[0].upper(), templatePattern[0].lower(), @@ -192,6 +192,7 @@ This robot will load all pages yielded by a page generator and replace or remove all occurences of the old template, or substitute them with the template's text. + """ def __init__(self, generator, templates, subst=False, remove=False, editSummary='', acceptAll=False, addedCat=None): @@ -204,6 +205,7 @@ removed/resolved to None. * remove - True if the template should be removed. * subst- True if the template should be resolved. + """ self.generator = generator self.templates = templates @@ -217,9 +219,11 @@ self.addedCat = pywikibot.Category( site, u'%s:%s' % (site.namespace(14), self.addedCat)) +comma = site.mediawiki_message('comma-separator') + # get edit summary message if it's empty -if (self.editSummary == ''): -Param = {'list': (', ').join(self.templates.keys()), +if not self.editSummary: +Param = {'list': comma.join(self.templates.keys()), 'num': len(self.templates)} if self.remove: self.editSummary = i18n.twntranslate( @@ -232,9 +236,7 @@ site, 'template-changing', Param) def run(self): -""" -Starts the robot's action. -""" +"""Starts the robot's action.""" # regular expression to find the original template. # {{vfd}} does the same thing as {{Vfd}}, so both will be found. # The old syntax, {{msg:vfd}}, will also be found. @@ -285,7 +287,6 @@ templates = {} subst = False remove = False -namespaces = [] editSummary = '' addedCat = '' acceptAll = False @@ -326,7 +327,8 @@ if not genFactory.handleArg(arg): templateNames.append( pywikibot.Page(pywikibot.Site(), arg, - ns=10).title(withNamespace=False)) + ns=10 + ).title(withNamespace=False)) if subst ^ remove: for templateName in templateNames: @@ -341,9 +343,9 @@ return oldTemplates = [] -ns = pywikibot.Site().template_namespace() for templateName in templates.keys(): -oldTemplate = pywikibot.Page(pywikibot.Site(), templateName, ns=10) +oldTemplate = pywikibot.Page(pywikibot.Site(), templateName, +
[MediaWiki-commits] [Gerrit] [i18n] Add protect.py to i18n system - change (pywikibot/compat)
jenkins-bot has submitted this change and it was merged. Change subject: [i18n] Add protect.py to i18n system .. [i18n] Add protect.py to i18n system update from core Change-Id: I2e6a451132c2e5080ffe73b194c23c1b7847580d --- M protect.py 1 file changed, 11 insertions(+), 59 deletions(-) Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/protect.py b/protect.py index 85cfeb4..acf1824 100644 --- a/protect.py +++ b/protect.py @@ -49,58 +49,8 @@ import pywikibot import catlib +from pywikibot import i18n import pagegenerators - -# Summary messages for protecting from a category. -msg_simple_protect = { -'ar': u'بوت: حماية قائمة من الملفات.', -'en': u'Robot: Protecting a list of files.', -'it': u'Bot: Protezione di una lista di pagine.', -'fa': u'ربات:حفاظت فهرستی از صفحهها', -'nl': u'Bot: lijst met bestanden beveiligd', -'pt': u'Bot: Protegendo uma lista de artigos.', -'zh': u'機器人:保護清單中的所有檔案', -} - -msg_protect_category = { -'ar': u'روبوت - حماية كل الصفحات من التصنيف %s', -'en': u'Robot: Protecting all pages from category %s', -'it': u'Bot: Protezione di tutte le pagine nella categoria %s.', -'fa': u'ربات:حفاظت تمام صفحههای رده %s', -'nl': u'Bot: alle pagina\'s uit categorie %s beveiligd', -'pt': u'Bot: Protegendo todos os artigos da categoria %s', -'zh': u'機器人: 保護目錄 %s 的所有頁面', -} - -msg_protect_links = { -'ar': u'روبوت - حماية كل الصفحات الموصولة من %s', -'en': u'Robot: Protecting all pages linked from %s', -'it': u'Bot: Protezione di tutte le pagine linkate da %s.', -'fa': u'ربات:حفاظت تمام صفحههایی که در %s پیوند شدهاند.', -'nl': u'Bot: alle pagina\'s met verwijzingen vanaf %s beveiligd', -'pt': u'Bot: Protegendo todos os artigos ligados a %s', -'zh': u'機器人: 保護所有從 %s 連結的頁面', -} - -msg_protect_ref = { -'ar': u'روبوت - حماية كل الصفحات الراجعة من %s', -'en': u'Robot: Protecting all pages referring from %s', -'it': u'Bot: Protezione di tutte le pagine con link verso %s.', -'fa': u'ربات:حفاظت تمام صفحههایی که به %s پیوند دادهاند', -'nl': u'Bot: alle pagina\'s met een verwijzing op beveiligd', -'pt': u'Bot: Protegendo todos os artigos afluentes a %s', -'zh': u'機器人: 保護所有連至 %s 的頁面', -} - -msg_protect_images = { -'ar': u'روبوت - حماية كل الصور في الصفحة %s', -'en': u'Robot: Protecting all images on page %s', -'it': u'Bot: Protezione di tutte le immagini presenti in %s.', -'fa': u'ربات:حفاظت تمام تصاویر به کار رفته در %s', -'nl': u'Bot: alle bestanden gebruikt op %s beveiligd', -'pt': u'Bot: Protegendo todas as imagens do artigo %s', -'zh': u'機器人: 保護頁面 %s 中的所有圖條', -} class ProtectionRobot: @@ -132,7 +82,6 @@ #Loop through everything in the page generator and (un)protect it. for page in self.generator: pywikibot.output(u'Processing page %s' % page.title()) -#print self.edit, self.move#, self.create page.protect(unprotect=self.unprotect, reason=self.summary, prompt=self.prompt, editcreate=self.edit, move=self.move) @@ -244,30 +193,32 @@ gen = iter([page]) elif doCategory: if not summary: -summary = pywikibot.translate(mysite, - msg_protect_category) % pageName +summary = i18n.twtranslate(mysite, 'protect-category', + {'cat': pageName}) ns = mysite.category_namespace() categoryPage = catlib.Category(mysite, ns + ':' + pageName) gen = pagegenerators.CategorizedPageGenerator( categoryPage, recurse=protectSubcategories) elif doLinks: if not summary: -summary = pywikibot.translate(mysite, - msg_protect_links) % pageName +summary = i18n.twtranslate(mysite, 'protect-links', + {'page': pageName}) linksPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.LinkedPageGenerator(linksPage) elif doRef: if not summary: -summary = pywikibot.translate(mysite, msg_protect_ref) % pageName +summary = i18n.twtranslate(mysite, 'protect-ref', + {'page': pageName}) refPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.ReferringPageGenerator(refPage) elif fileName: if not summary: -summary = pywikibot.translate(mysite, msg_simple_protect) +summary = i18n.twtranslate(mysite, 'protect-simple') gen = pagegenerators.TextfilePageGenerator(fileName) elif doImages: if not summary: -summary = pywikibot.translate(mysite, msg_protect_images) % pageName +summary = i18n.twtranslate(mysite, 'prote
[MediaWiki-commits] [Gerrit] [PEP8] changes, code improvements - change (pywikibot/compat)
jenkins-bot has submitted this change and it was merged. Change subject: [PEP8] changes, code improvements .. [PEP8] changes, code improvements Change-Id: I98ddf0217a7259983fc3c31d7d47b489ac8edc0d --- M imagerecat.py 1 file changed, 129 insertions(+), 105 deletions(-) Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/imagerecat.py b/imagerecat.py index ee28f78..e210c06 100644 --- a/imagerecat.py +++ b/imagerecat.py @@ -24,35 +24,35 @@ wps : Work on all wikipedia's """ -__version__ = '$Id$' # # (C) Multichill 2008-2011 -# (C) Pywikipedia bot team, 2008-2011 +# (C) Pywikibot team, 2008-2013 # # Distributed under the terms of the MIT license. # +__version__ = '$Id$' # -import os, sys, re, codecs -import urllib, httplib, urllib2 +import sys +import re +import urllib import catlib import time import socket -import StringIO -import wikipedia as pywikibot -import config +import pywikibot import pagegenerators import xml.etree.ElementTree category_blacklist = [] countries = [] -search_wikis=u'_20' -hint_wiki=u'' +search_wikis = u'_20' +hint_wiki = u'' + def initLists(): -''' +""" Get the list of countries & the blacklist from Commons. -''' +""" global category_blacklist global countries @@ -67,11 +67,12 @@ countries.append(country.title(withNamespace=False)) return + def categorizeImages(generator, onlyFilter, onlyUncat): -''' Loop over all images in generator and try to categorize them. Get +""" Loop over all images in generator and try to categorize them. Get category suggestions from CommonSense. -''' +""" for page in generator: if page.exists() and (page.namespace() == 6) and \ (not page.isRedirectPage()): @@ -87,27 +88,30 @@ usage = [] galleries = [] else: -(commonshelperCats, usage, galleries) = getCommonshelperCats(imagepage) +(commonshelperCats, usage, + galleries) = getCommonshelperCats(imagepage) newcats = applyAllFilters(commonshelperCats+currentCats) -if (len(newcats) > 0 and not(set(currentCats)==set(newcats))): +if (len(newcats) > 0 and not(set(currentCats) == set(newcats))): for cat in newcats: -pywikibot.output(u' Found new cat: ' + cat); +pywikibot.output(u' Found new cat: ' + cat) saveImagePage(imagepage, newcats, usage, galleries, onlyFilter) + def getCurrentCats(imagepage): -''' Get the categories currently on the image ''' +""" Get the categories currently on the image """ result = [] for cat in imagepage.categories(): result.append(cat.title(withNamespace=False)) return list(set(result)) + def getCommonshelperCats(imagepage): -''' Get category suggestions from CommonSense. Parse them and return a list +""" Get category suggestions from CommonSense. Parse them and return a list of suggestions. -''' +""" commonshelperCats = [] usage = [] galleries = [] @@ -117,37 +121,40 @@ site = imagepage.site() lang = site.language() family = site.family.name -if lang==u'commons' and family==u'commons': +if lang == u'commons' and family == u'commons': parameters = urllib.urlencode( -{'i' : imagepage.title(withNamespace=False).encode('utf-8'), - 'r' : 'on', - 'go-clean' : 'Find+Categories', - 'p' : search_wikis, - 'cl' : hint_wiki}) -elif family==u'wikipedia': +{'i': imagepage.title(withNamespace=False).encode('utf-8'), + 'r': 'on', + 'go-clean': 'Find+Categories', + 'p': search_wikis, + 'cl': hint_wiki}) +elif family == u'wikipedia': parameters = urllib.urlencode( -{'i' : imagepage.title(withNamespace=False).encode('utf-8'), - 'r' : 'on', - 'go-move' : 'Find+Categories', - 'p' : search_wikis, - 'cl' : hint_wiki, - 'w' : lang}) +{'i': imagepage.title(withNamespace=False).encode('utf-8'), + 'r': 'on', + 'go-move': 'Find+Categories', + 'p': search_wikis, + 'cl': hint_wiki, + 'w': lang}) else: #Cant handle other sites atm return ([], [], []) -commonsenseRe = re.compile('^#COMMONSENSE(.*)#USAGE(\s)+\((?P(\d)+)\)\s(?P(.*))\s#KEYWORDS(\s)+\((?P(\d)+)\)(.*)#CATEGORIES(\s)+\((?P(\d)+)\)\s(?P(.*))\s#GALLERIES(\s)+\((?P(\d)+)\)\s(?P(.*))\s(.*)#EOF$', re.MULTILINE + re.DOTALL) +commonsenseRe = re.compile( + '^#COMMONSENSE(.*)#USAGE(\s)+\((?P(\d)+)\)\s(
[MediaWiki-commits] [Gerrit] wfRunHooks() return value no longer implies whether variable... - change (mediawiki/core)
Vishnunk90 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104206 Change subject: wfRunHooks() return value no longer implies whether variable value was found .. wfRunHooks() return value no longer implies whether variable value was found Bug: 12837 Trailing whitespace was removed. Change-Id: I8cec01afa3b8002f9ec2959c590003506f410764 --- M includes/parser/Parser.php 1 file changed, 1 insertion(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/06/104206/1 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9be75ae..ebae9e2 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3034,11 +3034,8 @@ return $wgLanguageCode; default: $ret = null; - if ( wfRunHooks( 'ParserGetVariableValueSwitch', array( &$this, &$this->mVarCache, &$index, &$ret, &$frame ) ) ) { + wfRunHooks( 'ParserGetVariableValueSwitch', array( &$this, &$this->mVarCache, &$index, &$ret, &$frame ) ); return $ret; - } else { - return null; - } } if ( $index ) { -- To view, visit https://gerrit.wikimedia.org/r/104206 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cec01afa3b8002f9ec2959c590003506f410764 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Vishnunk90 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] bugfix; : 'NoneType' objec... - change (pywikibot...drtrigonbot)
DrTrigon has submitted this change and it was merged. Change subject: bugfix; : 'NoneType' object has no attribute 'contents' .. bugfix; : 'NoneType' object has no attribute 'contents' Change-Id: Icf8c8d9e2e2b42566fc3a9df4bbb527afd937a6c --- M public_html/cgi-bin/filter.py 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: DrTrigon: Verified; Looks good to me, approved diff --git a/public_html/cgi-bin/filter.py b/public_html/cgi-bin/filter.py index 4d1b29c..124be2f 100755 --- a/public_html/cgi-bin/filter.py +++ b/public_html/cgi-bin/filter.py @@ -149,9 +149,9 @@ bs = BeautifulSoup.BeautifulSoup(unshort_buf) #if (bs.status.contents[0] == "1"): #longurl = str(bs.real.contents[0]) -#if not bs.findAll('error'): +if not bs.findAll('error'): #longurl = str(bs.fullurl.contents[0]) -if (bs.success.contents[0] == "true"): +#if (bs.success.contents[0] == "true"): longurl = str(bs.resolvedurl.contents[0]) page_buf = page_buf.replace(url, longurl) -- To view, visit https://gerrit.wikimedia.org/r/104205 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf8c8d9e2e2b42566fc3a9df4bbb527afd937a6c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon Gerrit-Reviewer: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] bugfix; : 'NoneType' objec... - change (pywikibot...drtrigonbot)
DrTrigon has uploaded a new change for review. https://gerrit.wikimedia.org/r/104205 Change subject: bugfix; : 'NoneType' object has no attribute 'contents' .. bugfix; : 'NoneType' object has no attribute 'contents' Change-Id: Icf8c8d9e2e2b42566fc3a9df4bbb527afd937a6c --- M public_html/cgi-bin/filter.py 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot refs/changes/05/104205/1 diff --git a/public_html/cgi-bin/filter.py b/public_html/cgi-bin/filter.py index 4d1b29c..124be2f 100755 --- a/public_html/cgi-bin/filter.py +++ b/public_html/cgi-bin/filter.py @@ -149,9 +149,9 @@ bs = BeautifulSoup.BeautifulSoup(unshort_buf) #if (bs.status.contents[0] == "1"): #longurl = str(bs.real.contents[0]) -#if not bs.findAll('error'): +if not bs.findAll('error'): #longurl = str(bs.fullurl.contents[0]) -if (bs.success.contents[0] == "true"): +#if (bs.success.contents[0] == "true"): longurl = str(bs.resolvedurl.contents[0]) page_buf = page_buf.replace(url, longurl) -- To view, visit https://gerrit.wikimedia.org/r/104205 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icf8c8d9e2e2b42566fc3a9df4bbb527afd937a6c Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Escape special namespaces in some messages - change (mediawiki...Translate)
Seb35 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104204 Change subject: Escape special namespaces in some messages .. Escape special namespaces in some messages Four messages were not wikitext-escaped, so it was interpreted on Category: and File: namespaces as a special syntax. Bug: 44864 Change-Id: Ib319bfd5e1d0297d6daae3f49bd33ca245ec9249 --- M tag/PageTranslationHooks.php M tag/SpecialPageTranslation.php 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/04/104204/1 diff --git a/tag/PageTranslationHooks.php b/tag/PageTranslationHooks.php index f20cfa4..248387e 100644 --- a/tag/PageTranslationHooks.php +++ b/tag/PageTranslationHooks.php @@ -603,7 +603,7 @@ list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); $result = array( 'tpt-target-page', - $page->getTitle()->getPrefixedText(), + ':'.$page->getTitle()->getPrefixedText(), // This url shouldn't get cached wfExpandUrl( $page->getTranslationUrl( $code ) ) ); @@ -753,7 +753,7 @@ $wrap = '$1'; $out = RequestContext::getMain()->getOutput(); - $out->wrapWikiMsg( $wrap, array( 'tpt-translation-intro', $url, $titleText, $per ) ); + $out->wrapWikiMsg( $wrap, array( 'tpt-translation-intro', $url, ':'.$titleText, $per ) ); $out->addHTML( '' ); } diff --git a/tag/SpecialPageTranslation.php b/tag/SpecialPageTranslation.php index 7898220..c22462e 100644 --- a/tag/SpecialPageTranslation.php +++ b/tag/SpecialPageTranslation.php @@ -128,7 +128,7 @@ // We do want to notify the reviewer if the underlying page changes during review $target = $title->getFullUrl( array( 'oldid' => $revision ) ); $link = "[$target $revision]"; - $out->addWikiMsg( 'tpt-oldrevision', $title->getPrefixedText(), $link ); + $out->addWikiMsg( 'tpt-oldrevision', ':'.$title->getPrefixedText(), $link ); return; } @@ -171,7 +171,7 @@ $link = SpecialPage::getTitleFor( 'Translate' )->getFullUrl( array( 'group' => $page->getMessageGroupId() ) ); - $this->getOutput()->addWikiMsg( 'tpt-saveok', $titleText, $num, $link ); + $this->getOutput()->addWikiMsg( 'tpt-saveok', ':'.$titleText, $num, $link ); // If TranslationNotifications is installed, and the user can notify // translators, add a convenience link. if ( method_exists( 'SpecialNotifyTranslators', 'execute' ) && -- To view, visit https://gerrit.wikimedia.org/r/104204 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib319bfd5e1d0297d6daae3f49bd33ca245ec9249 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Seb35 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update #firstHeading on livepreview to show {{DISPLAYTITLE:.... - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Update #firstHeading on livepreview to show {{DISPLAYTITLE:...}} .. Update #firstHeading on livepreview to show {{DISPLAYTITLE:...}} Bug: 59015 Change-Id: I17f240cce92f1b98a226d5c2e2b3e82e15ceb616 --- M resources/mediawiki.action/mediawiki.action.edit.preview.js 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Bartosz Dziewoński: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/mediawiki.action/mediawiki.action.edit.preview.js b/resources/mediawiki.action/mediawiki.action.edit.preview.js index 664bf89..43642d0 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/mediawiki.action/mediawiki.action.edit.preview.js @@ -29,6 +29,7 @@ // update from from the ajax-loaded preview page. copySelectors = [ // Main + '#firstHeading', '#wikiPreview', '#wikiDiff', '#catlinks', @@ -47,7 +48,7 @@ $spinner = $.createSpinner( { size: 'large', type: 'block' - }); + } ); $wikiPreview.before( $spinner ); $spinner.css( { marginTop: $spinner.height() -- To view, visit https://gerrit.wikimedia.org/r/104201 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I17f240cce92f1b98a226d5c2e2b3e82e15ceb616 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader Gerrit-Reviewer: Bartosz Dziewoński Gerrit-Reviewer: Gerrit Patch Uploader Gerrit-Reviewer: Jack Phoenix Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] wfRunHooks() return value no longer implies whether variable... - change (mediawiki/core)
Vishnunk90 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104203 Change subject: wfRunHooks() return value no longer implies whether variable value was found. Bug: 12837 .. wfRunHooks() return value no longer implies whether variable value was found. Bug: 12837 Change-Id: I459923deee4fa294f78f277620f229fc2a84d266 --- M includes/parser/Parser.php 1 file changed, 2 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/03/104203/1 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9be75ae..c58675f 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3034,11 +3034,9 @@ return $wgLanguageCode; default: $ret = null; - if ( wfRunHooks( 'ParserGetVariableValueSwitch', array( &$this, &$this->mVarCache, &$index, &$ret, &$frame ) ) ) { + wfRunHooks( 'ParserGetVariableValueSwitch', array( &$this, &$this->mVarCache, &$index, &$ret, &$frame ) ); return $ret; - } else { - return null; - } + } if ( $index ) { -- To view, visit https://gerrit.wikimedia.org/r/104203 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I459923deee4fa294f78f277620f229fc2a84d266 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Vishnunk90 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Enable XFN rel=me for links on User Profile pages and rel="a... - change (mediawiki/core)
Vishnunk90 has uploaded a new change for review. https://gerrit.wikimedia.org/r/104202 Change subject: Enable XFN rel=me for links on User Profile pages and rel="author" link Bug: 29968 .. Enable XFN rel=me for links on User Profile pages and rel="author" link Bug: 29968 Change-Id: I5ca55a4f6db4f27b3fafe5d0c31a66addd1801b3 --- M includes/Linker.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/02/104202/1 diff --git a/includes/Linker.php b/includes/Linker.php index 27f8ab4..614645e 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1084,7 +1084,7 @@ return self::link( $page, htmlspecialchars( $altUserName !== false ? $altUserName : $userName ), - array( 'class' => 'mw-userlink' ) + array( 'class' => 'mw-userlink', 'rel' => 'author' ) ); } -- To view, visit https://gerrit.wikimedia.org/r/104202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5ca55a4f6db4f27b3fafe5d0c31a66addd1801b3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Vishnunk90 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update #firstHeading on livepreview to show {{DISPLAYTITLE:.... - change (mediawiki/core)
Gerrit Patch Uploader has uploaded a new change for review. https://gerrit.wikimedia.org/r/104201 Change subject: Update #firstHeading on livepreview to show {{DISPLAYTITLE:...}} .. Update #firstHeading on livepreview to show {{DISPLAYTITLE:...}} Bug: 59015 Change-Id: I17f240cce92f1b98a226d5c2e2b3e82e15ceb616 --- M resources/mediawiki.action/mediawiki.action.edit.preview.js 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/01/104201/1 diff --git a/resources/mediawiki.action/mediawiki.action.edit.preview.js b/resources/mediawiki.action/mediawiki.action.edit.preview.js index 664bf89..43642d0 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/mediawiki.action/mediawiki.action.edit.preview.js @@ -29,6 +29,7 @@ // update from from the ajax-loaded preview page. copySelectors = [ // Main + '#firstHeading', '#wikiPreview', '#wikiDiff', '#catlinks', @@ -47,7 +48,7 @@ $spinner = $.createSpinner( { size: 'large', type: 'block' - }); + } ); $wikiPreview.before( $spinner ); $spinner.css( { marginTop: $spinner.height() -- To view, visit https://gerrit.wikimedia.org/r/104201 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I17f240cce92f1b98a226d5c2e2b3e82e15ceb616 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Gerrit Patch Uploader ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] bugfix; path adopted to tool-labs to solve: *
DrTrigon has submitted this change and it was merged. Change subject: bugfix; path adopted to tool-labs to solve: * : No module named subster * : No module named query * : [Errno 2] No such file or directory: '/data/project/data/subster .. bugfix; path adopted to tool-labs to solve: * : No module named subster * : No module named query * : [Errno 2] No such file or directory: '/data/project/data/subster/mail_inbox' Change-Id: If9d2476ed40ca9a3e6d414fc01649b4efb89c6ee --- M public_html/cgi-bin/ps_wikinew.py M public_html/cgi-bin/subster_mail_queue.py M public_html/cgi-bin/substersim.py M public_html/cgi-bin/sum_cat_disc.py 4 files changed, 44 insertions(+), 19 deletions(-) Approvals: DrTrigon: Verified; Looks good to me, approved diff --git a/public_html/cgi-bin/ps_wikinew.py b/public_html/cgi-bin/ps_wikinew.py index bc7d6cd..a3bcc88 100644 --- a/public_html/cgi-bin/ps_wikinew.py +++ b/public_html/cgi-bin/ps_wikinew.py @@ -112,6 +112,9 @@ # === labs conversion patch: variables === === === ver_desc = { 'ts': ['trunk', 'rewrite'], 'labs': ['compat', 'core'], } - + localdir = { 'ts': ['..', 'DrTrigonBot', '.'], 'labs': ['..', 'public_html', 'logs', '.'], } + +bot_path = { 'ts': ["../../pywikipedia/", "../../rewrite/"], +'labs': ["../pywikibot-compat/", "../pywikibot-core/"], } diff --git a/public_html/cgi-bin/subster_mail_queue.py b/public_html/cgi-bin/subster_mail_queue.py index 5edd275..cad05a6 100755 --- a/public_html/cgi-bin/subster_mail_queue.py +++ b/public_html/cgi-bin/subster_mail_queue.py @@ -51,6 +51,8 @@ #import ps_wiki as style# panel-stylesheet 'wiki (monobook)' import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant +bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) + # === page HTML contents === === === # @@ -75,7 +77,7 @@ def displaystate(form): data = {} -mbox = mailbox.mbox('../../data/subster/mail_inbox') +mbox = mailbox.mbox(os.path.join(bot_path, '../data/subster/mail_inbox')) buf = [] buf.append( '\n' ) diff --git a/public_html/cgi-bin/substersim.py b/public_html/cgi-bin/substersim.py index 4b7ef5a..697d3bc 100755 --- a/public_html/cgi-bin/substersim.py +++ b/public_html/cgi-bin/substersim.py @@ -55,7 +55,19 @@ import StringIO, traceback, signal -bot_path = os.path.realpath("../../pywikipedia/") +# === panel HTML stylesheets === === === +# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or needed at any point...) +# +#import ps_plain as style # panel-stylesheet 'plain' +#import ps_simple as style # panel-stylesheet 'simple' +#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' +import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant + +bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) + + +# === pywikibot framework === === === +# #importglobal("subster_beta", bot_path) #importglobal(["wikipedia", "xmlreader", "config", "dtbext", "subster_beta"], bot_path) # http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder @@ -65,15 +77,8 @@ import wikipedia as pywikibot -# === panel HTML stylesheets === === === -# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or needed at any point...) +# === page HTML contents === === === # -#import ps_plain as style # panel-stylesheet 'plain' -#import ps_simple as style # panel-stylesheet 'simple' -#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' -import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant - - maindisplay_content = \ """(analog to http://meta.wikimedia.org/wiki/Special:ExpandTemplates";>Special:ExpandTemplates) Version: @@ -194,6 +199,8 @@ """ +# === variables === === === +# sim_param_default = { 'value':'val', 'action': '', 'content': '', @@ -201,6 +208,8 @@ timeout = 60 # xx-sec. max. delay for url request +# === code === === === +# # from 'runbotrun.py' def gettraceback(exc_info): output = StringIO.StringIO() diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index 4885547..d36c7b1 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -46,7 +46,18 @@ import MySQLdb, _mysql_exceptions -bot_path = os.path.realpath("../../pywikipedia/") +# === panel HTML stylesheets === === === +# +#import ps_plain as style # panel-stylesheet 'plain' +#import ps_simple as style # panel-stylesheet 'simple' +#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' +import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant + +bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) + + +# === pywikibot framework ===
[MediaWiki-commits] [Gerrit] bugfix; path adopted to tool-labs to solve: *
DrTrigon has uploaded a new change for review. https://gerrit.wikimedia.org/r/104200 Change subject: bugfix; path adopted to tool-labs to solve: * : No module named subster * : No module named query * : [Errno 2] No such file or directory: '/data/project/data/subster .. bugfix; path adopted to tool-labs to solve: * : No module named subster * : No module named query * : [Errno 2] No such file or directory: '/data/project/data/subster/mail_inbox' Change-Id: If9d2476ed40ca9a3e6d414fc01649b4efb89c6ee --- M public_html/cgi-bin/ps_wikinew.py M public_html/cgi-bin/subster_mail_queue.py M public_html/cgi-bin/substersim.py M public_html/cgi-bin/sum_cat_disc.py 4 files changed, 44 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot refs/changes/00/104200/1 diff --git a/public_html/cgi-bin/ps_wikinew.py b/public_html/cgi-bin/ps_wikinew.py index bc7d6cd..a3bcc88 100644 --- a/public_html/cgi-bin/ps_wikinew.py +++ b/public_html/cgi-bin/ps_wikinew.py @@ -112,6 +112,9 @@ # === labs conversion patch: variables === === === ver_desc = { 'ts': ['trunk', 'rewrite'], 'labs': ['compat', 'core'], } - + localdir = { 'ts': ['..', 'DrTrigonBot', '.'], 'labs': ['..', 'public_html', 'logs', '.'], } + +bot_path = { 'ts': ["../../pywikipedia/", "../../rewrite/"], +'labs': ["../pywikibot-compat/", "../pywikibot-core/"], } diff --git a/public_html/cgi-bin/subster_mail_queue.py b/public_html/cgi-bin/subster_mail_queue.py index 5edd275..cad05a6 100755 --- a/public_html/cgi-bin/subster_mail_queue.py +++ b/public_html/cgi-bin/subster_mail_queue.py @@ -51,6 +51,8 @@ #import ps_wiki as style# panel-stylesheet 'wiki (monobook)' import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant +bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) + # === page HTML contents === === === # @@ -75,7 +77,7 @@ def displaystate(form): data = {} -mbox = mailbox.mbox('../../data/subster/mail_inbox') +mbox = mailbox.mbox(os.path.join(bot_path, '../data/subster/mail_inbox')) buf = [] buf.append( '\n' ) diff --git a/public_html/cgi-bin/substersim.py b/public_html/cgi-bin/substersim.py index 4b7ef5a..697d3bc 100755 --- a/public_html/cgi-bin/substersim.py +++ b/public_html/cgi-bin/substersim.py @@ -55,7 +55,19 @@ import StringIO, traceback, signal -bot_path = os.path.realpath("../../pywikipedia/") +# === panel HTML stylesheets === === === +# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or needed at any point...) +# +#import ps_plain as style # panel-stylesheet 'plain' +#import ps_simple as style # panel-stylesheet 'simple' +#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' +import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant + +bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0]) + + +# === pywikibot framework === === === +# #importglobal("subster_beta", bot_path) #importglobal(["wikipedia", "xmlreader", "config", "dtbext", "subster_beta"], bot_path) # http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder @@ -65,15 +77,8 @@ import wikipedia as pywikibot -# === panel HTML stylesheets === === === -# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or needed at any point...) +# === page HTML contents === === === # -#import ps_plain as style # panel-stylesheet 'plain' -#import ps_simple as style # panel-stylesheet 'simple' -#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' -import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant - - maindisplay_content = \ """(analog to http://meta.wikimedia.org/wiki/Special:ExpandTemplates";>Special:ExpandTemplates) Version: @@ -194,6 +199,8 @@ """ +# === variables === === === +# sim_param_default = { 'value':'val', 'action': '', 'content': '', @@ -201,6 +208,8 @@ timeout = 60 # xx-sec. max. delay for url request +# === code === === === +# # from 'runbotrun.py' def gettraceback(exc_info): output = StringIO.StringIO() diff --git a/public_html/cgi-bin/sum_cat_disc.py b/public_html/cgi-bin/sum_cat_disc.py index 4885547..d36c7b1 100755 --- a/public_html/cgi-bin/sum_cat_disc.py +++ b/public_html/cgi-bin/sum_cat_disc.py @@ -46,7 +46,18 @@ import MySQLdb, _mysql_exceptions -bot_path = os.path.realpath("../../pywikipedia/") +# === panel HTML stylesheets === === === +# +#import ps_plain as style # panel-stylesheet 'plain' +#import ps_simple as style # panel-stylesheet 'simple' +#import ps_wiki as style# panel-stylesheet 'wiki (monobook)' +import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1 compilant + +bot_path = os.path.realpath(style.b
[MediaWiki-commits] [Gerrit] Ignore wmf.bugconver...@gmail.com - change (wikimedia...wikibugs)
Merlijn van Deen has uploaded a new change for review. https://gerrit.wikimedia.org/r/104199 Change subject: Ignore wmf.bugconver...@gmail.com .. Ignore wmf.bugconver...@gmail.com Change-Id: Iee5d66a3f9e190a1ead78237b813c1d73653d815 --- M wikibugs 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/bugzilla/wikibugs refs/changes/99/104199/1 diff --git a/wikibugs b/wikibugs index 20652a0..f7c29b5 100755 --- a/wikibugs +++ b/wikibugs @@ -148,6 +148,12 @@ exit 0; } +# Check if the user is 'wmf.bugconver...@gmail.com', which is used +# to import bugs from other bug trackers. Ignore these messages. +if ($mail->header( 'X-Bugzilla-Who' ) eq 'wmf.bugconver...@gmail.com') { + exit 0; +} + my ($bug, $summary, $st); if ($subject =~ /\[Bug (\d+)\]\s+New:\s+(.*)/s) { ($bug, $summary, $st) = ($1, $2, "\00303(NEW)\003"); -- To view, visit https://gerrit.wikimedia.org/r/104199 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iee5d66a3f9e190a1ead78237b813c1d73653d815 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/bugzilla/wikibugs Gerrit-Branch: master Gerrit-Owner: Merlijn van Deen ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] use all pagegenerators options for protect.py - change (pywikibot/core)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104198 Change subject: use all pagegenerators options for protect.py .. use all pagegenerators options for protect.py The edit summary depends on the genFactory option provided by pagegenerators Change-Id: I6e2b6b85670a28e24c50f6da9cb6b3db236f78b5 --- M scripts/protect.py 1 file changed, 49 insertions(+), 103 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/98/104198/1 diff --git a/scripts/protect.py b/scripts/protect.py index deaae24..32ecb5a 100644 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -3,21 +3,21 @@ This script can be used to protect and unprotect pages en masse. Of course, you will need an admin account on the relevant wiki. -Syntax: python protect.py OPTION... -Command line options: +These command line parameters can be used to specify which pages to work on: --page: Protect specified page --cat:Protect all pages in the given category. --nosubcats: Don't protect pages in the subcategories. --links: Protect all pages linked from a given page. --file: Protect all pages listed in a text file. --ref:Protect all pages referring from a given page. --images: Protect all images used on a given page. --always: Don't prompt to protect pages, just do it. --summary:Supply a custom edit summary. --unprotect: Actually unprotect pages instead of protecting +¶ms; + +Furthermore, the following command line parameters are supported: + +-always: Don't prompt to protect pages, just do it. + +-summary: Supply a custom edit summary. + +-unprotect: Actually unprotect pages instead of protecting + -edit:PROTECTION_LEVEL Set edit protection level to PROTECTION_LEVEL + -move:PROTECTION_LEVEL Set move protection level to PROTECTION_LEVEL ## Without support ## @@ -26,6 +26,8 @@ Values for PROTECTION_LEVEL are: sysop, autoconfirmed, none. If an operation parameter (edit, move or create) is not specified, default protection level is 'sysop' (or 'none' if -unprotect). + +Usage: python protect.py Examples: @@ -40,7 +42,7 @@ # Written by http://it.wikisource.org/wiki/Utente:Qualc1 # Created by modifying delete.py # -# (C) Pywikibot team, 2008-2013 +# (c) Pywikibot team, 2008-2013 # # Distributed under the terms of the MIT license. # @@ -51,11 +53,15 @@ from pywikibot import i18n from pywikibot import pagegenerators +# This is required for the text that is shown when you run this script +# with the parameter -help. +docuReplacements = { +'¶ms;': pagegenerators.parameterHelp, +} + class ProtectionRobot: -""" -This robot allows protection of pages en masse. -""" +""" This robot allows protection of pages en masse. """ def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): @@ -75,9 +81,7 @@ self.move = move def run(self): -""" -Starts the robot's action. -""" +""" Starts the robot's action. """ #Loop through everything in the page generator and (un)protect it. for page in self.generator: pywikibot.output(u'Processing page %s' % page.title()) @@ -100,74 +104,38 @@ return level -def main(): +def main(*args): global protectionLevels protectionLevels = ['sysop', 'autoconfirmed', 'none'] -pageName = '' -summary = '' +summary = None always = False -doSinglePage = False -doCategory = False -protectSubcategories = True -doRef = False -doLinks = False -doImages = False -fileName = '' gen = None edit = '' move = '' defaultProtection = 'sysop' +# This factory is responsible for processing command line arguments +# that are also used by other scripts and that determine on which pages +# to work on. +genFactory = pagegenerators.GeneratorFactory() # read command line parameters -for arg in pywikibot.handleArgs(): +for arg in pywikibot.handleArgs(*args): +if genFactory.handleArg(arg): +continue if arg == '-always': always = True -elif arg.startswith('-file'): -if len(arg) == len('-file'): -fileName = pywikibot.input( -u'Enter name of file to protect pages from:') -else: -fileName = arg[len('-file:'):] elif arg.startswith('-summary'): if len(arg) == len('-summary'): summary = pywikibot.input( u'Enter a reason for the protection:') else: summary = arg[len('-summary:'):] -elif arg.startswith('-cat'): -doCategory = True -if len(arg) == len('-cat'): -pageName = pywikibot.input( -
[MediaWiki-commits] [Gerrit] Replaced catlib with other functions. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104197 Change subject: Replaced catlib with other functions. .. Replaced catlib with other functions. Change-Id: Ib8ed2ecbcef0b7dcdaf08e9fc4b55ad817d6e280 --- M scripts/commons_link.py 1 file changed, 2 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/97/104197/1 diff --git a/scripts/commons_link.py b/scripts/commons_link.py index b318042..28e0e66 100644 --- a/scripts/commons_link.py +++ b/scripts/commons_link.py @@ -41,7 +41,6 @@ import re import pywikibot from pywikibot import pagegenerators, i18n -from pywikibot import catlib class CommonsLinkBot: @@ -108,7 +107,7 @@ try: pywikibot.output(u'\n %s ' % page.title()) commons = pywikibot.getSite().image_repository() -commonsCategory = catlib.Category(commons, +commonsCategory = pywikibot.Category(commons, 'Category:%s' % page.title()) try: getcommonscat = commonsCategory.get(get_redirect=True) @@ -178,7 +177,7 @@ namespace=start.namespace(), includeredirects=False) elif arg.startswith('-cat:'): -cat = catlib.Category(pywikibot.getSite(), +cat = pywikibot.Category(pywikibot.getSite(), 'Category:%s' % arg[5:]) gen = pagegenerators.CategorizedPageGenerator(cat) elif arg.startswith('-ref:'): -- To view, visit https://gerrit.wikimedia.org/r/104197 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8ed2ecbcef0b7dcdaf08e9fc4b55ad817d6e280 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Removed not needed imports. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104196 Change subject: Removed not needed imports. .. Removed not needed imports. * catlib * config Change-Id: I5608de3fc9366c9a5fd33506016ca082645c133f --- M scripts/replace.py 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/96/104196/1 diff --git a/scripts/replace.py b/scripts/replace.py index acc6da0..5a32c3a 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -127,7 +127,6 @@ import pywikibot from pywikibot import pagegenerators from pywikibot import editor as editarticle -from pywikibot import catlib, config from pywikibot import i18n import webbrowser -- To view, visit https://gerrit.wikimedia.org/r/104196 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5608de3fc9366c9a5fd33506016ca082645c133f Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] template.py: Removed unneaded catlib import. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104195 Change subject: template.py: Removed unneaded catlib import. .. template.py: Removed unneaded catlib import. Change-Id: I70c1107fba532eeb3e2f2fafc9e852b6383af1fc --- M scripts/template.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/95/104195/1 diff --git a/scripts/template.py b/scripts/template.py index 3400c60..7ab7db4 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -110,7 +110,7 @@ import re import pywikibot from pywikibot import i18n -from pywikibot import config, pagegenerators, catlib +from pywikibot import pagegenerators from scripts import replace -- To view, visit https://gerrit.wikimedia.org/r/104195 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I70c1107fba532eeb3e2f2fafc9e852b6383af1fc Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Type cast formatted time - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Type cast formatted time .. Type cast formatted time Static code analyser warned for possible incorrect string concatenation operator. Now it's clear what type we're dealing with. Change-Id: Ic9f19479379ec2c6f4cb087ade44235fb110318c --- M includes/parser/Parser.php 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9be75ae..dea9895 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2941,7 +2941,7 @@ $value = ( wfUrlencode( $this->mTitle->getSubjectNsText() ) ); break; case 'currentdayname': - $value = $pageLang->getWeekdayName( MWTimestamp::getInstance( $ts )->format( 'w' ) + 1 ); + $value = $pageLang->getWeekdayName( (int)MWTimestamp::getInstance( $ts )->format( 'w' ) + 1 ); break; case 'currentyear': $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'Y' ), true ); @@ -2961,7 +2961,7 @@ $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'w' ) ); break; case 'localdayname': - $value = $pageLang->getWeekdayName( MWTimestamp::getLocalInstance( $ts )->format( 'w' ) + 1 ); + $value = $pageLang->getWeekdayName( (int)MWTimestamp::getLocalInstance( $ts )->format( 'w' ) + 1 ); break; case 'localyear': $value = $pageLang->formatNum( MWTimestamp::getLocalInstance( $ts )->format( 'Y' ), true ); -- To view, visit https://gerrit.wikimedia.org/r/104049 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic9f19479379ec2c6f4cb087ade44235fb110318c Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Cscott Gerrit-Reviewer: Daniel Friesen Gerrit-Reviewer: Hoo man Gerrit-Reviewer: Siebrand Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace deprecated CategoryViewer::addSubcategory() - change (mediawiki...Video)
Hoo man has submitted this change and it was merged. Change subject: Replace deprecated CategoryViewer::addSubcategory() .. Replace deprecated CategoryViewer::addSubcategory() Change-Id: I71520c9814195a74ceea61599f9b3e2708ed6e62 --- M VideoPage.php 1 file changed, 6 insertions(+), 2 deletions(-) Approvals: Hoo man: Verified; Looks good to me, approved diff --git a/VideoPage.php b/VideoPage.php index 439e5d0..8fd31b7 100644 --- a/VideoPage.php +++ b/VideoPage.php @@ -426,7 +426,11 @@ $title = Title::makeTitle( $x->page_namespace, $x->page_title ); if( $title->getNamespace() == NS_CATEGORY ) { - $this->addSubcategory( $title, $x->cl_sortkey, $x->page_len ); + $this->addSubcategoryObject( + Category::newFromTitle( $title ), + $x->cl_sortkey, + $x->page_len + ); } elseif( $title->getNamespace() == NS_FILE ) { $this->addImage( $title, $x->cl_sortkey, $x->page_len ); } elseif( $title->getNamespace() == NS_VIDEO ) { @@ -436,4 +440,4 @@ } } } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/104143 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I71520c9814195a74ceea61599f9b3e2708ed6e62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Video Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Bartosz Dziewoński Gerrit-Reviewer: Chad Gerrit-Reviewer: Hoo man Gerrit-Reviewer: Parent5446 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix bugs in textlib.py - change (pywikibot/core)
pyfi...@gmail.com has uploaded a new change for review. https://gerrit.wikimedia.org/r/104194 Change subject: Fix bugs in textlib.py .. Fix bugs in textlib.py * Fixed undefined name Error * Fixed broken link * Renamed PyWikipediaBot to Pywikibot Change-Id: Ie14d14edb7e92f8463bf4983804cb3e54ff012a0 --- M pywikibot/textlib.py 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/94/104194/1 diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 751634c..7d59faf 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -26,6 +26,7 @@ from html.parser import HTMLParser from . import config2 as config +from pywikibot.exceptions import * TEMP_REGEX = re.compile( '{{(?:msg:)?(?P[^{\|]+?)(?:\|(?P[^{]+?(?:{[^{]+?}[^{]*?)?))?}}') @@ -775,10 +776,10 @@ site = pywikibot.getSite() if site.sitename() == 'wikipedia:de' and "{{Personendaten" in oldtext: raise Error("""\ -The PyWikipediaBot is no longer allowed to touch categories on the German +The Pywikibot is no longer allowed to touch categories on the German Wikipedia on pages that contain the Personendaten template because of the non-standard placement of that template. -See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv/bis_2006#Position_der_Personendaten_am_.22Artikelende.22 +See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv/1#Position_der_Personendaten_am_.22Artikelende.22 """) separator = site.family.category_text_separator iseparator = site.family.interwiki_text_separator -- To view, visit https://gerrit.wikimedia.org/r/104194 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie14d14edb7e92f8463bf4983804cb3e54ff012a0 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: pyfi...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Keep track of selected options. - change (pywikibot/core)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104193 Change subject: Keep track of selected options. .. Keep track of selected options. Single-selected options may be used for different edit summaries e.g. for delete.py or protect.py etc. Change-Id: I1001110571f8f7d6d8bfd1b88538dcdba4057288 --- M pywikibot/pagegenerators.py 1 file changed, 26 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/93/104193/1 diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 2801746..1b46b51 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -192,12 +192,30 @@ This factory is responsible for processing command line arguments that are used by many scripts and that determine which pages to work on. """ + +generator_options = ( # a list of all generators except filters +'filelinks', 'unusedfiles', 'unwatched', 'usercontribs', +'withoutinterwiki', 'interwiki', 'randomredirect', 'random', +'recentchanges', 'file', 'catr', 'cat', 'category', 'subcatsr', +'subcats', 'page', 'uncatfiles', 'uncatcat', 'uncat', 'ref', 'links', +'weblink', 'transcludes', 'start', 'prefixindex', 'newimages', +'newpages', 'imagesused', 'search', 'google', 'yahoo', 'untagged' +) + def __init__(self): self.gens = [] self.namespaces = [] self.step = None self.limit = None self.articlefilter = None +self.__option = [] + +@property +def option(self): +if len(self.__option) > 1: +pass +elif len(self.__option) == 1: +return self.__option[0] def getCombinedGenerator(self): """Return the combination of all accumulated generators. @@ -488,10 +506,15 @@ gen = YahooSearchPageGenerator(arg[7:]) elif arg.startswith('-untagged'): gen = UntaggedPageGenerator(arg[10:]) -else: -pass + if gen: self.gens.append(gen) +# fill selected generator options +index = arg.find(':') +option = arg[1:] if index < 0 else arg[1:index] +if option and option in self.generator_options: +self.__option.append(option) +print len(self.gens) return True else: return False @@ -1043,7 +1066,7 @@ """ URL = "http://toolserver.org/~daniel/WikiSense/UntaggedImages.php?"; REGEXP = r".*?" + "\.org/w/index\.php\?title=(.*?)'>.*?" lang, project = untaggedProject.split('.', 1) if lang == 'commons': wiki = 'wikifam=commons.wikimedia.org' -- To view, visit https://gerrit.wikimedia.org/r/104193 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1001110571f8f7d6d8bfd1b88538dcdba4057288 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt ___ 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...CommunityTwitter)
FastLizard4 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: Icb4359c67abbf41d8c46881a6bd67e7c25f010f8 --- M CommunityTwitter_body.php 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: FastLizard4: Verified; Looks good to me, approved diff --git a/CommunityTwitter_body.php b/CommunityTwitter_body.php index c6eeecb..200c7cc 100755 --- a/CommunityTwitter_body.php +++ b/CommunityTwitter_body.php @@ -47,7 +47,7 @@ $output = $this->getOutput(); $user = $this->getUser(); $request = $this->getRequest(); - $title = $this->getTitle(); + $title = $this->getPageTitle(); $language = $this->getLanguage(); // Get extension configuration variables @@ -91,7 +91,7 @@ // Not logged in $tLogin = SpecialPage::getTitleFor( 'UserLogin' ); - $ctPrefixedText = $this->getTitle()->getPrefixedText(); + $ctPrefixedText = $this->getPageTitle()->getPrefixedText(); $loginLink = $tLogin->getFullURL( array( 'returnto' => $ctPrefixedText ) ); $nologinMsg = $this->msg( 'communitytwitter-nologin', $loginLink, $rightsLink, $groupsList, count( $groups ) ); -- To view, visit https://gerrit.wikimedia.org/r/103919 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icb4359c67abbf41d8c46881a6bd67e7c25f010f8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CommunityTwitter Gerrit-Branch: master Gerrit-Owner: Legoktm Gerrit-Reviewer: FastLizard4 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Throw exception when ArchivedFile::getUser() has unkown type - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Throw exception when ArchivedFile::getUser() has unkown type .. Throw exception when ArchivedFile::getUser() has unkown type Change-Id: I95117c5cc73d187c8c7b859b67ad6655d196d91e --- M includes/filerepo/file/ArchivedFile.php 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index 012dd84..26699c4 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -458,6 +458,7 @@ * the rest of the file classes. * @param string $type 'text' or 'id' * @return int|string +* @throws MWException */ public function getUser( $type = 'text' ) { $this->load(); @@ -467,6 +468,9 @@ } elseif ( $type == 'id' ) { return $this->user; } + + throw new MWException( "Unknown type '$type'." ); + } /** -- To view, visit https://gerrit.wikimedia.org/r/104056 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I95117c5cc73d187c8c7b859b67ad6655d196d91e Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Aaron Schulz Gerrit-Reviewer: Chad Gerrit-Reviewer: Hoo man 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 deprecated WebRequest::getFileSize() - change (mediawiki...SportsTeams)
Hoo man has submitted this change and it was merged. Change subject: Replace deprecated WebRequest::getFileSize() .. Replace deprecated WebRequest::getFileSize() Change-Id: I37f3d4e5c43a456ed033b7b502ef5fcf61e69daa --- M SpecialSportsManagerLogo.php M SpecialSportsTeamsManagerLogo.php 2 files changed, 6 insertions(+), 4 deletions(-) Approvals: Hoo man: Verified; Looks good to me, approved diff --git a/SpecialSportsManagerLogo.php b/SpecialSportsManagerLogo.php index 95cde69..457a73f 100644 --- a/SpecialSportsManagerLogo.php +++ b/SpecialSportsManagerLogo.php @@ -76,7 +76,8 @@ * Check for a newly uploaded file. */ $this->mUploadTempName = $request->getFileTempName( 'wpUploadFile' ); - $this->mUploadSize = $request->getFileSize( 'wpUploadFile' ); + $file = new WebRequestUpload( $request, 'wpUploadFile' ); + $this->mUploadSize = $file->getSize(); $this->mOname = $request->getFileName( 'wpUploadFile' ); $this->mSessionKey = false; $this->mStashed= false; @@ -678,4 +679,4 @@ wfDebug( __METHOD__ . ": all clear; passing.\n" ); return Status::newGood(); } -} \ No newline at end of file +} diff --git a/SpecialSportsTeamsManagerLogo.php b/SpecialSportsTeamsManagerLogo.php index ba621c4..c757e55 100644 --- a/SpecialSportsTeamsManagerLogo.php +++ b/SpecialSportsTeamsManagerLogo.php @@ -75,7 +75,8 @@ * Check for a newly uploaded file. */ $this->mUploadTempName = $request->getFileTempName( 'wpUploadFile' ); - $this->mUploadSize = $request->getFileSize( 'wpUploadFile' ); + $file = new WebRequestUpload( $request, 'wpUploadFile' ); + $this->mUploadSize = $file->getSize(); $this->mOname = $request->getFileName( 'wpUploadFile' ); $this->mSessionKey = false; $this->mStashed= false; @@ -705,4 +706,4 @@ wfDebug( __METHOD__ . ": all clear; passing.\n" ); return Status::newGood(); } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/104146 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I37f3d4e5c43a456ed033b7b502ef5fcf61e69daa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SportsTeams Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Bartosz Dziewoński Gerrit-Reviewer: Chad Gerrit-Reviewer: Hoo man Gerrit-Reviewer: Parent5446 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] update; crontab adopted - change (pywikibot...drtrigonbot)
DrTrigon has submitted this change and it was merged. Change subject: update; crontab adopted .. update; crontab adopted Change-Id: I8ebb50fde67f4d4d5dc010814e591aa96a81618f --- M crontab 1 file changed, 5 insertions(+), 5 deletions(-) Approvals: DrTrigon: Verified; Looks good to me, approved diff --git a/crontab b/crontab index ae0b829..162760a 100644 --- a/crontab +++ b/crontab @@ -78,8 +78,8 @@ PATH=/usr/local/bin:/usr/bin:/bin # pywikibot-core: script_wui.py -06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log -#06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log >/dev/null +#06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log +06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log >/dev/null # pywikibot-compat: sum_disc.py [SIMULATE] 36 2 * * * jsub -l h_vmem=1024M -quiet -N sum_disc python $HOME/pywikibot-compat/pwb.py -sum_disc -simulate @@ -89,13 +89,13 @@ #36 2 * * * jsub -l h_vmem=1024M -quiet -N sum_disc python $HOME/pywikibot-compat/pwb.py -sum_disc #06 2 */14 * * jsub -l h_vmem=256M -quiet -N compbot python $HOME/pywikibot-compat/pwb.py -sum_disc -compress_history:[] -## pywikibot-compat: catimages.py [SIMULATE] -#06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -cat -simulate +# pywikibot-compat: catimages.py [SIMULATE] +06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -cat -simulate ## pywikibot-compat: catimages.py #06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -## pywikibot-compat: subster.py, subster_irc.py [SIMULATE] +# pywikibot-compat: subster.py, subster_irc.py [SIMULATE] #36 6 * * * jsub -l h_vmem=1024M -quiet -N subster python $HOME/pywikibot-compat/pwb.py -subster -simulate #06 * * * * jstart -l h_vmem=512M -quiet -N ircbot python $HOME/pywikibot-compat/pwb.py -subster_irc -simulate 06 0 * * * jsub -l h_vmem=512M -quiet -N subster_meta python $HOME/pywikibot-compat/pwb.py -subster -family:meta -lang: -simulate -- To view, visit https://gerrit.wikimedia.org/r/104192 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8ebb50fde67f4d4d5dc010814e591aa96a81618f Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon Gerrit-Reviewer: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] update; crontab adopted - change (pywikibot...drtrigonbot)
DrTrigon has uploaded a new change for review. https://gerrit.wikimedia.org/r/104192 Change subject: update; crontab adopted .. update; crontab adopted Change-Id: I8ebb50fde67f4d4d5dc010814e591aa96a81618f --- M crontab 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/drtrigonbot refs/changes/92/104192/1 diff --git a/crontab b/crontab index ae0b829..162760a 100644 --- a/crontab +++ b/crontab @@ -78,8 +78,8 @@ PATH=/usr/local/bin:/usr/bin:/bin # pywikibot-core: script_wui.py -06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log -#06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log >/dev/null +#06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log +06 0 * * * jstart -l h_vmem=512M -quiet -N script_wui python $HOME/pywikibot-core/pwb.py script_wui.py -log >/dev/null # pywikibot-compat: sum_disc.py [SIMULATE] 36 2 * * * jsub -l h_vmem=1024M -quiet -N sum_disc python $HOME/pywikibot-compat/pwb.py -sum_disc -simulate @@ -89,13 +89,13 @@ #36 2 * * * jsub -l h_vmem=1024M -quiet -N sum_disc python $HOME/pywikibot-compat/pwb.py -sum_disc #06 2 */14 * * jsub -l h_vmem=256M -quiet -N compbot python $HOME/pywikibot-compat/pwb.py -sum_disc -compress_history:[] -## pywikibot-compat: catimages.py [SIMULATE] -#06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -cat -simulate +# pywikibot-compat: catimages.py [SIMULATE] +06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -cat -simulate ## pywikibot-compat: catimages.py #06 20 * * * jsub -l h_vmem=1024M -quiet -N catimages python $HOME/pywikibot-compat/pwb.py -catimages -## pywikibot-compat: subster.py, subster_irc.py [SIMULATE] +# pywikibot-compat: subster.py, subster_irc.py [SIMULATE] #36 6 * * * jsub -l h_vmem=1024M -quiet -N subster python $HOME/pywikibot-compat/pwb.py -subster -simulate #06 * * * * jstart -l h_vmem=512M -quiet -N ircbot python $HOME/pywikibot-compat/pwb.py -subster_irc -simulate 06 0 * * * jsub -l h_vmem=512M -quiet -N subster_meta python $HOME/pywikibot-compat/pwb.py -subster -family:meta -lang: -simulate -- To view, visit https://gerrit.wikimedia.org/r/104192 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ebb50fde67f4d4d5dc010814e591aa96a81618f Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/drtrigonbot Gerrit-Branch: master Gerrit-Owner: DrTrigon ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update documentation for WebInstaller_DBConnect::execute() - change (mediawiki/core)
MarkAHershberger has submitted this change and it was merged. Change subject: Update documentation for WebInstaller_DBConnect::execute() .. Update documentation for WebInstaller_DBConnect::execute() Change-Id: I7f700daf8c1dbf0903159a1b750612b09f0e8e25 --- M includes/installer/WebInstallerPage.php 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: MarkAHershberger: Looks good to me, approved diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 1c95d9a..aa324de 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -454,7 +454,9 @@ } class WebInstaller_DBConnect extends WebInstallerPage { - + /** +* @return string|void When string, "skip" or "continue" +*/ public function execute() { if ( $this->getVar( '_ExistingDBSettings' ) ) { return 'skip'; -- To view, visit https://gerrit.wikimedia.org/r/104057 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7f700daf8c1dbf0903159a1b750612b09f0e8e25 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Chad Gerrit-Reviewer: MarkAHershberger Gerrit-Reviewer: Waldir 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 deprecated WebRequest::getFileSize() - change (mediawiki...SocialProfile)
Hoo man has submitted this change and it was merged. Change subject: Replace deprecated WebRequest::getFileSize() .. Replace deprecated WebRequest::getFileSize() Change-Id: Ib59ed2776030c41d33bb85c986e1352fa40740ab --- M SystemGifts/SpecialSystemGiftManagerLogo.php M UserGifts/SpecialGiftManagerLogo.php 2 files changed, 6 insertions(+), 4 deletions(-) Approvals: Hoo man: Verified; Looks good to me, approved diff --git a/SystemGifts/SpecialSystemGiftManagerLogo.php b/SystemGifts/SpecialSystemGiftManagerLogo.php index b1e47d1..7d983de 100644 --- a/SystemGifts/SpecialSystemGiftManagerLogo.php +++ b/SystemGifts/SpecialSystemGiftManagerLogo.php @@ -97,7 +97,8 @@ * Check for a newly uploaded file. */ $this->mUploadTempName = $request->getFileTempName( 'wpUploadFile' ); - $this->mUploadSize = $request->getFileSize( 'wpUploadFile' ); + $file = new WebRequestUpload( $request, 'wpUploadFile' ); + $this->mUploadSize = $file->getSize(); $this->mOname = $request->getFileName( 'wpUploadFile' ); $this->mSessionKey = false; $this->mStashed = false; @@ -727,4 +728,4 @@ wfDebug( __METHOD__ . ": all clear; passing.\n" ); return Status::newGood(); } -} \ No newline at end of file +} diff --git a/UserGifts/SpecialGiftManagerLogo.php b/UserGifts/SpecialGiftManagerLogo.php index cd8d080..b13f117 100644 --- a/UserGifts/SpecialGiftManagerLogo.php +++ b/UserGifts/SpecialGiftManagerLogo.php @@ -94,7 +94,8 @@ * Check for a newly uploaded file. */ $this->mUploadTempName = $request->getFileTempName( 'wpUploadFile' ); - $this->mUploadSize = $request->getFileSize( 'wpUploadFile' ); + $file = new WebRequestUpload( $request, 'wpUploadFile' ); + $this->mUploadSize = $file->getSize(); $this->mOname = $request->getFileName( 'wpUploadFile' ); $this->mSessionKey = false; $this->mStashed = false; @@ -709,4 +710,4 @@ wfDebug( __METHOD__ . ": all clear; passing.\n" ); return Status::newGood(); } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/104145 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib59ed2776030c41d33bb85c986e1352fa40740ab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SocialProfile Gerrit-Branch: master Gerrit-Owner: Siebrand Gerrit-Reviewer: Bartosz Dziewoński Gerrit-Reviewer: Chad Gerrit-Reviewer: Hoo man Gerrit-Reviewer: Parent5446 Gerrit-Reviewer: Siebrand ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Disable MessageBlobStore::clear() via hook - change (operations/mediawiki-config)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104191 Change subject: Disable MessageBlobStore::clear() via hook .. Disable MessageBlobStore::clear() via hook Change-Id: I76bfac45e73cba2e0362fddc4eff9dff80689809 --- M wmf-config/CommonSettings.php 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/91/104191/1 diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php index 4c7092e..cfc9058 100644 --- a/wmf-config/CommonSettings.php +++ b/wmf-config/CommonSettings.php @@ -293,6 +293,12 @@ $wgLocalisationCacheConf['storeDirectory'] = "$IP/cache/l10n"; $wgLocalisationCacheConf['manualRecache'] = true; +// Bug 27320: skip MessageBlobStore::clear(); handle via refreshMessageBlobs.php instead +$wgHooks['LocalisationCacheRecache'][] = function( $cache, $code, &$allData, &$purgeBlobs ) { + $purgeBlobs = false; + return true; +}; + $wgFileStore['deleted']['directory'] = "/mnt/upload7/private/archive/$site/$lang"; # used for mysql/search settings -- To view, visit https://gerrit.wikimedia.org/r/104191 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I76bfac45e73cba2e0362fddc4eff9dff80689809 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added $purgeBlobs flag to LocalisationCacheRecache hook - change (mediawiki/core)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104190 Change subject: Added $purgeBlobs flag to LocalisationCacheRecache hook .. Added $purgeBlobs flag to LocalisationCacheRecache hook * This helps replace the WMF live hack to skip calling clear() Change-Id: I37bd6cf87e72b6d32e4c6c261abe2a0ef43d067e --- M docs/hooks.txt M includes/cache/LocalisationCache.php 2 files changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/104190/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index ebc412b..fc4d40e 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1546,6 +1546,7 @@ $cache: The LocalisationCache object $code: language code &$alldata: The localisation data from core and extensions +&purgeBlobs: whether to purge/update the message blobs via MessageBlobStore::clear() 'LocalisationChecksBlacklist': When fetching the blacklist of localisation checks. diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 55c4c58..47a5904 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -923,7 +923,8 @@ $allData['list'][$key] = array_keys( $allData[$key] ); } # Run hooks - wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData ) ); + $purgeBlobs = true; + wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) ); if ( is_null( $allData['namespaceNames'] ) ) { wfProfileOut( __METHOD__ ); @@ -958,7 +959,7 @@ # Clear out the MessageBlobStore # HACK: If using a null (i.e. disabled) storage backend, we # can't write to the MessageBlobStore either - if ( !$this->store instanceof LCStoreNull ) { + if ( $purgeBlobs && !$this->store instanceof LCStoreNull ) { MessageBlobStore::clear(); } -- To view, visit https://gerrit.wikimedia.org/r/104190 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I37bd6cf87e72b6d32e4c6c261abe2a0ef43d067e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] delete-from-category needs a category not a page - change (pywikibot/i18n)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104188 Change subject: delete-from-category needs a category not a page .. delete-from-category needs a category not a page Change-Id: Ice2fae60fe68c548f6569449c35451c101224967 --- M delete.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/i18n refs/changes/88/104188/1 diff --git a/delete.py b/delete.py index 68a18a3..3084ff9 100644 --- a/delete.py +++ b/delete.py @@ -13,7 +13,7 @@ 'qqq': { 'delete-images': u'Used as edit summary. Parameters:\n* %(page)s - page name', 'delete-referring-pages': u'Used as edit summary. Parameters:\n* %(page)s - page name\n\nDefinitions:\n*"Link" - Link is all the links on a page. So if your page content was [[Page1]] [[Page2]], it would use those two pages. \n*"Refer" - Refer is basically [[Special:WhatLinksHere]], or all the pages that link to the page provided.', - 'delete-from-category': u'Used as edit summary. Parameters:\n* %(page)s - page name', + 'delete-from-category': u'Used as edit summary. Parameters:\n* %(page)s - category name', 'delete-from-file': u'Edit summary when the bot deletes a list of pages.', 'delete-linked-pages': u'Used as edit summary. Parameters:\n* %(page)s - page name', }, -- To view, visit https://gerrit.wikimedia.org/r/104188 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice2fae60fe68c548f6569449c35451c101224967 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/i18n Gerrit-Branch: master Gerrit-Owner: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added MW version argument to scap - change (operations/puppet)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/104189 Change subject: Added MW version argument to scap .. Added MW version argument to scap * It can either be "active" for all active MW versions, a specific MW version, or left out for all MW versions. The can avoid lots of rsync traffic on old versions. Change-Id: I1e2bcf4268b389544de35ed4c4a929935a4b5808 --- M files/scap/mw-update-l10n M files/scap/scap M files/scap/scap-2 3 files changed, 50 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/89/104189/1 diff --git a/files/scap/mw-update-l10n b/files/scap/mw-update-l10n index 2497548..3823a54 100755 --- a/files/scap/mw-update-l10n +++ b/files/scap/mw-update-l10n @@ -48,6 +48,20 @@ for i in ${mwExtVerDbSets[@]}; do mwVerNum=${i%=*} mwDbName=${i#*=} + + # Only looks at certain MW version if specified + if [ -n "$MW_VERSIONS_SYNC" ]; then + skip=1 + for v in ${MW_VERSIONS_SYNC[@]}; do + if [ "$mwVerNum" == "$v" ]; then + skip=0 + fi + done + if [ "$skip" -eq "1" ]; then + continue + fi + fi + echo -n "Updating ExtensionMessages-$mwVerNum.php..." mwTempDest=$(sudo -u apache mktemp) || die sudo -u apache $BINDIR/mwscript mergeMessageFileList.php --wiki="$mwDbName" \ diff --git a/files/scap/scap b/files/scap/scap index 6a89b3c..30961cd 100755 --- a/files/scap/scap +++ b/files/scap/scap @@ -33,6 +33,23 @@ die "SSH_AUTH_SOCK not set or not pointing to a socket. Did you start your ssh-agent?" fi +DSH_EXPORTS= +# Only sync the active version(s) if requested +if [ -n "$1" ]; then + # This will export MW_VERSIONS_SYNC to sync-common/mw-update-l10n + if [ "$1" == "active" ]; then + # All active MW versions + export MW_VERSIONS_SYNC=$($BINDIR/mwversionsinuse --home) + elif [ -d "$MW_COMMON_SOURCE/$1" ]; then + # A specific MW version + export MW_VERSIONS_SYNC=$1 + else + die "Invalid MediaWiki version \"$1\"" + fi + # This will export MW_VERSIONS_SYNC to scap-1 on the proxies/servers + DSH_EXPORTS="export MW_VERSIONS_SYNC=\"$MW_VERSIONS_SYNC\";" +fi + # Perform syntax check echo -n "Checking syntax of wmf-config and multiversion..." if ( ! ( $BINDIR/lint $MW_COMMON_SOURCE/wmf-config && $BINDIR/lint $MW_COMMON_SOURCE/multiversion ) ); then @@ -56,7 +73,7 @@ export DOLOGMSGNOLOG=1 echo 'Updating rsync proxies...' -dsh -cM -g scap-proxies -o -oSetupTimeout=10 -- /usr/local/bin/scap-1 +dsh -cM -g scap-proxies -o -oSetupTimeout=10 -- "$DSH_EXPORTS /usr/local/bin/scap-1" # Do the main code update in random order to avoid overloading any given rsync server NODEFILE=$(mktemp) @@ -67,7 +84,7 @@ RSYNC_SERVERS=`echo $RSYNC_SERVERS` echo 'Copying code to apaches...' -dsh -F30 -cM -f "$NODEFILE" -o -oSetupTimeout=10 /usr/local/bin/scap-1 \""$RSYNC_SERVERS"\" +dsh -F30 -cM -f "$NODEFILE" -o -oSetupTimeout=10 -- "$DSH_EXPORTS /usr/local/bin/scap-1 \""$RSYNC_SERVERS"\"" echo 'Finished' # Builds wikiversions.cdb and syncs it to the apaches with the dat file diff --git a/files/scap/scap-2 b/files/scap/scap-2 index 43cfe2b..b8fbbe2 100755 --- a/files/scap/scap-2 +++ b/files/scap/scap-2 @@ -11,8 +11,17 @@ SERVER="${MW_RSYNC_HOST}" fi +RSYNC_ARGS=MW_RSYNC_ARGS +# Only looks at certain MW version if specified +if [ -n "$MW_VERSIONS_SYNC" ]; then + RSYNC_ARGS+=("--exclude='php-*'") + for v in ${MW_VERSIONS_SYNC[@]}; do + RSYNC_ARGS+=("--include='php-$v'") + done +fi + echo -n Copying to `hostname -s` from "$SERVER"... -if rsync "${MW_RSYNC_ARGS[@]}" "$SERVER"::common/ "${MW_COMMON}" +if rsync "${RSYNC_ARGS[@]}" "$SERVER"::common/ "${MW_COMMON}" then echo "ok" else @@ -24,7 +33,13 @@ CPUS=`grep -c 'model name' /proc/cpuinfo` THREADS=`expr $CPUS / 2` -mwVersions=$($BINDIR/mwversionsinuse) +# Only looks at certain MW version if specified +if [ -n "$MW_VERSIONS_SYNC" ]; then + mwVersions=$MW_VERSIONS_SYNC +else + mwVersions=$($BINDIR/mwversionsinuse) +fi + # Rebuild the CDB files from the JSON versions # Regenerate the extension message file list for all active MediaWiki versions for mwVerNum in ${mwVersions[@]}; do -- To view, visit https://gerrit.wikimedia.org/r/104189 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e2bcf4268b389544de35ed4c4a929935a4b5808 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Aaron Schulz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikime
[MediaWiki-commits] [Gerrit] More explaining doc messages - change (pywikibot/i18n)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104187 Change subject: More explaining doc messages .. More explaining doc messages Change-Id: I9067db06adee90e3a7eeedc0bfae80cfcc413448 --- M protect.py 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/i18n refs/changes/87/104187/1 diff --git a/protect.py b/protect.py index 459d568..f236cfe 100644 --- a/protect.py +++ b/protect.py @@ -10,10 +10,10 @@ # Author: Geoffrey "GEOFBOT" Mon 'qqq': { 'protect-simple': u'Edit summary when the bot protects a list of files.', - 'protect-category': u'Edit summary when the bot protects all pages from a category (%(cat)s).', - 'protect-links': u'Edit summary when the bot protects all pages linked from a page (%(page)s).', - 'protect-ref': u'Edit summary when the bot protects all pages referring from a page (%(page)s).', - 'protect-images': u'Edit summary when the bot protects all images on a page (%(page)s).', + 'protect-category': u'Edit summary when the bot protects all pages from a category. Parameters:\n* %(cat)s - category name.', + 'protect-links': u'Edit summary when the bot protects all pages linked from a page. Parameters:\n* %(page)s - page name', + 'protect-ref': u'Edit summary when the bot protects all pages referring from a page. Parameters:\n* %(page)s - page name', + 'protect-images': u'Edit summary when the bot protects all images on a page. Parameters:\n* %(page)s - page name', }, 'ar': { 'protect-simple': u'بوت: حماية قائمة من الملفات.', -- To view, visit https://gerrit.wikimedia.org/r/104187 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9067db06adee90e3a7eeedc0bfae80cfcc413448 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/i18n Gerrit-Branch: master Gerrit-Owner: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] cosmetic changes - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: cosmetic changes .. cosmetic changes Change-Id: I53a8be38cfde116f37a9153a08d0833d1ce942e7 --- M scripts/protect.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Xqt: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/protect.py b/scripts/protect.py index 22e604d..deaae24 100644 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -40,7 +40,7 @@ # Written by http://it.wikisource.org/wiki/Utente:Qualc1 # Created by modifying delete.py # -# (C) Pywiki bot team, 2008-2013 +# (C) Pywikibot team, 2008-2013 # # Distributed under the terms of the MIT license. # -- To view, visit https://gerrit.wikimedia.org/r/104186 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I53a8be38cfde116f37a9153a08d0833d1ce942e7 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt Gerrit-Reviewer: Xqt Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [BUGFIX] use pywikibot.Category instead of catlib.Category - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: [BUGFIX] use pywikibot.Category instead of catlib.Category .. [BUGFIX] use pywikibot.Category instead of catlib.Category update from compat Change-Id: I680d9d0c44f46c436b4cab546aaa0a959e59dd81 --- M scripts/protect.py 1 file changed, 22 insertions(+), 11 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/protect.py b/scripts/protect.py index 0fa1ca1..22e604d 100644 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -40,7 +40,7 @@ # Written by http://it.wikisource.org/wiki/Utente:Qualc1 # Created by modifying delete.py # -# (C) Pywikipedia bot team, 2008-2012 +# (C) Pywiki bot team, 2008-2013 # # Distributed under the terms of the MIT license. # @@ -65,6 +65,7 @@ * always - Protect without prompting? * edit, move, create - protection level for these operations * unprotect - unprotect pages (and ignore edit, move, create params) + """ self.generator = generator self.summary = summary @@ -124,18 +125,21 @@ always = True elif arg.startswith('-file'): if len(arg) == len('-file'): -fileName = pywikibot.input(u'Enter name of file to protect pages from:') +fileName = pywikibot.input( +u'Enter name of file to protect pages from:') else: fileName = arg[len('-file:'):] elif arg.startswith('-summary'): if len(arg) == len('-summary'): -summary = pywikibot.input(u'Enter a reason for the protection:') +summary = pywikibot.input( +u'Enter a reason for the protection:') else: summary = arg[len('-summary:'):] elif arg.startswith('-cat'): doCategory = True if len(arg) == len('-cat'): -pageName = pywikibot.input(u'Enter the category to protect from:') +pageName = pywikibot.input( +u'Enter the category to protect from:') else: pageName = arg[len('-cat:'):] elif arg.startswith('-nosubcats'): @@ -188,18 +192,22 @@ gen = iter([page]) elif doCategory: if not summary: -summary = i18n.twtranslate(mysite, 'protect-category', {'cat': pageName}) +summary = i18n.twtranslate(mysite, 'protect-category', + {'cat': pageName}) ns = mysite.category_namespace() -categoryPage = catlib.Category(mysite, ns + ':' + pageName) -gen = pagegenerators.CategorizedPageGenerator(categoryPage, recurse=protectSubcategories) +categoryPage = pywikibot.Category(mysite, ns + ':' + pageName) +gen = pagegenerators.CategorizedPageGenerator( +categoryPage, recurse=protectSubcategories) elif doLinks: if not summary: -summary = i18n.twtranslate(mysite, 'protect-links', {'page': pageName}) +summary = i18n.twtranslate(mysite, 'protect-links', + {'page': pageName}) linksPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.LinkedPageGenerator(linksPage) elif doRef: if not summary: -summary = i18n.twtranslate(mysite, 'protect-ref', {'page': pageName}) +summary = i18n.twtranslate(mysite, 'protect-ref', + {'page': pageName}) refPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.ReferringPageGenerator(refPage) elif fileName: @@ -208,8 +216,10 @@ gen = pagegenerators.TextfilePageGenerator(fileName) elif doImages: if not summary: -summary = i18n.twtranslate(mysite, 'protect-images', {'page': pageName}) -gen = pagegenerators.ImagesPageGenerator(pywikibot.Page(mysite, pageName)) +summary = i18n.twtranslate(mysite, 'protect-images', + {'page': pageName}) +gen = pagegenerators.ImagesPageGenerator(pywikibot.Page(mysite, +pageName)) if gen: pywikibot.setAction(summary) @@ -225,6 +235,7 @@ else: pywikibot.showHelp(u'protect') + if __name__ == "__main__": try: main() -- To view, visit https://gerrit.wikimedia.org/r/104185 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I680d9d0c44f46c436b4cab546aaa0a959e59dd81 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt Gerrit-Reviewer: Ladsgroup Gerrit-Reviewer: Merlijn van Deen Gerrit-Reviewer: Xqt Gerrit-Reviewer: jenkins-bot _
[MediaWiki-commits] [Gerrit] cosmetic changes - change (pywikibot/core)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104186 Change subject: cosmetic changes .. cosmetic changes Change-Id: I53a8be38cfde116f37a9153a08d0833d1ce942e7 --- M scripts/protect.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/86/104186/1 diff --git a/scripts/protect.py b/scripts/protect.py index 22e604d..deaae24 100644 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -40,7 +40,7 @@ # Written by http://it.wikisource.org/wiki/Utente:Qualc1 # Created by modifying delete.py # -# (C) Pywiki bot team, 2008-2013 +# (C) Pywikibot team, 2008-2013 # # Distributed under the terms of the MIT license. # -- To view, visit https://gerrit.wikimedia.org/r/104186 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I53a8be38cfde116f37a9153a08d0833d1ce942e7 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [BUGFIX] use pywikibot.Category instead of catlib.Category - change (pywikibot/core)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104185 Change subject: [BUGFIX] use pywikibot.Category instead of catlib.Category .. [BUGFIX] use pywikibot.Category instead of catlib.Category update from compat Change-Id: I680d9d0c44f46c436b4cab546aaa0a959e59dd81 --- M scripts/protect.py 1 file changed, 22 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/85/104185/1 diff --git a/scripts/protect.py b/scripts/protect.py index 0fa1ca1..22e604d 100644 --- a/scripts/protect.py +++ b/scripts/protect.py @@ -40,7 +40,7 @@ # Written by http://it.wikisource.org/wiki/Utente:Qualc1 # Created by modifying delete.py # -# (C) Pywikipedia bot team, 2008-2012 +# (C) Pywiki bot team, 2008-2013 # # Distributed under the terms of the MIT license. # @@ -65,6 +65,7 @@ * always - Protect without prompting? * edit, move, create - protection level for these operations * unprotect - unprotect pages (and ignore edit, move, create params) + """ self.generator = generator self.summary = summary @@ -124,18 +125,21 @@ always = True elif arg.startswith('-file'): if len(arg) == len('-file'): -fileName = pywikibot.input(u'Enter name of file to protect pages from:') +fileName = pywikibot.input( +u'Enter name of file to protect pages from:') else: fileName = arg[len('-file:'):] elif arg.startswith('-summary'): if len(arg) == len('-summary'): -summary = pywikibot.input(u'Enter a reason for the protection:') +summary = pywikibot.input( +u'Enter a reason for the protection:') else: summary = arg[len('-summary:'):] elif arg.startswith('-cat'): doCategory = True if len(arg) == len('-cat'): -pageName = pywikibot.input(u'Enter the category to protect from:') +pageName = pywikibot.input( +u'Enter the category to protect from:') else: pageName = arg[len('-cat:'):] elif arg.startswith('-nosubcats'): @@ -188,18 +192,22 @@ gen = iter([page]) elif doCategory: if not summary: -summary = i18n.twtranslate(mysite, 'protect-category', {'cat': pageName}) +summary = i18n.twtranslate(mysite, 'protect-category', + {'cat': pageName}) ns = mysite.category_namespace() -categoryPage = catlib.Category(mysite, ns + ':' + pageName) -gen = pagegenerators.CategorizedPageGenerator(categoryPage, recurse=protectSubcategories) +categoryPage = pywikibot.Category(mysite, ns + ':' + pageName) +gen = pagegenerators.CategorizedPageGenerator( +categoryPage, recurse=protectSubcategories) elif doLinks: if not summary: -summary = i18n.twtranslate(mysite, 'protect-links', {'page': pageName}) +summary = i18n.twtranslate(mysite, 'protect-links', + {'page': pageName}) linksPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.LinkedPageGenerator(linksPage) elif doRef: if not summary: -summary = i18n.twtranslate(mysite, 'protect-ref', {'page': pageName}) +summary = i18n.twtranslate(mysite, 'protect-ref', + {'page': pageName}) refPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.ReferringPageGenerator(refPage) elif fileName: @@ -208,8 +216,10 @@ gen = pagegenerators.TextfilePageGenerator(fileName) elif doImages: if not summary: -summary = i18n.twtranslate(mysite, 'protect-images', {'page': pageName}) -gen = pagegenerators.ImagesPageGenerator(pywikibot.Page(mysite, pageName)) +summary = i18n.twtranslate(mysite, 'protect-images', + {'page': pageName}) +gen = pagegenerators.ImagesPageGenerator(pywikibot.Page(mysite, +pageName)) if gen: pywikibot.setAction(summary) @@ -225,6 +235,7 @@ else: pywikibot.showHelp(u'protect') + if __name__ == "__main__": try: main() -- To view, visit https://gerrit.wikimedia.org/r/104185 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I680d9d0c44f46c436b4cab546aaa0a959e59dd81 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedi
[MediaWiki-commits] [Gerrit] [i18n] Add protect.py to i18n system - change (pywikibot/compat)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/104184 Change subject: [i18n] Add protect.py to i18n system .. [i18n] Add protect.py to i18n system update from core Change-Id: I2e6a451132c2e5080ffe73b194c23c1b7847580d --- M protect.py 1 file changed, 11 insertions(+), 59 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat refs/changes/84/104184/1 diff --git a/protect.py b/protect.py index 85cfeb4..acf1824 100644 --- a/protect.py +++ b/protect.py @@ -49,58 +49,8 @@ import pywikibot import catlib +from pywikibot import i18n import pagegenerators - -# Summary messages for protecting from a category. -msg_simple_protect = { -'ar': u'بوت: حماية قائمة من الملفات.', -'en': u'Robot: Protecting a list of files.', -'it': u'Bot: Protezione di una lista di pagine.', -'fa': u'ربات:حفاظت فهرستی از صفحهها', -'nl': u'Bot: lijst met bestanden beveiligd', -'pt': u'Bot: Protegendo uma lista de artigos.', -'zh': u'機器人:保護清單中的所有檔案', -} - -msg_protect_category = { -'ar': u'روبوت - حماية كل الصفحات من التصنيف %s', -'en': u'Robot: Protecting all pages from category %s', -'it': u'Bot: Protezione di tutte le pagine nella categoria %s.', -'fa': u'ربات:حفاظت تمام صفحههای رده %s', -'nl': u'Bot: alle pagina\'s uit categorie %s beveiligd', -'pt': u'Bot: Protegendo todos os artigos da categoria %s', -'zh': u'機器人: 保護目錄 %s 的所有頁面', -} - -msg_protect_links = { -'ar': u'روبوت - حماية كل الصفحات الموصولة من %s', -'en': u'Robot: Protecting all pages linked from %s', -'it': u'Bot: Protezione di tutte le pagine linkate da %s.', -'fa': u'ربات:حفاظت تمام صفحههایی که در %s پیوند شدهاند.', -'nl': u'Bot: alle pagina\'s met verwijzingen vanaf %s beveiligd', -'pt': u'Bot: Protegendo todos os artigos ligados a %s', -'zh': u'機器人: 保護所有從 %s 連結的頁面', -} - -msg_protect_ref = { -'ar': u'روبوت - حماية كل الصفحات الراجعة من %s', -'en': u'Robot: Protecting all pages referring from %s', -'it': u'Bot: Protezione di tutte le pagine con link verso %s.', -'fa': u'ربات:حفاظت تمام صفحههایی که به %s پیوند دادهاند', -'nl': u'Bot: alle pagina\'s met een verwijzing op beveiligd', -'pt': u'Bot: Protegendo todos os artigos afluentes a %s', -'zh': u'機器人: 保護所有連至 %s 的頁面', -} - -msg_protect_images = { -'ar': u'روبوت - حماية كل الصور في الصفحة %s', -'en': u'Robot: Protecting all images on page %s', -'it': u'Bot: Protezione di tutte le immagini presenti in %s.', -'fa': u'ربات:حفاظت تمام تصاویر به کار رفته در %s', -'nl': u'Bot: alle bestanden gebruikt op %s beveiligd', -'pt': u'Bot: Protegendo todas as imagens do artigo %s', -'zh': u'機器人: 保護頁面 %s 中的所有圖條', -} class ProtectionRobot: @@ -132,7 +82,6 @@ #Loop through everything in the page generator and (un)protect it. for page in self.generator: pywikibot.output(u'Processing page %s' % page.title()) -#print self.edit, self.move#, self.create page.protect(unprotect=self.unprotect, reason=self.summary, prompt=self.prompt, editcreate=self.edit, move=self.move) @@ -244,30 +193,32 @@ gen = iter([page]) elif doCategory: if not summary: -summary = pywikibot.translate(mysite, - msg_protect_category) % pageName +summary = i18n.twtranslate(mysite, 'protect-category', + {'cat': pageName}) ns = mysite.category_namespace() categoryPage = catlib.Category(mysite, ns + ':' + pageName) gen = pagegenerators.CategorizedPageGenerator( categoryPage, recurse=protectSubcategories) elif doLinks: if not summary: -summary = pywikibot.translate(mysite, - msg_protect_links) % pageName +summary = i18n.twtranslate(mysite, 'protect-links', + {'page': pageName}) linksPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.LinkedPageGenerator(linksPage) elif doRef: if not summary: -summary = pywikibot.translate(mysite, msg_protect_ref) % pageName +summary = i18n.twtranslate(mysite, 'protect-ref', + {'page': pageName}) refPage = pywikibot.Page(mysite, pageName) gen = pagegenerators.ReferringPageGenerator(refPage) elif fileName: if not summary: -summary = pywikibot.translate(mysite, msg_simple_protect) +summary = i18n.twtranslate(mysite, 'protect-simple') gen = pagegenerators.TextfilePageGenerator(fileName) elif doImages: if not summary: -summary = pywikibot.translate(mysite, msg_protect_images) % pageName +summ