[MediaWiki-commits] [Gerrit] Pass Config to ResourceLoader constructor in a few places - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155869 Change subject: Pass Config to ResourceLoader constructor in a few places .. Pass Config to ResourceLoader constructor in a few places Change-Id: I200e2c2dc922ae1fa5fa68d449403d0287e41786 --- M includes/resourceloader/ResourceLoaderContext.php M load.php M maintenance/cleanupRemovedModules.php 3 files changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/69/155869/1 diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index e79aadc..7af7b89 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -113,7 +113,9 @@ * @return ResourceLoaderContext */ public static function newDummyContext() { - return new self( new ResourceLoader, new FauxRequest( array() ) ); + return new self( new ResourceLoader( + ConfigFactory::getDefaultInstance()-makeConfig( 'main' ) + ), new FauxRequest( array() ) ); } /** diff --git a/load.php b/load.php index 1dd1a89..655f309 100644 --- a/load.php +++ b/load.php @@ -39,7 +39,9 @@ } // Respond to resource loading request -$resourceLoader = new ResourceLoader(); +$resourceLoader = new ResourceLoader( + ConfigFactory::getDefaultInstance()-makeConfig( 'main' ) +); $resourceLoader-respond( new ResourceLoaderContext( $resourceLoader, $wgRequest ) ); wfProfileOut( 'load.php' ); diff --git a/maintenance/cleanupRemovedModules.php b/maintenance/cleanupRemovedModules.php index cc8b024..e1d0ed6 100644 --- a/maintenance/cleanupRemovedModules.php +++ b/maintenance/cleanupRemovedModules.php @@ -47,7 +47,7 @@ public function execute() { $dbw = wfGetDB( DB_MASTER ); - $rl = new ResourceLoader(); + $rl = new ResourceLoader( ConfigFactory::getDefaultInstance()-makeConfig( 'main' ) ); $moduleNames = $rl-getModuleNames(); $moduleList = implode( ', ', array_map( array( $dbw, 'addQuotes' ), $moduleNames ) ); $limit = max( 1, intval( $this-getOption( 'batchsize', 500 ) ) ); -- To view, visit https://gerrit.wikimedia.org/r/155869 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I200e2c2dc922ae1fa5fa68d449403d0287e41786 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add a test for ApiFormatNone - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155870 Change subject: Add a test for ApiFormatNone .. Add a test for ApiFormatNone Because lolz. Change-Id: I9c472131746a722737300b7d2d2291c70f80bb2e --- A tests/phpunit/includes/api/format/ApiFormatNoneTest.php 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/70/155870/1 diff --git a/tests/phpunit/includes/api/format/ApiFormatNoneTest.php b/tests/phpunit/includes/api/format/ApiFormatNoneTest.php new file mode 100644 index 000..cabd750 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatNoneTest.php @@ -0,0 +1,16 @@ +?php + +/** + * @group API + * @group Database + * @group medium + * @covers ApiFormatNone + */ +class ApiFormatNoneTest extends ApiFormatTestBase { + + public function testValidSyntax( ) { + $data = $this-apiRequest( 'none', array( 'action' = 'query', 'meta' = 'siteinfo' ) ); + + $this-assertEquals( '', $data ); // No output! + } +} -- To view, visit https://gerrit.wikimedia.org/r/155870 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c472131746a722737300b7d2d2291c70f80bb2e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Mark ConfigFactory::destroyDefaultInstance() with @codeCover... - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155871 Change subject: Mark ConfigFactory::destroyDefaultInstance() with @codeCoverageIgnore .. Mark ConfigFactory::destroyDefaultInstance() with @codeCoverageIgnore Change-Id: Icd4a5724aefab58dad1af07874ef7ee415922ead --- M includes/config/ConfigFactory.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/71/155871/1 diff --git a/includes/config/ConfigFactory.php b/includes/config/ConfigFactory.php index 312d461..12b0c39 100644 --- a/includes/config/ConfigFactory.php +++ b/includes/config/ConfigFactory.php @@ -61,6 +61,7 @@ * Destroy the default instance * Should only be called inside unit tests * @throws MWException +* @codeCoverageIgnore */ public static function destroyDefaultInstance() { if ( !defined( 'MW_PHPUNIT_TEST' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/155871 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd4a5724aefab58dad1af07874ef7ee415922ead Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Import.php: Use Config instead of globals - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155872 Change subject: Import.php: Use Config instead of globals .. Import.php: Use Config instead of globals Change-Id: I4d1a8c443cfa360c5d388364c580d48fa7124099 --- M includes/Import.php M includes/api/ApiImport.php M includes/specials/SpecialImport.php M maintenance/dumpIterator.php M tests/phpunit/includes/ImportTest.php 5 files changed, 25 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/72/155872/1 diff --git a/includes/Import.php b/includes/Import.php index 3880e25..f1677cb 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -37,13 +37,17 @@ private $mNoticeCallback, $mDebug; private $mImportUploads, $mImageBasePath; private $mNoUpdates = false; + /** @var Config */ + private $config; /** * Creates an ImportXMLReader drawing from the source provided * @param ImportStreamSource $source +* @param Config $config */ - function __construct( ImportStreamSource $source ) { + function __construct( ImportStreamSource $source, Config $config = null ) { $this-reader = new XMLReader(); + $this-config = $config ? : RequestContext::getMainAndWarn( __METHOD__ ); if ( !in_array( 'uploadsource', stream_get_wrappers() ) ) { stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' ); @@ -536,7 +540,7 @@ * @return bool|mixed */ private function processLogItem( $logInfo ) { - $revision = new WikiRevision; + $revision = new WikiRevision( $this-config ); $revision-setID( $logInfo['id'] ); $revision-setType( $logInfo['type'] ); @@ -670,7 +674,7 @@ * @return bool|mixed */ private function processRevision( $pageInfo, $revisionInfo ) { - $revision = new WikiRevision; + $revision = new WikiRevision( $this-config ); if ( isset( $revisionInfo['id'] ) ) { $revision-setID( $revisionInfo['id'] ); @@ -786,7 +790,7 @@ * @return mixed */ private function processUpload( $pageInfo, $uploadInfo ) { - $revision = new WikiRevision; + $revision = new WikiRevision( $this-config ); $text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : ''; $revision-setTitle( $pageInfo['_title'] ); @@ -847,8 +851,6 @@ * @return array|bool */ private function processTitle( $text ) { - global $wgCommandLineMode; - $workTitle = $text; $origTitle = Title::newFromText( $workTitle ); @@ -864,6 +866,7 @@ $title = Title::newFromText( $workTitle ); } + $commandLineMode = $this-config-get( 'CommandLineMode' ); if ( is_null( $title ) ) { # Invalid page title? Ignore the page $this-notice( 'import-error-invalid', $workTitle ); @@ -874,11 +877,11 @@ } elseif ( !$title-canExist() ) { $this-notice( 'import-error-special', $title-getPrefixedText() ); return false; - } elseif ( !$title-userCan( 'edit' ) !$wgCommandLineMode ) { + } elseif ( !$title-userCan( 'edit' ) !$commandLineMode ) { # Do not import if the importing wiki user cannot edit this page $this-notice( 'import-error-edit', $title-getPrefixedText() ); return false; - } elseif ( !$title-exists() !$title-userCan( 'create' ) !$wgCommandLineMode ) { + } elseif ( !$title-exists() !$title-userCan( 'create' ) !$commandLineMode ) { # Do not import if the importing wiki user cannot create this page $this-notice( 'import-error-create', $title-getPrefixedText() ); return false; @@ -1092,6 +1095,13 @@ /** @var bool */ private $mNoUpdates = false; + + /** @var Config $config */ + private $config; + + public function __construct( Config $config ) { + $this-config = $config; + } /** * @param Title $title @@ -1611,8 +1621,7 @@ * @return bool|string */ function downloadSource() { - global $wgEnableUploads; - if ( !$wgEnableUploads ) { + if ( !$this-config-get( 'EnableUploads' ) ) { return false; } diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 25ce89b..c8083ba 100644 --- a/includes/api/ApiImport.php
[MediaWiki-commits] [Gerrit] MessageBlobStore: Use Config instead of globals - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155874 Change subject: MessageBlobStore: Use Config instead of globals .. MessageBlobStore: Use Config instead of globals Change-Id: I458cc74bac1bff8edab6ad537a3a999ede5706ed --- M includes/MessageBlobStore.php 1 file changed, 3 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/155874/1 diff --git a/includes/MessageBlobStore.php b/includes/MessageBlobStore.php index 120c685..5999a5a 100644 --- a/includes/MessageBlobStore.php +++ b/includes/MessageBlobStore.php @@ -345,8 +345,7 @@ * @return array Array mapping module names to blobs */ private function getFromDB( ResourceLoader $resourceLoader, $modules, $lang ) { - global $wgCacheEpoch; - + $config = $resourceLoader-getConfig(); $retval = array(); $dbr = wfGetDB( DB_SLAVE ); $res = $dbr-select( 'msg_resource', @@ -363,11 +362,11 @@ } // Update the module's blobs if the set of messages changed or if the blob is - // older than $wgCacheEpoch + // older than the CacheEpoch setting $keys = array_keys( FormatJson::decode( $row-mr_blob, true ) ); $values = array_values( array_unique( $module-getMessages() ) ); if ( $keys !== $values - || wfTimestamp( TS_MW, $row-mr_timestamp ) = $wgCacheEpoch + || wfTimestamp( TS_MW, $row-mr_timestamp ) = $config-get( 'CacheEpoch' ) ) { $retval[$row-mr_resource] = $this-updateModule( $row-mr_resource, $module, $lang ); } else { -- To view, visit https://gerrit.wikimedia.org/r/155874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I458cc74bac1bff8edab6ad537a3a999ede5706ed Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Turn MessageBlobStore into a singleton instead of static fun... - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155873 Change subject: Turn MessageBlobStore into a singleton instead of static functions .. Turn MessageBlobStore into a singleton instead of static functions For easier testability and other things. There are no uses of this class in any extensions in gerrit. Change-Id: I606de4259239e128ed7e0477fc98b84c647430c4 --- M includes/MessageBlobStore.php M includes/cache/LocalisationCache.php M includes/cache/MessageCache.php M includes/installer/DatabaseUpdater.php M includes/resourceloader/ResourceLoader.php 5 files changed, 35 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/73/155873/1 diff --git a/includes/MessageBlobStore.php b/includes/MessageBlobStore.php index 5725898..120c685 100644 --- a/includes/MessageBlobStore.php +++ b/includes/MessageBlobStore.php @@ -33,6 +33,21 @@ */ class MessageBlobStore { /** +* Get the singleton instance +* +* @since 1.24 +* @return MessageBlobStore +*/ + public static function singleton() { + static $instance = null; + if ( $instance === null ) { + $instance = new self; + } + + return $instance; + } + + /** * Get the message blobs for a set of modules * * @param ResourceLoader $resourceLoader @@ -40,19 +55,19 @@ * @param string $lang Language code * @return array An array mapping module names to message blobs */ - public static function get( ResourceLoader $resourceLoader, $modules, $lang ) { + public function get( ResourceLoader $resourceLoader, $modules, $lang ) { wfProfileIn( __METHOD__ ); if ( !count( $modules ) ) { wfProfileOut( __METHOD__ ); return array(); } // Try getting from the DB first - $blobs = self::getFromDB( $resourceLoader, array_keys( $modules ), $lang ); + $blobs = $this-getFromDB( $resourceLoader, array_keys( $modules ), $lang ); // Generate blobs for any missing modules and store them in the DB $missing = array_diff( array_keys( $modules ), array_keys( $blobs ) ); foreach ( $missing as $name ) { - $blob = self::insertMessageBlob( $name, $modules[$name], $lang ); + $blob = $this-insertMessageBlob( $name, $modules[$name], $lang ); if ( $blob ) { $blobs[$name] = $blob; } @@ -72,8 +87,8 @@ * @param string $lang Language code * @return mixed Message blob or false if the module has no messages */ - public static function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) { - $blob = self::generateMessageBlob( $module, $lang ); + public function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) { + $blob = $this-generateMessageBlob( $module, $lang ); if ( !$blob ) { return false; @@ -130,7 +145,7 @@ * @return string Regenerated message blob, or null if there was no blob for * the given module/language pair. */ - public static function updateModule( $name, ResourceLoaderModule $module, $lang ) { + public function updateModule( $name, ResourceLoaderModule $module, $lang ) { $dbw = wfGetDB( DB_MASTER ); $row = $dbw-selectRow( 'msg_resource', 'mr_blob', array( 'mr_resource' = $name, 'mr_lang' = $lang ), @@ -142,7 +157,7 @@ // Save the old and new blobs for later $oldBlob = $row-mr_blob; - $newBlob = self::generateMessageBlob( $module, $lang ); + $newBlob = $this-generateMessageBlob( $module, $lang ); try { $newRow = array( @@ -197,7 +212,7 @@ * * @param string $key Message key */ - public static function updateMessage( $key ) { + public function updateMessage( $key ) { try { $dbw = wfGetDB( DB_MASTER ); @@ -206,7 +221,7 @@ // in one iteration. $updates = null; do { - $updates = self::getUpdatesForMessage( $key, $updates ); + $updates = $this-getUpdatesForMessage( $key, $updates ); foreach ( $updates as $k = $update ) { // Update the row on the condition that it @@ -240,7 +255,7 @@ } }
[MediaWiki-commits] [Gerrit] MimeMagic: Use Config instead of globals - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155875 Change subject: MimeMagic: Use Config instead of globals .. MimeMagic: Use Config instead of globals Change-Id: I07d1420deddeb886c714d7e2c99f8b456573a07f --- M includes/MimeMagic.php 1 file changed, 39 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/75/155875/1 diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 8f0a2af..1403da0 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -172,6 +172,9 @@ */ private $mExtraInfo = ''; + /** @var Config */ + private $mConfig; + /** @var MimeMagic The singleton instance */ private static $instance = null; @@ -179,30 +182,40 @@ /** Initializes the MimeMagic object. This is called by MimeMagic::singleton(). * * This constructor parses the mime.types and mime.info files and build internal mappings. +* +* @todo Make this constructor private once everything uses the singleton instance +* @param Config $config */ - function __construct() { + function __construct( Config $config = null ) { + if ( !$config ) { + wfDebug( __METHOD__ . ' called with no Config instance passed to it' ); + $config = ConfigFactory::getDefaultInstance()-makeConfig( 'main' ); + } + $this-mConfig = $config; + /** * --- load mime.types --- */ - global $wgMimeTypeFile, $IP; + global $IP; # Allow media handling extensions adding MIME-types and MIME-info wfRunHooks( 'MimeMagicInit', array( $this ) ); $types = MM_WELL_KNOWN_MIME_TYPES; - if ( $wgMimeTypeFile == 'includes/mime.types' ) { - $wgMimeTypeFile = $IP/$wgMimeTypeFile; + $mimeTypeFile = $this-mConfig-get( 'MimeTypeFile' ); + if ( $mimeTypeFile == 'includes/mime.types' ) { + $mimeTypeFile = $IP/$mimeTypeFile; } - if ( $wgMimeTypeFile ) { - if ( is_file( $wgMimeTypeFile ) and is_readable( $wgMimeTypeFile ) ) { - wfDebug( __METHOD__ . : loading mime types from $wgMimeTypeFile\n ); + if ( $mimeTypeFile ) { + if ( is_file( $mimeTypeFile ) and is_readable( $mimeTypeFile ) ) { + wfDebug( __METHOD__ . : loading mime types from $mimeTypeFile\n ); $types .= \n; - $types .= file_get_contents( $wgMimeTypeFile ); + $types .= file_get_contents( $mimeTypeFile ); } else { - wfDebug( __METHOD__ . : can't load mime types from $wgMimeTypeFile\n ); + wfDebug( __METHOD__ . : can't load mime types from $mimeTypeFile\n ); } } else { wfDebug( __METHOD__ . : no mime types file defined, using build-ins only.\n ); @@ -266,20 +279,20 @@ * --- load mime.info --- */ - global $wgMimeInfoFile; - if ( $wgMimeInfoFile == 'includes/mime.info' ) { - $wgMimeInfoFile = $IP/$wgMimeInfoFile; + $mimeInfoFile = $this-mConfig-get( 'MimeInfoFile' ); + if ( $mimeInfoFile == 'includes/mime.info' ) { + $mimeInfoFile = $IP/$mimeInfoFile; } $info = MM_WELL_KNOWN_MIME_INFO; - if ( $wgMimeInfoFile ) { - if ( is_file( $wgMimeInfoFile ) and is_readable( $wgMimeInfoFile ) ) { - wfDebug( __METHOD__ . : loading mime info from $wgMimeInfoFile\n ); + if ( $mimeInfoFile ) { + if ( is_file( $mimeInfoFile ) and is_readable( $mimeInfoFile ) ) { + wfDebug( __METHOD__ . : loading mime info from $mimeInfoFile\n ); $info .= \n; - $info .= file_get_contents( $wgMimeInfoFile ); + $info .= file_get_contents( $mimeInfoFile ); } else { - wfDebug( __METHOD__ . : can't load mime info from $wgMimeInfoFile\n ); + wfDebug( __METHOD__ . : can't load mime info from $mimeInfoFile\n ); } } else { wfDebug( __METHOD__ . : no mime info file defined, using build-ins only.\n ); @@ -352,7 +365,9 @@ */ public
[MediaWiki-commits] [Gerrit] Use MimeMagic::singleton() instead of instantiating a new class - change (mediawiki...ProofreadPage)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155876 Change subject: Use MimeMagic::singleton() instead of instantiating a new class .. Use MimeMagic::singleton() instead of instantiating a new class Change-Id: I3299c66568780c1026ebabecddda51f0f2fdc9c2 --- M includes/index/ProofreadIndexPage.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage refs/changes/76/155876/1 diff --git a/includes/index/ProofreadIndexPage.php b/includes/index/ProofreadIndexPage.php index ffdb7a7..73797a3 100644 --- a/includes/index/ProofreadIndexPage.php +++ b/includes/index/ProofreadIndexPage.php @@ -255,7 +255,7 @@ */ public function getMimeType() { if( preg_match( /^.*\.(.{2,5})$/, $this-title-getText(), $m ) ) { - $mimeMagic = new MimeMagic(); + $mimeMagic = MimeMagic::singleton(); return $mimeMagic-guessTypesForExtension( $m[1] ); } else { return null; -- To view, visit https://gerrit.wikimedia.org/r/155876 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3299c66568780c1026ebabecddda51f0f2fdc9c2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ProofreadPage Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pager: Use Config instead of globals - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155877 Change subject: Pager: Use Config instead of globals .. Pager: Use Config instead of globals Change-Id: Ib12bd3dfa102dc673789c27506becc2fd8138f56 --- M includes/Pager.php 1 file changed, 4 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/77/155877/1 diff --git a/includes/Pager.php b/includes/Pager.php index c7de8c1..2bf8a7e 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -957,8 +957,8 @@ * @return string */ function getStartBody() { - global $wgStylePath; $sortClass = $this-getSortHeaderClass(); + $stylePath = $this-getConfig()-get( 'StylePath' ); $s = ''; $fields = $this-getFieldNames(); @@ -985,7 +985,7 @@ $query['desc'] = '1'; $alt = $this-msg( 'ascending_abbrev' )-escaped(); } - $image = $wgStylePath/common/images/$image; + $image = $stylePath/common/images/$image; $link = $this-makeLink( Html::element( 'img', array( 'width' = 12, 'height' = 12, 'alt' = $alt, 'src' = $image ) ) . htmlspecialchars( $name ), $query ); @@ -1137,13 +1137,11 @@ * @return string HTML */ public function getNavigationBar() { - global $wgStylePath; - if ( !$this-isNavigationBarShown() ) { return ''; } - $path = $wgStylePath/common/images; + $path = $this-getConfig()-get( 'StylePath' ) . '/common/images'; $labels = array( 'first' = 'table_pager_first', 'prev' = 'table_pager_prev', @@ -1262,13 +1260,11 @@ * @return string HTML fragment */ function getLimitForm() { - global $wgScript; - return Html::rawElement( 'form', array( 'method' = 'get', - 'action' = $wgScript + 'action' = wfScript() ), \n . $this-getLimitDropdown() ) . \n; -- To view, visit https://gerrit.wikimedia.org/r/155877 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib12bd3dfa102dc673789c27506becc2fd8138f56 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use config instead of globals for Preferences - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/155878 Change subject: Use config instead of globals for Preferences .. Use config instead of globals for Preferences Change-Id: Id18d6419bc11be495a3b658b4a053f7d4b4424c9 --- M includes/Preferences.php 1 file changed, 52 insertions(+), 59 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/78/155878/1 diff --git a/includes/Preferences.php b/includes/Preferences.php index eb29e41..e7413d6 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -111,10 +111,9 @@ * @param array $defaultPreferences Array to load values for * @return array|null */ - static function loadPreferenceValues( $user, $context, $defaultPreferences ) { + static function loadPreferenceValues( $user, IContextSource $context, $defaultPreferences ) { ## Remove preferences that wikis don't want to use - global $wgHiddenPrefs; - foreach ( $wgHiddenPrefs as $pref ) { + foreach ( $context-getConfig( 'HiddenPrefs' ) as $pref ) { if ( isset( $defaultPreferences[$pref] ) ) { unset( $defaultPreferences[$pref] ); } @@ -207,11 +206,7 @@ * @return void */ static function profilePreferences( $user, IContextSource $context, $defaultPreferences ) { - global $wgAuth, $wgContLang, $wgParser, $wgLanguageCode, - $wgDisableLangConversion, $wgMaxSigChars, - $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication, - $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress, - $wgSecureLogin; + global $wgAuth, $wgContLang, $wgParser, $wgLanguageCode; // retrieving user name for GENDER and misc. $userName = $user-getName(); @@ -243,6 +238,7 @@ asort( $userMembers ); $lang = $context-getLanguage(); + $config = $context-getConfig(); $defaultPreferences['usergroups'] = array( 'type' = 'info', @@ -310,7 +306,7 @@ ); } // Only show prefershttps if secure login is turned on - if ( $wgSecureLogin wfCanIPUseHTTPS( $context-getRequest()-getIP() ) ) { + if ( $config-get( 'SecureLogin' ) wfCanIPUseHTTPS( $context-getRequest()-getIP() ) ) { $defaultPreferences['prefershttps'] = array( 'type' = 'toggle', 'label-message' = 'tog-prefershttps', @@ -353,7 +349,7 @@ ); // see if there are multiple language variants to choose from - if ( !$wgDisableLangConversion ) { + if ( !$config-get( 'DisableLangConversion' ) ) { foreach ( LanguageConverter::$languagesWithVariants as $langCode ) { if ( $langCode == $wgContLang-getCode() ) { $variants = $wgContLang-getVariants(); @@ -418,7 +414,7 @@ ); $defaultPreferences['nickname'] = array( 'type' = $wgAuth-allowPropChange( 'nickname' ) ? 'text' : 'info', - 'maxlength' = $wgMaxSigChars, + 'maxlength' = $config-get( 'MaxSigChars' ), 'label-message' = 'yournick', 'validation-callback' = array( 'Preferences', 'validateSignature' ), 'section' = 'personal/signature', @@ -434,13 +430,13 @@ ## Email stuff - if ( $wgEnableEmail ) { + if ( $config-get( 'EnableEmail' ) ) { if ( $canViewPrivateInfo ) { - $helpMessages[] = $wgEmailConfirmToEdit + $helpMessages[] = $config-get( 'EmailConfirmToEdit' ) ? 'prefs-help-email-required' : 'prefs-help-email'; - if ( $wgEnableUserEmail ) { + if ( $config-get( 'EnableUserEmail' ) ) { // additional messages when users can send email to each other $helpMessages[] = 'prefs-help-email-others'; } @@ -472,7 +468,7 @@ $disableEmailPrefs = false; - if ( $wgEmailAuthentication ) { + if ( $config-get( 'EmailAuthentication' ) ) {
[MediaWiki-commits] [Gerrit] ProtectionForm: Stop using global objects - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/155879 Change subject: ProtectionForm: Stop using global objects .. ProtectionForm: Stop using global objects Also use Config instead of global variables Change-Id: Idad1d0648f8ab6aba472845df4fef8ef83043bb2 --- M includes/ProtectionForm.php 1 file changed, 59 insertions(+), 55 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/79/155879/1 diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 853e2cc..4aa65d9 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -57,16 +57,21 @@ /** @var array Map of action to the expiry time of the existing protection */ protected $mExistingExpiry = array(); - function __construct( Page $article ) { - global $wgUser; + /** @var IContextSource */ + private $mContext; + + function __construct( Article $article ) { // Set instance variables. $this-mArticle = $article; $this-mTitle = $article-getTitle(); $this-mApplicableTypes = $this-mTitle-getRestrictionTypes(); + $this-mContext = $article-getContext(); // Check if the form should be disabled. // If it is, the form will be available in read-only to show levels. - $this-mPermErrors = $this-mTitle-getUserPermissionsErrors( 'protect', $wgUser ); + $this-mPermErrors = $this-mTitle-getUserPermissionsErrors( + 'protect', $this-mContext-getUser() + ); if ( wfReadOnly() ) { $this-mPermErrors[] = array( 'readonlytext', wfReadOnlyReason() ); } @@ -82,14 +87,15 @@ * Loads the current state of protection into the object. */ function loadData() { - global $wgRequest, $wgUser; - - $levels = MWNamespace::getRestrictionLevels( $this-mTitle-getNamespace(), $wgUser ); + $levels = MWNamespace::getRestrictionLevels( + $this-mTitle-getNamespace(), $this-mContext-getUser() + ); $this-mCascade = $this-mTitle-areRestrictionsCascading(); - $this-mReason = $wgRequest-getText( 'mwProtect-reason' ); - $this-mReasonSelection = $wgRequest-getText( 'wpProtectReasonSelection' ); - $this-mCascade = $wgRequest-getBool( 'mwProtect-cascade', $this-mCascade ); + $request = $this-mContext-getRequest(); + $this-mReason = $request-getText( 'mwProtect-reason' ); + $this-mReasonSelection = $request-getText( 'wpProtectReasonSelection' ); + $this-mCascade = $request-getBool( 'mwProtect-cascade', $this-mCascade ); foreach ( $this-mApplicableTypes as $action ) { // @todo FIXME: This form currently requires individual selections, @@ -106,8 +112,8 @@ } $this-mExistingExpiry[$action] = $existingExpiry; - $requestExpiry = $wgRequest-getText( mwProtect-expiry-$action ); - $requestExpirySelection = $wgRequest-getVal( wpProtectExpirySelection-$action ); + $requestExpiry = $request-getText( mwProtect-expiry-$action ); + $requestExpirySelection = $request-getVal( wpProtectExpirySelection-$action ); if ( $requestExpiry ) { // Custom expiry takes precedence @@ -128,7 +134,7 @@ $this-mExpirySelection[$action] = 'infinite'; } - $val = $wgRequest-getVal( mwProtect-level-$action ); + $val = $request-getVal( mwProtect-level-$action ); if ( isset( $val ) in_array( $val, $levels ) ) { $this-mRestrictions[$action] = $val; } @@ -170,16 +176,14 @@ * Main entry point for action=protect and action=unprotect */ function execute() { - global $wgRequest, $wgOut; - if ( MWNamespace::getRestrictionLevels( $this-mTitle-getNamespace() ) === array( '' ) ) { throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' ); } - if ( $wgRequest-wasPosted() ) { + if ( $this-mContext-getRequest()-wasPosted() ) { if ( $this-save() ) { $q = $this-mArticle-isRedirect() ? 'redirect=no' : ''; - $wgOut-redirect( $this-mTitle-getFullURL( $q ) ); + $this-mContext-getOutput()-redirect(
[MediaWiki-commits] [Gerrit] Use config instead of globals for OutputPage - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/155880 Change subject: Use config instead of globals for OutputPage .. Use config instead of globals for OutputPage Change-Id: I5e0ebc173631d1d1052de7ccee4ef839c7c1767f --- M includes/OutputPage.php 1 file changed, 70 insertions(+), 87 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/80/155880/1 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index f3b8c98..7377715 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -449,15 +449,14 @@ * @param string $version Style version of the file. Defaults to $wgStyleVersion */ public function addScriptFile( $file, $version = null ) { - global $wgStylePath, $wgStyleVersion; // See if $file parameter is an absolute URL or begins with a slash if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) { $path = $file; } else { - $path = {$wgStylePath}/common/{$file}; + $path = $this-getConfig()-get( 'StylePath' ) . /common/{$file}; } if ( is_null( $version ) ) { - $version = $wgStyleVersion; + $version = $this-getConfig()-get( 'StyleVersion' ); } $this-addScript( Html::linkedScript( wfAppendQuery( $path, $version ) ) ); } @@ -733,13 +732,12 @@ * @return bool True if cache-ok headers was sent. */ public function checkLastModified( $timestamp ) { - global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage; - if ( !$timestamp || $timestamp == '1970010100' ) { wfDebug( __METHOD__ . : CACHE DISABLED, NO TIMESTAMP\n ); return false; } - if ( !$wgCachePages ) { + $config = $this-getConfig(); + if ( !$config-get( 'CachePages' ) ) { wfDebug( __METHOD__ . : CACHE DISABLED\n ); return false; } @@ -748,11 +746,11 @@ $modifiedTimes = array( 'page' = $timestamp, 'user' = $this-getUser()-getTouched(), - 'epoch' = $wgCacheEpoch + 'epoch' = $config-get( 'CacheEpoch' ) ); - if ( $wgUseSquid ) { + if ( $config-get( 'UseSquid' ) ) { // bug 44570: the core page itself may not change, but resources might - $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $wgSquidMaxage ); + $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config-get( 'SquidMaxage' ) ); } wfRunHooks( 'OutputPageCheckLastModified', array( $modifiedTimes ) ); @@ -1107,11 +1105,9 @@ *default links */ public function setFeedAppendQuery( $val ) { - global $wgAdvertisedFeedTypes; - $this-mFeedLinks = array(); - foreach ( $wgAdvertisedFeedTypes as $type ) { + foreach ( $this-getConfig()-get( 'AdvertisedFeedTypes' ) as $type ) { $query = feed=$type; if ( is_string( $val ) ) { $query .= '' . $val; @@ -1127,9 +1123,7 @@ * @param string $href URL */ public function addFeedLink( $format, $href ) { - global $wgAdvertisedFeedTypes; - - if ( in_array( $format, $wgAdvertisedFeedTypes ) ) { + if ( in_array( $format, $this-getConfig()-get( 'AdvertisedFeedTypes' ) ) ) { $this-mFeedLinks[$format] = $href; } } @@ -1240,7 +1234,7 @@ * @param array $categories Mapping category name = sort key */ public function addCategoryLinks( array $categories ) { - global $wgContLang, $wgContentHandlerUseDB; + global $wgContLang; if ( !is_array( $categories ) || count( $categories ) == 0 ) { return; @@ -1256,7 +1250,7 @@ $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ); - if ( $wgContentHandlerUseDB ) { + if ( $this-getConfig()-get( 'ContentHandlerUseDB' ) ) { $fields[] = 'page_content_model'; } @@ -1663,11 +1657,11 @@ } // Hooks registered in the object - global $wgParserOutputHooks; + $parserOutputHooks =
[MediaWiki-commits] [Gerrit] Set the dir and the lang of the link - change (mediawiki...ContentTranslation)
Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/155881 Change subject: Set the dir and the lang of the link .. Set the dir and the lang of the link The link titles are in different languages and they need to be shown with appropriate dir and lang attributes. This is repeated, so the attributes settings is now in one function. Change-Id: I91be8fb97020cf5cdb24a5ab652f3f2fa3ace272 --- M modules/tools/ext.cx.tools.link.js 1 file changed, 23 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/81/155881/1 diff --git a/modules/tools/ext.cx.tools.link.js b/modules/tools/ext.cx.tools.link.js index caa366a..c247161 100644 --- a/modules/tools/ext.cx.tools.link.js +++ b/modules/tools/ext.cx.tools.link.js @@ -112,7 +112,7 @@ }; /** -* Get the link for a given title and language +* Get the link data for a given title and language. * @param {string} title * @param {string} language * @return {jQuery.Promise} @@ -134,6 +134,21 @@ // This prevents warnings about the unrecognized parameter _ cache: true } ); + } + + /** +* Returns an attributes object for the a element for a given title and language. +* @param {string} title +* @param {string} language +* @return {Object} +*/ + function getAnchorAttributes( title, language ) { + return { + lang: language, + dir: $.uls.data.getDir( language ), + target: '_blank', + href: '//' + language + '.wikipedia.org/wiki/' + title + }; } /** @@ -326,20 +341,19 @@ /** * Make the given element to be an external link to a page in given language. -* @param {jQuery} $a Link element +* @param {jQuery} $link Link element * @param {string} target The page title in the target wikis * @param {string} language Language code of target wikis */ - LinkCard.prototype.createExternalLink = function ( $a, target, language ) { + LinkCard.prototype.createExternalLink = function ( $link, target, language ) { // Normalize the text for display and href var title = mw.Title.newFromText( target ); + title = title ? title.getPrefixedText() : target; - $a.text( title ); - $a.attr( { - target: '_blank', - href: '//' + language + '.wikipedia.org/wiki/' + title - } ); + $link + .text( title ) + .attr( getAnchorAttributes( title, language ) ); }; /** @@ -470,10 +484,7 @@ // Since this is an existing link, we can show the link title early. this.$card.find( '.card__link-text' ) .text( title ) - .attr( { - target: '_blank', - href: '//' + language + '.wikipedia.org/wiki/' + title - } ); + .attr( getAnchorAttributes( title, language ) ); this.$addLink.hide(); } else { this.$removeLink.hide(); -- To view, visit https://gerrit.wikimedia.org/r/155881 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I91be8fb97020cf5cdb24a5ab652f3f2fa3ace272 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 amir.ahar...@mail.huji.ac.il ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix comment spelling - change (mediawiki...ContentTranslation)
Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/155882 Change subject: Fix comment spelling .. Fix comment spelling Change-Id: Ie245f51764bfae988faf0c484e25449ac3387fe9 --- M modules/tools/ext.cx.tools.link.js 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/82/155882/1 diff --git a/modules/tools/ext.cx.tools.link.js b/modules/tools/ext.cx.tools.link.js index caa366a..370f55d 100644 --- a/modules/tools/ext.cx.tools.link.js +++ b/modules/tools/ext.cx.tools.link.js @@ -26,7 +26,7 @@ /** * Get a link card -* @rertun {jQuery} +* @return {jQuery} */ LinkCard.prototype.getLinkCard = function () { var $card, $imageContainer, @@ -74,7 +74,7 @@ /** * Get a target link card -* @rertun {jQuery} +* @return {jQuery} */ LinkCard.prototype.getTargetLinkCard = function () { this.$targetLinkCard = this.getLinkCard(); @@ -548,7 +548,7 @@ }; /** -* Click handler for the links in translation column +* Click handler for the links in translation column. */ function linkClickHandler() { /*jshint validthis:true */ -- To view, visit https://gerrit.wikimedia.org/r/155882 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie245f51764bfae988faf0c484e25449ac3387fe9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 amir.ahar...@mail.huji.ac.il ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove messages which are not used in JavaScript - change (mediawiki...Translate)
Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/155883 Change subject: Remove messages which are not used in JavaScript .. Remove messages which are not used in JavaScript Change-Id: Iad218373a9062e37b457cfaf200f9ab8711d7522 --- M Resources.php 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/83/155883/1 diff --git a/Resources.php b/Resources.php index c591572..a6abfd8 100644 --- a/Resources.php +++ b/Resources.php @@ -237,7 +237,6 @@ $wgResourceModules['ext.translate.pagepreparation'] = array( 'scripts' = 'resources/js/ext.translate.pagepreparation.js', 'messages' = array( - 'pp-save-summary', 'pp-save-message', 'pp-save-button-label', 'pp-prepare-message', @@ -383,7 +382,6 @@ 'pm-swap-icon-hover-text', 'pm-delete-icon-hover-text', 'pm-pagetitle-invalid', - 'pm-summary-import', ), ) + $resourcePaths; -- To view, visit https://gerrit.wikimedia.org/r/155883 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iad218373a9062e37b457cfaf200f9ab8711d7522 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nikerabbit niklas.laxst...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Depool db1004 for maintenance. Pool db1053 in its place. - change (operations/mediawiki-config)
Springle has uploaded a new change for review. https://gerrit.wikimedia.org/r/155885 Change subject: Depool db1004 for maintenance. Pool db1053 in its place. .. Depool db1004 for maintenance. Pool db1053 in its place. Change-Id: Ic30a8e05c25da13d35220d30bef7fbc86d2056a1 --- M wmf-config/db-eqiad.php 1 file changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/85/155885/1 diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php index 69d75fd..c022284 100644 --- a/wmf-config/db-eqiad.php +++ b/wmf-config/db-eqiad.php @@ -116,7 +116,7 @@ 's4' = array( 'db1040' = 0, # 1.4TB 64GB 'db1042' = 0, # 1.4TB 64GB, snapshot, vslow, api, dump - 'db1004' = 0, # 1.4TB 64GB, watchlist, recentchangeslinked, contributions, logpager + 'db1053' = 0, # 2.8TB 96GB, watchlist, recentchangeslinked, contributions, logpager 'db1056' = 400, # 2.8TB 96GB 'db1059' = 400, # 2.8TB 96GB 'db1064' = 500, # 2.8TB 160GB @@ -212,16 +212,16 @@ 'db1042' = 1, ), 'watchlist' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'recentchangeslinked' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'contributions' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'logpager' = array( - 'db1004' = 1, + 'db1053' = 1, ), ), 's5' = array( @@ -395,6 +395,7 @@ 'db1050' = '10.64.16.145', #do not remove or comment out 'db1051' = '10.64.32.21', #do not remove or comment out 'db1052' = '10.64.32.22', #do not remove or comment out + 'db1053' = '10.64.32.23', #do not remove or comment out 'db1055' = '10.64.32.25', #do not remove or comment out 'db1056' = '10.64.32.26', #do not remove or comment out 'db1058' = '10.64.32.28', #do not remove or comment out -- To view, visit https://gerrit.wikimedia.org/r/155885 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic30a8e05c25da13d35220d30bef7fbc86d2056a1 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Springle sprin...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Depool db1004 for maintenance. Pool db1053 in its place. - change (operations/mediawiki-config)
jenkins-bot has submitted this change and it was merged. Change subject: Depool db1004 for maintenance. Pool db1053 in its place. .. Depool db1004 for maintenance. Pool db1053 in its place. Change-Id: Ic30a8e05c25da13d35220d30bef7fbc86d2056a1 --- M wmf-config/db-eqiad.php 1 file changed, 6 insertions(+), 5 deletions(-) Approvals: Springle: Looks good to me, approved jenkins-bot: Verified diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php index 69d75fd..c022284 100644 --- a/wmf-config/db-eqiad.php +++ b/wmf-config/db-eqiad.php @@ -116,7 +116,7 @@ 's4' = array( 'db1040' = 0, # 1.4TB 64GB 'db1042' = 0, # 1.4TB 64GB, snapshot, vslow, api, dump - 'db1004' = 0, # 1.4TB 64GB, watchlist, recentchangeslinked, contributions, logpager + 'db1053' = 0, # 2.8TB 96GB, watchlist, recentchangeslinked, contributions, logpager 'db1056' = 400, # 2.8TB 96GB 'db1059' = 400, # 2.8TB 96GB 'db1064' = 500, # 2.8TB 160GB @@ -212,16 +212,16 @@ 'db1042' = 1, ), 'watchlist' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'recentchangeslinked' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'contributions' = array( - 'db1004' = 1, + 'db1053' = 1, ), 'logpager' = array( - 'db1004' = 1, + 'db1053' = 1, ), ), 's5' = array( @@ -395,6 +395,7 @@ 'db1050' = '10.64.16.145', #do not remove or comment out 'db1051' = '10.64.32.21', #do not remove or comment out 'db1052' = '10.64.32.22', #do not remove or comment out + 'db1053' = '10.64.32.23', #do not remove or comment out 'db1055' = '10.64.32.25', #do not remove or comment out 'db1056' = '10.64.32.26', #do not remove or comment out 'db1058' = '10.64.32.28', #do not remove or comment out -- To view, visit https://gerrit.wikimedia.org/r/155885 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic30a8e05c25da13d35220d30bef7fbc86d2056a1 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Springle sprin...@wikimedia.org Gerrit-Reviewer: Springle sprin...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix comment spelling - change (mediawiki...ContentTranslation)
jenkins-bot has submitted this change and it was merged. Change subject: Fix comment spelling .. Fix comment spelling Change-Id: Ie245f51764bfae988faf0c484e25449ac3387fe9 --- M modules/tools/ext.cx.tools.link.js 1 file changed, 3 insertions(+), 3 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/tools/ext.cx.tools.link.js b/modules/tools/ext.cx.tools.link.js index caa366a..370f55d 100644 --- a/modules/tools/ext.cx.tools.link.js +++ b/modules/tools/ext.cx.tools.link.js @@ -26,7 +26,7 @@ /** * Get a link card -* @rertun {jQuery} +* @return {jQuery} */ LinkCard.prototype.getLinkCard = function () { var $card, $imageContainer, @@ -74,7 +74,7 @@ /** * Get a target link card -* @rertun {jQuery} +* @return {jQuery} */ LinkCard.prototype.getTargetLinkCard = function () { this.$targetLinkCard = this.getLinkCard(); @@ -548,7 +548,7 @@ }; /** -* Click handler for the links in translation column +* Click handler for the links in translation column. */ function linkClickHandler() { /*jshint validthis:true */ -- To view, visit https://gerrit.wikimedia.org/r/155882 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie245f51764bfae988faf0c484e25449ac3387fe9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 amir.ahar...@mail.huji.ac.il Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Mark ConfigFactory::destroyDefaultInstance() with @codeCover... - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Mark ConfigFactory::destroyDefaultInstance() with @codeCoverageIgnore .. Mark ConfigFactory::destroyDefaultInstance() with @codeCoverageIgnore Change-Id: Icd4a5724aefab58dad1af07874ef7ee415922ead --- M includes/config/ConfigFactory.php 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/config/ConfigFactory.php b/includes/config/ConfigFactory.php index 312d461..12b0c39 100644 --- a/includes/config/ConfigFactory.php +++ b/includes/config/ConfigFactory.php @@ -61,6 +61,7 @@ * Destroy the default instance * Should only be called inside unit tests * @throws MWException +* @codeCoverageIgnore */ public static function destroyDefaultInstance() { if ( !defined( 'MW_PHPUNIT_TEST' ) ) { -- To view, visit https://gerrit.wikimedia.org/r/155871 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icd4a5724aefab58dad1af07874ef7ee415922ead Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add a test for ApiFormatNone - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Add a test for ApiFormatNone .. Add a test for ApiFormatNone Because lolz. Change-Id: I9c472131746a722737300b7d2d2291c70f80bb2e --- A tests/phpunit/includes/api/format/ApiFormatNoneTest.php 1 file changed, 16 insertions(+), 0 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/includes/api/format/ApiFormatNoneTest.php b/tests/phpunit/includes/api/format/ApiFormatNoneTest.php new file mode 100644 index 000..cabd750 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatNoneTest.php @@ -0,0 +1,16 @@ +?php + +/** + * @group API + * @group Database + * @group medium + * @covers ApiFormatNone + */ +class ApiFormatNoneTest extends ApiFormatTestBase { + + public function testValidSyntax( ) { + $data = $this-apiRequest( 'none', array( 'action' = 'query', 'meta' = 'siteinfo' ) ); + + $this-assertEquals( '', $data ); // No output! + } +} -- To view, visit https://gerrit.wikimedia.org/r/155870 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9c472131746a722737300b7d2d2291c70f80bb2e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] welcome.py: fix comparison with families - change (pywikibot/core)
Mpaa has uploaded a new change for review. https://gerrit.wikimedia.org/r/155886 Change subject: welcome.py: fix comparison with families .. welcome.py: fix comparison with families site.family returns a Family() object, not a string. site.family.name should be used for string comparison. Change-Id: I26627c1fa9da90a63934a937c45d95490a326fb3 --- M scripts/welcome.py 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/86/155886/1 diff --git a/scripts/welcome.py b/scripts/welcome.py index 37f3956..b5fa34b 100644 --- a/scripts/welcome.py +++ b/scripts/welcome.py @@ -738,15 +738,15 @@ continue welcome_text = i18n.translate(self.site, netext) if globalvar.randomSign: -if self.site.family != 'wikinews': +if self.site.family.name != 'wikinews': welcome_text = (welcome_text % choice(self.defineSign())) -if self.site.family == 'wiktionary' and \ +if self.site.family.name == 'wiktionary' and \ self.site.code == 'it': pass else: welcome_text += timeselected -elif (self.site.family != 'wikinews' and +elif (self.site.family.name != 'wikinews' and self.site.code != 'it'): welcome_text = (welcome_text % globalvar.defaultSign) -- To view, visit https://gerrit.wikimedia.org/r/155886 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26627c1fa9da90a63934a937c45d95490a326fb3 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Mpaa mpaa.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add more tests for GlobalVarConfig - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Add more tests for GlobalVarConfig .. Add more tests for GlobalVarConfig Change-Id: I31d50a0636792104e32e3f25694f45942c5c0217 --- M tests/phpunit/includes/config/GlobalVarConfigTest.php 1 file changed, 35 insertions(+), 0 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/includes/config/GlobalVarConfigTest.php b/tests/phpunit/includes/config/GlobalVarConfigTest.php index 7080b02..662f268 100644 --- a/tests/phpunit/includes/config/GlobalVarConfigTest.php +++ b/tests/phpunit/includes/config/GlobalVarConfigTest.php @@ -2,6 +2,14 @@ class GlobalVarConfigTest extends MediaWikiTestCase { + /** +* @covers GlobalVarConfig::newInstance +*/ + public function testNewInstance() { + $config = GlobalVarConfig::newInstance(); + $this-assertInstanceOf( 'GlobalVarConfig', $config ); + } + public function provideGet() { $set = array( 'wgSomething' = 'default1', @@ -28,9 +36,36 @@ * @param string $expected * @dataProvider provideGet * @covers GlobalVarConfig::get +* @covers GlobalVarConfig::getWithPrefix */ public function testGet( $name, $prefix, $expected ) { $config = new GlobalVarConfig( $prefix ); $this-assertEquals( $config-get( $name ), $expected ); } + + public static function provideSet() { + return array( + array( 'Foo', 'wg', 'wgFoo' ), + array( 'SomethingRandom', 'wg', 'wgSomethingRandom' ), + array( 'FromAnExtension', 'eg', 'egFromAnExtension' ), + array( 'NoPrefixHere', '', 'NoPrefixHere' ), + ); + } + + /** +* @dataProvider provideSet +* @covers GlobalVarConfig::set +* @covers GlobalVarConfig::setWithPrefix +*/ + public function testSet( $name, $prefix, $var ) { + if ( array_key_exists( $var, $GLOBALS ) ) { + // Will be reset after this test is over + $this-stashMwGlobals( $var ); + } + $config = new GlobalVarConfig( $prefix ); + $random = wfRandomString(); + $config-set( $name, $random ); + $this-assertArrayHasKey( $var, $GLOBALS ); + $this-assertEquals( $random, $GLOBALS[$var] ); + } } -- To view, visit https://gerrit.wikimedia.org/r/155217 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I31d50a0636792104e32e3f25694f45942c5c0217 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove IPv6 address from fenari - change (operations/puppet)
Mark Bergsma has submitted this change and it was merged. Change subject: Remove IPv6 address from fenari .. Remove IPv6 address from fenari We want to reuse that subnet for codfw. Change-Id: I773a83ddecf52f06a22746f69f193f8dfe11f5cc --- M manifests/site.pp 1 file changed, 0 insertions(+), 4 deletions(-) Approvals: Mark Bergsma: Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/site.pp b/manifests/site.pp index 155c940..4482653 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -1116,10 +1116,6 @@ $cluster = 'misc' $domain_search = 'wikimedia.org pmtpa.wmnet eqiad.wmnet esams.wikimedia.org' -interface::add_ip6_mapped { 'main': -interface = 'eth0', -} - class { 'admin': groups = ['deployment', 'restricted'], -- To view, visit https://gerrit.wikimedia.org/r/155758 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I773a83ddecf52f06a22746f69f193f8dfe11f5cc Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Mark Bergsma m...@wikimedia.org Gerrit-Reviewer: Mark Bergsma m...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unused styles for .imagelist - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155887 Change subject: Remove unused styles for .imagelist .. Remove unused styles for .imagelist Added in r16083 for Special:ImageList, which has been renamed to Special:ListFiles in r45357, with class names being changed in the PHP code without adjusting the CSS. It seems no one has missed these styles over the years, so let's just delete them. Change-Id: I1f7775b3c7733cbfdd3f404527063e973fb80ec7 --- M skins/common/oldshared.css M skins/common/shared.css 2 files changed, 0 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/87/155887/1 diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index ecd846e..a4e7544 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -487,23 +487,6 @@ background-color: #ff; } -.imagelist td, -.imagelist th { - white-space: nowrap; -} - -.imagelist .TablePager_col_links { - background-color: #ff; -} - -.imagelist .TablePager_col_img_description { - white-space: normal; -} - -.imagelist th.TablePager_sort { - background-color: #ff; -} - .templatesUsed { margin-top: 1em; } diff --git a/skins/common/shared.css b/skins/common/shared.css index 9aa1e3e..af5d82c 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -681,23 +681,6 @@ text-decoration: none; } -.imagelist td, -.imagelist th { - white-space: nowrap; -} - -.imagelist .TablePager_col_links { - background-color: #ff; -} - -.imagelist .TablePager_col_img_description { - white-space: normal; -} - -.imagelist th.TablePager_sort { - background-color: #ff; -} - /* filetoc */ ul#filetoc { text-align: center; -- To view, visit https://gerrit.wikimedia.org/r/155887 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1f7775b3c7733cbfdd3f404527063e973fb80ec7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Split includes/Pager.php - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155888 Change subject: Split includes/Pager.php .. Split includes/Pager.php Change-Id: I67fcffca4e3de081a895deb1a285a5545940ece9 --- M includes/AutoLoader.php D includes/Pager.php A includes/pager/AlphabeticPager.php A includes/pager/IndexPager.php A includes/pager/Pager.php A includes/pager/ReverseChronologicalPager.php A includes/pager/TablePager.php 7 files changed, 1,426 insertions(+), 1,336 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/88/155888/1 diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 38e92b6..2c71ce8 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -31,7 +31,6 @@ # Includes 'AjaxDispatcher' = 'includes/AjaxDispatcher.php', 'AjaxResponse' = 'includes/AjaxResponse.php', - 'AlphabeticPager' = 'includes/Pager.php', 'AtomFeed' = 'includes/Feed.php', 'AuthPlugin' = 'includes/AuthPlugin.php', 'AuthPluginUser' = 'includes/AuthPlugin.php', @@ -110,7 +109,6 @@ 'IdentityCollation' = 'includes/Collation.php', 'ImportStreamSource' = 'includes/Import.php', 'ImportStringSource' = 'includes/Import.php', - 'IndexPager' = 'includes/Pager.php', 'Interwiki' = 'includes/interwiki/Interwiki.php', 'License' = 'includes/Licenses.php', 'Licenses' = 'includes/Licenses.php', @@ -128,7 +126,6 @@ 'MWHttpRequest' = 'includes/HttpFunctions.php', 'MWNamespace' = 'includes/MWNamespace.php', 'OutputPage' = 'includes/OutputPage.php', - 'Pager' = 'includes/Pager.php', 'PathRouter' = 'includes/PathRouter.php', 'PathRouterPatternReplacer' = 'includes/PathRouter.php', 'PhpHttpRequest' = 'includes/HttpFunctions.php', @@ -143,7 +140,6 @@ 'PrefixSearch' = 'includes/PrefixSearch.php', 'ProtectionForm' = 'includes/ProtectionForm.php', 'RawMessage' = 'includes/Message.php', - 'ReverseChronologicalPager' = 'includes/Pager.php', 'RevisionItem' = 'includes/RevisionList.php', 'RevisionItemBase' = 'includes/RevisionList.php', 'RevisionListBase' = 'includes/RevisionList.php', @@ -162,7 +158,6 @@ 'StringPrefixSearch' = 'includes/PrefixSearch.php', 'StubObject' = 'includes/StubObject.php', 'StubUserLang' = 'includes/StubObject.php', - 'TablePager' = 'includes/Pager.php', 'MWTimestamp' = 'includes/MWTimestamp.php', 'TimestampException' = 'includes/TimestampException.php', 'Title' = 'includes/Title.php', @@ -787,6 +782,13 @@ 'WikiFilePage' = 'includes/page/WikiFilePage.php', 'WikiPage' = 'includes/page/WikiPage.php', + # includes/pager + 'AlphabeticPager' = 'includes/pager/AlphabeticPager.php', + 'IndexPager' = 'includes/pager/IndexPager.php', + 'Pager' = 'includes/pager/Pager.php', + 'ReverseChronologicalPager' = 'includes/pager/ReverseChronologicalPager.php', + 'TablePager' = 'includes/pager/TablePager.php', + # includes/parser 'CacheTime' = 'includes/parser/CacheTime.php', 'CoreParserFunctions' = 'includes/parser/CoreParserFunctions.php', diff --git a/includes/Pager.php b/includes/Pager.php deleted file mode 100644 index c7de8c1..000 --- a/includes/Pager.php +++ /dev/null @@ -1,1331 +0,0 @@ -?php -/** - * Efficient paging for SQL queries. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Pager - */ - -/** - * @defgroup Pager Pager - */ - -/** - * Basic pager interface. - * @ingroup Pager - */ -interface Pager { - function getNavigationBar(); - function getBody(); -} - -/** - * IndexPager is an efficient pager which uses a (roughly unique) index in the - * data set to implement paging, rather than a LIMIT offset,limit clause. - * In MySQL, such a limit/offset clause requires counting through the - * specified number of offset rows to find the desired data, which can be - * expensive for large offsets. - * - * ReverseChronologicalPager is a child class of the abstract IndexPager, and - * contains some
[MediaWiki-commits] [Gerrit] standardize revertbot.py - change (pywikibot/core)
Ladsgroup has uploaded a new change for review. https://gerrit.wikimedia.org/r/155889 Change subject: standardize revertbot.py .. standardize revertbot.py -Removing unneded generator which causes endless loop in case of reverting self. -Using options and getOption Change-Id: Ifc8cd9e79f6325f9b8ee457c5421164d9609262b --- M scripts/revertbot.py 1 file changed, 40 insertions(+), 45 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/89/155889/1 diff --git a/scripts/revertbot.py b/scripts/revertbot.py index 345c72c..db28c4e 100644 --- a/scripts/revertbot.py +++ b/scripts/revertbot.py @@ -26,52 +26,37 @@ import re import pywikibot -from pywikibot import i18n -from pywikibot import pagegenerators +from pywikibot import i18n, pagegenerators, Bot docuReplacements = { 'params;': pagegenerators.parameterHelp } -class BaseRevertBot(object): - -Base revert bot. - -Subclass this bot and override callback to get it to do something useful. +class BaseRevertBot(Bot): +Base revert bot. -def __init__(self, site, user=None, comment=None, rollback=False): +Subclass this bot and override callback to get it to do something useful. + + +def __init__(self, site, **kwargs): self.site = site -self.comment = comment -self.user = user -if not self.user: -self.user = self.site.username() -self.rollback = rollback - -def get_contributions(self, max=500, ns=None): -count = 0 -iterator = iter(xrange(0)) -never_continue = False -while count != max or never_continue: -try: -item = iterator.next() -except StopIteration: -self.log(u'Fetching new batch of contributions') -data = list(pywikibot.Site().usercontribs(user=self.user, namespaces=ns, total=max)) -never_continue = True -iterator = iter(data) -else: -count += 1 -yield item +self.availableOptions.update({ +'rollback': False, +'user': self.site.username(), +'comment': None, +}) +super(BaseRevertBot, self).__init__(**kwargs) def revert_contribs(self, callback=None): if callback is None: callback = self.callback -contribs = self.get_contributions() +contribs = pywikibot.Site().usercontribs( +user=self.getOption('user'), namespaces=None, total=500) for item in contribs: try: if callback(item): @@ -90,32 +75,37 @@ def revert(self, item): history = pywikibot.Page(self.site, item['title']).fullVersionHistory( -total=2, rollback=self.rollback) +total=2, rollback=self.getOption('rollback')) if len(history) 1: rev = history[1] else: return False -comment = i18n.twtranslate(pywikibot.Site(), 'revertbot-revert', {'revid': rev[0], 'author': rev[2], 'timestamp': rev[1]}) -if self.comment: -comment += ': ' + self.comment +comment = i18n.twtranslate( +pywikibot.Site(), +'revertbot-revert', +{'revid': rev[0], 'author': rev[2], 'timestamp': rev[1]}) +if self.getOption('comment'): +comment += ': ' + self.getOption('comment') page = pywikibot.Page(self.site, item['title']) pywikibot.output(u\n\n \03{lightpurple}%s\03{default} % page.title(asLink=True, forceInterwiki=True, textlink=True)) -if not self.rollback: +if not self.getOption('rollback'): old = page.text page.text = rev[3] pywikibot.showDiff(old, page.text) page.save(comment) return comment try: -pywikibot.data.api.Request(action=rollback, title=page.title(), user=self.user, - token=rev[4], markbot=1).submit() +pywikibot.data.api.Request( +action=rollback, title=page.title(), user=self.getOption('user'), +token=rev[4], markbot=1).submit() except pywikibot.data.api.APIError as e: if e == badtoken: Invalid token: pywikibot.out(There is an issue for rollbacking the edit, Giving up) return False -return uThe edit(s) made in %s by %s was rollbacked % (page.title(), self.user) +return uThe edit(s) made in %s by %s was rollbacked % \ +(page.title(), self.getOption('user')) def log(self, msg): pywikibot.output(msg) @@ -133,18 +123,23 @@ def main(): -user = None -rollback = False +options = {} for arg in pywikibot.handleArgs():
[MediaWiki-commits] [Gerrit] Be consistent about 'TablePager' CSS class usage - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155891 Change subject: Be consistent about 'TablePager' CSS class usage .. Be consistent about 'TablePager' CSS class usage * Do not use it when not actually using the TablePager * Always use it when actually using the TablePager * Use parent::getTableClass() rather than hardcoding it every time * Place it before other classes to allow overriding Change-Id: I042b65be64e2c2fa6c68a7bb972a7a2ea7f55b4e --- M includes/specials/SpecialAllMessages.php M includes/specials/SpecialBlockList.php M includes/specials/SpecialListfiles.php M includes/specials/SpecialProtectedpages.php M includes/specials/SpecialTrackingCategories.php 5 files changed, 8 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/91/155891/1 diff --git a/includes/specials/SpecialAllMessages.php b/includes/specials/SpecialAllMessages.php index 1e4e18b..7096fde 100644 --- a/includes/specials/SpecialAllMessages.php +++ b/includes/specials/SpecialAllMessages.php @@ -336,8 +336,9 @@ } function getStartBody() { + $tableClass = $this-getTableClass(); return Xml::openElement( 'table', array( - 'class' = 'mw-datatable TablePager', + 'class' = mw-datatable $tableClass, 'id' = 'mw-allmessagestable' ) ) . \n . diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 62fadb5..e2ebdbe 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -409,7 +409,7 @@ } public function getTableClass() { - return 'TablePager mw-blocklist'; + return parent::getTableClass() . ' mw-blocklist'; } function getIndexField() { diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index ed7648d..5eafd66 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -557,15 +557,15 @@ } function getTableClass() { - return 'listfiles ' . parent::getTableClass(); + return parent::getTableClass() . ' listfiles'; } function getNavClass() { - return 'listfiles_nav ' . parent::getNavClass(); + return parent::getNavClass() . ' listfiles_nav'; } function getSortHeaderClass() { - return 'listfiles_sort ' . parent::getSortHeaderClass(); + return parent::getSortHeaderClass() . ' listfiles_sort'; } function getPagingQueries() { diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index b64b029..5072e76 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -558,7 +558,7 @@ } public function getTableClass() { - return 'TablePager mw-protectedpages'; + return parent::getTableClass() . ' mw-protectedpages'; } function getIndexField() { diff --git a/includes/specials/SpecialTrackingCategories.php b/includes/specials/SpecialTrackingCategories.php index 5e5588c..552031f 100644 --- a/includes/specials/SpecialTrackingCategories.php +++ b/includes/specials/SpecialTrackingCategories.php @@ -41,7 +41,7 @@ $this-outputHeader(); $this-getOutput()-allowClickjacking(); $this-getOutput()-addHTML( - Html::openElement( 'table', array( 'class' = 'mw-datatable TablePager', + Html::openElement( 'table', array( 'class' = 'mw-datatable', 'id' = 'mw-trackingcategories-table' ) ) . \n . theadtr th . -- To view, visit https://gerrit.wikimedia.org/r/155891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I042b65be64e2c2fa6c68a7bb972a7a2ea7f55b4e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add debugging for bug 69830 - change (mediawiki...Translate)
Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/155892 Change subject: Add debugging for bug 69830 .. Add debugging for bug 69830 Change-Id: Ia20458cd604e230aa608294fc46b0ab6416c0b10 --- M utils/MessageGroupCache.php 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/92/155892/1 diff --git a/utils/MessageGroupCache.php b/utils/MessageGroupCache.php index c4c0fc5..7429847 100644 --- a/utils/MessageGroupCache.php +++ b/utils/MessageGroupCache.php @@ -77,7 +77,16 @@ * @return string[] Message keys that can be passed one-by-one to get() method. */ public function getKeys() { - return unserialize( $this-open()-get( '#keys' ) ); + $value = $this-open()-get( '#keys' ); + $array = unserialize( $value ); + + // Debugging for bug 69830 + if ( !is_array( $array ) ) { + $filename = $this-getCacheFileName(); + throw new MWException( Unable to get keys from '$filename' ); + } + + return $array; } /** -- To view, visit https://gerrit.wikimedia.org/r/155892 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia20458cd604e230aa608294fc46b0ab6416c0b10 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nikerabbit niklas.laxst...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Code comment followup to b096ffc70 - change (mediawiki...Translate)
jenkins-bot has submitted this change and it was merged. Change subject: Code comment followup to b096ffc70 .. Code comment followup to b096ffc70 Change-Id: I4844fe26f69782f97e29e6a03e5394586f7a8dfc --- M resources/js/ext.translate.storage.js 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/js/ext.translate.storage.js b/resources/js/ext.translate.storage.js index 54ade87..c635249 100644 --- a/resources/js/ext.translate.storage.js +++ b/resources/js/ext.translate.storage.js @@ -26,7 +26,8 @@ title: title, text: translation, // If the session expires, fail the saving instead of saving it - // as an anonymous user(if anonymous can save) + // as an anonymous user (if anonymous can save). + // When undefined, the parameter is not included in the request assert: mw.user.isAnon() ? undefined : 'user' } ); -- To view, visit https://gerrit.wikimedia.org/r/155751 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4844fe26f69782f97e29e6a03e5394586f7a8dfc Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nemo bis federicol...@tiscali.it Gerrit-Reviewer: Nikerabbit niklas.laxst...@gmail.com Gerrit-Reviewer: Rillke ril...@wikipedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Stop using EntityDiff and ItemDiff aliases - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Stop using EntityDiff and ItemDiff aliases .. Stop using EntityDiff and ItemDiff aliases ... if possible. It's not possible in classes that are directly in the Wikibase namespace. Change-Id: I8871e1a55ad349e8b463664c497219ee90937978 --- M lib/tests/phpunit/ChangesTableTest.php M repo/tests/phpunit/includes/EntityDiffVisualizerTest.php M repo/tests/phpunit/includes/content/EntityContentTest.php 3 files changed, 5 insertions(+), 7 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/lib/tests/phpunit/ChangesTableTest.php b/lib/tests/phpunit/ChangesTableTest.php index f302feb..85b9538 100644 --- a/lib/tests/phpunit/ChangesTableTest.php +++ b/lib/tests/phpunit/ChangesTableTest.php @@ -7,8 +7,8 @@ use Diff\DiffOpChange; use Wikibase\ChangesTable; use Wikibase\Claim; +use Wikibase\DataModel\Entity\ItemDiff; use Wikibase\DataModel\Entity\ItemId; -use Wikibase\ItemDiff; use Wikibase\PropertyNoValueSnak; /** @@ -164,4 +164,3 @@ } } - diff --git a/repo/tests/phpunit/includes/EntityDiffVisualizerTest.php b/repo/tests/phpunit/includes/EntityDiffVisualizerTest.php index 705ac17..166a856 100644 --- a/repo/tests/phpunit/includes/EntityDiffVisualizerTest.php +++ b/repo/tests/phpunit/includes/EntityDiffVisualizerTest.php @@ -10,9 +10,9 @@ use Site; use Wikibase\ClaimDiffer; use Wikibase\ClaimDifferenceVisualizer; -use Wikibase\Repo\Content\EntityContentDiff; use Wikibase\DataModel\Entity\EntityDiff; use Wikibase\EntityDiffVisualizer; +use Wikibase\Repo\Content\EntityContentDiff; use Wikibase\Repo\WikibaseRepo; /** diff --git a/repo/tests/phpunit/includes/content/EntityContentTest.php b/repo/tests/phpunit/includes/content/EntityContentTest.php index 90ed889..f05156d 100644 --- a/repo/tests/phpunit/includes/content/EntityContentTest.php +++ b/repo/tests/phpunit/includes/content/EntityContentTest.php @@ -8,16 +8,14 @@ use ParserOptions; use RequestContext; use Title; -use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\Entity; -use Wikibase\DataModel\Term\Term; -use Wikibase\Lib\Store\EntityRedirect; use Wikibase\DataModel\Entity\EntityDiff; -use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Entity\EntityId; +use Wikibase\DataModel\Term\Term; use Wikibase\EntityContent; use Wikibase\LanguageFallbackChain; use Wikibase\LanguageWithConversion; +use Wikibase\Lib\Store\EntityRedirect; use Wikibase\Lib\Store\EntityStore; use Wikibase\Repo\Content\EntityContentDiff; use Wikibase\Repo\WikibaseRepo; @@ -509,4 +507,5 @@ $this-assertNotNull( $content-getRedirectTarget() ); } } + } -- To view, visit https://gerrit.wikimedia.org/r/155515 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8871e1a55ad349e8b463664c497219ee90937978 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Stop using the Wikibase\ByPropertyIdArray alias - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Stop using the Wikibase\ByPropertyIdArray alias .. Stop using the Wikibase\ByPropertyIdArray alias Change-Id: I56f3e1a4e7dde3687035ee1a85441c12b0e922fb --- M lib/includes/serializers/ByPropertyListSerializer.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/lib/includes/serializers/ByPropertyListSerializer.php b/lib/includes/serializers/ByPropertyListSerializer.php index 4bd5a05..5af57d2 100644 --- a/lib/includes/serializers/ByPropertyListSerializer.php +++ b/lib/includes/serializers/ByPropertyListSerializer.php @@ -4,7 +4,7 @@ use InvalidArgumentException; use Traversable; -use Wikibase\ByPropertyIdArray; +use Wikibase\DataModel\ByPropertyIdArray; /** * Serializer for Traversable objects that need to be grouped -- To view, visit https://gerrit.wikimedia.org/r/155510 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I56f3e1a4e7dde3687035ee1a85441c12b0e922fb Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Stop using the Wikibase\References and ReferenceList aliases - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Stop using the Wikibase\References and ReferenceList aliases .. Stop using the Wikibase\References and ReferenceList aliases Change-Id: I911bb6d3c8635700afb04fd980a1ca30bfe6eabe --- M lib/includes/serializers/ClaimSerializer.php M repo/includes/ClaimDiffer.php M repo/tests/phpunit/includes/ClaimDifferTest.php M repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php 6 files changed, 8 insertions(+), 8 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/lib/includes/serializers/ClaimSerializer.php b/lib/includes/serializers/ClaimSerializer.php index 3194340..0211a1c 100644 --- a/lib/includes/serializers/ClaimSerializer.php +++ b/lib/includes/serializers/ClaimSerializer.php @@ -5,7 +5,7 @@ use InvalidArgumentException; use OutOfBoundsException; use Wikibase\Claim; -use Wikibase\ReferenceList; +use Wikibase\DataModel\ReferenceList; use Wikibase\Snak; use Wikibase\SnakList; use Wikibase\Statement; diff --git a/repo/includes/ClaimDiffer.php b/repo/includes/ClaimDiffer.php index 420aca9..bd01646 100644 --- a/repo/includes/ClaimDiffer.php +++ b/repo/includes/ClaimDiffer.php @@ -2,8 +2,8 @@ namespace Wikibase; -use Diff\DiffOp\Diff\Diff; use Diff\Differ\Differ; +use Diff\DiffOp\Diff\Diff; use Diff\DiffOp\DiffOpChange; /** diff --git a/repo/tests/phpunit/includes/ClaimDifferTest.php b/repo/tests/phpunit/includes/ClaimDifferTest.php index c76fa37..7d73ec9 100644 --- a/repo/tests/phpunit/includes/ClaimDifferTest.php +++ b/repo/tests/phpunit/includes/ClaimDifferTest.php @@ -11,8 +11,8 @@ use Wikibase\Claim; use Wikibase\ClaimDiffer; use Wikibase\ClaimDifference; +use Wikibase\DataModel\ReferenceList; use Wikibase\PropertyNoValueSnak; -use Wikibase\ReferenceList; use Wikibase\SnakList; use Wikibase\Statement; diff --git a/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php b/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php index c53de5b..b675002 100644 --- a/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php +++ b/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php @@ -11,12 +11,12 @@ use Wikibase\ClaimDifference; use Wikibase\ClaimDifferenceVisualizer; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\ReferenceList; use Wikibase\Lib\SnakFormatter; use Wikibase\PropertyNoValueSnak; use Wikibase\PropertySomeValueSnak; use Wikibase\PropertyValueSnak; use Wikibase\Reference; -use Wikibase\ReferenceList; use Wikibase\SnakList; use Wikibase\Statement; diff --git a/repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php b/repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php index 112ba11..5a4f77f 100644 --- a/repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php +++ b/repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php @@ -7,15 +7,15 @@ use Wikibase\Claim; use Wikibase\ClaimHtmlGenerator; use Wikibase\DataModel\Entity\EntityId; +use Wikibase\DataModel\ReferenceList; use Wikibase\EntityTitleLookup; use Wikibase\Lib\DispatchingSnakFormatter; use Wikibase\PropertySomeValueSnak; use Wikibase\PropertyValueSnak; use Wikibase\Reference; -use Wikibase\ReferenceList; +use Wikibase\Repo\View\SnakHtmlGenerator; use Wikibase\SnakList; use Wikibase\Statement; -use Wikibase\Repo\View\SnakHtmlGenerator; /** * @covers Wikibase\ClaimHtmlGenerator diff --git a/repo/tests/phpunit/includes/Validators/SnakValidatorTest.php b/repo/tests/phpunit/includes/Validators/SnakValidatorTest.php index 4c3e1d7..24515d2 100644 --- a/repo/tests/phpunit/includes/Validators/SnakValidatorTest.php +++ b/repo/tests/phpunit/includes/Validators/SnakValidatorTest.php @@ -10,14 +10,14 @@ use DataValues\UnknownValue; use Wikibase\Claim; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\ReferenceList; +use Wikibase\DataModel\References; use Wikibase\Lib\InMemoryDataTypeLookup; use Wikibase\Lib\PropertyDataTypeLookup; use Wikibase\PropertyNoValueSnak; use Wikibase\PropertySomeValueSnak; use Wikibase\PropertyValueSnak; use Wikibase\Reference; -use Wikibase\ReferenceList; -use Wikibase\References; use Wikibase\Snak; use Wikibase\SnakList; use Wikibase\Statement; -- To view, visit https://gerrit.wikimedia.org/r/155519 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I911bb6d3c8635700afb04fd980a1ca30bfe6eabe Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer:
[MediaWiki-commits] [Gerrit] Stop using the Wikibase\Reference alias - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Stop using the Wikibase\Reference alias .. Stop using the Wikibase\Reference alias Change-Id: I2b22e8c1efa9db12fb3ed4a850a0caf2e4337027 --- M lib/includes/serializers/ReferenceSerializer.php M lib/includes/serializers/SerializerFactory.php M lib/tests/phpunit/serializers/ReferenceSerializerTest.php M lib/tests/phpunit/serializers/SerializerFactoryTest.php M repo/tests/phpunit/includes/ClaimDifferenceTest.php M repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php M repo/tests/phpunit/includes/api/SetReferenceTest.php 10 files changed, 15 insertions(+), 13 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/lib/includes/serializers/ReferenceSerializer.php b/lib/includes/serializers/ReferenceSerializer.php index 1535b6d..2942803 100644 --- a/lib/includes/serializers/ReferenceSerializer.php +++ b/lib/includes/serializers/ReferenceSerializer.php @@ -4,7 +4,7 @@ use InvalidArgumentException; use OutOfBoundsException; -use Wikibase\Reference; +use Wikibase\DataModel\Reference; use Wikibase\Snak; use Wikibase\SnakList; diff --git a/lib/includes/serializers/SerializerFactory.php b/lib/includes/serializers/SerializerFactory.php index 8cf7af9..7be28fd 100644 --- a/lib/includes/serializers/SerializerFactory.php +++ b/lib/includes/serializers/SerializerFactory.php @@ -7,11 +7,11 @@ use SiteStore; use Wikibase\Claim; use Wikibase\Claims; +use Wikibase\DataModel\Reference; use Wikibase\EntityFactory; use Wikibase\Item; use Wikibase\Lib\PropertyDataTypeLookup; use Wikibase\Property; -use Wikibase\Reference; use Wikibase\Snak; /** @@ -142,7 +142,7 @@ //TODO: support extra entity types! case 'Wikibase\Snak': return $this-newSnakUnserializer( $options ); - case 'Wikibase\Reference': + case 'Wikibase\DataModel\Reference': return $this-newReferenceUnserializer($options ); case 'Wikibase\Claim': return $this-newClaimUnserializer( $options ); @@ -389,4 +389,5 @@ return $mergedOptions; } + } diff --git a/lib/tests/phpunit/serializers/ReferenceSerializerTest.php b/lib/tests/phpunit/serializers/ReferenceSerializerTest.php index 7305247..d5459fb 100644 --- a/lib/tests/phpunit/serializers/ReferenceSerializerTest.php +++ b/lib/tests/phpunit/serializers/ReferenceSerializerTest.php @@ -3,13 +3,13 @@ namespace Wikibase\Test; use DataValues\StringValue; +use Wikibase\DataModel\Reference; use Wikibase\Lib\Serializers\ReferenceSerializer; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Serializers\SnakSerializer; use Wikibase\PropertyNoValueSnak; use Wikibase\PropertySomeValueSnak; use Wikibase\PropertyValueSnak; -use Wikibase\Reference; use Wikibase\SnakList; /** diff --git a/lib/tests/phpunit/serializers/SerializerFactoryTest.php b/lib/tests/phpunit/serializers/SerializerFactoryTest.php index 6d250c8..dfb0534 100644 --- a/lib/tests/phpunit/serializers/SerializerFactoryTest.php +++ b/lib/tests/phpunit/serializers/SerializerFactoryTest.php @@ -3,12 +3,12 @@ namespace Wikibase\Lib\Test\Serializers; use Wikibase\Claim; +use Wikibase\DataModel\Reference; use Wikibase\Item; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Serializers\SerializerFactory; use Wikibase\Property; use Wikibase\PropertyNoValueSnak; -use Wikibase\Reference; /** * @covers Wikibase\Lib\Serializers\SerializerFactory diff --git a/repo/tests/phpunit/includes/ClaimDifferenceTest.php b/repo/tests/phpunit/includes/ClaimDifferenceTest.php index 4e671fd..7bb8f7b 100644 --- a/repo/tests/phpunit/includes/ClaimDifferenceTest.php +++ b/repo/tests/phpunit/includes/ClaimDifferenceTest.php @@ -6,8 +6,8 @@ use Diff\DiffOpAdd; use Diff\DiffOpChange; use Wikibase\ClaimDifference; +use Wikibase\DataModel\Reference; use Wikibase\PropertyNoValueSnak; -use Wikibase\Reference; use Wikibase\Statement; /** diff --git a/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php b/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php index b675002..26851b2 100644 --- a/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php +++ b/repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php @@ -11,12 +11,12 @@ use Wikibase\ClaimDifference; use Wikibase\ClaimDifferenceVisualizer; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Reference; use Wikibase\DataModel\ReferenceList; use Wikibase\Lib\SnakFormatter; use
[MediaWiki-commits] [Gerrit] Stop using the Wikibase\EntityId alias - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Stop using the Wikibase\EntityId alias .. Stop using the Wikibase\EntityId alias At least in all the tests. This can not be done in classes that are in the Wikibase namespace. PHP will find both and complain. Change-Id: Iaf184d9522035b4b01872427b703e0bd88bac893 --- M client/tests/phpunit/includes/RepoLinkerTest.php M lib/tests/phpunit/MockPropertyLabelResolver.php M lib/tests/phpunit/ReferencedUrlFinderTest.php M repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php M repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 7 files changed, 14 insertions(+), 10 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/client/tests/phpunit/includes/RepoLinkerTest.php b/client/tests/phpunit/includes/RepoLinkerTest.php index cc28ae8..999d8d4 100644 --- a/client/tests/phpunit/includes/RepoLinkerTest.php +++ b/client/tests/phpunit/includes/RepoLinkerTest.php @@ -2,9 +2,9 @@ namespace Wikibase\Test; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\Entity\PropertyId; -use Wikibase\EntityId; use Wikibase\RepoLinker; /** @@ -350,4 +350,5 @@ ) ); } + } diff --git a/lib/tests/phpunit/MockPropertyLabelResolver.php b/lib/tests/phpunit/MockPropertyLabelResolver.php index 4b53471..2a454fc 100644 --- a/lib/tests/phpunit/MockPropertyLabelResolver.php +++ b/lib/tests/phpunit/MockPropertyLabelResolver.php @@ -2,7 +2,7 @@ namespace Wikibase\Test; -use Wikibase\EntityId; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\PropertyLabelResolver; /** @@ -46,4 +46,5 @@ return $ids; } + } diff --git a/lib/tests/phpunit/ReferencedUrlFinderTest.php b/lib/tests/phpunit/ReferencedUrlFinderTest.php index afa0654..3eb8913 100644 --- a/lib/tests/phpunit/ReferencedUrlFinderTest.php +++ b/lib/tests/phpunit/ReferencedUrlFinderTest.php @@ -3,8 +3,8 @@ namespace Wikibase\Lib\Test; use DataValues\StringValue; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\PropertyId; -use Wikibase\EntityId; use Wikibase\Lib\InMemoryDataTypeLookup; use Wikibase\PropertyNoValueSnak; use Wikibase\PropertySomeValueSnak; @@ -82,4 +82,5 @@ $actual = $linkFinder-findSnakLinks( $snaks ); $this-assertEmpty( $actual ); // since $p42 isn't know, this should return nothing } + } diff --git a/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php b/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php index 2772dc3..1bb2244 100644 --- a/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php +++ b/repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php @@ -9,9 +9,9 @@ use SiteStore; use Title; use ValueFormatters\ValueFormatter; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\SiteLink; -use Wikibase\EntityId; use Wikibase\EntityTitleLookup; use Wikibase\Repo\Localizer\MessageParameterFormatter; @@ -112,4 +112,5 @@ return $mock; } + } diff --git a/repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php b/repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php index 6afe5d5..65db270 100644 --- a/repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php +++ b/repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php @@ -3,13 +3,13 @@ namespace Wikibase\Test\Validators; use Wikibase\DataModel\Entity\Entity; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Property; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Term\AliasGroupList; use Wikibase\DataModel\Term\Fingerprint; use Wikibase\DataModel\Term\Term; use Wikibase\DataModel\Term\TermList; -use Wikibase\EntityId; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\Test\ChangeOpTestMockProvider; use Wikibase\Validators\LabelUniquenessValidator; diff --git a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php index 6a4f64e..b755806 100644 --- a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php +++ b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php @@ -8,9 +8,9 @@ use EasyRdf_Namespace; use EasyRdf_Resource; use SiteList; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\ItemId; use Wikibase\Entity; -use Wikibase\EntityId; use Wikibase\EntityRevision; use Wikibase\Item; use Wikibase\RdfBuilder; diff --git a/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php
[MediaWiki-commits] [Gerrit] cswikinews: Remove unused custom namespace - change (operations/mediawiki-config)
Danny B. has uploaded a new change for review. https://gerrit.wikimedia.org/r/155893 Change subject: cswikinews: Remove unused custom namespace .. cswikinews: Remove unused custom namespace Change-Id: I57ca7a5da796a37b071cdf1517e46519da27a3fe --- M wmf-config/InitialiseSettings.php 1 file changed, 1 insertion(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/93/155893/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 30a4b34..44235bd 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -2605,9 +2605,6 @@ 'WZ' = NS_PROJECT, 'Wikinews_diskuse' = NS_PROJECT_TALK, 'Wikinews_talk' = NS_PROJECT_TALK, - 'Portal' = 100, - 'Portal_talk' = 101, - 'Portál_diskuse' = 101, ), '+cswikiquote' = array( 'WC' = NS_PROJECT, @@ -5720,8 +5717,6 @@ 'cswikinews' = array( NS_USER = 'Redaktor', # language default set back in wgNamespaceAliases NS_USER_TALK = 'Diskuse_s_redaktorem', # language default set back in wgNamespaceAliases - 100 = 'Portál', - 101 = 'Diskuse_k_portálu', ), 'dewikinews' = array( 100 = 'Portal', @@ -6432,7 +6427,7 @@ '+cawikisource' = array( 104 = 1, 106 = 1 ), '+cswiki' = array( 100 = 1, 101 = 0, 102 = 1 ), '+commonswiki' = array( 6 = 1, 12 = 1, 14 = 1, 100 = 1, 106 = 1 ), - '+cswikinews' = array( 14 = 0, 15 = 0, 100 = 1, 101 = 0 ), + '+cswikinews' = array( 14 = 0, 15 = 0 ), '+cswikiquote' = array( 14 = 0, 15 = 0, 100 = 1, 101 = 0 ), '+cswikisource' = array( 100 = 1, 101 = 0 ), '+cswikiversity' = array( 14 = 0, 15 = 0, 100 = 0, 101 = 0 ), -- To view, visit https://gerrit.wikimedia.org/r/155893 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57ca7a5da796a37b071cdf1517e46519da27a3fe Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Danny B. dann...@email.cz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Sort imports in WikibaseRepo class - change (mediawiki...Wikibase)
Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/155894 Change subject: Sort imports in WikibaseRepo class .. Sort imports in WikibaseRepo class Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 --- M repo/includes/WikibaseRepo.php 1 file changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/94/155894/1 diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index 2f23620..4f431fa 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -14,11 +14,6 @@ use StubObject; use ValueFormatters\FormatterOptions; use ValueFormatters\ValueFormatter; -use Wikibase\ItemHandler; -use Wikibase\PropertyHandler; -use Wikibase\Repo\Notifications\ChangeNotifier; -use Wikibase\Repo\Notifications\ChangeTransmitter; -use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\ChangeOp\ChangeOpFactoryProvider; use Wikibase\DataModel\Claim\ClaimGuidParser; use Wikibase\DataModel\Entity\BasicEntityIdParser; @@ -26,14 +21,14 @@ use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\Property; -use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\EntityContentFactory; +use Wikibase\EntityFactory; use Wikibase\InternalSerialization\DeserializerFactory; use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Store\EntityLookup; -use Wikibase\EntityFactory; +use Wikibase\ItemHandler; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\LanguageFallbackChainFactory; +use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Lib\ClaimGuidValidator; use Wikibase\Lib\DispatchingValueFormatter; @@ -50,14 +45,19 @@ use Wikibase\Lib\PropertyInfoDataTypeLookup; use Wikibase\Lib\SnakConstructionService; use Wikibase\Lib\SnakFormatter; +use Wikibase\Lib\Store\EntityContentDataCodec; +use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\WikibaseDataTypeBuilders; use Wikibase\Lib\WikibaseSnakFormatterBuilders; use Wikibase\Lib\WikibaseValueFormatterBuilders; -use Wikibase\Lib\Store\EntityContentDataCodec; use Wikibase\ParserOutputJsConfigBuilder; +use Wikibase\PropertyHandler; use Wikibase\ReferencedEntitiesFinder; use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer; use Wikibase\Repo\Localizer\MessageParameterFormatter; +use Wikibase\Repo\Notifications\ChangeNotifier; +use Wikibase\Repo\Notifications\ChangeTransmitter; +use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\Repo\Notifications\DummyChangeTransmitter; use Wikibase\Settings; use Wikibase\SettingsArray; -- To view, visit https://gerrit.wikimedia.org/r/155894 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move EntityPermissionChecker to repo, as not used elsewhere - change (mediawiki...Wikibase)
Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/155895 Change subject: Move EntityPermissionChecker to repo, as not used elsewhere .. Move EntityPermissionChecker to repo, as not used elsewhere Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f --- R repo/includes/store/EntityPermissionChecker.php 1 file changed, 0 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/95/155895/1 diff --git a/lib/includes/store/EntityPermissionChecker.php b/repo/includes/store/EntityPermissionChecker.php similarity index 100% rename from lib/includes/store/EntityPermissionChecker.php rename to repo/includes/store/EntityPermissionChecker.php -- To view, visit https://gerrit.wikimedia.org/r/155895 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [FEAT] Add deprecation warnings for textlib/deprecation redi... - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: [FEAT] Add deprecation warnings for textlib/deprecation redirects .. [FEAT] Add deprecation warnings for textlib/deprecation redirects It's adding a function which dynamically can create a redirect to another function and warn because of deprecation when the redirected function is executed. It works similar to the @deprecated decorator but doesn't require the old function. All functions which from 'textlib' which were simply redirected from 'pywikibot' to the 'textlib' module are created with this function. Also 'deprecated' and 'deprecate_arg' are marked as deprecated too. Change-Id: I69dbf351c22fd0caacbf047ae38aca067f8cef96 --- M pywikibot/__init__.py M pywikibot/tools.py 2 files changed, 79 insertions(+), 20 deletions(-) Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 0d13cdf..6804291 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -41,21 +41,24 @@ CaptchaError, SpamfilterError, CircularRedirect, WikiBaseError, CoordinateGlobeUnknownException, ) -from pywikibot.textlib import ( -unescape, replaceExcept, removeDisabledParts, removeHTMLParts, -isDisabled, interwikiFormat, interwikiSort, -getLanguageLinks, replaceLanguageLinks, -removeLanguageLinks, removeLanguageLinksAndSeparator, -getCategoryLinks, categoryFormat, replaceCategoryLinks, -removeCategoryLinks, removeCategoryLinksAndSeparator, -replaceCategoryInPlace, compileLinkR, extract_templates_and_params, -) -from pywikibot.tools import UnicodeMixin, deprecated, deprecate_arg +from pywikibot.tools import UnicodeMixin, redirect_func from pywikibot.i18n import translate from pywikibot.data.api import UploadWarning +import pywikibot.textlib as textlib +import pywikibot.tools + +textlib_methods = ( +'unescape', 'replaceExcept', 'removeDisabledParts', 'removeHTMLParts', +'isDisabled', 'interwikiFormat', 'interwikiSort', +'getLanguageLinks', 'replaceLanguageLinks', +'removeLanguageLinks', 'removeLanguageLinksAndSeparator', +'getCategoryLinks', 'categoryFormat', 'replaceCategoryLinks', +'removeCategoryLinks', 'removeCategoryLinksAndSeparator', +'replaceCategoryInPlace', 'compileLinkR', 'extract_templates_and_params', +) __all__ = ( -'config', 'ui', 'UnicodeMixin', 'translate', 'deprecated', 'deprecate_arg', +'config', 'ui', 'UnicodeMixin', 'translate', 'Page', 'FilePage', 'ImagePage', 'Category', 'Link', 'User', 'ItemPage', 'PropertyPage', 'Claim', 'TimeStripper', 'html2unicode', 'url2unicode', 'unicode2html', @@ -67,17 +70,24 @@ 'PageRelatedError', 'IsRedirectPage', 'IsNotRedirectPage', 'PageNotSaved', 'UploadWarning', 'LockedPage', 'EditConflict', 'ServerError', 'FatalServerError', 'Server504Error', -'CaptchaError', 'SpamfilterError', 'CircularRedirect', +'CaptchaError', 'SpamfilterError', 'CircularRedirect', 'WikiBaseError', 'CoordinateGlobeUnknownException', -'unescape', 'replaceExcept', 'removeDisabledParts', 'removeHTMLParts', -'isDisabled', 'interwikiFormat', 'interwikiSort', -'getLanguageLinks', 'replaceLanguageLinks', -'removeLanguageLinks', 'removeLanguageLinksAndSeparator', -'getCategoryLinks', 'categoryFormat', 'replaceCategoryLinks', -'removeCategoryLinks', 'removeCategoryLinksAndSeparator', -'replaceCategoryInPlace', 'compileLinkR', 'extract_templates_and_params', 'QuitKeyboardInterrupt', ) +# flake8 is unable to detect concatenation in the same operation +# like: +# ) + textlib_methods +# so instead use this trick +globals()['__all__'] = __all__ + textlib_methods + +for _name in textlib_methods: +target = getattr(textlib, _name) +wrapped_func = redirect_func(target) +globals()[_name] = wrapped_func + + +deprecated = redirect_func(pywikibot.tools.deprecated) +deprecate_arg = redirect_func(pywikibot.tools.deprecate_arg) class Timestamp(datetime.datetime): @@ -491,7 +501,7 @@ link_regex = re.compile(r'\[\[(?Ptitle[^\]|[{}]*)(\|.*?)?\]\]') -@deprecated(comment parameter for page saving method) +@pywikibot.tools.deprecated(comment parameter for page saving method) def setAction(s): Set a summary to use for changed page submissions config.default_edit_summary = s diff --git a/pywikibot/tools.py b/pywikibot/tools.py index 462b5ef..fb8628f 100644 --- a/pywikibot/tools.py +++ b/pywikibot/tools.py @@ -314,6 +314,55 @@ return decorator +def redirect_func(target, source_module=None, target_module=None): + +Return a function which can be used to redirect to 'target'. + +It also acts like marking that function deprecated and copies all +parameters. + +@param target: The targeted function which is to be executed. +@type target: callable +@param source_module: The module
[MediaWiki-commits] [Gerrit] Record usage of commons media files - change (mediawiki...Wikibase)
Bene has uploaded a new change for review. https://gerrit.wikimedia.org/r/155896 Change subject: Record usage of commons media files .. Record usage of commons media files This patch creates a new ReferencedImageFinder to find all image usages in snaks on an entity. It also refactors the ReferencedXxxFinder classes and gives them a better structure and quality. Change-Id: Ib2c4e49bb63e2ac574b1a2c2224c0a0a8238a860 --- M lib/includes/ReferencedEntitiesFinder.php A lib/includes/ReferencedFinder.php A lib/includes/ReferencedImageFinder.php M lib/includes/ReferencedUrlFinder.php M lib/tests/phpunit/ReferencedEntitiesFinderTest.php A lib/tests/phpunit/ReferencedImageFinderTest.php M lib/tests/phpunit/ReferencedUrlFinderTest.php M repo/includes/EntityView.php 8 files changed, 278 insertions(+), 155 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/96/155896/1 diff --git a/lib/includes/ReferencedEntitiesFinder.php b/lib/includes/ReferencedEntitiesFinder.php index b629658..6ead007 100644 --- a/lib/includes/ReferencedEntitiesFinder.php +++ b/lib/includes/ReferencedEntitiesFinder.php @@ -15,8 +15,14 @@ * @author Daniel Werner daniel.a.r.wer...@gmail.com * @author Katie Filbert * @author Daniel Kinzler + * @author Bene* benestar.wikime...@gmail.com */ class ReferencedEntitiesFinder { + + /** +* @var EntityId[] serialized entity ids pointing to entity id objects +*/ + private $foundEntityIds; /** * Finds linked entities within a set of snaks. @@ -26,51 +32,33 @@ * @return EntityId[] */ public function findSnakLinks( array $snaks ) { - $foundEntities = array(); + $this-foundEntityIds = array(); foreach ( $snaks as $snak ) { - // all of the Snak's properties are referenced entities, add them: - $propertyId = $snak-getPropertyId(); - $foundEntities[ $propertyId-getSerialization() ] = $propertyId; - - // PropertyValueSnaks might have a value referencing an Entity, find those as well: - if( $snak instanceof PropertyValueSnak ) { - $snakValue = $snak-getDataValue(); - - if( $snakValue === null ) { - // shouldn't ever run into this, but make sure! - continue; - } - - $entitiesInSnakDataValue = $this-findDataValueLinks( $snakValue ); - $foundEntities = array_merge( $foundEntities, $entitiesInSnakDataValue ); - } + $this-handleSnak( $snak ); } - return $foundEntities; + return $this-foundEntityIds; } - /** -* Finds linked entities within a given data value. -* -* @since 0.5 -* -* @param DataValue $dataValue -* @return EntityId[] -*/ - public function findDataValueLinks( DataValue $dataValue ) { - switch( $dataValue-getType() ) { - case 'wikibase-entityid': - if( $dataValue instanceof EntityIdValue ) { - $entityId = $dataValue-getEntityId(); - return array( - $entityId-getSerialization() = $entityId ); - } - break; + private function handleSnak( Snak $snak ) { + // all of the Snak's properties are referenced entities + $this-addEntityId( $snak-getPropertyId() ); - // TODO: we might want to allow extensions to add handling for their custom - // data value types here. Either use a hook or a proper registration for that. + // PropertyValueSnaks might have a value referencing an Entity + if( $snak instanceof PropertyValueSnak ) { + $this-handleDataValue( $snak-getDataValue() ); } - return array(); } + + private function handleDataValue( DataValue $dataValue ) { + if ( $dataValue instanceof EntityIdValue ) { + $this-addEntityId( $dataValue-getEntityId() ); + } + } + + private function addEntityId( EntityId $entityId ) { + $this-foundEntityIds[$entityId-getSerialization()] = $entityId; + } + } diff --git a/lib/includes/ReferencedFinder.php b/lib/includes/ReferencedFinder.php new file mode 100644 index 000..a7e17f2 --- /dev/null +++ b/lib/includes/ReferencedFinder.php @@
[MediaWiki-commits] [Gerrit] Move EntityPermissionChecker to repo, as not used elsewhere - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Move EntityPermissionChecker to repo, as not used elsewhere .. Move EntityPermissionChecker to repo, as not used elsewhere Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f --- R repo/includes/store/EntityPermissionChecker.php 1 file changed, 0 insertions(+), 0 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/lib/includes/store/EntityPermissionChecker.php b/repo/includes/store/EntityPermissionChecker.php similarity index 100% rename from lib/includes/store/EntityPermissionChecker.php rename to repo/includes/store/EntityPermissionChecker.php -- To view, visit https://gerrit.wikimedia.org/r/155895 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Sort imports in WikibaseRepo class - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Sort imports in WikibaseRepo class .. Sort imports in WikibaseRepo class Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 --- M repo/includes/WikibaseRepo.php 1 file changed, 9 insertions(+), 9 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index 2f23620..4f431fa 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -14,11 +14,6 @@ use StubObject; use ValueFormatters\FormatterOptions; use ValueFormatters\ValueFormatter; -use Wikibase\ItemHandler; -use Wikibase\PropertyHandler; -use Wikibase\Repo\Notifications\ChangeNotifier; -use Wikibase\Repo\Notifications\ChangeTransmitter; -use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\ChangeOp\ChangeOpFactoryProvider; use Wikibase\DataModel\Claim\ClaimGuidParser; use Wikibase\DataModel\Entity\BasicEntityIdParser; @@ -26,14 +21,14 @@ use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\Property; -use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\EntityContentFactory; +use Wikibase\EntityFactory; use Wikibase\InternalSerialization\DeserializerFactory; use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Store\EntityLookup; -use Wikibase\EntityFactory; +use Wikibase\ItemHandler; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\LanguageFallbackChainFactory; +use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Lib\ClaimGuidValidator; use Wikibase\Lib\DispatchingValueFormatter; @@ -50,14 +45,19 @@ use Wikibase\Lib\PropertyInfoDataTypeLookup; use Wikibase\Lib\SnakConstructionService; use Wikibase\Lib\SnakFormatter; +use Wikibase\Lib\Store\EntityContentDataCodec; +use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\WikibaseDataTypeBuilders; use Wikibase\Lib\WikibaseSnakFormatterBuilders; use Wikibase\Lib\WikibaseValueFormatterBuilders; -use Wikibase\Lib\Store\EntityContentDataCodec; use Wikibase\ParserOutputJsConfigBuilder; +use Wikibase\PropertyHandler; use Wikibase\ReferencedEntitiesFinder; use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer; use Wikibase\Repo\Localizer\MessageParameterFormatter; +use Wikibase\Repo\Notifications\ChangeNotifier; +use Wikibase\Repo\Notifications\ChangeTransmitter; +use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\Repo\Notifications\DummyChangeTransmitter; use Wikibase\Settings; use Wikibase\SettingsArray; -- To view, visit https://gerrit.wikimedia.org/r/155894 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] ArticleTable: Remove useless getBody() override - change (mediawiki...EducationProgram)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155897 Change subject: ArticleTable: Remove useless getBody() override .. ArticleTable: Remove useless getBody() override Change-Id: I340424b9142a34198d5b3852ca03494ef51299ff --- M includes/pagers/ArticleTable.php 1 file changed, 0 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram refs/changes/97/155897/1 diff --git a/includes/pagers/ArticleTable.php b/includes/pagers/ArticleTable.php index 9390353..0fe3fc6 100644 --- a/includes/pagers/ArticleTable.php +++ b/includes/pagers/ArticleTable.php @@ -117,10 +117,6 @@ return $modules; } - public function getBody() { - return parent::getBody(); - } - /** * @see Pager::getFields() */ -- To view, visit https://gerrit.wikimedia.org/r/155897 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I340424b9142a34198d5b3852ca03494ef51299ff Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EducationProgram Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make GadgetResourceLoaderModule a simple wrapper around Gadget - change (mediawiki...Gadgets)
jenkins-bot has submitted this change and it was merged. Change subject: Make GadgetResourceLoaderModule a simple wrapper around Gadget .. Make GadgetResourceLoaderModule a simple wrapper around Gadget Change-Id: Ia402698ec2863b75ea1d2a95b4a7aa57cc29d0d1 --- M Gadgets.hooks.php M SpecialGadgets.php M backend/Gadget.php M backend/GadgetResourceLoaderModule.php 4 files changed, 52 insertions(+), 56 deletions(-) Approvals: Alex Monk: Looks good to me, approved jenkins-bot: Verified diff --git a/Gadgets.hooks.php b/Gadgets.hooks.php index 58819b8..f95ab56 100644 --- a/Gadgets.hooks.php +++ b/Gadgets.hooks.php @@ -309,7 +309,10 @@ foreach ( $gadgets as $gadget ) { $resourceLoader-register( $gadget-getModuleName(), - array( 'object' = $gadget-getModule() ) + array( + 'class' = 'GadgetResourceLoaderModule', + 'gadget' = $gadget + ) ); } return true; diff --git a/SpecialGadgets.php b/SpecialGadgets.php index 98187a8..2d971f6 100644 --- a/SpecialGadgets.php +++ b/SpecialGadgets.php @@ -364,14 +364,12 @@ $exportTitles[] = Title::makeTitleSafe( NS_GADGET, $style ); } - $gadgetModule = $gadget-getModule(); - // Module messages in NS_MEDIAWIKI - foreach( $gadgetModule-getMessages() as $message ) { + foreach( $gadget-getMessages() as $message ) { $message = Title::makeTitleSafe( NS_MEDIAWIKI, $message ); // Add this page and its subpages (for translations) $exportTitles = array_merge( $exportTitles, - $message, + $message, // @fixme this should be an array? $message-getSubpages() ); } diff --git a/backend/Gadget.php b/backend/Gadget.php index f3af5c3..cd6cde7 100644 --- a/backend/Gadget.php +++ b/backend/Gadget.php @@ -282,8 +282,8 @@ } /** -* Get the name of the ResourceLoader source for this gadget's module -* @return string +* Get the GadgetRepo this Gadget belongs to +* @return GadgetRepo */ public function getRepo() { return $this-repo; @@ -425,11 +425,11 @@ } /** -* Get the ResourceLoader module for this gadget, if available. -* @return ResourceLoaderModule object +* Returns a ResourceLoaderWikiModule-style array of pages +* +* @return array */ - public function getModule() { - // Build $pages + public function getPages() { $pages = array(); foreach ( $this-moduleData['scripts'] as $script ) { $pages[Gadget:$script] = array( 'type' = 'script' ); @@ -438,14 +438,20 @@ $pages[Gadget:$style] = array( 'type' = 'style' ); } + return $pages; + } + + /** +* Get the ResourceLoader module for this gadget, if available. +* +* This method really shouldn't be called unless there's a +* good reason for it. +* +* @return GadgetResourceLoaderModule +*/ + public function getModule() { return new GadgetResourceLoaderModule( - $pages, - (array)$this-moduleData['dependencies'], - (array)$this-moduleData['messages'], - $this-repo-getSource(), - $this-moduleData['position'], - $this-timestamp, - $this-repo-getDB() + array( 'gadget' = $this ) ); } @@ -469,6 +475,14 @@ return $this-moduleData['dependencies']; } + public function getMessages() { + return $this-moduleData['messages']; + } + + public function getPosition() { + return $this-moduleData['position']; + } + /*** Public methods ***/ /** diff --git a/backend/GadgetResourceLoaderModule.php b/backend/GadgetResourceLoaderModule.php index 7e3bc24..ff8ee81 100644 --- a/backend/GadgetResourceLoaderModule.php +++ b/backend/GadgetResourceLoaderModule.php @@ -1,72 +1,53 @@ ?php /** - * ResourceLoader module for a single gadget + * ResourceLoader module for a single gadget, really just a wrapper + * around the Gadget class */ class GadgetResourceLoaderModule extends ResourceLoaderWikiModule { - protected $pages, $dependencies, $messages, $source,
[MediaWiki-commits] [Gerrit] Pass arrays to array_merge, instead of Titles and TitleArray... - change (mediawiki...Gadgets)
Alex Monk has uploaded a new change for review. https://gerrit.wikimedia.org/r/155898 Change subject: Pass arrays to array_merge, instead of Titles and TitleArray iterator objects .. Pass arrays to array_merge, instead of Titles and TitleArray iterator objects Per comments on Ia402698e Change-Id: Iffcbb3a62306a6e3b31fe45fcf1948210f4f3641 --- M SpecialGadgets.php 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets refs/changes/98/155898/1 diff --git a/SpecialGadgets.php b/SpecialGadgets.php index 2d971f6..1e1267e 100644 --- a/SpecialGadgets.php +++ b/SpecialGadgets.php @@ -349,10 +349,10 @@ $descriptionMessage = Title::makeTitleSafe( NS_MEDIAWIKI, $gadget-getDescriptionMessageKey() ); // Add these pages and their subpages (for translations) $exportTitles = array_merge( $exportTitles, - $titleMessage, - $titleMessage-getSubpages(), - $descriptionMessage, - $descriptionMessage-getSubpages() + array( $titleMessage ), + iterator_to_array( $titleMessage-getSubpages() ), + array( $descriptionMessage ), + iterator_to_array( $descriptionMessage-getSubpages() ) ); // Module script and styles in NS_GADGET @@ -369,8 +369,8 @@ $message = Title::makeTitleSafe( NS_MEDIAWIKI, $message ); // Add this page and its subpages (for translations) $exportTitles = array_merge( $exportTitles, - $message, // @fixme this should be an array? - $message-getSubpages() + array( $message ), + array( $message-getSubpages() ) ); } -- To view, visit https://gerrit.wikimedia.org/r/155898 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iffcbb3a62306a6e3b31fe45fcf1948210f4f3641 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gadgets Gerrit-Branch: RL2 Gerrit-Owner: Alex Monk kren...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Wikidata is now its own client - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Wikidata is now its own client .. Wikidata is now its own client Update Wikidata family configuration. Existing tests need to be updated as they verified that the Wikidata site was not a client, which is no longer true. Change-Id: If98313a6ca79d660d68b9cfc5a990d68218430ec --- M pywikibot/families/wikidata_family.py M tests/wikibase_tests.py 2 files changed, 25 insertions(+), 21 deletions(-) Approvals: John Vandenberg: Looks good to me, but someone else must approve Ladsgroup: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/families/wikidata_family.py b/pywikibot/families/wikidata_family.py index 614..2e33e5b 100644 --- a/pywikibot/families/wikidata_family.py +++ b/pywikibot/families/wikidata_family.py @@ -17,14 +17,17 @@ } def shared_data_repository(self, code, transcluded=False): -Always return a repository tupe. This enables testing whether -the site object is the repository itself, see Site.is_data_repository() - -if transcluded: -return (None, None) -else: -return (code, self.name) +Indicate Wikidata is both a repository and its own client. + +Until 20 August 2014, Wikidata was only a data repository, +and this method only returned a tuple with data if +transcluded was False. + +On that date, the software was enhanced so that Wikidata +could store sitelinks to itself. + +return (code, self.name) def calendarmodel(self, code): Default calendar model for WbTime datatype diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index 0f1cba9..05dd97b 100644 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -127,21 +127,23 @@ 'species.*no transcluded data', self.wdp.data_item) -# test.wikidata does not have a data repository. -self.wdp = pywikibot.ItemPage(wikidatatest, 'Q6') -self.assertRaises(pywikibot.WikiBaseError, - pywikibot.ItemPage.fromPage, self.wdp) +def test_own_client(self): +Test that a data repository family can be its own client. +# Note: these tests do not yet verify that pywikibot can +# utilise this Wikibase configuration, as it is not yet +# working correctly on Wikidata. -# The main Wikidata also does not have a data repository. -# It is a data repository, but no pages on Wikidata have -# a linked page. -self.wdp = pywikibot.ItemPage(wikidata, 'Q60') -self.assertRaises(pywikibot.WikiBaseError, - pywikibot.ItemPage.fromPage, self.wdp) +# The main Wikidata is its own client. +self.wdp = pywikibot.ItemPage(wikidata, + wikidata.siteinfo['mainpage']) +item = pywikibot.ItemPage.fromPage(self.wdp) +del item -self.wdp = pywikibot.Page(wikidata, 'Main Page', ns=4) -self.assertRaises(pywikibot.WikiBaseError, - pywikibot.ItemPage.fromPage, self.wdp) +# test.wikidata is also +self.wdp = pywikibot.ItemPage(wikidatatest, + wikidatatest.siteinfo['mainpage']) +item = pywikibot.ItemPage.fromPage(self.wdp) +del item class TestItemLoad(PywikibotTestCase): @@ -413,7 +415,6 @@ def test_page_methods(self): Test ItemPage methods inherited from superclass Page. self.wdp = pywikibot.ItemPage(wikidatatest, 'Q6') -self.assertRaises(pywikibot.WikiBaseError, self.wdp.data_item) self.assertRaises(pywikibot.PageNotSaved, self.wdp.save) self.wdp.previousRevision() self.assertEquals(self.wdp.langlinks(), []) -- To view, visit https://gerrit.wikimedia.org/r/155225 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If98313a6ca79d660d68b9cfc5a990d68218430ec Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg jay...@gmail.com Gerrit-Reviewer: John Vandenberg jay...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl 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 problem with remote autocompletion in tokens and combo... - change (mediawiki...SemanticForms)
Jatin has uploaded a new change for review. https://gerrit.wikimedia.org/r/155899 Change subject: Fixed problem with remote autocompletion in tokens and combobox for private wikis .. Fixed problem with remote autocompletion in tokens and combobox for private wikis Change-Id: Ifcee0c0e71e2ce844514388b74607ae4cfa23895 --- M libs/ext.sf.select2.combobox.js M libs/ext.sf.select2.tokens.js 2 files changed, 20 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms refs/changes/99/155899/1 diff --git a/libs/ext.sf.select2.combobox.js b/libs/ext.sf.select2.combobox.js index ca6e6ae..cccfab9 100644 --- a/libs/ext.sf.select2.combobox.js +++ b/libs/ext.sf.select2.combobox.js @@ -193,7 +193,7 @@ var ajaxOpts = { url: my_server, - dataType: 'jsonp', + dataType: 'json', data: function (term) { return { substr: term, // search term @@ -201,11 +201,15 @@ }, results: function (data, page, query) { // parse the results into the format expected by Select2. var id = 0; - data.sfautocomplete.forEach( function(item) { - item.id = id++; - item.text = item.title; - }); - return {results: data.sfautocomplete}; + if (data.sfautocomplete !== undefined) { + data.sfautocomplete.forEach( function(item) { + item.id = id++; + item.text = item.title; + }); + return {results: data.sfautocomplete}; + } else { + return {results: []}; + } } }; diff --git a/libs/ext.sf.select2.tokens.js b/libs/ext.sf.select2.tokens.js index df1d474..3be0223 100644 --- a/libs/ext.sf.select2.tokens.js +++ b/libs/ext.sf.select2.tokens.js @@ -237,7 +237,7 @@ var ajaxOpts = { url: my_server, - dataType: 'jsonp', + dataType: 'json', data: function (term) { return { substr: term, // search term @@ -245,11 +245,15 @@ }, results: function (data, page, query) { // parse the results into the format expected by Select2. var id = 0; - data.sfautocomplete.forEach( function(item) { - item.id = id++; - item.text = item.title; - }); - return {results: data.sfautocomplete}; + if (data.sfautocomplete !== undefined) { + data.sfautocomplete.forEach( function(item) { + item.id = id++; + item.text = item.title; + }); + return {results: data.sfautocomplete}; + } else { + return {results: []}; + } } }; -- To view, visit https://gerrit.wikimedia.org/r/155899 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifcee0c0e71e2ce844514388b74607ae4cfa23895 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SemanticForms Gerrit-Branch: master Gerrit-Owner: Jatin mehtajati...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Testreduce server: Couple more relative url fixes - change (mediawiki...parsoid)
Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/155900 Change subject: Testreduce server: Couple more relative url fixes .. Testreduce server: Couple more relative url fixes Change-Id: Idcfc813e62f5c40ffeb2a7a6c54f4c8214281474 --- M tests/server/server.js 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/00/155900/1 diff --git a/tests/server/server.js b/tests/server/server.js index fe9f174..3fa95fc 100755 --- a/tests/server/server.js +++ b/tests/server/server.js @@ -1052,6 +1052,7 @@ page = (req.params[2] || 0) - 0, offset = page * 40, relativeUrlPrefix = '../../../'; + relativeUrlPrefix = relativeUrlPrefix + (req.params[0] ? '../' : ''); db.query( dbNumRegressionsBetweenRevs, [ r2, r1 ], function(err, row) { if (err) { res.send( err.toString(), 500 ); @@ -1078,6 +1079,7 @@ page = (req.params[2] || 0) - 0, offset = page * 40, relativeUrlPrefix = '../../../'; + relativeUrlPrefix = relativeUrlPrefix + (req.params[0] ? '../' : ''); db.query( dbNumFixesBetweenRevs, [ r2, r1 ], function(err, row) { if (err) { res.send( err.toString(), 500 ); -- To view, visit https://gerrit.wikimedia.org/r/155900 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idcfc813e62f5c40ffeb2a7a6c54f4c8214281474 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry ssas...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] TemplateParser: Fix whitespace trim - change (mediawiki...CommonsMetadata)
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/155901 Change subject: TemplateParser: Fix whitespace trim .. TemplateParser: Fix whitespace trim Bug: 57458 Change-Id: Id916ec3070ef49ea7b2e4d602805596593adcca4 --- M TemplateParser.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommonsMetadata refs/changes/01/155901/1 diff --git a/TemplateParser.php b/TemplateParser.php index 5f70dac..5e0c6c0 100755 --- a/TemplateParser.php +++ b/TemplateParser.php @@ -61,7 +61,7 @@ * @var array */ protected static $cleanupPatterns = array( - '/^\s+(.*)\s+$/' = '\1', // trim whitespace + '/^\s+|\s+$/' = '', // trim leading or trailing whitespace '/^p(.*)\/p$/' = '\1', // clean paragraph with no styling - usually generated by MediaWiki ); -- To view, visit https://gerrit.wikimedia.org/r/155901 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id916ec3070ef49ea7b2e4d602805596593adcca4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CommonsMetadata Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make trim consider both parts of coordinate - change (mediawiki...CommonsMetadata)
jenkins-bot has submitted this change and it was merged. Change subject: Make trim consider both parts of coordinate .. Make trim consider both parts of coordinate In TemplateParser.parseCoordinates(), trim whitespace of both parts of the coordinate string rather than the whole string before splitting. Otherwise whitespace between ';' and longitude is left. Bug: 65573 Change-Id: I9b5c1dbadd1c81524fec556da2882c70321ea1c4 --- M TemplateParser.php 1 file changed, 3 insertions(+), 3 deletions(-) Approvals: TheDJ: Looks good to me, approved jenkins-bot: Verified diff --git a/TemplateParser.php b/TemplateParser.php index 5f70dac..cbcd7fc 100755 --- a/TemplateParser.php +++ b/TemplateParser.php @@ -120,10 +120,10 @@ $data = array(); foreach ( $domNavigator-findElementsWithClass( 'span', 'geo' ) as $geoNode ) { $coordinateData = array(); - $coords = explode( ';', trim( $geoNode-textContent ) ); + $coords = explode( ';', $geoNode-textContent ); if ( count( $coords ) == 2 is_numeric( $coords[0] ) is_numeric( $coords[1] ) ) { - $coordinateData['GPSLatitude'] = $coords[0]; - $coordinateData['GPSLongitude'] = $coords[1]; + $coordinateData['GPSLatitude'] = trim( $coords[0] ); + $coordinateData['GPSLongitude'] = trim( $coords[1] ); $coordinateData['GPSMapDatum'] = 'WGS-84'; } $data[] = $coordinateData; -- To view, visit https://gerrit.wikimedia.org/r/153761 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9b5c1dbadd1c81524fec556da2882c70321ea1c4 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CommonsMetadata Gerrit-Branch: master Gerrit-Owner: Lokal Profil lokal.pro...@gmail.com Gerrit-Reviewer: Gergő Tisza gti...@wikimedia.org Gerrit-Reviewer: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] TablePager: Modernize style loading - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155903 Change subject: TablePager: Modernize style loading .. TablePager: Modernize style loading * Create a CSS module for pager styling (table and navigation), pulling in existing styles for shared.css. Load it on all pages where the pager itself is shown. * Build a ParserOutput object encapsulating the return HTML and required modules, rather than only providing the HTML. Added some terrible hacks for backwards-compatibility with old-style calls and soft-deprecated them (there are many calls in extensions). Other cleanup: * Remove styles in oldshared.css, they were all overwritten by shared.css or by styles for .mw-datatable. * Remove inline styles where possible. * On SpecialListFiles, display navigation bar above the table as well as below (this seems to be the convention for other pages). Change-Id: Iae976f854b96b5c61691918787c4dff7db089c28 --- M RELEASE-NOTES-1.24 M includes/pager/TablePager.php M includes/specials/SpecialAllMessages.php M includes/specials/SpecialBlockList.php M includes/specials/SpecialListfiles.php M includes/specials/SpecialProtectedpages.php M resources/Resources.php A resources/src/mediawiki/mediawiki.pager.tablePager.css M skins/common/oldshared.css M skins/common/shared.css 10 files changed, 138 insertions(+), 78 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/03/155903/1 diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 37334b0..69f625c 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -350,6 +350,8 @@ * Removed EnhancedChangesList::arrow(), sideArrow(), downArrow(), spacerArrow(). * Removed Xml::namespaceSelector(). (deprecated since 1.19) * Removed WikiPage::estimateRevisionCount. (deprecated since 1.19) +* TablePager::getBody() is now 'final' and can't be overridden in subclasses. +* TablePager::getBody() is deprecated, use getBodyOutput() or getFullOutput(). Renamed classes * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression diff --git a/includes/pager/TablePager.php b/includes/pager/TablePager.php index 19538c6..c21b2b7 100644 --- a/includes/pager/TablePager.php +++ b/includes/pager/TablePager.php @@ -51,6 +51,100 @@ } /** +* Get the formatted result list. Calls getStartBody(), formatRow() and +* getEndBody(), concatenates the results and returns them. +* +* Making this 'final', there's no reason to override it. If anyone is doing +* it now, they're probably breaking the style loading hack, so let's fail +* fast rather than mysteriously render things wrong. +* +* @deprecated since 1.24, use getBodyOutput() or getFullOutput() instead +* @return string +*/ + public final function getBody() { + return $this-makeResourceLoaderStylesLink( $this-getModuleStyles() ) + . parent::getBody(); + } + + /** +* The good parts of OutputPage::makeResourceLoaderLink(). +* +* @since 1.24 +* @deprecated since 1.24 +* @param string[] $modules +* @return string HTML +*/ + private function makeResourceLoaderStylesLink( $modules ) { + $modules = (array)$modules; + + if ( !count( $modules ) ) { + return ''; + } + + if ( count( $modules ) 1 ) { + $modules = array_unique( $modules ); + sort( $modules ); + } + + $resourceLoader = $this-getOutput()-getResourceLoader(); + + $query = ResourceLoader::makeLoaderQuery( + $modules, + $this-getLanguage()-getCode(), + $this-getSkin()-getSkinName(), + null, // user + null, // version + ResourceLoader::inDebugMode(), + ResourceLoaderModule::TYPE_STYLES, // only + $this-getOutput()-isPrintable(), + $this-getRequest()-getBool( 'handheld' ), + array() // extraQuery + ); + $context = new ResourceLoaderContext( $resourceLoader, new FauxRequest( $query ) ); + + $url = $resourceLoader-createLoaderURL( 'local', $context, array() ); + + return Html::linkedStyle( $url ); + } + + /** +* Get the formatted result list. +* +* Calls getBody() and getModuleStyles() and builds a ParserOutput +* object. (This is a bit hacky but works well.) +* +* @since 1.24 +* @return ParserOutput +*/ + public function getBodyOutput() { + $body = parent::getBody(); + +
[MediaWiki-commits] [Gerrit] OutputPage: addParserOutput*() family doesn't need to take a... - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155902 Change subject: OutputPage: addParserOutput*() family doesn't need to take a reference .. OutputPage: addParserOutput*() family doesn't need to take a reference We never assign to the variable, only call some (mutating) methods on the object. With PHP5 we don't need to pass this by reference. Change-Id: Ib4ab141ca6d803f9df0351b1f65c7e9955c37d57 --- M includes/OutputPage.php 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/02/155902/1 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index c98f34b..8a69f6c 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1617,7 +1617,7 @@ * @deprecated since 1.24, use addParserOutputMetadata() instead. * @param ParserOutput $parserOutput */ - public function addParserOutputNoText( $parserOutput ) { + public function addParserOutputNoText( $parserOutput ) { $this-addParserOutputMetadata( $parserOutput ); } @@ -1629,7 +1629,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputMetadata( $parserOutput ) { + public function addParserOutputMetadata( $parserOutput ) { $this-mLanguageLinks += $parserOutput-getLanguageLinks(); $this-addCategoryLinks( $parserOutput-getCategories() ); $this-mNewSectionLink = $parserOutput-getNewSection(); @@ -1685,7 +1685,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputContent( $parserOutput ) { + public function addParserOutputContent( $parserOutput ) { $this-addParserOutputText( $parserOutput ); $this-addModules( $parserOutput-getModules() ); @@ -1702,7 +1702,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputText( $parserOutput ) { + public function addParserOutputText( $parserOutput ) { $text = $parserOutput-getText(); wfRunHooks( 'OutputPageBeforeHTML', array( $this, $text ) ); $this-addHTML( $text ); @@ -1713,7 +1713,7 @@ * * @param ParserOutput $parserOutput */ - function addParserOutput( $parserOutput ) { + function addParserOutput( $parserOutput ) { $this-addParserOutputMetadata( $parserOutput ); $parserOutput-setTOCEnabled( $this-mEnableTOC ); -- To view, visit https://gerrit.wikimedia.org/r/155902 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib4ab141ca6d803f9df0351b1f65c7e9955c37d57 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move EntityPermissionChecker and EntityContentFactory into n... - change (mediawiki...Wikibase)
Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/155904 Change subject: Move EntityPermissionChecker and EntityContentFactory into namespaces .. Move EntityPermissionChecker and EntityContentFactory into namespaces EntityPermissionChecker to Wikibase\Repo\Store namespace EntityContentFactory to Wikibase\Repo\Content namespace Change-Id: I02eb32ff83ab3a41d857edb6a10734a1cd4cddfc --- M repo/includes/EditEntity.php M repo/includes/Hook/MakeGlobalVariablesScriptHandler.php M repo/includes/Interactors/RedirectCreationInteractor.php M repo/includes/UpdateRepoOnMoveJob.php M repo/includes/WikibaseRepo.php M repo/includes/actions/ViewEntityAction.php M repo/includes/api/ApiWikibase.php M repo/includes/content/EntityContentFactory.php M repo/includes/specials/SpecialWikibaseRepoPage.php M repo/includes/store/EntityPermissionChecker.php M repo/includes/store/sql/EntityPerPageBuilder.php M repo/includes/store/sql/WikiPageEntityStore.php M repo/tests/phpunit/includes/EditEntityTest.php M repo/tests/phpunit/includes/Hook/MakeGlobalVariablesScriptHandlerTest.php M repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php M repo/tests/phpunit/includes/WikibaseRepoTest.php M repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 19 files changed, 33 insertions(+), 22 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/04/155904/1 diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php index 762dd8c..e67b9cb 100644 --- a/repo/includes/EditEntity.php +++ b/repo/includes/EditEntity.php @@ -16,6 +16,7 @@ use Wikibase\Lib\Store\EntityStore; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Lib\Store\StorageException; +use Wikibase\Repo\Store\EntityPermissionChecker; use Wikibase\Repo\WikibaseRepo; use WikiPage; diff --git a/repo/includes/Hook/MakeGlobalVariablesScriptHandler.php b/repo/includes/Hook/MakeGlobalVariablesScriptHandler.php index 0642b7a..a67a178 100644 --- a/repo/includes/Hook/MakeGlobalVariablesScriptHandler.php +++ b/repo/includes/Hook/MakeGlobalVariablesScriptHandler.php @@ -5,9 +5,9 @@ use OutputPage; use Wikibase\DataModel\Entity\Entity; use Wikibase\EntityContent; -use Wikibase\EntityContentFactory; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\ParserOutputJsConfigBuilder; +use Wikibase\Repo\Content\EntityContentFactory; /** * @since 0.5 diff --git a/repo/includes/Interactors/RedirectCreationInteractor.php b/repo/includes/Interactors/RedirectCreationInteractor.php index cebf128..54244fc 100644 --- a/repo/includes/Interactors/RedirectCreationInteractor.php +++ b/repo/includes/Interactors/RedirectCreationInteractor.php @@ -5,12 +5,12 @@ use Status; use User; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\EntityPermissionChecker; use Wikibase\Lib\Store\EntityRedirect; use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\Lib\Store\EntityStore; use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\UnresolvedRedirectException; +use Wikibase\Repo\Store\EntityPermissionChecker; use Wikibase\Summary; use Wikibase\SummaryFormatter; diff --git a/repo/includes/UpdateRepoOnMoveJob.php b/repo/includes/UpdateRepoOnMoveJob.php index 4e3cb5b..86c79f6 100644 --- a/repo/includes/UpdateRepoOnMoveJob.php +++ b/repo/includes/UpdateRepoOnMoveJob.php @@ -10,9 +10,11 @@ use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\SiteLink; use Wikibase\Lib\Store\EntityRevisionLookup; -use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\EntityStore; use Wikibase\Lib\Store\EntityTitleLookup; +use Wikibase\Lib\Store\StorageException; +use Wikibase\Repo\Content\EntityContentFactory; +use Wikibase\Repo\Store\EntityPermissionChecker; use Wikibase\Repo\WikibaseRepo; /** diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index 6029a20..16c4f82 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -21,7 +21,6 @@ use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\Property; -use Wikibase\EntityContentFactory; use Wikibase\EntityFactory; use Wikibase\InternalSerialization\DeserializerFactory; use Wikibase\InternalSerialization\SerializerFactory; @@ -53,12 +52,14 @@ use Wikibase\ParserOutputJsConfigBuilder; use Wikibase\PropertyHandler; use Wikibase\ReferencedEntitiesFinder; +use Wikibase\Repo\Content\EntityContentFactory; use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer; use Wikibase\Repo\Localizer\MessageParameterFormatter; use Wikibase\Repo\Notifications\ChangeNotifier; use Wikibase\Repo\Notifications\ChangeTransmitter; use Wikibase\Repo\Notifications\DatabaseChangeTransmitter;
[MediaWiki-commits] [Gerrit] Fix ResourceLoader calls. - change (mediawiki...Daddio)
Lewis Cawte has uploaded a new change for review. https://gerrit.wikimedia.org/r/155907 Change subject: Fix ResourceLoader calls. .. Fix ResourceLoader calls. Change-Id: I97b1c10b7c4d6bd3ed5f42c7e8dd09360c5f2666 --- M Daddio.php M Daddio.skin.php 2 files changed, 5 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Daddio refs/changes/07/155907/1 diff --git a/Daddio.php b/Daddio.php index 914ba92..a5dfc3c 100644 --- a/Daddio.php +++ b/Daddio.php @@ -32,12 +32,10 @@ $wgResourceModules['skins.daddio'] = array( 'styles' = array( - // @Lcawte: this probably isn't the most kosher way to do this, but it's - // how most/all ShoutWiki skins do it and it works for our setup at - // least. Feel free to improve it :D - 'skins/Daddio/daddio/main.css' = array( 'media' = 'screen' ), - 'skins/Daddio/daddio/print.css' = array( 'media' = 'print' ) + 'daddio/main.css' = array( 'media' = 'screen' ), + 'daddio/print.css' = array( 'media' = 'print' ) ), 'position' = 'top', - //'localBasePath' = __DIR__, + 'localBasePath' = __DIR__, + 'remoteSkinPath' = 'Daddio', ); diff --git a/Daddio.skin.php b/Daddio.skin.php index e9921dd..e8765f1 100644 --- a/Daddio.skin.php +++ b/Daddio.skin.php @@ -20,7 +20,7 @@ $template = 'DaddioTemplate', $useHeadElement = true; function setupSkinUserCss( OutputPage $out ) { - $out-addModuleStyles( 'skin.daddio' ); + $out-addModuleStyles( array( 'skins.daddio', 'mediawiki.legacy.shared' ) ); } } -- To view, visit https://gerrit.wikimedia.org/r/155907 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I97b1c10b7c4d6bd3ed5f42c7e8dd09360c5f2666 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Daddio Gerrit-Branch: master Gerrit-Owner: Lewis Cawte le...@lewiscawte.me ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Some cleanup of Daddio skin. - change (mediawiki...Daddio)
Lewis Cawte has uploaded a new change for review. https://gerrit.wikimedia.org/r/155906 Change subject: Some cleanup of Daddio skin. .. Some cleanup of Daddio skin. Various improvements, or at least I hope this is an improvement over the status quo. Untested, but mostly based on MonoBook, so it should work(TM). Change-Id: I12baef6296779fe1c1d222d173cc0095948a2e4d --- M Daddio.php M Daddio.skin.php 2 files changed, 99 insertions(+), 76 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Daddio refs/changes/06/155906/1 diff --git a/Daddio.php b/Daddio.php index d9446b8..914ba92 100644 --- a/Daddio.php +++ b/Daddio.php @@ -16,20 +16,28 @@ $wgExtensionCredits['skin'][] = array( 'path' = __FILE__, 'name' = 'Daddio', + // @todo FIXME: add a meaningful version number 'author' = array( 'Rufus Post', 'Aaron Schulz' ), 'description-msg' = 'daddio-desc', 'url' = 'https://www.mediawiki.org/wiki/Skin:Daddio', ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = __DIR__ . /Daddio.skin.php; +// *cough cough* assumptions... +if ( !isset( $wgAutoloadClasses['ModernTemplate'] ) ) { + $wgAutoloadClasses['ModernTemplate'] = __DIR__ . '/../Modern/SkinModern.php'; +} +$wgAutoloadClasses['SkinDaddio'] = __DIR__ . '/Daddio.skin.php'; $wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; $wgResourceModules['skins.daddio'] = array( 'styles' = array( - 'daddio/main.css' = array( 'media' = 'screen' ), - 'daddio/print.css' = array( 'media' = 'print' ) -// 'daddio/rtl.css', 'screen', '', 'rtl' ); + // @Lcawte: this probably isn't the most kosher way to do this, but it's + // how most/all ShoutWiki skins do it and it works for our setup at + // least. Feel free to improve it :D + 'skins/Daddio/daddio/main.css' = array( 'media' = 'screen' ), + 'skins/Daddio/daddio/print.css' = array( 'media' = 'print' ) ), - 'localBasePath' = __DIR__, + 'position' = 'top', + //'localBasePath' = __DIR__, ); diff --git a/Daddio.skin.php b/Daddio.skin.php index a930ae2..e9921dd 100644 --- a/Daddio.skin.php +++ b/Daddio.skin.php @@ -3,28 +3,25 @@ * Daddio skin. Skin for getting work done. * Based on Modern, modified by Rufus Post, Aaron Schulz * + * @file */ -if( !defined( 'MEDIAWIKI' ) ) +if ( !defined( 'MEDIAWIKI' ) ) { die( -1 ); - -global $IP; -// @todo Fixme: autoload ModernTemplate -require_once( $IP/skins/Modern/Modern.php ); +} /** * Inherit main code from SkinTemplate, set the CSS and template filter. - * @todo document + * * @ingroup Skins */ class SkinDaddio extends SkinTemplate { public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; - function setupSkinUserCss( OutputPage $out ){ - $out-addModules( 'skin.daddio' ); + function setupSkinUserCss( OutputPage $out ) { + $out-addModuleStyles( 'skin.daddio' ); } - } /** @@ -39,14 +36,13 @@ * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. -* -* @access private */ - function execute() { - $this-skin = $skin = $this-data['skin']; + public function execute() { + $this-skin = $this-data['skin']; + + $this-data['pageLanguage'] = $this-skin-getTitle()-getPageViewLanguage()-getHtmlCode(); $this-html( 'headelement' ); - ? !-- heading -- @@ -54,15 +50,14 @@ div id=mw_contentwrapper !-- navigation portlet -- div class=portlet id=p-cactions - h5?php $this-msg('views') ?/h5 + h5?php $this-msg( 'views' ) ?/h5 div class=pBody ul - ?php foreach($this-data['content_actions'] as $key = $tab) { ? -li id=ca-?php echo Sanitizer::escapeId($key) ??php - if($tab['class']) { ? class=?php echo htmlspecialchars($tab['class']) ??php } -?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskeyAttribs('ca-'.$key) ??php -echo htmlspecialchars($tab['text']) ?/a/li - ?php} ? + ?php + foreach ( $this-data['content_actions'] as $key = $tab ) { + echo $this-makeListItem( $key, $tab ); + } + ? /ul /div /div
[MediaWiki-commits] [Gerrit] Some cleanup to Daddio skin. - change (mediawiki...Daddio)
Lewis Cawte has uploaded a new change for review. https://gerrit.wikimedia.org/r/155905 Change subject: Some cleanup to Daddio skin. .. Some cleanup to Daddio skin. Basic resourceloader support, fix Modern include to work with recent pathing. Also rename class file to meet the precedent set by other third-party skins of having the templates at Skinname.skin.php. Change-Id: I68e6bdbb249bb5b7b572d344099b03e1419f941e --- M Daddio.php R Daddio.skin.php 2 files changed, 20 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Daddio refs/changes/05/155905/1 diff --git a/Daddio.php b/Daddio.php index adcce67..d9446b8 100644 --- a/Daddio.php +++ b/Daddio.php @@ -22,5 +22,14 @@ ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = dirname( __FILE__ ) . /Daddio.class.php; -$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; \ No newline at end of file +$wgAutoloadClasses['SkinDaddio'] = __DIR__ . /Daddio.skin.php; +$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; + +$wgResourceModules['skins.daddio'] = array( + 'styles' = array( + 'daddio/main.css' = array( 'media' = 'screen' ), + 'daddio/print.css' = array( 'media' = 'print' ) +// 'daddio/rtl.css', 'screen', '', 'rtl' ); + ), + 'localBasePath' = __DIR__, +); diff --git a/Daddio.class.php b/Daddio.skin.php similarity index 86% rename from Daddio.class.php rename to Daddio.skin.php index 35757e0..a930ae2 100644 --- a/Daddio.class.php +++ b/Daddio.skin.php @@ -10,7 +10,7 @@ global $IP; // @todo Fixme: autoload ModernTemplate -require_once( $IP/skins/Modern.php ); +require_once( $IP/skins/Modern/Modern.php ); /** * Inherit main code from SkinTemplate, set the CSS and template filter. @@ -18,19 +18,11 @@ * @ingroup Skins */ class SkinDaddio extends SkinTemplate { - var $skinname = 'daddio', $stylename = 'daddio', + public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; function setupSkinUserCss( OutputPage $out ){ - global $wgScriptPath; - - $path = {$wgScriptPath}/skins/Daddio; - - // Do not call parent::setupSkinUserCss(), we have our own print style - $out-addStyle( 'common/shared.css', 'screen' ); - $out-addStyle( $path/daddio/main.css, 'screen' ); - $out-addStyle( $path/daddio/print.css, 'print' ); - $out-addStyle( $path/daddio/rtl.css, 'screen', '', 'rtl' ); + $out-addModules( 'skin.daddio' ); } } @@ -40,6 +32,8 @@ * @ingroup Skins */ class DaddioTemplate extends ModernTemplate { + public $skin; + /** * Template filter callback for Daddio skin. * Takes an associative array of data set from a SkinTemplate-based @@ -50,9 +44,6 @@ */ function execute() { $this-skin = $skin = $this-data['skin']; - - // Suppress warnings to prevent notices about missing indexes in $this-data - wfSuppressWarnings(); $this-html( 'headelement' ); @@ -63,13 +54,13 @@ div id=mw_contentwrapper !-- navigation portlet -- div class=portlet id=p-cactions - h5?php $this-msg('views') ?/h5 + h5?php $this-msg('views') ?/h5 div class=pBody ul ?php foreach($this-data['content_actions'] as $key = $tab) { ? li id=ca-?php echo Sanitizer::escapeId($key) ??php if($tab['class']) { ? class=?php echo htmlspecialchars($tab['class']) ??php } -?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskey('ca-'.$key) ??php +?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskeyAttribs('ca-'.$key) ??php echo htmlspecialchars($tab['text']) ?/a/li ?php} ? /ul @@ -109,7 +100,7 @@ div id=mw_portlets ?php - $sidebar = $this-data['sidebar']; + $sidebar = $this-data['sidebar']; if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true; if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true; if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true; @@ -142,7 +133,7 @@ ?php foreach($this-data['personal_urls'] as $key = $item) { ? li id=pt-?php echo Sanitizer::escapeId($key) ??php if ($item['active']) { ? class=active?php } ?a
[MediaWiki-commits] [Gerrit] Replace assert() with actual PHPUnit assertions - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Replace assert() with actual PHPUnit assertions .. Replace assert() with actual PHPUnit assertions Replace with PHPUnit assertions in actual tests but with exceptions in setup code. Change-Id: I8a1d95d70855ab4af3d35d6d79bc185f0045a5a1 --- M repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php 1 file changed, 8 insertions(+), 5 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Checked diff --git a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php index 0fb8984..941aaca 100644 --- a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php +++ b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php @@ -52,7 +52,9 @@ $this-clearTables(); $items = $this-addItems(); - assert( $this-countPages() === count( $items ) ); + if ( $this-countPages() !== count( $items ) ) { + throw new RuntimeException( 'Page count must be equal to item count.' ); + } $this-entityPerPageRows = $this-getEntityPerPageData(); } @@ -92,8 +94,9 @@ $dbw-delete( 'page', array( 1 ) ); $this-entityPerPageTable-clear(); - assert( $this-countPages() === 0 ); - assert( $this-countEntityPerPageRows() === 0 ); + if ( $this-countPages() !== 0 || $this-countEntityPerPageRows() !== 0 ) { + throw new RuntimeException( 'Clear failed.' ); + } } private function itemSupportsRedirect() { @@ -212,7 +215,7 @@ public function testRebuildAll() { $this-entityPerPageTable-clear(); - assert( $this-countEntityPerPageRows() === 0 ); + $this-assertEquals( 0, $this-countEntityPerPageRows() ); $builder = new EntityPerPageBuilder( $this-entityPerPageTable, @@ -232,7 +235,7 @@ $pageId = $this-getPageIdForPartialClear(); $this-partialClearEntityPerPageTable( $pageId ); - assert( $this-countEntityPerPageRows() === 6 ); + $this-assertEquals( 6, $this-countEntityPerPageRows() ); $builder = new EntityPerPageBuilder( $this-entityPerPageTable, -- To view, visit https://gerrit.wikimedia.org/r/155248 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8a1d95d70855ab4af3d35d6d79bc185f0045a5a1 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Allow exclamation point in attribute values - change (mediawiki...parsoid)
Arlolra has uploaded a new change for review. https://gerrit.wikimedia.org/r/155908 Change subject: Allow exclamation point in attribute values .. Allow exclamation point in attribute values * 97c45e848535185600f6d0fa8fe175f88786cd9b prevents them being eaten as attribute names but was perhaps a bit overreaching. Only the attribute_preprocessor_text_line production is used in parsing names. * Maintains the fix from that bug, {| ! Foo !! style=color: red | Bar |} * And fixes the recent one reported, {| title=!=foo |foo |} * A little cleanup as well. Change-Id: I493df53632f6baa9c7b2b01f5fd7f2e620b69f05 --- M lib/pegTokenizer.pegjs.txt 1 file changed, 11 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/08/155908/1 diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt index 1118bd3..dc46b76 100644 --- a/lib/pegTokenizer.pegjs.txt +++ b/lib/pegTokenizer.pegjs.txt @@ -99,11 +99,8 @@ /* The 'redirect' magic word. * The leading whitespace allowed is due to the PHP trim() function. */ -redirect_word = sp:[ \t\n\r\0\x0b]* rw:((!space_or_newline ![:\[] c:.{return c;})+) +redirect_word = sp:[ \t\n\r\0\x0b]* rw:(!space_or_newline ![:\[] c:.{return c;})+ { -if ( !rw ) { -rw = ; -} rw = rw.join(''); if ( options.env.conf.wiki.getMagicWordMatcher( 'redirect' ).test( rw ) ) { return sp.join('') + rw; @@ -2105,6 +2102,7 @@ { return tu.flatten_string( r ); } + attribute_preprocessor_text_single_broken = r:( t:[^{}'|]+ { return t.join(''); } / !inline_breaks r:( @@ -2114,6 +2112,7 @@ { return tu.flatten_string( r ); } + attribute_preprocessor_text_double = r:( t:[^{}]+ { return t.join(''); } / !inline_breaks r:( @@ -2124,6 +2123,7 @@ //console.warn( 'double:' + pp(r) ); return tu.flatten_string( r ); } + attribute_preprocessor_text_double_broken = r:( t:[^{}|]+ { return t.join(''); } / !inline_breaks r:( @@ -2157,31 +2157,34 @@ } attribute_preprocessor_text_single_line - = r:( t:[^{}'|!\n]+ { return t.join(''); } + = r:( t:[^{}'|\n]+ { return t.join(''); } / !inline_breaks r:( directive / ![\r\n] q:[{}] { return q; } ) { return r; } )* { return tu.flatten_string( r ); } + attribute_preprocessor_text_single_line_broken - = r:( t:[^{}'|!\n]+ { return t.join(''); } + = r:( t:[^{}'|\n]+ { return t.join(''); } / !inline_breaks r:( directive / ![\r\n] q:[{}] { return q; } ) { return r; } )* { return tu.flatten_string( r ); } + attribute_preprocessor_text_double_line - = r:( t:[^{}|!\n]+ { return t.join(''); } + = r:( t:[^{}|\n]+ { return t.join(''); } / !inline_breaks r:( directive / ![\r\n] q:[{}] { return q; } ) { return r; } )* { return tu.flatten_string( r ); } + attribute_preprocessor_text_double_line_broken - = r:( t:[^{}|!\n]+ { return t.join(''); } + = r:( t:[^{}|\n]+ { return t.join(''); } / !inline_breaks r:( directive / ![\r\n] q:[{}] { return q; } ) { return r; } -- To view, visit https://gerrit.wikimedia.org/r/155908 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I493df53632f6baa9c7b2b01f5fd7f2e620b69f05 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra abrea...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Improve code readability in EntityContent and related - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Improve code readability in EntityContent and related .. Improve code readability in EntityContent and related This clean-up is partly split from I9523656 (without the new status). I hope this makes the code more readable. Change-Id: If488df0d010df4da343b55ca351300b337dd0a10 --- M repo/includes/content/EntityContent.php M repo/includes/content/ItemContent.php 2 files changed, 29 insertions(+), 61 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified Thiemo Mättig (WMDE): Looks good to me, but someone else must approve jenkins-bot: Checked diff --git a/repo/includes/content/EntityContent.php b/repo/includes/content/EntityContent.php index 54ecce8..ececba7 100644 --- a/repo/includes/content/EntityContent.php +++ b/repo/includes/content/EntityContent.php @@ -64,6 +64,7 @@ /** * For use in the wb-status page property to indicate that the entity is empty. +* * @see getEntityStatus() */ const STATUS_EMPTY = 200; @@ -76,26 +77,15 @@ * @see Content::isValid() */ public function isValid() { - if ( $this-isRedirect() ) { - // Under some circumstances, the handler will not support redirects, // but it's still possible to construct Content objects that represent // redirects. In such a case, make sure such Content objects are considered // invalid and do not get saved. - - if ( !$this-getContentHandler()-supportsRedirects() ) { - return false; - } - - return true; + return $this-getContentHandler()-supportsRedirects(); } - if ( is_null( $this-getEntity()-getId() ) ) { - return false; - } - - return true; + return $this-getEntity()-getId() !== null; } /** @@ -302,25 +292,22 @@ $context = RequestContext::getMain(); } - // determine output language - $langCode = $context-getLanguage()-getCode(); + $languageCode = $context-getLanguage()-getCode(); if ( $options !== null ) { // NOTE: Parser Options language overrides context language! - $langCode = $options-getUserLang(); + $languageCode = $options-getUserLang(); } - // make formatter options $formatterOptions = new FormatterOptions(); - $formatterOptions-setOption( ValueFormatter::OPT_LANG, $langCode ); + $formatterOptions-setOption( ValueFormatter::OPT_LANG, $languageCode ); // Force the context's language to be the one specified by the parser options. - if ( $context $context-getLanguage()-getCode() !== $langCode ) { + if ( $context $context-getLanguage()-getCode() !== $languageCode ) { $context = clone $context; - $context-setLanguage( $langCode ); + $context-setLanguage( $languageCode ); } - // apply language fallback chain if ( !$uiLanguageFallbackChain ) { $factory = WikibaseRepo::getDefaultInstance()-getLanguageFallbackChainFactory(); $uiLanguageFallbackChain = $factory-newFromContextForPageView( $context ); @@ -337,9 +324,8 @@ $entityContentFactory = WikibaseRepo::getDefaultInstance()-getEntityContentFactory(); $idParser = new BasicEntityIdParser(); - $options = $this-makeSerializationOptions( $langCode, $uiLanguageFallbackChain ); + $options = $this-makeSerializationOptions( $languageCode, $uiLanguageFallbackChain ); - // construct the instance $entityView = $this-newEntityView( $context, $snakFormatter, @@ -389,10 +375,8 @@ wfProfileIn( __METHOD__ ); - $entity = $this-getEntity(); - $searchTextGenerator = new EntitySearchTextGenerator(); - $text = $searchTextGenerator-generate( $entity ); + $text = $searchTextGenerator-generate( $this-getEntity() ); wfProfileOut( __METHOD__ ); return $text; @@ -485,12 +469,12 @@ public function getTextForSummary( $maxLength = 250 ) { if ( $this-isRedirect() ) { return $this-getRedirectText(); - } else { - /** @var
[MediaWiki-commits] [Gerrit] Lint Trebuchet provider - change (operations/puppet)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/155909 Change subject: Lint Trebuchet provider .. Lint Trebuchet provider * The breezy, parens-free style is exciting but at the end of the day it makes the code harder to read. So add parens. * Make various style fixes suggested by 'rubocop'. Change-Id: I0393a2b537e63e2ac5bb7a71cfe9186432893943 --- M modules/trebuchet/lib/puppet/provider/package/trebuchet.rb 1 file changed, 56 insertions(+), 38 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/09/155909/1 diff --git a/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb b/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb index 4f7cbee..b19ee0b 100644 --- a/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb +++ b/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb @@ -22,8 +22,12 @@ require 'fileutils' require 'open-uri' -Puppet::Type.type(:package).provide :trebuchet, :parent = Puppet::Provider::Package do - desc Puppet package provider for `Trebuchet`. +Puppet::Type.type(:package).provide( + :trebuchet, + :parent = Puppet::Provider::Package +) do + + desc 'Puppet package provider for `Trebuchet`.' commands :git_cmd= '/usr/bin/git', :salt_cmd = '/usr/bin/salt-call', @@ -52,7 +56,7 @@ def target_path path = File.expand_path(File.join(self.class::BASE_PATH, qualified_name)) unless path.length self.class::BASE_PATH.length -raise Puppet::Error, Target path '#{path}' is invalid. + fail Puppet::Error, Target path '#{path}' is invalid. end path end @@ -60,35 +64,36 @@ # Convenience wrapper for shelling out to `git`. def git(*args) git_path = File.join(target_path, '.git') -git_cmd *args.map(:split).flatten.unshift('--git-dir', git_path) +git_cmd(*args.unshift('--git-dir', git_path)) end # Convenience wrapper for shelling out to `salt-call`. def salt(*args) -salt_cmd *args.map(:split).flatten.unshift('--out=json') +salt_cmd(*args.unshift('--out=json')) end # Synchronize local state with Salt master. def salt_refresh! - salt 'saltutil.sync_all' - salt 'saltutil.refresh_pillar' +salt('saltutil.sync_all') +salt('saltutil.refresh_pillar') end # Make sure that the salt-minion service is running. def check_salt_minion_status -begin - status = status_cmd('salt-minion') - raise Puppet::ExecutionFailure unless status.include? 'running' -rescue Puppet::ExecutionFailure - fail Trebuchet requires that the salt-minion service be running. -end +status = status_cmd('salt-minion') +fail Puppet::ExecutionFailure unless status.include? 'running' + rescue Puppet::ExecutionFailure +raise Puppet::ExecutionFailure, -END + The Trebuchet package provider requires that the salt-minion + service be running. +END end # Get the list of deployment targets defined for this minion. def targets @cached_targets || begin check_salt_minion_status - raw = salt 'grains.get', 'deployment_target' + raw = salt('grains.get', 'deployment_target') @cached_targets = PSON.load(raw).fetch('local', []) rescue Puppet::ExecutionFailure @cached_targets = [] @@ -98,19 +103,33 @@ # Return structured information about a particular package or `nil` if # it is not installed. def query -return nil unless targets.include? base +return nil unless targets.include?(base) + begin - tag = git 'rev-parse', 'HEAD' - {:ensure = tag.strip} + tag = git('rev-parse', 'HEAD') + { +:ensure = tag.strip + } rescue Puppet::ExecutionFailure - {:ensure = :purged, :status = 'missing', :name = @resource[:name]} + { +:ensure = :purged, +:status = 'missing', +:name = @resource[:name] + } end end def master @resource[:source] || begin - raw = salt 'grains.get', 'trebuchet_master' - @resource[:source] = PSON.load(raw).fetch('local') + raw = salt('grains.get', 'trebuchet_master') + master = PSON.load(raw)['local'] + if master.nil? || master.empty? +fail Puppet::Error, -END + Unable to determine Trebuchet master, because neither the `source` + parameter nor the `trebuchet_master` grain is set. +END + end + @resource[:source] = master end end @@ -118,54 +137,53 @@ # a deployment target. def latest_sha1 @cached_sha1 || begin - source = master || fail('Unable to determine Trebuchet master.') - source = 'http://' + source unless source.include? '://' + source = master + source = ('http://' + source) unless source.include?('://') source.gsub!(/\/?$/, /#{qualified_name}/.git/deploy/deploy) - tag = open(source) { |raw|
[MediaWiki-commits] [Gerrit] TablePager: Load images via CSS backgrounds rather than HTML... - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155910 Change subject: TablePager: Load images via CSS backgrounds rather than HTML imgs .. TablePager: Load images via CSS backgrounds rather than HTML imgs Moved files from directory: skins/common/images → resources/src/mediawiki/images and renamed: * arrow_disabled_last_25.png → pager-arrow-disabled-fastforward-ltr.png * arrow_disabled_first_25.png → pager-arrow-disabled-fastforward-rtl.png * arrow_disabled_right_25.png → pager-arrow-disabled-forward-ltr.png * arrow_disabled_left_25.png → pager-arrow-disabled-forward-rtl.png * arrow_last_25.png → pager-arrow-fastforward-ltr.png * arrow_first_25.png → pager-arrow-fastforward-rtl.png * arrow_right_25.png → pager-arrow-forward-ltr.png * arrow_left_25.png → pager-arrow-forward-rtl.png The new names are not very untuitive, but there's a mostly reasonable system behind them and we need names like this to have them automatically flipped for RTL styles. Bug: 69277 Change-Id: Ica34cdd5fcc9340a94fb5e60bb34c30266953dcb --- M includes/pager/TablePager.php R resources/src/mediawiki/images/pager-arrow-disabled-fastforward-ltr.png R resources/src/mediawiki/images/pager-arrow-disabled-fastforward-rtl.png R resources/src/mediawiki/images/pager-arrow-disabled-forward-ltr.png R resources/src/mediawiki/images/pager-arrow-disabled-forward-rtl.png R resources/src/mediawiki/images/pager-arrow-fastforward-ltr.png R resources/src/mediawiki/images/pager-arrow-fastforward-rtl.png R resources/src/mediawiki/images/pager-arrow-forward-ltr.png R resources/src/mediawiki/images/pager-arrow-forward-rtl.png M resources/src/mediawiki/mediawiki.pager.tablePager.css 10 files changed, 54 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/10/155910/1 diff --git a/includes/pager/TablePager.php b/includes/pager/TablePager.php index aacfd36..6e67b0b 100644 --- a/includes/pager/TablePager.php +++ b/includes/pager/TablePager.php @@ -328,45 +328,23 @@ * @return string HTML */ public function getNavigationBar() { - global $wgStylePath; - if ( !$this-isNavigationBarShown() ) { return ''; } - $path = $wgStylePath/common/images; $labels = array( 'first' = 'table_pager_first', 'prev' = 'table_pager_prev', 'next' = 'table_pager_next', 'last' = 'table_pager_last', ); - $images = array( - 'first' = 'arrow_first_25.png', - 'prev' = 'arrow_left_25.png', - 'next' = 'arrow_right_25.png', - 'last' = 'arrow_last_25.png', - ); - $disabledImages = array( - 'first' = 'arrow_disabled_first_25.png', - 'prev' = 'arrow_disabled_left_25.png', - 'next' = 'arrow_disabled_right_25.png', - 'last' = 'arrow_disabled_last_25.png', - ); - if ( $this-getLanguage()-isRTL() ) { - $keys = array_keys( $labels ); - $images = array_combine( $keys, array_reverse( $images ) ); - $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) ); - } $linkTexts = array(); $disabledTexts = array(); foreach ( $labels as $type = $label ) { $msgLabel = $this-msg( $label )-escaped(); - $linkTexts[$type] = Html::element( 'img', array( 'src' = $path/{$images[$type]}, - 'alt' = $msgLabel ) ) . br /$msgLabel; - $disabledTexts[$type] = Html::element( 'img', array( 'src' = $path/{$disabledImages[$type]}, - 'alt' = $msgLabel ) ) . br /$msgLabel; + $linkTexts[$type] = div class='TablePager_nav-enabled'$msgLabel/div; + $disabledTexts[$type] = div class='TablePager_nav-disabled'$msgLabel/div; } $links = $this-getPagingLinks( $linkTexts, $disabledTexts ); @@ -377,7 +355,9 @@ // We want every cell to have the same width. We could use table-layout: fixed; in CSS, // but it only works if we specify the width of a cell or the table and we don't want to. // There is no better way. http://www.w3.org/TR/CSS2/tables.html#fixed-table-layout - $s .= Html::rawElement( 'td', array( 'style' = width: $width; ), $links[$type] ) . \n; + $s .= Html::rawElement( 'td', +
[MediaWiki-commits] [Gerrit] Allow custom event handlers for the click event of toolbar b... - change (mediawiki/core)
Helder.wiki has uploaded a new change for review. https://gerrit.wikimedia.org/r/155912 Change subject: Allow custom event handlers for the click event of toolbar buttons .. Allow custom event handlers for the click event of toolbar buttons Example: mw.toolbar.addButton( { imageFile: '//upload.wikimedia.org/wikipedia/commons/a/a9/Button_tournesol.png', onClick: function(){ alert( 'MediaWiki!' ); } } ); Change-Id: I615960f689a0f8d35a12879efebc0afda8eef7b1 --- M resources/src/mediawiki.action/mediawiki.action.edit.js 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/12/155912/1 diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.js b/resources/src/mediawiki.action/mediawiki.action.edit.js index 0481b6a..0fdcc8e 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.js @@ -35,7 +35,11 @@ id: b.imageId || undefined, 'class': 'mw-toolbar-editbutton' } ).click( function () { - toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText ); + if ( $.isFunction( b.onClick ) ) { + b.onClick(); + } else { + toolbar.insertTags( b.tagOpen, b.tagClose, b.sampleText ); + } return false; } ); @@ -72,6 +76,7 @@ * @param {string} button.tagClose * @param {string} button.sampleText * @param {string} [button.imageId] +* @param {function} [button.onClick] */ addButton: function () { if ( isReady ) { -- To view, visit https://gerrit.wikimedia.org/r/155912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I615960f689a0f8d35a12879efebc0afda8eef7b1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Helder.wiki helder.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add new user rights 'editsitejs' and 'editsitecss' to user g... - change (operations/mediawiki-config)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/155913 Change subject: Add new user rights 'editsitejs' and 'editsitecss' to user groups .. Add new user rights 'editsitejs' and 'editsitecss' to user groups All groups with the 'editinterface' right should also be able to edit site styles and javascript for backward reasons. This patch depends on I6ad49037464c0bea8a6ee4a7866ff820168795fb in mediawiki/core Change-Id: I6f5a677248011761c3c6b08efd7d28367ca0eeb6 --- M wmf-config/CommonSettings.php M wmf-config/InitialiseSettings.php 2 files changed, 24 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/13/155913/1 diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php index c622acb..08b30e5 100644 --- a/wmf-config/CommonSettings.php +++ b/wmf-config/CommonSettings.php @@ -1071,6 +1071,8 @@ 'editinterface' = false, 'editusercss' = false, 'edituserjs' = false, + 'editsitecss' = false, + 'editsitejs' = false, ) ); } diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 30a4b34..7b3f941 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -6784,6 +6784,8 @@ 'editinterface' = true, // bug 52866 'editusercss' = true, // bug 52866 'edituserjs' = true, // bug 52866 + 'editsitecss' = true, + 'editsitejs' = true, 'apihighlimits' = true, // bug 65348 'noratelimit' = true, // bug 65348 ), @@ -6873,11 +6875,11 @@ 'sysop' = array( 'importupload' = true, ), ), '+donatewiki' = array( - 'user' = array( 'editinterface' = true ), + 'user' = array( 'editinterface' = true, 'editsitecss' = true, 'editsitejs' = true ), 'flood' = array( 'bot' = true ), ), '+elwiktionary' = array( - 'interface_editor' = array( 'editinterface' = true ), + 'interface_editor' = array( 'editinterface' = true, 'editsitecss' = true, 'editsitejs' = true ), 'autopatrolled' = array( 'autopatrol' = true ), // http://bugzilla.wikimedia.org/show_bug.cgi?id=28612 ), 'enwiki' = array( @@ -7029,7 +7031,7 @@ 'arbcom' = array( 'deletedhistory' = true, 'deletedtext' = true, 'undelete' = true ), ), '+foundationwiki' = array( - 'user' = array( 'editinterface' = true ), + 'user' = array( 'editinterface' = true, 'editsitecss' = true, 'editsitejs' = true ), 'flood' = array( 'bot' = true ), ), 'frwiki' = array( @@ -7057,7 +7059,7 @@ 'patroller' = array( 'patrol' = true, 'autopatrol' = true, 'rollback' = true, ), 'autopatrolled' = array( 'autopatrol' = true ), 'botadmin' = array( 'autopatrol' = true, 'autoconfirmed' = true, 'editsemiprotected' = true, 'suppressredirect' = true, 'nominornewtalk' = true, 'noratelimit' = true, 'skipcaptcha' = true, 'apihighlimits' = true, 'writeapi' = true, -'bot' = true, 'createaccount' = true, 'import' = true, 'patrol' = true, 'protect' = true, 'editprotected' = true, 'editusercss' = true, 'edituserjs' = true, 'editinterface' = true, 'browsearchive' = true, 'movefile' = true, 'move' = true, +'bot' = true, 'createaccount' = true, 'import' = true, 'patrol' = true, 'protect' = true, 'editprotected' = true, 'editusercss' = true, 'edituserjs' = true, 'editinterface' = true, 'editsitecss' = true, 'editsitejs' = true, 'browsearchive' = true, 'movefile' = true, 'move' = true, 'move-rootuserpages' = true, 'undelete' = true, 'rollback' = true, 'delete' = true, 'deleterevision' = true, 'reupload' = true ), ), @@ -7071,7 +7073,7 @@ 'autopatrolled' = array( 'autopatrol' = true ), 'editinterface' = array( 'abusefilter-hidden-log' = true, 'abusefilter-hide-log' = true, 'abusefilter-log' = true, 'abusefilter-log-detail' = true, 'abusefilter-modify' = true, 'abusefilter-modify-restricted' = true, 'abusefilter-revert' = true, 'abusefilter-view' = true, - 'abusefilter-view-private' = true, 'editinterface' = true, 'editusercssjs' = true, 'import' = true, 'tboverride' = true + 'abusefilter-view-private' = true, 'editinterface' = true, 'editsitecss' = true, 'editsitejs' = true, 'editusercssjs' = true, 'import' = true, 'tboverride' = true ), 'checkuser' = array( 'deletedhistory' = true, 'deletedtext' = true,
[MediaWiki-commits] [Gerrit] Pass arrays to array_merge, instead of Titles and TitleArray... - change (mediawiki...Gadgets)
jenkins-bot has submitted this change and it was merged. Change subject: Pass arrays to array_merge, instead of Titles and TitleArray iterator objects .. Pass arrays to array_merge, instead of Titles and TitleArray iterator objects Per comments on Ia402698e Change-Id: Iffcbb3a62306a6e3b31fe45fcf1948210f4f3641 --- M SpecialGadgets.php 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/SpecialGadgets.php b/SpecialGadgets.php index 2d971f6..c30acc4 100644 --- a/SpecialGadgets.php +++ b/SpecialGadgets.php @@ -349,10 +349,10 @@ $descriptionMessage = Title::makeTitleSafe( NS_MEDIAWIKI, $gadget-getDescriptionMessageKey() ); // Add these pages and their subpages (for translations) $exportTitles = array_merge( $exportTitles, - $titleMessage, - $titleMessage-getSubpages(), - $descriptionMessage, - $descriptionMessage-getSubpages() + array( $titleMessage ), + iterator_to_array( $titleMessage-getSubpages() ), + array( $descriptionMessage ), + iterator_to_array( $descriptionMessage-getSubpages() ) ); // Module script and styles in NS_GADGET @@ -369,8 +369,8 @@ $message = Title::makeTitleSafe( NS_MEDIAWIKI, $message ); // Add this page and its subpages (for translations) $exportTitles = array_merge( $exportTitles, - $message, // @fixme this should be an array? - $message-getSubpages() + array( $message ), + iterator_to_array( $message-getSubpages() ) ); } -- To view, visit https://gerrit.wikimedia.org/r/155898 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iffcbb3a62306a6e3b31fe45fcf1948210f4f3641 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Gadgets Gerrit-Branch: RL2 Gerrit-Owner: Alex Monk kren...@wikimedia.org Gerrit-Reviewer: Catrope roan.katt...@gmail.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] TablePager: Redo arrow icons from scratch as CSS backgrounds - change (mediawiki/core)
Bartosz Dziewoński has uploaded a new change for review. https://gerrit.wikimedia.org/r/155914 Change subject: TablePager: Redo arrow icons from scratch as CSS backgrounds .. TablePager: Redo arrow icons from scratch as CSS backgrounds Redrawn the images with SVG versions. Bug: 69277 Change-Id: Ibaec75e81d3eb8338d911ac84d91570047f475f5 --- M includes/pager/TablePager.php M languages/i18n/en.json M resources/Resources.php A resources/src/mediawiki/images/arrow-sort-ascending.png A resources/src/mediawiki/images/arrow-sort-ascending.svg A resources/src/mediawiki/images/arrow-sort-descending.png A resources/src/mediawiki/images/arrow-sort-descending.svg R resources/src/mediawiki/mediawiki.pager.tablePager.less D skins/common/images/Arr_d.png D skins/common/images/Arr_u.png 10 files changed, 21 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/14/155914/1 diff --git a/includes/pager/TablePager.php b/includes/pager/TablePager.php index 6e67b0b..e9e87cf 100644 --- a/includes/pager/TablePager.php +++ b/includes/pager/TablePager.php @@ -149,7 +149,6 @@ * @return string */ function getStartBody() { - global $wgStylePath; $sortClass = $this-getSortHeaderClass(); $s = ''; @@ -165,23 +164,16 @@ # This is the sorted column # Prepare a link that goes in the other sort order if ( $this-mDefaultDirection ) { - # Descending - $image = 'Arr_d.png'; + $class = 'TablePager_sort-descending'; $query['asc'] = '1'; $query['desc'] = ''; - $alt = $this-msg( 'descending_abbrev' )-escaped(); } else { - # Ascending - $image = 'Arr_u.png'; + $class = 'TablePager_sort-ascending'; $query['asc'] = ''; $query['desc'] = '1'; - $alt = $this-msg( 'ascending_abbrev' )-escaped(); } - $image = $wgStylePath/common/images/$image; - $link = $this-makeLink( - Html::element( 'img', array( 'width' = 12, 'height' = 12, - 'alt' = $alt, 'src' = $image ) ) . htmlspecialchars( $name ), $query ); - $s .= Html::rawElement( 'th', array( 'class' = $sortClass ), $link ) . \n; + $link = $this-makeLink( htmlspecialchars( $name ), $query ); + $s .= Html::rawElement( 'th', array( 'class' = $sortClass $class ), $link ) . \n; } else { $s .= Html::rawElement( 'th', array(), $this-makeLink( htmlspecialchars( $name ), $query ) ) . \n; diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e160327..41faa81 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -3106,8 +3106,6 @@ img-lang-default: (default language), img-lang-info: Render this image in $1. $2, img-lang-go: Go, - ascending_abbrev: asc, - descending_abbrev: desc, table_pager_next: Next page, table_pager_prev: Previous page, table_pager_first: First page, diff --git a/resources/Resources.php b/resources/Resources.php index 4455eee..392bb12 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -915,7 +915,7 @@ 'targets' = array( 'desktop', 'mobile' ), ), 'mediawiki.pager.tablePager' = array( - 'styles' = 'resources/src/mediawiki/mediawiki.pager.tablePager.css', + 'styles' = 'resources/src/mediawiki/mediawiki.pager.tablePager.less', 'position' = 'top', ), 'mediawiki.searchSuggest' = array( diff --git a/resources/src/mediawiki/images/arrow-sort-ascending.png b/resources/src/mediawiki/images/arrow-sort-ascending.png new file mode 100644 index 000..f2d339d --- /dev/null +++ b/resources/src/mediawiki/images/arrow-sort-ascending.png Binary files differ diff --git a/resources/src/mediawiki/images/arrow-sort-ascending.svg
[MediaWiki-commits] [Gerrit] Remove unused styles for .imagelist - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Remove unused styles for .imagelist .. Remove unused styles for .imagelist Added in r16083 for Special:ImageList, which has been renamed to Special:ListFiles in r45357, with class names being changed in the PHP code without adjusting the CSS. It seems no one has missed these styles over the years, so let's just delete them. Change-Id: I1f7775b3c7733cbfdd3f404527063e973fb80ec7 --- M skins/common/oldshared.css M skins/common/shared.css 2 files changed, 0 insertions(+), 34 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index ecd846e..a4e7544 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -487,23 +487,6 @@ background-color: #ff; } -.imagelist td, -.imagelist th { - white-space: nowrap; -} - -.imagelist .TablePager_col_links { - background-color: #ff; -} - -.imagelist .TablePager_col_img_description { - white-space: normal; -} - -.imagelist th.TablePager_sort { - background-color: #ff; -} - .templatesUsed { margin-top: 1em; } diff --git a/skins/common/shared.css b/skins/common/shared.css index 9aa1e3e..af5d82c 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -681,23 +681,6 @@ text-decoration: none; } -.imagelist td, -.imagelist th { - white-space: nowrap; -} - -.imagelist .TablePager_col_links { - background-color: #ff; -} - -.imagelist .TablePager_col_img_description { - white-space: normal; -} - -.imagelist th.TablePager_sort { - background-color: #ff; -} - /* filetoc */ ul#filetoc { text-align: center; -- To view, visit https://gerrit.wikimedia.org/r/155887 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1f7775b3c7733cbfdd3f404527063e973fb80ec7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Jack Phoenix j...@countervandalism.net Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Waldir wal...@email.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Split includes/Pager.php - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Split includes/Pager.php .. Split includes/Pager.php Change-Id: I67fcffca4e3de081a895deb1a285a5545940ece9 --- M includes/AutoLoader.php D includes/Pager.php A includes/pager/AlphabeticPager.php A includes/pager/IndexPager.php A includes/pager/Pager.php A includes/pager/ReverseChronologicalPager.php A includes/pager/TablePager.php 7 files changed, 1,426 insertions(+), 1,336 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 38e92b6..2c71ce8 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -31,7 +31,6 @@ # Includes 'AjaxDispatcher' = 'includes/AjaxDispatcher.php', 'AjaxResponse' = 'includes/AjaxResponse.php', - 'AlphabeticPager' = 'includes/Pager.php', 'AtomFeed' = 'includes/Feed.php', 'AuthPlugin' = 'includes/AuthPlugin.php', 'AuthPluginUser' = 'includes/AuthPlugin.php', @@ -110,7 +109,6 @@ 'IdentityCollation' = 'includes/Collation.php', 'ImportStreamSource' = 'includes/Import.php', 'ImportStringSource' = 'includes/Import.php', - 'IndexPager' = 'includes/Pager.php', 'Interwiki' = 'includes/interwiki/Interwiki.php', 'License' = 'includes/Licenses.php', 'Licenses' = 'includes/Licenses.php', @@ -128,7 +126,6 @@ 'MWHttpRequest' = 'includes/HttpFunctions.php', 'MWNamespace' = 'includes/MWNamespace.php', 'OutputPage' = 'includes/OutputPage.php', - 'Pager' = 'includes/Pager.php', 'PathRouter' = 'includes/PathRouter.php', 'PathRouterPatternReplacer' = 'includes/PathRouter.php', 'PhpHttpRequest' = 'includes/HttpFunctions.php', @@ -143,7 +140,6 @@ 'PrefixSearch' = 'includes/PrefixSearch.php', 'ProtectionForm' = 'includes/ProtectionForm.php', 'RawMessage' = 'includes/Message.php', - 'ReverseChronologicalPager' = 'includes/Pager.php', 'RevisionItem' = 'includes/RevisionList.php', 'RevisionItemBase' = 'includes/RevisionList.php', 'RevisionListBase' = 'includes/RevisionList.php', @@ -162,7 +158,6 @@ 'StringPrefixSearch' = 'includes/PrefixSearch.php', 'StubObject' = 'includes/StubObject.php', 'StubUserLang' = 'includes/StubObject.php', - 'TablePager' = 'includes/Pager.php', 'MWTimestamp' = 'includes/MWTimestamp.php', 'TimestampException' = 'includes/TimestampException.php', 'Title' = 'includes/Title.php', @@ -787,6 +782,13 @@ 'WikiFilePage' = 'includes/page/WikiFilePage.php', 'WikiPage' = 'includes/page/WikiPage.php', + # includes/pager + 'AlphabeticPager' = 'includes/pager/AlphabeticPager.php', + 'IndexPager' = 'includes/pager/IndexPager.php', + 'Pager' = 'includes/pager/Pager.php', + 'ReverseChronologicalPager' = 'includes/pager/ReverseChronologicalPager.php', + 'TablePager' = 'includes/pager/TablePager.php', + # includes/parser 'CacheTime' = 'includes/parser/CacheTime.php', 'CoreParserFunctions' = 'includes/parser/CoreParserFunctions.php', diff --git a/includes/Pager.php b/includes/Pager.php deleted file mode 100644 index c7de8c1..000 --- a/includes/Pager.php +++ /dev/null @@ -1,1331 +0,0 @@ -?php -/** - * Efficient paging for SQL queries. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - * @ingroup Pager - */ - -/** - * @defgroup Pager Pager - */ - -/** - * Basic pager interface. - * @ingroup Pager - */ -interface Pager { - function getNavigationBar(); - function getBody(); -} - -/** - * IndexPager is an efficient pager which uses a (roughly unique) index in the - * data set to implement paging, rather than a LIMIT offset,limit clause. - * In MySQL, such a limit/offset clause requires counting through the - * specified number of offset rows to find the desired data, which can be - * expensive for large offsets. - * - * ReverseChronologicalPager is a child class of the abstract IndexPager, and - * contains some formatting and display code which is specific to the
[MediaWiki-commits] [Gerrit] Be consistent about 'TablePager' CSS class usage - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Be consistent about 'TablePager' CSS class usage .. Be consistent about 'TablePager' CSS class usage * Do not use it when not actually using the TablePager * Always use it when actually using the TablePager * Use parent::getTableClass() rather than hardcoding it every time * Place it before other classes to allow overriding Change-Id: I042b65be64e2c2fa6c68a7bb972a7a2ea7f55b4e --- M includes/specials/SpecialAllMessages.php M includes/specials/SpecialBlockList.php M includes/specials/SpecialListfiles.php M includes/specials/SpecialProtectedpages.php M includes/specials/SpecialTrackingCategories.php 5 files changed, 8 insertions(+), 7 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/specials/SpecialAllMessages.php b/includes/specials/SpecialAllMessages.php index 1e4e18b..7096fde 100644 --- a/includes/specials/SpecialAllMessages.php +++ b/includes/specials/SpecialAllMessages.php @@ -336,8 +336,9 @@ } function getStartBody() { + $tableClass = $this-getTableClass(); return Xml::openElement( 'table', array( - 'class' = 'mw-datatable TablePager', + 'class' = mw-datatable $tableClass, 'id' = 'mw-allmessagestable' ) ) . \n . diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 62fadb5..e2ebdbe 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -409,7 +409,7 @@ } public function getTableClass() { - return 'TablePager mw-blocklist'; + return parent::getTableClass() . ' mw-blocklist'; } function getIndexField() { diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index ed7648d..5eafd66 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -557,15 +557,15 @@ } function getTableClass() { - return 'listfiles ' . parent::getTableClass(); + return parent::getTableClass() . ' listfiles'; } function getNavClass() { - return 'listfiles_nav ' . parent::getNavClass(); + return parent::getNavClass() . ' listfiles_nav'; } function getSortHeaderClass() { - return 'listfiles_sort ' . parent::getSortHeaderClass(); + return parent::getSortHeaderClass() . ' listfiles_sort'; } function getPagingQueries() { diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index b64b029..5072e76 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -558,7 +558,7 @@ } public function getTableClass() { - return 'TablePager mw-protectedpages'; + return parent::getTableClass() . ' mw-protectedpages'; } function getIndexField() { diff --git a/includes/specials/SpecialTrackingCategories.php b/includes/specials/SpecialTrackingCategories.php index 5e5588c..552031f 100644 --- a/includes/specials/SpecialTrackingCategories.php +++ b/includes/specials/SpecialTrackingCategories.php @@ -41,7 +41,7 @@ $this-outputHeader(); $this-getOutput()-allowClickjacking(); $this-getOutput()-addHTML( - Html::openElement( 'table', array( 'class' = 'mw-datatable TablePager', + Html::openElement( 'table', array( 'class' = 'mw-datatable', 'id' = 'mw-trackingcategories-table' ) ) . \n . theadtr th . -- To view, visit https://gerrit.wikimedia.org/r/155891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I042b65be64e2c2fa6c68a7bb972a7a2ea7f55b4e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Siebrand siebr...@kitano.nl Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] OutputPage: addParserOutput*() family doesn't need to take a... - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: OutputPage: addParserOutput*() family doesn't need to take a reference .. OutputPage: addParserOutput*() family doesn't need to take a reference We never assign to the variable, only call some (mutating) methods on the object. With PHP 5 we don't need to pass this by reference. The functions that evolved into this family were originally added in r12337, back then we probably still ran on PHP 4 or something. Change-Id: Ib4ab141ca6d803f9df0351b1f65c7e9955c37d57 --- M includes/OutputPage.php 1 file changed, 5 insertions(+), 5 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/OutputPage.php b/includes/OutputPage.php index c98f34b..8a69f6c 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1617,7 +1617,7 @@ * @deprecated since 1.24, use addParserOutputMetadata() instead. * @param ParserOutput $parserOutput */ - public function addParserOutputNoText( $parserOutput ) { + public function addParserOutputNoText( $parserOutput ) { $this-addParserOutputMetadata( $parserOutput ); } @@ -1629,7 +1629,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputMetadata( $parserOutput ) { + public function addParserOutputMetadata( $parserOutput ) { $this-mLanguageLinks += $parserOutput-getLanguageLinks(); $this-addCategoryLinks( $parserOutput-getCategories() ); $this-mNewSectionLink = $parserOutput-getNewSection(); @@ -1685,7 +1685,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputContent( $parserOutput ) { + public function addParserOutputContent( $parserOutput ) { $this-addParserOutputText( $parserOutput ); $this-addModules( $parserOutput-getModules() ); @@ -1702,7 +1702,7 @@ * @since 1.24 * @param ParserOutput $parserOutput */ - public function addParserOutputText( $parserOutput ) { + public function addParserOutputText( $parserOutput ) { $text = $parserOutput-getText(); wfRunHooks( 'OutputPageBeforeHTML', array( $this, $text ) ); $this-addHTML( $text ); @@ -1713,7 +1713,7 @@ * * @param ParserOutput $parserOutput */ - function addParserOutput( $parserOutput ) { + function addParserOutput( $parserOutput ) { $this-addParserOutputMetadata( $parserOutput ); $parserOutput-setTOCEnabled( $this-mEnableTOC ); -- To view, visit https://gerrit.wikimedia.org/r/155902 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib4ab141ca6d803f9df0351b1f65c7e9955c37d57 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Bartosz Dziewoński matma@gmail.com Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Tim Starling tstarl...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Syncronize VisualEditor: d074da3..1d7962c - change (mediawiki/extensions)
Jenkins-mwext-sync has uploaded a new change for review. https://gerrit.wikimedia.org/r/156001 Change subject: Syncronize VisualEditor: d074da3..1d7962c .. Syncronize VisualEditor: d074da3..1d7962c Change-Id: I0e54940c8608ef6079c724f14ec0c768a038d6c7 --- M VisualEditor 1 file changed, 0 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions refs/changes/01/156001/1 diff --git a/VisualEditor b/VisualEditor index d074da3..1d7962c 16 --- a/VisualEditor +++ b/VisualEditor -Subproject commit d074da35581820479c33ea2d5f5b0573f3813ed6 +Subproject commit 1d7962c61957c055962bca22ee94f219e96698fc -- To view, visit https://gerrit.wikimedia.org/r/156001 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e54940c8608ef6079c724f14ec0c768a038d6c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions Gerrit-Branch: master Gerrit-Owner: Jenkins-mwext-sync jenkins-...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Syncronize VisualEditor: d074da3..1d7962c - change (mediawiki/extensions)
Jenkins-mwext-sync has submitted this change and it was merged. Change subject: Syncronize VisualEditor: d074da3..1d7962c .. Syncronize VisualEditor: d074da3..1d7962c Change-Id: I0e54940c8608ef6079c724f14ec0c768a038d6c7 --- M VisualEditor 1 file changed, 0 insertions(+), 0 deletions(-) Approvals: Jenkins-mwext-sync: Verified; Looks good to me, approved diff --git a/VisualEditor b/VisualEditor index d074da3..1d7962c 16 --- a/VisualEditor +++ b/VisualEditor -Subproject commit d074da35581820479c33ea2d5f5b0573f3813ed6 +Subproject commit 1d7962c61957c055962bca22ee94f219e96698fc -- To view, visit https://gerrit.wikimedia.org/r/156001 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0e54940c8608ef6079c724f14ec0c768a038d6c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions Gerrit-Branch: master Gerrit-Owner: Jenkins-mwext-sync jenkins-...@wikimedia.org Gerrit-Reviewer: Jenkins-mwext-sync jenkins-...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make ForeignAPI and ForeignDB GadgetRepos use different cach... - change (mediawiki...Gadgets)
jenkins-bot has submitted this change and it was merged. Change subject: Make ForeignAPI and ForeignDB GadgetRepos use different cache keys .. Make ForeignAPI and ForeignDB GadgetRepos use different cache keys Change-Id: I5326753ff2c78c7b2515dfc59e95341a8b702280 --- M backend/ForeignAPIGadgetRepo.php M backend/ForeignDBGadgetRepo.php 2 files changed, 4 insertions(+), 8 deletions(-) Approvals: Alex Monk: Looks good to me, approved jenkins-bot: Verified diff --git a/backend/ForeignAPIGadgetRepo.php b/backend/ForeignAPIGadgetRepo.php index 68f1b05..676615b 100644 --- a/backend/ForeignAPIGadgetRepo.php +++ b/backend/ForeignAPIGadgetRepo.php @@ -56,12 +56,10 @@ protected function getCacheKey( $id ) { // No access to the foreign wiki's memc, so cache locally - // This uses the same cache keys as ForeignDBGadgetRepo but that's fine, - // source names should be unique. if ( $id === null ) { - return wfMemcKey( 'gadgets', 'foreignrepoids', $this-source ); + return wfMemcKey( 'gadgets', 'foreignapirepoids', $this-source ); } else { - return wfMemcKey( 'gadgets', 'foreignrepodata', $this-source, $id ); + return wfMemcKey( 'gadgets', 'foreignapirepodata', $this-source, $id ); } } diff --git a/backend/ForeignDBGadgetRepo.php b/backend/ForeignDBGadgetRepo.php index e295279..58542f7 100644 --- a/backend/ForeignDBGadgetRepo.php +++ b/backend/ForeignDBGadgetRepo.php @@ -87,12 +87,10 @@ } } else { // No access to the foreign wiki's memc, so cache locally - // This uses the same cache keys as ForeignAPIGadgetRepo but that's fine, - // source names should be unique. if ( $id === null ) { - return wfMemcKey( 'gadgets', 'foreignrepoids', $this-source ); + return wfMemcKey( 'gadgets', 'foreigndbrepoids', $this-source ); } else { - return wfMemcKey( 'gadgets', 'foreignrepodata', $this-source, $id ); + return wfMemcKey( 'gadgets', 'foreigndbrepodata', $this-source, $id ); } } } -- To view, visit https://gerrit.wikimedia.org/r/154726 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5326753ff2c78c7b2515dfc59e95341a8b702280 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gadgets Gerrit-Branch: RL2 Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Alex Monk kren...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use config instead of globals for OutputPage - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Use config instead of globals for OutputPage .. Use config instead of globals for OutputPage Change-Id: I5e0ebc173631d1d1052de7ccee4ef839c7c1767f --- M includes/OutputPage.php 1 file changed, 70 insertions(+), 87 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/OutputPage.php b/includes/OutputPage.php index f3b8c98..7377715 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -449,15 +449,14 @@ * @param string $version Style version of the file. Defaults to $wgStyleVersion */ public function addScriptFile( $file, $version = null ) { - global $wgStylePath, $wgStyleVersion; // See if $file parameter is an absolute URL or begins with a slash if ( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) { $path = $file; } else { - $path = {$wgStylePath}/common/{$file}; + $path = $this-getConfig()-get( 'StylePath' ) . /common/{$file}; } if ( is_null( $version ) ) { - $version = $wgStyleVersion; + $version = $this-getConfig()-get( 'StyleVersion' ); } $this-addScript( Html::linkedScript( wfAppendQuery( $path, $version ) ) ); } @@ -733,13 +732,12 @@ * @return bool True if cache-ok headers was sent. */ public function checkLastModified( $timestamp ) { - global $wgCachePages, $wgCacheEpoch, $wgUseSquid, $wgSquidMaxage; - if ( !$timestamp || $timestamp == '1970010100' ) { wfDebug( __METHOD__ . : CACHE DISABLED, NO TIMESTAMP\n ); return false; } - if ( !$wgCachePages ) { + $config = $this-getConfig(); + if ( !$config-get( 'CachePages' ) ) { wfDebug( __METHOD__ . : CACHE DISABLED\n ); return false; } @@ -748,11 +746,11 @@ $modifiedTimes = array( 'page' = $timestamp, 'user' = $this-getUser()-getTouched(), - 'epoch' = $wgCacheEpoch + 'epoch' = $config-get( 'CacheEpoch' ) ); - if ( $wgUseSquid ) { + if ( $config-get( 'UseSquid' ) ) { // bug 44570: the core page itself may not change, but resources might - $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $wgSquidMaxage ); + $modifiedTimes['sepoch'] = wfTimestamp( TS_MW, time() - $config-get( 'SquidMaxage' ) ); } wfRunHooks( 'OutputPageCheckLastModified', array( $modifiedTimes ) ); @@ -1107,11 +1105,9 @@ *default links */ public function setFeedAppendQuery( $val ) { - global $wgAdvertisedFeedTypes; - $this-mFeedLinks = array(); - foreach ( $wgAdvertisedFeedTypes as $type ) { + foreach ( $this-getConfig()-get( 'AdvertisedFeedTypes' ) as $type ) { $query = feed=$type; if ( is_string( $val ) ) { $query .= '' . $val; @@ -1127,9 +1123,7 @@ * @param string $href URL */ public function addFeedLink( $format, $href ) { - global $wgAdvertisedFeedTypes; - - if ( in_array( $format, $wgAdvertisedFeedTypes ) ) { + if ( in_array( $format, $this-getConfig()-get( 'AdvertisedFeedTypes' ) ) ) { $this-mFeedLinks[$format] = $href; } } @@ -1240,7 +1234,7 @@ * @param array $categories Mapping category name = sort key */ public function addCategoryLinks( array $categories ) { - global $wgContLang, $wgContentHandlerUseDB; + global $wgContLang; if ( !is_array( $categories ) || count( $categories ) == 0 ) { return; @@ -1256,7 +1250,7 @@ $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ); - if ( $wgContentHandlerUseDB ) { + if ( $this-getConfig()-get( 'ContentHandlerUseDB' ) ) { $fields[] = 'page_content_model'; } @@ -1663,11 +1657,11 @@ } // Hooks registered in the object - global $wgParserOutputHooks; + $parserOutputHooks = $this-getConfig()-get( 'ParserOutputHooks' );
[MediaWiki-commits] [Gerrit] Labs: point /public/dumps to the new server - change (operations/puppet)
coren has uploaded a new change for review. https://gerrit.wikimedia.org/r/156002 Change subject: Labs: point /public/dumps to the new server .. Labs: point /public/dumps to the new server While the copy is not yet complete for incrementals and pagecounts, having a working set of dumps is better than partial ones. Change-Id: I7cf0dccc0a2a279e15104d942a44809c3d97d76f --- M manifests/role/labs.pp 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/02/156002/1 diff --git a/manifests/role/labs.pp b/manifests/role/labs.pp index 68d2746..67edd57 100644 --- a/manifests/role/labs.pp +++ b/manifests/role/labs.pp @@ -40,6 +40,7 @@ $nfs_opts = 'vers=4,bg,hard,intr,sec=sys,proto=tcp,port=0,noatime,nofsc' $nfs_server = 'labstore.svc.eqiad.wmnet' +$dumps_server = 'labstore1003.eqiad.wmnet' mount { '/home': ensure = mounted, @@ -89,7 +90,7 @@ atboot = true, fstype = 'nfs', options = ro,${nfs_opts}, -device = ${nfs_server}:/dumps, +device = ${dumps_server}:/dumps, require = File['/public/dumps'], } -- To view, visit https://gerrit.wikimedia.org/r/156002 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7cf0dccc0a2a279e15104d942a44809c3d97d76f Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: coren mpellet...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add missing @return to function docs - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/156003 Change subject: Add missing @return to function docs .. Add missing @return to function docs Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9 --- M includes/EditPage.php M includes/Html.php M includes/MagicWord.php M includes/Sanitizer.php M includes/WatchedItem.php M includes/api/ApiFormatBase.php M includes/api/ApiParse.php M includes/cache/LocalisationCache.php M includes/changes/ChangesFeed.php M includes/db/Database.php M includes/db/DatabaseMysqli.php M includes/db/DatabasePostgres.php M includes/deferred/SearchUpdate.php M includes/filerepo/RepoGroup.php M includes/filerepo/file/ArchivedFile.php M includes/filerepo/file/File.php M includes/gallery/ImageGalleryBase.php M includes/gallery/PackedImageGallery.php M includes/installer/DatabaseUpdater.php M includes/installer/Installer.php M includes/logging/LogPage.php M includes/media/Exif.php M includes/page/Article.php M includes/parser/ParserOutput.php M includes/search/SearchHighlighter.php M includes/specials/SpecialListDuplicatedFiles.php M includes/specials/SpecialListfiles.php M includes/specials/SpecialMIMEsearch.php M includes/specials/SpecialPageLanguage.php M includes/specials/SpecialResetTokens.php M includes/utils/Cdb.php M includes/utils/MWCryptRand.php 32 files changed, 36 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/03/156003/1 diff --git a/includes/EditPage.php b/includes/EditPage.php index 70eb909..9a4567d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3100,6 +3100,7 @@ * Get the copyright warning * * Renamed to getCopyrightWarning(), old name kept around for backwards compatibility +* @return string */ protected function getCopywarn() { return self::getCopyrightWarning( $this-mTitle ); diff --git a/includes/Html.php b/includes/Html.php index 9e7f5c4..48dbdba 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -673,6 +673,7 @@ * @param string $name Name attribute * @param bool $checked Whether the checkbox is checked or not * @param array $attribs Array of additional attributes +* @return string */ public static function check( $name, $checked = false, array $attribs = array() ) { if ( isset( $attribs['value'] ) ) { @@ -695,6 +696,7 @@ * @param string $name Name attribute * @param bool $checked Whether the checkbox is checked or not * @param array $attribs Array of additional attributes +* @return string */ public static function radio( $name, $checked = false, array $attribs = array() ) { if ( isset( $attribs['value'] ) ) { @@ -717,6 +719,7 @@ * @param string $label Contents of the label * @param string $id ID of the element being labeled * @param array $attribs Additional attributes +* @return string */ public static function label( $label, $id, array $attribs = array() ) { $attribs += array( diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 7decbee..4d17298 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -754,6 +754,7 @@ /** * Get a 2-d hashtable for this array +* @return array */ function getHash() { if ( is_null( $this-hash ) ) { @@ -775,6 +776,7 @@ /** * Get the base regex +* @return array */ function getBaseRegex() { if ( is_null( $this-baseRegex ) ) { @@ -799,6 +801,7 @@ /** * Get an unanchored regex that does not match parameters +* @return array */ function getRegex() { if ( is_null( $this-regex ) ) { diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index b173ae9..2cdbe15 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -328,6 +328,7 @@ * Regular expression to match HTML/XML attribute pairs within a tag. * Allows some... latitude. * Used in Sanitizer::fixTagAttributes and Sanitizer::decodeTagAttributes +* @return string */ static function getAttribsRegex() { if ( self::$attribsRegex === null ) { diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index 93d6c0b..d9a1e80 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -164,6 +164,7 @@ /** * Check permissions * @param string $what 'viewmywatchlist' or 'editmywatchlist' +* @return bool */ private function isAllowed( $what ) { return !$this-mCheckRights || $this-mUser-isAllowed( $what ); diff --git a/includes/api/ApiFormatBase.php
[MediaWiki-commits] [Gerrit] Fix preference DB values - change (mediawiki...MultimediaViewer)
Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/156004 Change subject: Fix preference DB values .. Fix preference DB values Ensure that changing the preference via the quick link and Special:Preferences is stored identically in the DB. Change-Id: Ia37da1c6bfbb3edf0eba56f01105e4a5f3a5e4ba --- M MultimediaViewerHooks.php M resources/mmv/mmv.Config.js 2 files changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/04/156004/1 diff --git a/MultimediaViewerHooks.php b/MultimediaViewerHooks.php index 6ac204a..9d40dee 100644 --- a/MultimediaViewerHooks.php +++ b/MultimediaViewerHooks.php @@ -164,8 +164,12 @@ * @param OutputPage $out */ public static function makeGlobalVariablesScript( $vars, OutputPage $out ) { + global $wgDefaultUserOptions; + $user = $out-getUser(); $vars['wgMediaViewerOnClick'] = self::shouldHandleClicks( $user ); + // needed because of bug 69942; could be different for anon and logged-in + $vars['wgMediaViewerEnabledByDefault'] = !empty( $wgDefaultUserOptions['multimediaviewer-enable'] ); } /** diff --git a/resources/mmv/mmv.Config.js b/resources/mmv/mmv.Config.js index 341cdeb..38107bf 100644 --- a/resources/mmv/mmv.Config.js +++ b/resources/mmv/mmv.Config.js @@ -140,7 +140,9 @@ * @return {jQuery.Promise} a deferred which resolves/rejects on success/failure respectively */ CP.setMediaViewerEnabledOnClick = function ( enabled ) { - var config = this, + var newPrefValue, + defaultPrefValue = this.mwConfig.get( 'wgMediaViewerEnabledByDefault'), + config = this, success = true; if ( this.mwUser.isAnon() ) { @@ -150,14 +152,20 @@ success = this.removeFromLocalStorage( 'wgMediaViewerOnClick' ); } if ( success ) { + // make the change work without a reload config.mwConfig.set( 'wgMediaViewerOnClick', enabled ); return $.Deferred().resolve(); } else { return $.Deferred().reject(); } } else { - return this.setUserPreference( 'multimediaviewer-enable', enabled ? true : '').then( function () { // wow our prefs API sucks - // make the change work without a reload + // bug 69942 + if ( defaultPrefValue === true ) { + newPrefValue = enabled ? '1' : ''; + } else { + newPrefValue = enabled ? '1' : undefined; + } + return this.setUserPreference( 'multimediaviewer-enable', newPrefValue ).then( function () { // wow our prefs API sucks config.mwConfig.set( 'wgMediaViewerOnClick', enabled ); } ); } -- To view, visit https://gerrit.wikimedia.org/r/156004 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia37da1c6bfbb3edf0eba56f01105e4a5f3a5e4ba Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: Gergő Tisza gti...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Lint Trebuchet provider - change (operations/puppet)
Ori.livneh has submitted this change and it was merged. Change subject: Lint Trebuchet provider .. Lint Trebuchet provider * The breezy, parens-free style is exciting but at the end of the day it makes the code harder to read. So add parens. * Make various style fixes suggested by 'rubocop'. Change-Id: I0393a2b537e63e2ac5bb7a71cfe9186432893943 --- M modules/trebuchet/lib/puppet/provider/package/trebuchet.rb 1 file changed, 56 insertions(+), 38 deletions(-) Approvals: Ori.livneh: Verified; Looks good to me, approved diff --git a/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb b/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb index 4f7cbee..b19ee0b 100644 --- a/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb +++ b/modules/trebuchet/lib/puppet/provider/package/trebuchet.rb @@ -22,8 +22,12 @@ require 'fileutils' require 'open-uri' -Puppet::Type.type(:package).provide :trebuchet, :parent = Puppet::Provider::Package do - desc Puppet package provider for `Trebuchet`. +Puppet::Type.type(:package).provide( + :trebuchet, + :parent = Puppet::Provider::Package +) do + + desc 'Puppet package provider for `Trebuchet`.' commands :git_cmd= '/usr/bin/git', :salt_cmd = '/usr/bin/salt-call', @@ -52,7 +56,7 @@ def target_path path = File.expand_path(File.join(self.class::BASE_PATH, qualified_name)) unless path.length self.class::BASE_PATH.length -raise Puppet::Error, Target path '#{path}' is invalid. + fail Puppet::Error, Target path '#{path}' is invalid. end path end @@ -60,35 +64,36 @@ # Convenience wrapper for shelling out to `git`. def git(*args) git_path = File.join(target_path, '.git') -git_cmd *args.map(:split).flatten.unshift('--git-dir', git_path) +git_cmd(*args.unshift('--git-dir', git_path)) end # Convenience wrapper for shelling out to `salt-call`. def salt(*args) -salt_cmd *args.map(:split).flatten.unshift('--out=json') +salt_cmd(*args.unshift('--out=json')) end # Synchronize local state with Salt master. def salt_refresh! - salt 'saltutil.sync_all' - salt 'saltutil.refresh_pillar' +salt('saltutil.sync_all') +salt('saltutil.refresh_pillar') end # Make sure that the salt-minion service is running. def check_salt_minion_status -begin - status = status_cmd('salt-minion') - raise Puppet::ExecutionFailure unless status.include? 'running' -rescue Puppet::ExecutionFailure - fail Trebuchet requires that the salt-minion service be running. -end +status = status_cmd('salt-minion') +fail Puppet::ExecutionFailure unless status.include? 'running' + rescue Puppet::ExecutionFailure +raise Puppet::ExecutionFailure, -END + The Trebuchet package provider requires that the salt-minion + service be running. +END end # Get the list of deployment targets defined for this minion. def targets @cached_targets || begin check_salt_minion_status - raw = salt 'grains.get', 'deployment_target' + raw = salt('grains.get', 'deployment_target') @cached_targets = PSON.load(raw).fetch('local', []) rescue Puppet::ExecutionFailure @cached_targets = [] @@ -98,19 +103,33 @@ # Return structured information about a particular package or `nil` if # it is not installed. def query -return nil unless targets.include? base +return nil unless targets.include?(base) + begin - tag = git 'rev-parse', 'HEAD' - {:ensure = tag.strip} + tag = git('rev-parse', 'HEAD') + { +:ensure = tag.strip + } rescue Puppet::ExecutionFailure - {:ensure = :purged, :status = 'missing', :name = @resource[:name]} + { +:ensure = :purged, +:status = 'missing', +:name = @resource[:name] + } end end def master @resource[:source] || begin - raw = salt 'grains.get', 'trebuchet_master' - @resource[:source] = PSON.load(raw).fetch('local') + raw = salt('grains.get', 'trebuchet_master') + master = PSON.load(raw)['local'] + if master.nil? || master.empty? +fail Puppet::Error, -END + Unable to determine Trebuchet master, because neither the `source` + parameter nor the `trebuchet_master` grain is set. +END + end + @resource[:source] = master end end @@ -118,54 +137,53 @@ # a deployment target. def latest_sha1 @cached_sha1 || begin - source = master || fail('Unable to determine Trebuchet master.') - source = 'http://' + source unless source.include? '://' + source = master + source = ('http://' + source) unless source.include?('://') source.gsub!(/\/?$/, /#{qualified_name}/.git/deploy/deploy) - tag = open(source) { |raw| PSON.load(raw).fetch('tag', nil) } + tag = open(source) { |raw|
[MediaWiki-commits] [Gerrit] Improve GlobalVarConfigTest - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/156005 Change subject: Improve GlobalVarConfigTest .. Improve GlobalVarConfigTest Should bring includes/config to 100% coverage :D Change-Id: I929448b7a306fb1efb8b523d16305a7666f78fd0 --- M tests/phpunit/includes/config/GlobalVarConfigTest.php 1 file changed, 40 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/05/156005/1 diff --git a/tests/phpunit/includes/config/GlobalVarConfigTest.php b/tests/phpunit/includes/config/GlobalVarConfigTest.php index 662f268..a999081 100644 --- a/tests/phpunit/includes/config/GlobalVarConfigTest.php +++ b/tests/phpunit/includes/config/GlobalVarConfigTest.php @@ -8,6 +8,34 @@ public function testNewInstance() { $config = GlobalVarConfig::newInstance(); $this-assertInstanceOf( 'GlobalVarConfig', $config ); + $this-maybeStashGlobal( 'wgBaz' ); + $GLOBALS['wgBaz'] = 'somevalue'; + // Check prefix is set to 'wg' + $this-assertEquals( 'somevalue', $config-get( 'Baz' ) ); + } + + /** +* @covers GlobalVarConfig::__construct +* @dataProvider provideConstructor +*/ + public function testConstructor( $prefix ) { + $var = $prefix . 'GlobalVarConfigTest'; + $rand = wfRandomString(); + $this-maybeStashGlobal( $var ); + $GLOBALS[$var] = $rand; + $config = new GlobalVarConfig( $prefix ); + $this-assertInstanceOf( 'GlobalVarConfig', $config ); + $this-assertEquals( $rand, $config-get( 'GlobalVarConfigTest' ) ); + } + + public static function provideConstructor() { + return array( + array( 'wg' ), + array( 'ef' ), + array( 'smw' ), + array( 'blahblahblahblah' ), + array( '' ), + ); } public function provideGet() { @@ -27,6 +55,7 @@ array( 'Foo', 'wg', 'default2' ), array( 'Variable', 'ef', 'default3' ), array( 'BAR', '', 'default4' ), + array( 'ThisGlobalWasNotSetAbove', 'wg', false ) ); } @@ -40,6 +69,9 @@ */ public function testGet( $name, $prefix, $expected ) { $config = new GlobalVarConfig( $prefix ); + if ( $expected === false ) { + $this-setExpectedException( 'ConfigException', 'GlobalVarConfig::getWithPrefix: undefined variable:' ); + } $this-assertEquals( $config-get( $name ), $expected ); } @@ -52,16 +84,20 @@ ); } + private function maybeStashGlobal( $var ) { + if ( array_key_exists( $var, $GLOBALS ) ) { + // Will be reset after this test is over + $this-stashMwGlobals( $var ); + } + } + /** * @dataProvider provideSet * @covers GlobalVarConfig::set * @covers GlobalVarConfig::setWithPrefix */ public function testSet( $name, $prefix, $var ) { - if ( array_key_exists( $var, $GLOBALS ) ) { - // Will be reset after this test is over - $this-stashMwGlobals( $var ); - } + $this-maybeStashGlobal( $var ); $config = new GlobalVarConfig( $prefix ); $random = wfRandomString(); $config-set( $name, $random ); -- To view, visit https://gerrit.wikimedia.org/r/156005 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I929448b7a306fb1efb8b523d16305a7666f78fd0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Speedup for image placeholder record creation. - change (apps...wikipedia)
Mhurd has uploaded a new change for review. https://gerrit.wikimedia.org/r/156006 Change subject: Speedup for image placeholder record creation. .. Speedup for image placeholder record creation. This gets called in a loop - once for each section retrieved, and it was unnecessarily saving each time inside the loop, instead of once afterwards. Much faster this way! Change-Id: I7d5791c9846146deb456bd33683812f684d4dcaa --- M wikipedia/Categories/Section+ImageRecords.m 1 file changed, 86 insertions(+), 90 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia refs/changes/06/156006/1 diff --git a/wikipedia/Categories/Section+ImageRecords.m b/wikipedia/Categories/Section+ImageRecords.m index bfdb04b..392fa00 100644 --- a/wikipedia/Categories/Section+ImageRecords.m +++ b/wikipedia/Categories/Section+ImageRecords.m @@ -17,99 +17,95 @@ // for TFHpple details. // Call *after* article record created but before section html sent across bridge. - -NSManagedObjectID *sectionID = self.objectID; - -[context performBlockAndWait:^(){ -Section *section = (Section *)[context objectWithID:sectionID]; + +// Reminder: don't do context performBlockAndWait here - createImageRecordsForHtmlOnContext gets +// called in a loop which is encompassed by such a block already! + +if (self.html.length == 0) return; + +NSData *sectionHtmlData = [self.html dataUsingEncoding:NSUTF8StringEncoding]; +TFHpple *sectionParser = [TFHpple hppleWithHTMLData:sectionHtmlData]; +//NSString *imageXpathQuery = @//img[@src]; +NSString *imageXpathQuery = @//img[@src][not(ancestor::table[@class='navbox'])]; +// ^ the navbox exclusion prevents images from the hidden navbox table from appearing +// in the last section's TOC cell. + +NSArray *imageNodes = [sectionParser searchWithXPathQuery:imageXpathQuery]; +NSUInteger imageIndexInSection = 0; + +for (TFHppleElement *imageNode in imageNodes) { -NSData *sectionHtmlData = [section.html dataUsingEncoding:NSUTF8StringEncoding]; -TFHpple *sectionParser = [TFHpple hppleWithHTMLData:sectionHtmlData]; -//NSString *imageXpathQuery = @//img[@src]; -NSString *imageXpathQuery = @//img[@src][not(ancestor::table[@class='navbox'])]; -// ^ the navbox exclusion prevents images from the hidden navbox table from appearing -// in the last section's TOC cell. - -NSArray *imageNodes = [sectionParser searchWithXPathQuery:imageXpathQuery]; -NSUInteger imageIndexInSection = 0; - -for (TFHppleElement *imageNode in imageNodes) { - -NSString *height = imageNode.attributes[@height]; -NSString *width = imageNode.attributes[@width]; - -if ( -height.integerValue THUMBNAIL_MINIMUM_SIZE_TO_CACHE.width -|| -width.integerValue THUMBNAIL_MINIMUM_SIZE_TO_CACHE.height -) -{ -//NSLog(@SKIPPING - IMAGE TOO SMALL); -continue; -} - -NSString *alt = imageNode.attributes[@alt]; -NSString *src = imageNode.attributes[@src]; - -Image *image = (Image *)[context getEntityForName: @Image withPredicateFormat:@sourceUrl == %@, src]; - -if (image) { -// If Image record already exists, update its attributes. -image.alt = alt; -image.height = @(height.integerValue); -image.width = @(width.integerValue); -}else{ -// If no Image record, create one setting its data attribute to nil. This allows the record to be -// created so it can be associated with the section in which this , then when the URLCache intercepts the request for this image -image = [NSEntityDescription insertNewObjectForEntityForName:@Image inManagedObjectContext:context]; - -/* - Moved imageData into own entity: -For small to modest sized BLOBs (and CLOBs), you should create a separate -entity for the data and create a to-one relationship in place of the attribute. -See: http://stackoverflow.com/a/9288796/135557 - - This allows core data to lazily load the image blob data only when it's needed. - */ -image.imageData = [NSEntityDescription insertNewObjectForEntityForName:@ImageData inManagedObjectContext:context]; - -image.imageData.data = [[NSData alloc] init]; -image.dataSize = @(image.imageData.data.length); -image.fileName = [src lastPathComponent]; -image.fileNameNoSizePrefix = [image.fileName getWikiImageFileNameWithoutSizePrefix]; -
[MediaWiki-commits] [Gerrit] Apply csshelpclass to vform help - change (mediawiki/core)
BryanDavis has uploaded a new change for review. https://gerrit.wikimedia.org/r/156007 Change subject: Apply csshelpclass to vform help .. Apply csshelpclass to vform help Ensure that a form field which sets 'csshelpclass' and is rendered as a vform receives expected styling. Change-Id: Ibe082e07fe846334bd4dc257c9c0df8db23a1957 --- M includes/htmlform/HTMLFormField.php 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/07/156007/1 diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 7e4b15b..70b1535 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -593,6 +593,9 @@ $wrapperAttributes = array( 'class' = 'htmlform-tip', ); + if ( $this-mHelpClass !== false ) { + $wrapperAttributes['class'] .= {$this-mHelpClass}; + } if ( $this-mHideIf ) { $wrapperAttributes['data-hide-if'] = FormatJson::encode( $this-mHideIf ); $wrapperAttributes['class'] .= ' mw-htmlform-hide-if'; -- To view, visit https://gerrit.wikimedia.org/r/156007 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibe082e07fe846334bd4dc257c9c0df8db23a1957 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: BryanDavis bda...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use Config and remove globals - change (mediawiki...GoogleLogin)
jenkins-bot has submitted this change and it was merged. Change subject: Use Config and remove globals .. Use Config and remove globals Use the Config object introduced in MediaWiki 1.23 to get Configuration options of GoogleLogin Extension. Remove unused uses of global. Bug: 69086 Change-Id: I0cbdcd84c710b75f4c19b904e968616b309f9d52 --- M GoogleLogin.php M includes/GoogleLogin.body.php M includes/GoogleLogin.hooks.php M includes/specials/SpecialGoogleLogin.php 4 files changed, 50 insertions(+), 28 deletions(-) Approvals: Legoktm: Looks good to me, but someone else must approve Florianschmidtwelzow: Looks good to me, approved jenkins-bot: Verified diff --git a/GoogleLogin.php b/GoogleLogin.php index 8dd7999..3079830 100644 --- a/GoogleLogin.php +++ b/GoogleLogin.php @@ -72,6 +72,9 @@ $wgHooks['SpecialPage_initList'][] = 'GoogleLoginHooks::onSpecialPage_initList'; $wgHooks['GetPreferences'][] = 'GoogleLoginHooks::onGetPreferences'; + // Create own instance of Config + $wgConfigRegistry['googlelogin'] = 'GlobalVarConfig::newInstance'; + // Configuration settings defaults /** diff --git a/includes/GoogleLogin.body.php b/includes/GoogleLogin.body.php index 55b3938..ef4588a 100644 --- a/includes/GoogleLogin.body.php +++ b/includes/GoogleLogin.body.php @@ -10,6 +10,8 @@ private $mPlusClient; /** @var $mHost The Host of E-Mail provided by Google */ private $mHost; + /** @var $mConfig Config object created for GoogleLogin extension */ + private $mConfig; /** * Returns an prepared instance of Google client to do requests with to Google API @@ -24,6 +26,18 @@ ); } return $this-mGoogleClient; + } + + /** +* Returns Config object for use in GoogleLogin. +* +* @return Config +*/ + public function getGLConfig() { + if ( $this-mConfig === null ) { + $this-mConfig = ConfigFactory::getDefaultInstance()-makeConfig( 'googlelogin' ); + } + return $this-mConfig; } /** @@ -164,8 +178,8 @@ * Checks if the user is allowed to create a new account with Google Login. */ public function isCreateAllowed() { - global $wgGLAllowAccountCreation; - return $wgGLAllowAccountCreation; + $glConfig = $this-getGLConfig(); + return $glConfig-get( 'GLAllowAccountCreation' ); } /** @@ -194,12 +208,12 @@ * @return boolean */ public function isValidDomain( $mailDomain ) { - global $wgGLAllowedDomains; - if ( is_array( $wgGLAllowedDomains ) ) { + $glConfig = $this-getGLConfig(); + if ( is_array( $glConfig-get( 'GLAllowedDomains' ) ) ) { if ( in_array( $this-getHost( $mailDomain ), - $wgGLAllowedDomains + $glConfig-get( 'GLAllowedDomains' ) ) ) { return true; @@ -297,12 +311,12 @@ * @see http://www.programmierer-forum.de/domainnamen-ermitteln-t244185.htm */ public function getHost( $domain = '' ) { - global $wgGLAllowedDomainsStrict; + $glConfig = $this-getGLConfig(); if ( !empty( $this-mHost ) ) { return $this-mHost; } $dir = __DIR__ . /..; - if ( $wgGLAllowedDomainsStrict ) { + if ( $glConfig-get( 'GLAllowedDomainsStrict' ) ) { $domain = explode( '@', $domain ); // we can trust google to give us only valid email address, so give the last element $this-mHost = array_pop( $domain ); @@ -424,9 +438,9 @@ * @return Google_Client A prepared instance of Google Client class */ private function prepareClient( $client, $redirectURI ) { - global $wgGLSecret, $wgGLAppId, $wgGLAppName; - $client-setClientId( $wgGLAppId ); -
[MediaWiki-commits] [Gerrit] Check that there is an unblocked user in the sysop group - change (mediawiki...AutomaticBoardWelcome)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/156008 Change subject: Check that there is an unblocked user in the sysop group .. Check that there is an unblocked user in the sysop group Also other minor cleanup Change-Id: I088de0cfe0fe252296cf563d1bfa70a8e74ed629 --- M AutomaticBoardWelcome.php 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AutomaticBoardWelcome refs/changes/08/156008/1 diff --git a/AutomaticBoardWelcome.php b/AutomaticBoardWelcome.php index ab1e870..eb2d245 100644 --- a/AutomaticBoardWelcome.php +++ b/AutomaticBoardWelcome.php @@ -7,7 +7,7 @@ * * @file * @ingroup Extensions - * @version 0.2 + * @version 0.3.0 * @date 31 May 2012 * @author Jack Phoenix j...@countervandalism.net * @license http://en.wikipedia.org/wiki/Public_domain Public domain @@ -27,7 +27,7 @@ ); $wgMessagesDirs['AutomaticBoardWelcome'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['AutomaticBoardWelcome'] = dirname( __FILE__ ) . '/AutomaticBoardWelcome.i18n.php'; +$wgExtensionMessagesFiles['AutomaticBoardWelcome'] = __DIR__ . '/AutomaticBoardWelcome.i18n.php'; $wgHooks['AddNewAccount'][] = 'wfSendUserBoardMessageOnRegistration'; /** @@ -68,6 +68,11 @@ $adminUids[] = $row-ug_user; } + if ( !$adminUids ) { + // No unblocked sysops? + return true; + } + // Pick one UID from the array of admin user IDs $random = array_rand( array_flip( $adminUids ), 1 ); $sender = User::newFromId( $random ); -- To view, visit https://gerrit.wikimedia.org/r/156008 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I088de0cfe0fe252296cf563d1bfa70a8e74ed629 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AutomaticBoardWelcome Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Check that there is an unblocked user in the sysop group - change (mediawiki...AutomaticBoardWelcome)
Jack Phoenix has submitted this change and it was merged. Change subject: Check that there is an unblocked user in the sysop group .. Check that there is an unblocked user in the sysop group Also other minor cleanup Change-Id: I088de0cfe0fe252296cf563d1bfa70a8e74ed629 --- M AutomaticBoardWelcome.php 1 file changed, 7 insertions(+), 2 deletions(-) Approvals: Jack Phoenix: Verified; Looks good to me, approved diff --git a/AutomaticBoardWelcome.php b/AutomaticBoardWelcome.php index ab1e870..eb2d245 100644 --- a/AutomaticBoardWelcome.php +++ b/AutomaticBoardWelcome.php @@ -7,7 +7,7 @@ * * @file * @ingroup Extensions - * @version 0.2 + * @version 0.3.0 * @date 31 May 2012 * @author Jack Phoenix j...@countervandalism.net * @license http://en.wikipedia.org/wiki/Public_domain Public domain @@ -27,7 +27,7 @@ ); $wgMessagesDirs['AutomaticBoardWelcome'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['AutomaticBoardWelcome'] = dirname( __FILE__ ) . '/AutomaticBoardWelcome.i18n.php'; +$wgExtensionMessagesFiles['AutomaticBoardWelcome'] = __DIR__ . '/AutomaticBoardWelcome.i18n.php'; $wgHooks['AddNewAccount'][] = 'wfSendUserBoardMessageOnRegistration'; /** @@ -68,6 +68,11 @@ $adminUids[] = $row-ug_user; } + if ( !$adminUids ) { + // No unblocked sysops? + return true; + } + // Pick one UID from the array of admin user IDs $random = array_rand( array_flip( $adminUids ), 1 ); $sender = User::newFromId( $random ); -- To view, visit https://gerrit.wikimedia.org/r/156008 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I088de0cfe0fe252296cf563d1bfa70a8e74ed629 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AutomaticBoardWelcome Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Jack Phoenix j...@countervandalism.net Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove use of wfMsg and friends - change (mediawiki...BlogPage)
jenkins-bot has submitted this change and it was merged. Change subject: Remove use of wfMsg and friends .. Remove use of wfMsg and friends The function changes in this change only to get a testable, fatal, warning and notice free test environment with MW 1.20. Bug: 68750 Change-Id: Ic60108036805dd203f51a6d291957fa1323fb3b0 --- M BlogHooks.php M BlogPage.php M SpecialArticleLists.php M SpecialArticlesHome.php M SpecialCreateBlogPost.php M TagCloudClass.php M i18n/en.json 7 files changed, 176 insertions(+), 183 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/BlogHooks.php b/BlogHooks.php index 9b056d6..8a9995c 100644 --- a/BlogHooks.php +++ b/BlogHooks.php @@ -65,7 +65,7 @@ } if ( !$wgUser-isAllowed( 'edit' ) || $wgUser-isBlocked() ) { - $wgOut-addHTML( wfMsg( 'blog-permission-required' ) ); + $wgOut-addWikiMsg( 'blog-permission-required' ); return false; } } @@ -107,8 +107,7 @@ foreach ( $res as $row ) { $ctg = Title::makeTitle( NS_CATEGORY, $row-cl_to ); $ctgname = $ctg-getText(); - $blogCat = wfMsgForContent( 'blog-category' ); - $userBlogCat = wfMsgForContent( 'blog-by-user-category', $blogCat ); + $userBlogCat = wfMessage( 'blog-by-user-category' )-inContentLanguage()-text(); if( strpos( $ctgname, $userBlogCat ) !== false ) { $user_name = trim( str_replace( $userBlogCat, '', $ctgname ) ); @@ -116,6 +115,8 @@ if( $u ) { $stats = new UserStatsTrack( $u, $user_name ); + $userBlogCat = wfMessage( 'blog-by-user-category', $stats-user_name ) + -inContentLanguage()-text(); // Copied from UserStatsTrack::updateCreatedOpinionsCount() // Throughout this code, we could use $u and $user_name // instead of $stats-user_id and $stats-user_name but @@ -211,10 +212,10 @@ Got UserProfile articles for user {$user_name} from DB\n ); $categoryTitle = Title::newFromText( - wfMsgForContent( + wfMessage( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) - ) . {$user_name} + $user_name + )-inContentLanguage()-text() ); $dbr = wfGetDB( DB_SLAVE ); @@ -256,30 +257,28 @@ $articleLink = Title::makeTitle( NS_CATEGORY, - wfMsgForContent( + wfMessage( 'blog-by-user-category', - wfMsgForContent( 'blog-category' ) - ) . {$user_name} + $user_name + )-inContentLanguage()-text() ); if ( count( $articles ) 0 ) { $output .= 'div class=user-section-heading div class=user-section-title' . - wfMsg( 'blog-user-articles-title' ) . + wfMessae( 'blog-user-articles-title' )-escaped() . '/div div class=user-section-actions div class=action-right'; if( $articleCount 5 ) { $output .= 'a href=' . htmlspecialchars( $articleLink-getFullURL() ) . - ' rel=nofollow' . wfMsg( 'user-view-all' ) . '/a'; + ' rel=nofollow' . wfMessage( 'user-view-all' )-escaped(). '/a'; } $output .= '/div - div class=action-left' . wfMsgExt( - 'user-count-separator', - 'parsemag', - count( $articles ), - $articleCount - ) . '/div + div class=action-left' . +
[MediaWiki-commits] [Gerrit] Revert Toolbar: Only show on WikiText pages - change (mediawiki/core)
Helder.wiki has uploaded a new change for review. https://gerrit.wikimedia.org/r/156009 Change subject: Revert Toolbar: Only show on WikiText pages .. Revert Toolbar: Only show on WikiText pages Classical toolbar no longer appears in Page namespace on Wikisources. Bug: 69447 This reverts commit 7263ef1e002786b27fa06db43aa7a6fca00461fb. Change-Id: Ifafe41f7bc91183e0db4c10d8340a8b620b380bc --- M includes/EditPage.php 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/09/156009/1 diff --git a/includes/EditPage.php b/includes/EditPage.php index 84545b1..98e0ec4 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2531,9 +2531,7 @@ $wgOut-addHTML( $this-editFormTextBeforeContent ); - if ( $this-contentModel === CONTENT_MODEL_WIKITEXT - $showToolbar $wgUser-getOption( 'showtoolbar' ) ) - { + if ( !$this-isCssJsSubpage $showToolbar $wgUser-getOption( 'showtoolbar' ) ) { $wgOut-addHTML( EditPage::getEditToolbar() ); } -- To view, visit https://gerrit.wikimedia.org/r/156009 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifafe41f7bc91183e0db4c10d8340a8b620b380bc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Helder.wiki helder.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove globals, set visibility of functions and variables - change (mediawiki...BlogPage)
jenkins-bot has submitted this change and it was merged. Change subject: Remove globals, set visibility of functions and variables .. Remove globals, set visibility of functions and variables Replaced a bunch of globals, set the visibility for all functions and var's. Change-Id: I9f19d817f4a4a9acf6794fc2706c81a7312ec126 --- M BlogHooks.php M BlogPage.php M SpecialArticleLists.php M SpecialArticlesHome.php M SpecialCreateBlogPost.php M TagCloudClass.php 6 files changed, 144 insertions(+), 140 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/BlogHooks.php b/BlogHooks.php index 8a9995c..3e32c66 100644 --- a/BlogHooks.php +++ b/BlogHooks.php @@ -16,8 +16,7 @@ * @return Boolean: true */ public static function blogFromTitle( $title, $article ) { - global $wgRequest, $wgOut, $wgHooks, $wgScriptPath; - global $wgSupressPageTitle, $wgSupressSubTitle, $wgSupressPageCategories; + global $wgHooks, $wgOut, $wgRequest, $wgSupressPageTitle, $wgSupressSubTitle, $wgSupressPageCategories; if ( $title-getNamespace() == NS_BLOG ) { if( !$wgRequest-getVal( 'action' ) ) { @@ -52,20 +51,22 @@ * @return Boolean: true if the user should be allowed to continue, else false */ public static function allowShowEditBlogPage( $editPage ) { - global $wgOut, $wgUser; + $context = $editPage-getArticle()-getContext(); + $output = $context-getOutput(); + $user = $context-getUser(); if( $editPage-mTitle-getNamespace() == NS_BLOG ) { - if( $wgUser-isAnon() ) { // anons can't edit blog pages + if( $user-isAnon() ) { // anons can't edit blog pages if( !$editPage-mTitle-exists() ) { - $wgOut-addWikiMsg( 'blog-login' ); + $output-addWikiMsg( 'blog-login' ); } else { - $wgOut-addWikiMsg( 'blog-login-edit' ); + $output-addWikiMsg( 'blog-login-edit' ); } return false; } - if ( !$wgUser-isAllowed( 'edit' ) || $wgUser-isBlocked() ) { - $wgOut-addWikiMsg( 'blog-permission-required' ); + if ( !$user-isAllowed( 'edit' ) || $user-isBlocked() ) { + $output-addWikiMsg( 'blog-permission-required' ); return false; } } @@ -87,8 +88,7 @@ * (being) saved * @return Boolean: true */ - public static function updateCreatedOpinionsCount( $article ) { - global $wgOut, $wgUser; + public static function updateCreatedOpinionsCount( $article, $user ) { $aid = $article-getTitle()-getArticleID(); // Shortcut, in order not to perform stupid queries (cl_from = 0...) @@ -122,14 +122,14 @@ // instead of $stats-user_id and $stats-user_name but // there's no point in doing that because we have to call // clearCache() in any case - if ( !$wgUser-isAnon() $stats-user_id ) { + if ( !$user-isAnon() $stats-user_id ) { $ctg = $userBlogCat . ' ' . $stats-user_name; $parser = new Parser(); $ctgTitle = Title::newFromText( $parser-preprocess( trim( $ctg ), - $wgOut-getTitle(), - $wgOut-parserOptions() + $article-getContext()-getTitle(), + $article-getContext()-getOutput()-parserOptions() ) ); $ctgTitle = $ctgTitle-getDBkey(); diff --git a/BlogPage.php b/BlogPage.php index 47ad774..43276d9 100644 --- a/BlogPage.php +++ b/BlogPage.php @@ -9,13 +9,13 @@ public $title = null; public $authors = array(); - function __construct( Title $title ) { +
[MediaWiki-commits] [Gerrit] Use Linker for accesskey - change (mediawiki...BlogPage)
jenkins-bot has submitted this change and it was merged. Change subject: Use Linker for accesskey .. Use Linker for accesskey Instead of hardcoded accessKey use Linker::accessKey with save. Change-Id: I1e6cdd13d51846fbdc14ab9a05896ed32460cd6a --- M SpecialCreateBlogPost.php 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Legoktm: Looks good to me, approved Siebrand: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/SpecialCreateBlogPost.php b/SpecialCreateBlogPost.php index d8d804b..9253485 100644 --- a/SpecialCreateBlogPost.php +++ b/SpecialCreateBlogPost.php @@ -290,6 +290,7 @@ */ public function displayForm() { $user = $this-getUser(); + $accessKey = Linker::accessKey( 'save' ); $output = 'form id=editform name=editform method=post action=' . htmlspecialchars( $this-getTitle()-getFullURL() ) . ' enctype=multipart/form-data'; $output .= \n . $this-displayFormPageTitle() . \n; @@ -298,8 +299,8 @@ $output .= \n . $this-displayFormPageCategories() . \n; $output .= \n . $this-displayCopyrightWarning() . \n; $output .= 'input type=button value=' . $this-msg( 'blog-create-button' )-escaped() . - ' name=wpSave class=createsubmit site-button accesskey=s title=' . - $this-msg( 'tooltip-save' )-escaped() . ' [alt-s] / + ' name=wpSave class=createsubmit site-button accesskey=' . $accessKey . ' title=' . + $this-msg( 'tooltip-save' )-escaped() . ' / input type=hidden value= name=wpSection / input type=hidden value= name=wpEdittime / input type=hidden value= name=wpTextbox1 id=wpTextbox1 / -- To view, visit https://gerrit.wikimedia.org/r/151208 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1e6cdd13d51846fbdc14ab9a05896ed32460cd6a Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/BlogPage Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow florian.schmidt.wel...@t-online.de Gerrit-Reviewer: Alex Monk kren...@wikimedia.org Gerrit-Reviewer: Jack Phoenix j...@countervandalism.net Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: Nemo bis federicol...@tiscali.it Gerrit-Reviewer: Siebrand siebr...@kitano.nl Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Labs: point /public/dumps to the new server - change (operations/puppet)
coren has submitted this change and it was merged. Change subject: Labs: point /public/dumps to the new server .. Labs: point /public/dumps to the new server While the copy is not yet complete for incrementals and pagecounts, having a working set of dumps is better than partial ones. Change-Id: I7cf0dccc0a2a279e15104d942a44809c3d97d76f --- M manifests/role/labs.pp 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: coren: Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/role/labs.pp b/manifests/role/labs.pp index 68d2746..67edd57 100644 --- a/manifests/role/labs.pp +++ b/manifests/role/labs.pp @@ -40,6 +40,7 @@ $nfs_opts = 'vers=4,bg,hard,intr,sec=sys,proto=tcp,port=0,noatime,nofsc' $nfs_server = 'labstore.svc.eqiad.wmnet' +$dumps_server = 'labstore1003.eqiad.wmnet' mount { '/home': ensure = mounted, @@ -89,7 +90,7 @@ atboot = true, fstype = 'nfs', options = ro,${nfs_opts}, -device = ${nfs_server}:/dumps, +device = ${dumps_server}:/dumps, require = File['/public/dumps'], } -- To view, visit https://gerrit.wikimedia.org/r/156002 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7cf0dccc0a2a279e15104d942a44809c3d97d76f Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: coren mpellet...@wikimedia.org Gerrit-Reviewer: coren mpellet...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Some cleanup of Daddio skin. - change (mediawiki...Daddio)
jenkins-bot has submitted this change and it was merged. Change subject: Some cleanup of Daddio skin. .. Some cleanup of Daddio skin. Various improvements, or at least I hope this is an improvement over the status quo. Untested, but mostly based on MonoBook, so it should work(TM). Change-Id: I12baef6296779fe1c1d222d173cc0095948a2e4d --- M Daddio.php M Daddio.skin.php 2 files changed, 99 insertions(+), 76 deletions(-) Approvals: Isarra: Looks good to me, approved jenkins-bot: Verified diff --git a/Daddio.php b/Daddio.php index d9446b8..914ba92 100644 --- a/Daddio.php +++ b/Daddio.php @@ -16,20 +16,28 @@ $wgExtensionCredits['skin'][] = array( 'path' = __FILE__, 'name' = 'Daddio', + // @todo FIXME: add a meaningful version number 'author' = array( 'Rufus Post', 'Aaron Schulz' ), 'description-msg' = 'daddio-desc', 'url' = 'https://www.mediawiki.org/wiki/Skin:Daddio', ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = __DIR__ . /Daddio.skin.php; +// *cough cough* assumptions... +if ( !isset( $wgAutoloadClasses['ModernTemplate'] ) ) { + $wgAutoloadClasses['ModernTemplate'] = __DIR__ . '/../Modern/SkinModern.php'; +} +$wgAutoloadClasses['SkinDaddio'] = __DIR__ . '/Daddio.skin.php'; $wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; $wgResourceModules['skins.daddio'] = array( 'styles' = array( - 'daddio/main.css' = array( 'media' = 'screen' ), - 'daddio/print.css' = array( 'media' = 'print' ) -// 'daddio/rtl.css', 'screen', '', 'rtl' ); + // @Lcawte: this probably isn't the most kosher way to do this, but it's + // how most/all ShoutWiki skins do it and it works for our setup at + // least. Feel free to improve it :D + 'skins/Daddio/daddio/main.css' = array( 'media' = 'screen' ), + 'skins/Daddio/daddio/print.css' = array( 'media' = 'print' ) ), - 'localBasePath' = __DIR__, + 'position' = 'top', + //'localBasePath' = __DIR__, ); diff --git a/Daddio.skin.php b/Daddio.skin.php index a930ae2..e9921dd 100644 --- a/Daddio.skin.php +++ b/Daddio.skin.php @@ -3,28 +3,25 @@ * Daddio skin. Skin for getting work done. * Based on Modern, modified by Rufus Post, Aaron Schulz * + * @file */ -if( !defined( 'MEDIAWIKI' ) ) +if ( !defined( 'MEDIAWIKI' ) ) { die( -1 ); - -global $IP; -// @todo Fixme: autoload ModernTemplate -require_once( $IP/skins/Modern/Modern.php ); +} /** * Inherit main code from SkinTemplate, set the CSS and template filter. - * @todo document + * * @ingroup Skins */ class SkinDaddio extends SkinTemplate { public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; - function setupSkinUserCss( OutputPage $out ){ - $out-addModules( 'skin.daddio' ); + function setupSkinUserCss( OutputPage $out ) { + $out-addModuleStyles( 'skin.daddio' ); } - } /** @@ -39,14 +36,13 @@ * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. -* -* @access private */ - function execute() { - $this-skin = $skin = $this-data['skin']; + public function execute() { + $this-skin = $this-data['skin']; + + $this-data['pageLanguage'] = $this-skin-getTitle()-getPageViewLanguage()-getHtmlCode(); $this-html( 'headelement' ); - ? !-- heading -- @@ -54,15 +50,14 @@ div id=mw_contentwrapper !-- navigation portlet -- div class=portlet id=p-cactions - h5?php $this-msg('views') ?/h5 + h5?php $this-msg( 'views' ) ?/h5 div class=pBody ul - ?php foreach($this-data['content_actions'] as $key = $tab) { ? -li id=ca-?php echo Sanitizer::escapeId($key) ??php - if($tab['class']) { ? class=?php echo htmlspecialchars($tab['class']) ??php } -?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskeyAttribs('ca-'.$key) ??php -echo htmlspecialchars($tab['text']) ?/a/li - ?php} ? + ?php + foreach ( $this-data['content_actions'] as $key = $tab ) { + echo $this-makeListItem( $key, $tab ); + } + ? /ul /div /div @@ -73,39 +68,45 @@ the content area
[MediaWiki-commits] [Gerrit] Fix ResourceLoader calls. - change (mediawiki...Daddio)
jenkins-bot has submitted this change and it was merged. Change subject: Fix ResourceLoader calls. .. Fix ResourceLoader calls. Change-Id: I97b1c10b7c4d6bd3ed5f42c7e8dd09360c5f2666 --- M Daddio.php M Daddio.skin.php 2 files changed, 5 insertions(+), 7 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/Daddio.php b/Daddio.php index 914ba92..a5dfc3c 100644 --- a/Daddio.php +++ b/Daddio.php @@ -32,12 +32,10 @@ $wgResourceModules['skins.daddio'] = array( 'styles' = array( - // @Lcawte: this probably isn't the most kosher way to do this, but it's - // how most/all ShoutWiki skins do it and it works for our setup at - // least. Feel free to improve it :D - 'skins/Daddio/daddio/main.css' = array( 'media' = 'screen' ), - 'skins/Daddio/daddio/print.css' = array( 'media' = 'print' ) + 'daddio/main.css' = array( 'media' = 'screen' ), + 'daddio/print.css' = array( 'media' = 'print' ) ), 'position' = 'top', - //'localBasePath' = __DIR__, + 'localBasePath' = __DIR__, + 'remoteSkinPath' = 'Daddio', ); diff --git a/Daddio.skin.php b/Daddio.skin.php index e9921dd..e8765f1 100644 --- a/Daddio.skin.php +++ b/Daddio.skin.php @@ -20,7 +20,7 @@ $template = 'DaddioTemplate', $useHeadElement = true; function setupSkinUserCss( OutputPage $out ) { - $out-addModuleStyles( 'skin.daddio' ); + $out-addModuleStyles( array( 'skins.daddio', 'mediawiki.legacy.shared' ) ); } } -- To view, visit https://gerrit.wikimedia.org/r/155907 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I97b1c10b7c4d6bd3ed5f42c7e8dd09360c5f2666 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/Daddio Gerrit-Branch: master Gerrit-Owner: Lewis Cawte le...@lewiscawte.me Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Some cleanup to Daddio skin. - change (mediawiki...Daddio)
jenkins-bot has submitted this change and it was merged. Change subject: Some cleanup to Daddio skin. .. Some cleanup to Daddio skin. Basic resourceloader support, fix Modern include to work with recent pathing. Also rename class file to meet the precedent set by other third-party skins of having the templates at Skinname.skin.php. Change-Id: I68e6bdbb249bb5b7b572d344099b03e1419f941e --- M Daddio.php R Daddio.skin.php 2 files changed, 20 insertions(+), 21 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/Daddio.php b/Daddio.php index adcce67..d9446b8 100644 --- a/Daddio.php +++ b/Daddio.php @@ -22,5 +22,14 @@ ); $wgValidSkinNames['daddio'] = 'Daddio'; -$wgAutoloadClasses['SkinDaddio'] = dirname( __FILE__ ) . /Daddio.class.php; -$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; \ No newline at end of file +$wgAutoloadClasses['SkinDaddio'] = __DIR__ . /Daddio.skin.php; +$wgMessagesDirs['SkinDaddio'] = __DIR__ . '/i18n'; + +$wgResourceModules['skins.daddio'] = array( + 'styles' = array( + 'daddio/main.css' = array( 'media' = 'screen' ), + 'daddio/print.css' = array( 'media' = 'print' ) +// 'daddio/rtl.css', 'screen', '', 'rtl' ); + ), + 'localBasePath' = __DIR__, +); diff --git a/Daddio.class.php b/Daddio.skin.php similarity index 86% rename from Daddio.class.php rename to Daddio.skin.php index 35757e0..a930ae2 100644 --- a/Daddio.class.php +++ b/Daddio.skin.php @@ -10,7 +10,7 @@ global $IP; // @todo Fixme: autoload ModernTemplate -require_once( $IP/skins/Modern.php ); +require_once( $IP/skins/Modern/Modern.php ); /** * Inherit main code from SkinTemplate, set the CSS and template filter. @@ -18,19 +18,11 @@ * @ingroup Skins */ class SkinDaddio extends SkinTemplate { - var $skinname = 'daddio', $stylename = 'daddio', + public $skinname = 'daddio', $stylename = 'daddio', $template = 'DaddioTemplate', $useHeadElement = true; function setupSkinUserCss( OutputPage $out ){ - global $wgScriptPath; - - $path = {$wgScriptPath}/skins/Daddio; - - // Do not call parent::setupSkinUserCss(), we have our own print style - $out-addStyle( 'common/shared.css', 'screen' ); - $out-addStyle( $path/daddio/main.css, 'screen' ); - $out-addStyle( $path/daddio/print.css, 'print' ); - $out-addStyle( $path/daddio/rtl.css, 'screen', '', 'rtl' ); + $out-addModules( 'skin.daddio' ); } } @@ -40,6 +32,8 @@ * @ingroup Skins */ class DaddioTemplate extends ModernTemplate { + public $skin; + /** * Template filter callback for Daddio skin. * Takes an associative array of data set from a SkinTemplate-based @@ -50,9 +44,6 @@ */ function execute() { $this-skin = $skin = $this-data['skin']; - - // Suppress warnings to prevent notices about missing indexes in $this-data - wfSuppressWarnings(); $this-html( 'headelement' ); @@ -63,13 +54,13 @@ div id=mw_contentwrapper !-- navigation portlet -- div class=portlet id=p-cactions - h5?php $this-msg('views') ?/h5 + h5?php $this-msg('views') ?/h5 div class=pBody ul ?php foreach($this-data['content_actions'] as $key = $tab) { ? li id=ca-?php echo Sanitizer::escapeId($key) ??php if($tab['class']) { ? class=?php echo htmlspecialchars($tab['class']) ??php } -?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskey('ca-'.$key) ??php +?a href=?php echo htmlspecialchars($tab['href']) ??php echo $skin-tooltipAndAccesskeyAttribs('ca-'.$key) ??php echo htmlspecialchars($tab['text']) ?/a/li ?php} ? /ul @@ -109,7 +100,7 @@ div id=mw_portlets ?php - $sidebar = $this-data['sidebar']; + $sidebar = $this-data['sidebar']; if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true; if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true; if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true; @@ -142,7 +133,7 @@ ?php foreach($this-data['personal_urls'] as $key = $item) { ? li id=pt-?php echo Sanitizer::escapeId($key) ??php if ($item['active']) { ? class=active?php } ?a href=?php - echo
[MediaWiki-commits] [Gerrit] Do not load ext.wikiEditor.toolbar if the user disabled Wi... - change (mediawiki...ProofreadPage)
Helder.wiki has uploaded a new change for review. https://gerrit.wikimedia.org/r/156010 Change subject: Do not load ext.wikiEditor.toolbar if the user disabled WikiEditor .. Do not load ext.wikiEditor.toolbar if the user disabled WikiEditor Change-Id: Iaf19349ceb9a86e6d0fd117d1e3f3c70dbc632fb --- M modules/page/ext.proofreadpage.page.edit.js 1 file changed, 32 insertions(+), 32 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage refs/changes/10/156010/1 diff --git a/modules/page/ext.proofreadpage.page.edit.js b/modules/page/ext.proofreadpage.page.edit.js index b0b3f25..3addd0c 100644 --- a/modules/page/ext.proofreadpage.page.edit.js +++ b/modules/page/ext.proofreadpage.page.edit.js @@ -163,9 +163,7 @@ icon: iconPath + 'Button_multicol.png', action: { type: 'callback', - execute: function() { - toogleLayout(); - } + execute: toogleLayout } } } @@ -173,38 +171,40 @@ }; var $edit = $( '#wpTextbox1' ); - if( mw.user.options.get( 'usebetatoolbar' ) ) { - mw.loader.using( 'ext.wikiEditor.toolbar', function() { - $edit.wikiEditor( 'addToToolbar', { - sections: { - 'proofreadpage-tools': { - type: 'toolbar', - labelMsg: 'proofreadpage-section-tools', - groups: tools + if( mw.user.options.get( 'showtoolbar' ) == 1 ) { + if( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { + mw.loader.using( 'ext.wikiEditor.toolbar', function() { + $edit.wikiEditor( 'addToToolbar', { + sections: { + 'proofreadpage-tools': { + type: 'toolbar', + labelMsg: 'proofreadpage-section-tools', + groups: tools + } } - } - } ); - } ); - } else if( mw.user.options.get( 'showtoolbar' ) ) { - mw.loader.using( 'mediawiki.action.edit', function() { - var $toolbar = $( '#toolbar' ); - - $.each( tools, function( group, list ) { - $.each( list.tools, function( id, def ) { - $( 'img' ) - .attr( { - width: 23, - height: 22, - src: def.icon, - alt: mw.msg( def.labelMsg ), - title: mw.msg( def.labelMsg ), - 'class': 'mw-toolbar-editbutton' //quotes needed for IE - } ) - .click( def.action.execute ) - .appendTo( $toolbar ); } ); } ); - } ); + } else { + mw.loader.using( 'mediawiki.action.edit', function() { + var $toolbar = $( '#toolbar' ); + + $.each( tools, function( group, list ) { + $.each( list.tools, function( id, def ) { + $( 'img' ) + .attr( { +
[MediaWiki-commits] [Gerrit] Render the lightbulb icon correctly in IE9 - change (mediawiki...GettingStarted)
jenkins-bot has submitted this change and it was merged. Change subject: Render the lightbulb icon correctly in IE9 .. Render the lightbulb icon correctly in IE9 Change-Id: I957c7f58398c2002457f8cc2554bf2febca39a8d --- M resources/lightbulb/lightbulb.flyout.less 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Mattflaschen: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/lightbulb/lightbulb.flyout.less b/resources/lightbulb/lightbulb.flyout.less index eafef49..58f2480 100644 --- a/resources/lightbulb/lightbulb.flyout.less +++ b/resources/lightbulb/lightbulb.flyout.less @@ -15,6 +15,7 @@ height: 13px; position: absolute; .background-image-svg('images/lightbulb.svg', 'images/lightbulb.png'); + background-size: 100%; top: -1px; left: 0; } -- To view, visit https://gerrit.wikimedia.org/r/155711 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I957c7f58398c2002457f8cc2554bf2febca39a8d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GettingStarted Gerrit-Branch: master Gerrit-Owner: Phuedx g...@samsmith.io Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Swalling swall...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix regression: Allow HTML as checkbox label in HTMLCheckField - change (mediawiki/core)
Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/156011 Change subject: Fix regression: Allow HTML as checkbox label in HTMLCheckField .. Fix regression: Allow HTML as checkbox label in HTMLCheckField Follow-up to aa15d5287d898b624a30a70d14e495899f7d251e Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af --- M includes/htmlform/HTMLCheckField.php 1 file changed, 15 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/11/156011/1 diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index 4eb7e6e..5f70362 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -5,6 +5,8 @@ */ class HTMLCheckField extends HTMLFormField { function getInputHTML( $value ) { + global $wgUseMediaWikiUIEverywhere; + if ( !empty( $this-mParams['invert'] ) ) { $value = !$value; } @@ -26,7 +28,19 @@ ), Xml::check( $this-mName, $value, $attr ) . $this-mLabel ); } else { - return Xml::checkLabel( $this-mLabel, $this-mName, $this-mID, $value, $attr ); + $chkLabel = Xml::check( $this-mName, $value, $attr ) + . '#160;' + . Html::rawElement( 'label', array( 'for' = $this-mID ), $this-mLabel ); + + if ( $wgUseMediaWikiUIEverywhere ) { + $chkLabel = Html::rawElement( + 'div', + array( 'class' = 'mw-ui-checkbox' ), + $chkLabel + ); + } + + return $chkLabel; } } -- To view, visit https://gerrit.wikimedia.org/r/156011 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Scroll to section after you're done editing it. - change (apps...wikipedia)
Deskana has uploaded a new change for review. https://gerrit.wikimedia.org/r/156012 Change subject: Scroll to section after you're done editing it. .. Scroll to section after you're done editing it. When you tap edit on a section and successfully save your edit, return to that section rather than returning to the top of the article. Change-Id: I17a61aaa9cd02223bb857283853802a893028a4f --- M wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java M wikipedia/src/main/java/org/wikipedia/page/PageViewFragment.java 2 files changed, 29 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/12/156012/1 diff --git a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java index db8b80f..f4d4049 100644 --- a/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java +++ b/wikipedia/src/main/java/org/wikipedia/editing/EditSectionActivity.java @@ -312,7 +312,11 @@ if (result instanceof SuccessEditResult) { funnel.logSaved(((SuccessEditResult) result).getRevID()); progressDialog.dismiss(); -setResult(EditHandler.RESULT_REFRESH_PAGE); + +//Build intent that includes the section we were editing, so we can scroll to it later +Intent data = new Intent(); +data.putExtra(EXTRA_SECTION, section); +setResult(EditHandler.RESULT_REFRESH_PAGE,data); Toast.makeText(EditSectionActivity.this, R.string.edit_saved_successfully, Toast.LENGTH_LONG).show(); Utils.hideSoftKeyboard(EditSectionActivity.this); finish(); diff --git a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragment.java b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragment.java index 5fe8c34..1ef50aa 100644 --- a/wikipedia/src/main/java/org/wikipedia/page/PageViewFragment.java +++ b/wikipedia/src/main/java/org/wikipedia/page/PageViewFragment.java @@ -18,6 +18,7 @@ import org.mediawiki.api.json.RequestBuilder; import org.wikipedia.NightModeHandler; import org.wikipedia.analytics.ConnectionIssueFunnel; +import org.wikipedia.editing.EditSectionActivity; import org.wikipedia.pageimages.PageImage; import org.wikipedia.views.ObservableWebView; import org.wikipedia.PageTitle; @@ -122,6 +123,7 @@ private View pageFragmentContainer; private Page page; private HistoryEntry curEntry; +private Section section; private CommunicationBridge bridge; private LinkHandler linkHandler; @@ -149,6 +151,9 @@ this.title = title; this.curEntry = historyEntry; this.quickReturnBarId = quickReturnBarId; + +//FIXME: Make this hold the section to scroll to if you follow a section wikilink, e.g. [[Article#Section]] +this.section = null; } public PageViewFragment() { @@ -419,6 +424,22 @@ wrapper.put(isLast, index == page.getSections().size() - 1); wrapper.put(fragment, page.getTitle().getFragment()); bridge.sendMessage(displaySection, wrapper); + +//If we have a section to scroll to, and we've just loaded the last section, then scroll to it +if (section != null index == page.getSections().size() - 1) { +JSONObject payload = new JSONObject(); +try { +payload.put(anchor, section.isLead() ? heading_ + section.getId() : section.getAnchor()); +} catch (JSONException e) { +// This won't happen +throw new RuntimeException(e); +} + +bridge.sendMessage(scrollToSection, payload); + +//Set the section to null so we don't accidentally try to scroll to it again in the future +section = null; +} } } catch (JSONException e) { // Won't happen @@ -439,6 +460,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == EditHandler.RESULT_REFRESH_PAGE) { +//Retrieve section from intent so where know where to scroll to +section = data.getParcelableExtra(EditSectionActivity.EXTRA_SECTION); + ViewAnimations.crossFade(webView, loadProgress); setState(STATE_NO_FETCH);
[MediaWiki-commits] [Gerrit] Cherrypick: select and apply diffs between texts - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Cherrypick: select and apply diffs between texts .. Cherrypick: select and apply diffs between texts Display diffs, allow their selection and apply approved diffs. Return text obtained by applying only approved diffs. Change-Id: I11b5f36b2416f3f9a9209141d9df3fab483004b8 --- A pywikibot/diff.py 1 file changed, 337 insertions(+), 0 deletions(-) Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/diff.py b/pywikibot/diff.py new file mode 100644 index 000..490b0df --- /dev/null +++ b/pywikibot/diff.py @@ -0,0 +1,337 @@ +# -*- coding: utf-8 -*- + +User-interface related functions + +# +# (C) Pywikibot team, 2014 +# +# Distributed under the terms of the MIT license. +# +__version__ = '$Id$' + + +import difflib +import itertools + +import pywikibot + + +class Hunk(object): +One change hunk between a and b. + +a and b: two sequences of lines. +grouped_opcode: list of 5-tuples describing how to turn a into b. +it has the same format as returned by difflib.get_opcodes(). + +Note: parts of this code are taken from by difflib.get_grouped_opcodes(). + + + +APPR = 1 +NOT_APPR = -1 +PENDING = 0 + +def __init__(self, a, b, grouped_opcode): +self.a = a +self.b = b +self.group = grouped_opcode +self.header = u'' +self.colors = { +'+': 'lightgreen', +'-': 'lightred', +} + +self.diff = list(self.create_diff()) +self.diff_plain_text = u''.join(self.diff) +self.diff_text = u''.join(self.format_diff()) + +first, last = self.group[0], self.group[-1] +self.a_rng = (first[1], last[2]) +self.b_rng = (first[3], last[4]) + +self.header = self.get_header() +self.diff_plain_text = u'%s\n%s' % (self.header, self.diff_plain_text) +self.diff_text = u'%s' % self.diff_text + +self.reviewed = self.PENDING + +def get_header(self): +Provide header of unified diff. + +a_rng = difflib._format_range_unified(*self.a_rng) +b_rng = difflib._format_range_unified(*self.b_rng) +return '@@ -{} +{} @@{}'.format(a_rng, b_rng, '\n') + +def create_diff(self): +Generator of diff text for this hunk, without formatting. + +# make sure each line ends with '\n' to prevent +# behaviour like http://bugs.python.org/issue2142 +def check_line(l): +if not l.endswith('\n'): +return l + '\n' +return l + +for tag, i1, i2, j1, j2 in self.group: +if tag == 'equal': +for line in self.a[i1:i2]: +yield ' ' + check_line(line) +if tag in ('delete'): +for line in self.a[i1:i2]: +yield '-' + check_line(line) +if tag in ('insert'): +for line in self.b[j1:j2]: +yield '+' + check_line(line) +if tag in ('replace'): +for line in difflib.ndiff(self.a[i1:i2], self.b[j1:j2]): +yield check_line(line) + +def format_diff(self): +Color diff lines. + +diff = iter(self.diff) + +l1, l2 = '', next(diff) +for line in diff: +l1, l2 = l2, line +# do not show lines starting with '?'. +if l1.startswith('?'): +continue +if l2.startswith('?'): +yield self.color_line(l1, l2) +else: +yield self.color_line(l1) + +# handle last line +if not l2.startswith('?'): +yield self.color_line(l2) + +def color_line(self, line, line_ref=None): +Color line characters. + +If line_ref is None, the whole line is colored. +If line_ref[i] is not blank, line[i] is colored. +Color depends if line starts with +/-. + +line: string +line_ref: string. + + + +color = line[0] + +if line_ref is None: +if color in self.colors: +colored_line = '\03{%s}%s\03{default}' % (self.colors[color], line) +return colored_line +else: +return line + +colored_line = u'' +state = 'Close' +for char, char_ref in itertools.izip_longest(line, line_ref.strip(), fillvalue=' '): +char_tagged = char +if state == 'Close': +if char_ref != ' ': +char_tagged = '\03{%s}%s' % (self.colors[color], char) +state = 'Open' +elif state == 'Open': +if char_ref == ' ': +char_tagged = '\03{default}%s' % char +state = 'Close' +colored_line += char_tagged + +if state
[MediaWiki-commits] [Gerrit] WIP: WTS: handle absolute URLs (/wiki/...) better. - change (mediawiki...parsoid)
Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/156013 Change subject: WIP: WTS: handle absolute URLs (/wiki/...) better. .. WIP: WTS: handle absolute URLs (/wiki/...) better. This helps us with html2wt of parser tests written for PHP which use a tags with absolute links and without `typeof` attributes. Change-Id: I9a535d07d19b4a9c3af677c301d217b889f8441f --- M lib/wts.LinkHandler.js 1 file changed, 40 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/13/156013/1 diff --git a/lib/wts.LinkHandler.js b/lib/wts.LinkHandler.js index b08c503..5b31603 100644 --- a/lib/wts.LinkHandler.js +++ b/lib/wts.LinkHandler.js @@ -1,6 +1,8 @@ use strict; require('./core-upgrade.js'); +var url = require('url'); + var Util = require('./mediawiki.Util.js').Util, DU = require('./mediawiki.DOMUtils.js').DOMUtils, pd = require('./mediawiki.parser.defines.js'), @@ -34,6 +36,36 @@ } }; +// Helper function for munging protocol-less absolute URLs: +// If this URL is absolute, but doesn't contain a protocol, +// try to find a localinterwiki protocol that would work. +var getHref = function( env, node ) { + var href = node.getAttribute('href') || ''; + if (/^\/[^\/]/.test(href)) { + // protocol-less but absolute. let's find a base href + var i, bases = [], nhref; + env.conf.wiki.interwikiMap.forEach(function(interwikiInfo, prefix) { + if (interwikiInfo.localinterwiki !== undefined + interwikiInfo.url !== undefined) { + // this is a possible base href + bases.push(interwikiInfo.url); + } + }); + for (i=0; ibases.length; i++) { + // evaluate the url relative to this base + nhref = url.resolve(bases[i], href); + // can this match the pattern? + var re = '^' + + bases[i].split('$1').map(Util.escapeRegExp).join('[\\s\\S]*') + + '$'; + if (new RegExp(re).test(nhref)) { + return nhref; + } + } + } + return href; +} + // Helper function for getting RT data from the tokens var getLinkRoundTripData = function( env, node, state ) { var dp = DU.getDataParsoid( node ); @@ -54,7 +86,7 @@ } } - var href = node.getAttribute('href') || ''; + var href = getHref( env, node ); // Save the token's real href for comparison rtData.href = href.replace( /^(\.\.?\/)+/, '' ); @@ -244,6 +276,10 @@ // Get the rt data from the token and tplAttrs linkData = getLinkRoundTripData(env, node, state); + if (linkData.type === null !node.querySelector('IMG')) { + linkData.type = 'mw:ExtLink'; + } + if ( linkData.type !== null linkData.target.value !== null ) { // We have a type and target info @@ -257,7 +293,7 @@ } var target = linkData.target, - href = node.getAttribute('href') || ''; + href = getHref( env, node ); if (/\b(mw:ExtLink|mw:PageProp\/Language)\b/.test(linkData.type)) { var targetVal = target.fromsrc || true ? target.value : Util.decodeURI(target.value); // Check if the href matches any of our interwiki URL patterns @@ -479,7 +515,7 @@ if ( contentStr // Can we minimize this? ( target.value === contentStr || - node.getAttribute('href') === contentStr) + getHref( env, node ) === contentStr) // But preserve non-minimal encoding (target.modified || linkData.contentModified || dp.stx === 'url')) { @@ -560,7 +596,7 @@ } else { // href is already percent-encoded, etc., but it might contain // spaces or other wikitext nasties. escape the nasties. - var hrefStr = escapeExtLinkURL(node.getAttribute('href')); + var hrefStr = escapeExtLinkURL(getHref( env, node )); cb( '[' + hrefStr + ' ' + state.serializeLinkChildrenToString(node, this.wteHandlers.aHandler, false) + ']', node ); -- To view, visit https://gerrit.wikimedia.org/r/156013 To unsubscribe,
[MediaWiki-commits] [Gerrit] Improve tests for OutputPage::makeResourceLoaderLink - change (mediawiki/core)
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/156014 Change subject: Improve tests for OutputPage::makeResourceLoaderLink .. Improve tests for OutputPage::makeResourceLoaderLink Change-Id: I0880c2b92bcf96ca1d25952d55464bbfb755ade0 --- M tests/phpunit/includes/OutputPageTest.php 1 file changed, 30 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/14/156014/1 diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 5c1994b..b26968d 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -177,6 +177,24 @@ 'styleesi:include src=http://127.0.0.1:8080/w/load.php?debug=falseamp;lang=enamp;modules=test.fooamp;only=stylesamp;skin=fallbackamp;*; //style ', ), + // Load no modules + array( + array( array(), ResourceLoaderModule::TYPE_COMBINED ), + '', + ), + // noscript group + array( + array( 'test.noscript', ResourceLoaderModule::TYPE_STYLES ), + 'noscriptlink rel=stylesheet href=http://127.0.0.1:8080/w/load.php?debug=falseamp;lang=enamp;modules=test.noscriptamp;only=stylesamp;skin=fallbackamp;*;/noscript +' + ), + // Load two modules in separate groups + array( + array( array( 'test.group.foo', 'test.group.bar' ), ResourceLoaderModule::TYPE_COMBINED ), + 'script src=http://127.0.0.1:8080/w/load.php?debug=falseamp;lang=enamp;modules=test.group.baramp;skin=fallbackamp;*;/script +script src=http://127.0.0.1:8080/w/load.php?debug=falseamp;lang=enamp;modules=test.group.fooamp;skin=fallbackamp;*;/script +', + ), ); } @@ -218,6 +236,18 @@ 'styles' = '/* pref-animate=off */ .mw-icon { transition: none; }', 'group' = 'private', )), + 'test.noscript' = new ResourceLoaderTestModule( array( + 'styles' = '.mw-test-noscript { content: style; }', + 'group' = 'noscript', + )), + 'test.group.bar' = new ResourceLoaderTestModule( array( + 'styles' = '.mw-group-bar { content: style; }', + 'group' = 'bar', + )), + 'test.group.foo' = new ResourceLoaderTestModule( array( + 'styles' = '.mw-group-foo { content: style; }', + 'group' = 'foo', + )), ) ); $links = $method-invokeArgs( $out, $args ); // Strip comments to avoid variation due to wgDBname in WikiID and cache key -- To view, visit https://gerrit.wikimedia.org/r/156014 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0880c2b92bcf96ca1d25952d55464bbfb755ade0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] hhvm: dedupe mysql config key - change (operations/puppet)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/156016 Change subject: hhvm: dedupe mysql config key .. hhvm: dedupe mysql config key Change-Id: I58b9500712c98ab68089fd607b5dff09a3020761 --- M modules/hhvm/manifests/init.pp 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/16/156016/1 diff --git a/modules/hhvm/manifests/init.pp b/modules/hhvm/manifests/init.pp index fcc0d5c..1ed8f07 100644 --- a/modules/hhvm/manifests/init.pp +++ b/modules/hhvm/manifests/init.pp @@ -88,7 +88,6 @@ enable_obj_destruct_call = true, enable_zend_compat = true, include_path = '.:/usr/share/php', -mysql= { typed_results = false }, pid_file = '', # PID file managed by start-stop-daemon(8) resource_limit = { core_file_size = to_bytes('8 Gb') }, log = { @@ -98,6 +97,7 @@ native_stack_trace = true, }, mysql= { +typed_results= false, slow_query_threshold = 10 * 1000, # milliseconds }, debug= { -- To view, visit https://gerrit.wikimedia.org/r/156016 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I58b9500712c98ab68089fd607b5dff09a3020761 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh o...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix regression: Allow HTML as checkbox label in HTMLCheckField - change (mediawiki/core)
Alex Monk has uploaded a new change for review. https://gerrit.wikimedia.org/r/156015 Change subject: Fix regression: Allow HTML as checkbox label in HTMLCheckField .. Fix regression: Allow HTML as checkbox label in HTMLCheckField Follow-up to aa15d5287d898b624a30a70d14e495899f7d251e Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af --- M includes/htmlform/HTMLCheckField.php 1 file changed, 15 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/15/156015/1 diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index 4eb7e6e..5f70362 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -5,6 +5,8 @@ */ class HTMLCheckField extends HTMLFormField { function getInputHTML( $value ) { + global $wgUseMediaWikiUIEverywhere; + if ( !empty( $this-mParams['invert'] ) ) { $value = !$value; } @@ -26,7 +28,19 @@ ), Xml::check( $this-mName, $value, $attr ) . $this-mLabel ); } else { - return Xml::checkLabel( $this-mLabel, $this-mName, $this-mID, $value, $attr ); + $chkLabel = Xml::check( $this-mName, $value, $attr ) + . '#160;' + . Html::rawElement( 'label', array( 'for' = $this-mID ), $this-mLabel ); + + if ( $wgUseMediaWikiUIEverywhere ) { + $chkLabel = Html::rawElement( + 'div', + array( 'class' = 'mw-ui-checkbox' ), + $chkLabel + ); + } + + return $chkLabel; } } -- To view, visit https://gerrit.wikimedia.org/r/156015 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.24wmf18 Gerrit-Owner: Alex Monk kren...@wikimedia.org Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix regression: Allow HTML as checkbox label in HTMLCheckField - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Fix regression: Allow HTML as checkbox label in HTMLCheckField .. Fix regression: Allow HTML as checkbox label in HTMLCheckField Follow-up to aa15d5287d898b624a30a70d14e495899f7d251e Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af --- M includes/htmlform/HTMLCheckField.php 1 file changed, 15 insertions(+), 1 deletion(-) Approvals: Alex Monk: Looks good to me, approved GeorgeBarnick: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index 4eb7e6e..5f70362 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -5,6 +5,8 @@ */ class HTMLCheckField extends HTMLFormField { function getInputHTML( $value ) { + global $wgUseMediaWikiUIEverywhere; + if ( !empty( $this-mParams['invert'] ) ) { $value = !$value; } @@ -26,7 +28,19 @@ ), Xml::check( $this-mName, $value, $attr ) . $this-mLabel ); } else { - return Xml::checkLabel( $this-mLabel, $this-mName, $this-mID, $value, $attr ); + $chkLabel = Xml::check( $this-mName, $value, $attr ) + . '#160;' + . Html::rawElement( 'label', array( 'for' = $this-mID ), $this-mLabel ); + + if ( $wgUseMediaWikiUIEverywhere ) { + $chkLabel = Html::rawElement( + 'div', + array( 'class' = 'mw-ui-checkbox' ), + $chkLabel + ); + } + + return $chkLabel; } } -- To view, visit https://gerrit.wikimedia.org/r/156011 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie9a6b3f017912d0f3493da09a267cf32852392af Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Alex Monk kren...@wikimedia.org Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com Gerrit-Reviewer: GeorgeBarnick georgebarn...@gmail.com Gerrit-Reviewer: Jdlrobson jrob...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits