[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Remove duplicate 'hiwiktionary' in s3.dblist
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405337 ) Change subject: Remove duplicate 'hiwiktionary' in s3.dblist .. Remove duplicate 'hiwiktionary' in s3.dblist Also sort the list (with LANG=C). Change-Id: Ia2fed9958182591e1daaef1077622a22306159ac --- M dblists/s3.dblist 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/37/405337/1 diff --git a/dblists/s3.dblist b/dblists/s3.dblist index d341a68..83fc866 100644 --- a/dblists/s3.dblist +++ b/dblists/s3.dblist @@ -295,13 +295,12 @@ hewikisource hewikivoyage hewiktionary -hifwiktionary hifwiki +hifwiktionary hiwiki hiwikibooks hiwikiquote hiwikiversity -hiwiktionary hiwikivoyage hiwiktionary howiki -- To view, visit https://gerrit.wikimedia.org/r/405337 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2fed9958182591e1daaef1077622a22306159ac Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: SpecialLog: Don't ignore offender when it's a nonexistent us...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404696 ) Change subject: SpecialLog: Don't ignore offender when it's a nonexistent username .. SpecialLog: Don't ignore offender when it's a nonexistent username When viewing the suppression log, the 'offender' field is ignored if it specifies a username that happens to not exist locally. It would make more sense for it to filter by that name and return an empty list. Ideally such searches would have the possibility of succeeding, since imported log entries can be attributed to a nonexistent user, but the necessary data isn't currently being stored. The actor table patch (I8d825eb0) will start storing that data once migration begins, although a maintenance script run would be needed to populate it for old log entries. Change-Id: I73ac78f7623178ab878135b910a22013723885d3 --- M includes/specials/SpecialLog.php 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/96/404696/1 diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index 511cfbf..de3fd19 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -79,10 +79,12 @@ $qc = []; if ( $opts->getValue( 'type' ) == 'suppress' ) { $offender = User::newFromName( $opts->getValue( 'offender' ), false ); - if ( $offender && $offender->getId() > 0 ) { - $qc = [ 'ls_field' => 'target_author_id', 'ls_value' => $offender->getId() ]; - } elseif ( $offender && IP::isIPAddress( $offender->getName() ) ) { - $qc = [ 'ls_field' => 'target_author_ip', 'ls_value' => $offender->getName() ]; + if ( $offender ) { + if ( $offender->getId() > 0 ) { + $qc = [ 'ls_field' => 'target_author_id', 'ls_value' => $offender->getId() ]; + } else { + $qc = [ 'ls_field' => 'target_author_ip', 'ls_value' => $offender->getName() ]; + } } } else { // Allow extensions to add relations to their search types -- To view, visit https://gerrit.wikimedia.org/r/404696 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73ac78f7623178ab878135b910a22013723885d3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiQueryTags: Remove unused tgprop value
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404684 ) Change subject: ApiQueryTags: Remove unused tgprop value .. ApiQueryTags: Remove unused tgprop value While a tgprop=name has been defined since the module was created, it has never made any difference to the output. Let's just remove it. Bug: T185058 Change-Id: If9d7597751a8bdb8e415d6f7bab741452a6fd753 --- M RELEASE-NOTES-1.31 M includes/api/ApiQueryTags.php 2 files changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/84/404684/1 diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index fca71a7..45d096d 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -65,7 +65,9 @@ * (T90902) Non-breaking space in header ID breaks anchor === Action API changes in 1.31 === -* … +* (T185058) The 'name' value to tgprop for action=query&list=tags has been + removed. It has never made a difference in the output, the name was always + returned regardless. === Action API internal changes in 1.31 === * … diff --git a/includes/api/ApiQueryTags.php b/includes/api/ApiQueryTags.php index 1b154fa..b340b57 100644 --- a/includes/api/ApiQueryTags.php +++ b/includes/api/ApiQueryTags.php @@ -141,9 +141,8 @@ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 ], 'prop' => [ - ApiBase::PARAM_DFLT => 'name', + ApiBase::PARAM_DFLT => '', ApiBase::PARAM_TYPE => [ - 'name', 'displayname', 'description', 'hitcount', -- To view, visit https://gerrit.wikimedia.org/r/404684 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If9d7597751a8bdb8e415d6f7bab741452a6fd753 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Non-MySQL comment table updates
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404506 ) Change subject: Non-MySQL comment table updates .. Non-MySQL comment table updates Follows up Ic3a434c06. Add schema for MSSQL and Oracle, and add a missing 'migrateComments' call for PostgreSQL. Bug: T166732 Change-Id: I408085db17bf951ce721427e7344b4afd5706e40 --- M includes/installer/MssqlUpdater.php M includes/installer/OracleUpdater.php M includes/installer/PostgresUpdater.php A maintenance/mssql/archives/patch-comment-table.sql M maintenance/mssql/tables.sql A maintenance/oracle/archives/patch-comment-table.sql M maintenance/oracle/tables.sql 7 files changed, 260 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/06/404506/1 diff --git a/includes/installer/MssqlUpdater.php b/includes/installer/MssqlUpdater.php index b4b34de..1fd1d9b 100644 --- a/includes/installer/MssqlUpdater.php +++ b/includes/installer/MssqlUpdater.php @@ -106,6 +106,10 @@ [ 'modifyField', 'image', 'img_media_type', 'patch-add-3d.sql' ], [ 'addIndex', 'site_stats', 'PRIMARY', 'patch-site_stats-pk.sql' ], + // Should have been in 1.30 + [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'migrateComments' ], + // 1.31 [ 'addTable', 'slots', 'patch-slots.sql' ], [ 'addTable', 'content', 'patch-content.sql' ], diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index ea68412..3ee51ea 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -127,6 +127,10 @@ [ 'doAutoIncrementTriggers' ], [ 'addIndex', 'site_stats', 'PRIMARY', 'patch-site_stats-pk.sql' ], + // Should have been in 1.30 + [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'migrateComments' ], + // 1.31 [ 'addTable', 'slots', 'patch-slots.sql' ], [ 'addTable', 'content', 'patch-content.sql' ], diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 367d431..8d12404 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -481,6 +481,7 @@ [ 'changeNullableField', 'protected_titles', 'pt_reason', 'NOT NULL', true ], [ 'addPgField', 'protected_titles', 'pt_reason_id', 'INTEGER NOT NULL DEFAULT 0' ], [ 'addTable', 'comment', 'patch-comment-table.sql' ], + [ 'migrateComments' ], [ 'addIndex', 'site_stats', 'site_stats_pkey', 'patch-site_stats-pk.sql' ], [ 'addTable', 'ip_changes', 'patch-ip_changes.sql' ], diff --git a/maintenance/mssql/archives/patch-comment-table.sql b/maintenance/mssql/archives/patch-comment-table.sql new file mode 100644 index 000..e011e7c --- /dev/null +++ b/maintenance/mssql/archives/patch-comment-table.sql @@ -0,0 +1,57 @@ +-- +-- patch-comment-table.sql +-- +-- T166732. Add a `comment` table and various columns (and temporary tables) to reference it. + +CREATE TABLE /*_*/comment ( + comment_id bigint unsigned NOT NULL PRIMARY KEY IDENTITY(0,1), + comment_hash INT NOT NULL, + comment_text nvarchar(max) NOT NULL, + comment_data nvarchar(max) +); +CREATE INDEX /*i*/comment_hash ON /*_*/comment (comment_hash); + +-- dummy row for FKs. Hash is intentionally wrong so CommentStore won't match it. +INSERT INTO /*_*/comment (comment_hash, comment_text) VALUES (-1, '** dummy **'); + + +CREATE TABLE /*_*/revision_comment_temp ( + revcomment_rev INT NOT NULL CONSTRAINT FK_revcomment_rev FOREIGN KEY REFERENCES /*_*/revision(rev_id) ON DELETE CASCADE, + revcomment_comment_id bigint unsigned NOT NULL CONSTRAINT FK_revcomment_comment_id FOREIGN KEY REFERENCES /*_*/comment(comment_id), + CONSTRAINT PK_revision_comment_temp PRIMARY KEY (revcomment_rev, revcomment_comment_id) +); +CREATE UNIQUE INDEX /*i*/revcomment_rev ON /*_*/revision_comment_temp (revcomment_rev); + + +CREATE TABLE /*_*/image_comment_temp ( + imgcomment_name nvarchar(255) NOT NULL CONSTRAINT FK_imgcomment_name FOREIGN KEY REFERENCES /*_*/image(imgcomment_name) ON DELETE CASCADE, + imgcomment_description_id bigint unsigned NOT NULL CONSTRAINT FK_imgcomment_description_id FOREIGN KEY REFERENCES /*_*/comment(comment_id), + CONSTRAINT PK_image_comment_temp PRIMARY KEY (imgcomment_name, imgcomment_description_id) +); +CREATE UNIQUE INDEX /*i*/imgcomment_name ON /*_*/image_comment_temp (imgcomment_name); + + +ALTER TABLE /*_*/revision ALTER COLUMN rev_comment ADD CONSTRAINT DF_r
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiSandbox: Use OO.ui.getDefaultOverlay()
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403932 ) Change subject: ApiSandbox: Use OO.ui.getDefaultOverlay() .. ApiSandbox: Use OO.ui.getDefaultOverlay() Mostly via the shortcut of passing true to the '$overlay' parameter. Also use it instead of as the container for fullscreen mode, so we don't have to worry about different z indexes to not go over the default overlay in different skins. And rename our OptionalWidget's "$overlay" parameter to "$cover" since it's not an overlay in the sense that OOUI uses that term. Bug: T184790 Change-Id: Ia65400f4c8c5e0f44cdb30e09c854fa38590e39d --- M resources/src/mediawiki.special/mediawiki.special.apisandbox.css M resources/src/mediawiki.special/mediawiki.special.apisandbox.js 2 files changed, 18 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/32/403932/1 diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.css b/resources/src/mediawiki.special/mediawiki.special.apisandbox.css index 928fa17..acb3998 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.css +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.css @@ -24,7 +24,6 @@ bottom: 0; right: 0; background: #fff; - z-index: 100; } .mw-apisandbox-fullscreen .mw-apisandbox-container { @@ -52,10 +51,10 @@ .mw-apisandbox-optionalWidget.oo-ui-widget-disabled { position: relative; - z-index: 0; /* New stacking context to prevent the overlay from leaking out */ + z-index: 0; /* New stacking context to prevent the cover from leaking out */ } -.mw-apisandbox-optionalWidget-overlay { +.mw-apisandbox-optionalWidget-cover { position: absolute; left: 0; right: 0; diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js index a6450e9..7ceb9e6 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js @@ -339,7 +339,7 @@ widget = new OO.ui.CapsuleMultiselectWidget( { allowArbitrary: true, allowDuplicates: Util.apiBool( pi.allowsduplicates ), - $overlay: $( '#mw-apisandbox-ui' ) + $overlay: true } ); widget.paramInfo = pi; $.extend( widget, WidgetMethods.capsuleWidget ); @@ -459,14 +459,14 @@ widget = new OO.ui.CapsuleMultiselectWidget( { menu: { items: items }, - $overlay: $( '#mw-apisandbox-ui' ) + $overlay: true } ); widget.paramInfo = pi; $.extend( widget, WidgetMethods.capsuleWidget ); } else { widget = new OO.ui.DropdownWidget( { menu: { items: items }, - $overlay: $( '#mw-apisandbox-ui' ) + $overlay: true } ); widget.paramInfo = pi; $.extend( widget, WidgetMethods.dropdownWidget ); @@ -499,7 +499,7 @@ widget = new OO.ui.CapsuleMultiselectWidget( { menu: { items: items }, - $overlay: $( '#mw-apisandbox-ui' ) + $overlay: true } ); widget.paramInfo = pi; $.extend( widget, WidgetMethods.capsuleWidget ); @@ -510,7 +510,7 @@ } else { widget = new OO.ui.DropdownWidget( { menu: { items: items }, - $overlay: $( '#mw-apisandbox-ui' ) +
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add tests for RevisionStore::newMutableRevisionFromArray and...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403759 ) Change subject: Add tests for RevisionStore::newMutableRevisionFromArray and legacy encoding .. Add tests for RevisionStore::newMutableRevisionFromArray and legacy encoding Bug: T184749 Change-Id: I6dcfc0497bfce6605fa5517c9f91faf7131f4334 --- M tests/phpunit/includes/Storage/RevisionStoreDbTest.php 1 file changed, 44 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/59/403759/1 diff --git a/tests/phpunit/includes/Storage/RevisionStoreDbTest.php b/tests/phpunit/includes/Storage/RevisionStoreDbTest.php index 15f173a..d685424 100644 --- a/tests/phpunit/includes/Storage/RevisionStoreDbTest.php +++ b/tests/phpunit/includes/Storage/RevisionStoreDbTest.php @@ -6,6 +6,7 @@ use Exception; use HashBagOStuff; use InvalidArgumentException; +use Language; use MediaWiki\Linker\LinkTarget; use MediaWiki\MediaWikiServices; use MediaWiki\Storage\IncompleteRevisionException; @@ -1026,6 +1027,22 @@ 'content' => new WikitextContent( 'Some Content' ), ] ]; + yield 'Basic array, serialized text' => [ + [ + 'id' => 2, + 'page' => 1, + 'timestamp' => '20171017114835', + 'user_text' => '111.0.1.2', + 'user' => 0, + 'minor_edit' => false, + 'deleted' => 0, + 'len' => 46, + 'parent_id' => 1, + 'sha1' => 'rdqbbzs3pkhihgbs8qf2q9jsvheag5z', + 'comment' => 'Goat Comment!', + 'text' => ( new WikitextContent( 'Söme Content' ) )->serialize(), + ] + ]; yield 'Basic array, with title' => [ [ 'title' => Title::newFromText( 'SomeText' ), @@ -1092,6 +1109,8 @@ $this->assertTrue( $result->getSlot( 'main' )->getContent()->equals( $array['content'] ) ); + } elseif ( isset( $array['text'] ) ) { + $this->assertSame( $array['text'], $result->getSlot( 'main' )->getContent()->serialize() ); } else { $this->assertSame( $array['content_format'], @@ -1101,4 +1120,29 @@ } } + /** +* @dataProvider provideNewMutableRevisionFromArray +* @covers \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray +*/ + public function testNewMutableRevisionFromArray_legacyEncoding( array $array ) { + $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ); + $blobStore = new SqlBlobStore( wfGetLB(), $cache ); + $blobStore->setLegacyEncoding( 'windows-1252', Language::factory( 'en' ) ); + + $factory = $this->getMockBuilder( BlobStoreFactory::class ) + ->setMethods( [ 'newBlobStore', 'newSqlBlobStore' ] ) + ->disableOriginalConstructor() + ->getMock(); + $factory->expects( $this->any() ) + ->method( 'newBlobStore' ) + ->willReturn( $blobStore ); + $factory->expects( $this->any() ) + ->method( 'newSqlBlobStore' ) + ->willReturn( $blobStore ); + + $this->setService( 'BlobStoreFactory', $factory ); + + $this->testNewMutableRevisionFromArray( $array ); + } + } -- To view, visit https://gerrit.wikimedia.org/r/403759 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6dcfc0497bfce6605fa5517c9f91faf7131f4334 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiQueryImageInfo: Don't return URLs if the archived file is...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403174 ) Change subject: ApiQueryImageInfo: Don't return URLs if the archived file is missing .. ApiQueryImageInfo: Don't return URLs if the archived file is missing If the archived file doesn't exist, indicate that instead of returning bogus URLs. Bug: T184445 Change-Id: I831b13314300f0289a2baf26ed21d81be31b292a --- M includes/api/ApiQueryImageInfo.php 1 file changed, 25 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/403174/1 diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index b1df982..0603923 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -503,32 +503,36 @@ } if ( $url ) { - if ( !is_null( $thumbParams ) ) { - $mto = $file->transform( $thumbParams ); - self::$transformCount++; - if ( $mto && !$mto->isError() ) { - $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT ); + if ( $file->exists() ) { + if ( !is_null( $thumbParams ) ) { + $mto = $file->transform( $thumbParams ); + self::$transformCount++; + if ( $mto && !$mto->isError() ) { + $vals['thumburl'] = wfExpandUrl( $mto->getUrl(), PROTO_CURRENT ); - // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted - // thumbnail sizes for the thumbnail actual size - if ( $mto->getUrl() !== $file->getUrl() ) { - $vals['thumbwidth'] = intval( $mto->getWidth() ); - $vals['thumbheight'] = intval( $mto->getHeight() ); - } else { - $vals['thumbwidth'] = intval( $file->getWidth() ); - $vals['thumbheight'] = intval( $file->getHeight() ); - } + // T25834 - If the URLs are the same, we haven't resized it, so shouldn't give the wanted + // thumbnail sizes for the thumbnail actual size + if ( $mto->getUrl() !== $file->getUrl() ) { + $vals['thumbwidth'] = intval( $mto->getWidth() ); + $vals['thumbheight'] = intval( $mto->getHeight() ); + } else { + $vals['thumbwidth'] = intval( $file->getWidth() ); + $vals['thumbheight'] = intval( $file->getHeight() ); + } - if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) { - list( , $mime ) = $file->getHandler()->getThumbType( - $mto->getExtension(), $file->getMimeType(), $thumbParams ); - $vals['thumbmime'] = $mime; + if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) { + list( , $mime ) = $file->getHandler()->getThumbType( + $mto->getExtension(), $file->getMimeType(), $thumbParams ); + $vals['thumbmime'] = $mime; + } + } elseif ( $mto && $mto->isError() ) { + $vals['thumberror'] = $mto->toText(); } - } elseif ( $mto && $mto->isError() ) { - $vals['thumberror'] = $mto->toText(); } + $vals['url'] = wfExpandUrl( $file->getFullUrl(), PROTO_CURRENT ); + } else { + $vals['filemissing'] = true; } - $vals['url'] = wfExpandUrl( $file->getFullUrl(), PROTO_CURRENT );
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Populate ar_rev_id and make it non-nullable
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402932 ) Change subject: Populate ar_rev_id and make it non-nullable .. Populate ar_rev_id and make it non-nullable Revisions deleted before MediaWiki 1.5 do not have a value in this field. This is going to be a problem for migration to the MCR schema, so provide a maintenance script to clean this up. Then, for good measure, change the schema to make the field non-nullable. Bug: T182678 Change-Id: Ie2e11f12a30f379db32c3e074658012c6f93adb0 --- M autoload.php M includes/installer/DatabaseUpdater.php M includes/installer/MssqlUpdater.php M includes/installer/MysqlUpdater.php M includes/installer/OracleUpdater.php M includes/installer/PostgresUpdater.php M includes/installer/SqliteUpdater.php A maintenance/archives/patch-ar_rev_id-not-null.sql A maintenance/mssql/archives/patch-ar_rev_id-not-null.sql M maintenance/mssql/tables.sql A maintenance/oracle/archives/patch-ar_rev_id-not-null.sql M maintenance/oracle/tables.sql A maintenance/populateArchiveRevId.php A maintenance/postgres/archives/patch-ar_rev_id-not-null.sql M maintenance/postgres/tables.sql A maintenance/sqlite/archives/patch-ar_rev_id-not-null.sql M maintenance/tables.sql 17 files changed, 240 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/32/402932/1 diff --git a/autoload.php b/autoload.php index 351136d..40ae8ae 100644 --- a/autoload.php +++ b/autoload.php @@ -1139,6 +1139,7 @@ 'PoolCounterWorkViaCallback' => __DIR__ . '/includes/poolcounter/PoolCounterWorkViaCallback.php', 'PoolCounter_Stub' => __DIR__ . '/includes/poolcounter/PoolCounter.php', 'PoolWorkArticleView' => __DIR__ . '/includes/poolcounter/PoolWorkArticleView.php', + 'PopulateArchiveRevId' => __DIR__ . '/maintenance/populateArchiveRevId.php', 'PopulateBacklinkNamespace' => __DIR__ . '/maintenance/populateBacklinkNamespace.php', 'PopulateCategory' => __DIR__ . '/maintenance/populateCategory.php', 'PopulateContentModel' => __DIR__ . '/maintenance/populateContentModel.php', diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 242f148..249eb0b 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -1230,4 +1230,23 @@ } } + /** +* Populate ar_rev_id, then make it not nullable +* @since 1.31 +*/ +protected function populateArchiveRevId() { +$info = $this->db->fieldInfo( 'archive', 'ar_rev_id', __METHOD__ ); +if ( !$info ) { +return; +} +if ( $info->isNullable() ) { +$this->output( "Populating ar_rev_id.\n" ); +$task = $this->maintenance->runChild( 'PopulateArchiveRevId', 'populateArchiveRevId.php' ); +if ( $task->execute() ) { +$this->applyPatch( 'patch-ar_rev_id-not-null.sql', false, +'Making ar_rev_id not nullable' ); +} +} +} + } diff --git a/includes/installer/MssqlUpdater.php b/includes/installer/MssqlUpdater.php index cb7a6ba..211d420 100644 --- a/includes/installer/MssqlUpdater.php +++ b/includes/installer/MssqlUpdater.php @@ -111,6 +111,7 @@ [ 'addTable', 'content', 'patch-content.sql' ], [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ], [ 'addTable', 'content_models', 'patch-content_models.sql' ], + [ 'populateArchiveRevId' ], ]; } diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index bc7725e..1137fa4 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -335,6 +335,7 @@ [ 'addTable', 'content', 'patch-content.sql' ], [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ], [ 'addTable', 'content_models', 'patch-content_models.sql' ], + [ 'populateArchiveRevId' ], ]; } diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index 67150ee..ea1e53e 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -132,6 +132,7 @@ [ 'addTable', 'content', 'patch-content.sql' ], [ 'addTable', 'slot_roles', 'patch-slot_roles.sql' ], [ 'addTable', 'content_models', 'patch-content_models.sql' ], + [ 'populateArchiveRevId' ], // KEEP THIS AT THE BOTTOM!! [ 'doRebuildDup
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: API: Don't apply size limit to action=compare
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402834 ) Change subject: API: Don't apply size limit to action=compare .. API: Don't apply size limit to action=compare Some diffs can be really huge. Since ApiComparePages is intended to return only the diff and some small metadata, bypass $wgAPIMaxResultSize to allow the diff to be returned even if it's insanely huge. Really insanely huge diffs might still make PHP run out of memory, even before it gets the chance to return the diff to the API. That is outside the scope of this change. Bug: T184412 Change-Id: I755417f573c3caf85031d03b262aa55bd8cf36d7 --- M includes/api/ApiComparePages.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/34/402834/1 diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index 5486594..2407cd0 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -167,7 +167,7 @@ ApiResult::setContentValue( $vals, 'body', $difftext ); } - $this->getResult()->addValue( null, $this->getModuleName(), $vals ); + $this->getResult()->addValue( null, $this->getModuleName(), $vals, ApiResult::NO_SIZE_CHECK ); } /** -- To view, visit https://gerrit.wikimedia.org/r/402834 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I755417f573c3caf85031d03b262aa55bd8cf36d7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add options and join conds to MediaWikiTestCase::assertSelect
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402376 ) Change subject: Add options and join conds to MediaWikiTestCase::assertSelect .. Add options and join conds to MediaWikiTestCase::assertSelect Because selects sometimes need to specify these. Change-Id: I853e8210bbafe16a62060b9075384afb9cdb03c0 --- M tests/phpunit/MediaWikiTestCase.php 1 file changed, 13 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/76/402376/1 diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index d542826..5c27fa1 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1482,13 +1482,17 @@ * @param string|array $fields The columns to include in the result (and to sort by) * @param string|array $condition "where" condition(s) * @param array $expectedRows An array of arrays giving the expected rows. +* @param array $options Options for the query +* @param array $join_conds Join conditions for the query * * @throws MWException If this test cases's needsDB() method doesn't return true. * Test cases can use "@group Database" to enable database test support, * or list the tables under testing in $this->tablesUsed, or override the * needsDB() method. */ - protected function assertSelect( $table, $fields, $condition, array $expectedRows ) { + protected function assertSelect( + $table, $fields, $condition, array $expectedRows, array $options = [], array $join_conds = [] + ) { if ( !$this->needsDB() ) { throw new MWException( 'When testing database state, the test cases\'s needDB()' . ' method should return true. Use @group Database or $this->tablesUsed.' ); @@ -1496,7 +1500,14 @@ $db = wfGetDB( DB_REPLICA ); - $res = $db->select( $table, $fields, $condition, wfGetCaller(), [ 'ORDER BY' => $fields ] ); + $res = $db->select( + $table, + $fields, + $condition, + wfGetCaller(), + $options + [ 'ORDER BY' => $fields ], + $join_conds + ); $this->assertNotEmpty( $res, "query failed: " . $db->lastError() ); $i = 0; -- To view, visit https://gerrit.wikimedia.org/r/402376 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I853e8210bbafe16a62060b9075384afb9cdb03c0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix typo in PostgresUpdater in I30a3a983
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401774 ) Change subject: Fix typo in PostgresUpdater in I30a3a983 .. Fix typo in PostgresUpdater in I30a3a983 Bug: T174028 Change-Id: I916c8e693e477e03295a2224320eb94599c34d65 --- M includes/installer/PostgresUpdater.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/401774/1 diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index e920fb7..fe8a1b1 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -487,7 +487,7 @@ // 1.31 [ 'addTable', 'slots', 'patch-slots-table.sql' ], [ 'addTable', 'content', 'patch-content-table.sql' ], - [ 'addTable', 'content_moddels', 'patch-content_models-table.sql' ], + [ 'addTable', 'content_models', 'patch-content_models-table.sql' ], [ 'addTable', 'slot_roles', 'patch-slot_roles-table.sql' ], ]; } -- To view, visit https://gerrit.wikimedia.org/r/401774 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I916c8e693e477e03295a2224320eb94599c34d65 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add tests for ApiFormatBase
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401770 ) Change subject: Add tests for ApiFormatBase .. Add tests for ApiFormatBase Ensuring proper behavior of the base class lets comprehensive tests of subclasses be simpler. This also adjusts ApiFormatTestBase to be a bit more usable, passing an array of options through to encodeData() instead of just a class name. And removes the unused 'SKIP' from testGeneralEncoding, but allows expecting an exception (for use in I63ce42dd). Change-Id: Ib2a1fa0b04860b09105376881ff8411f9534c453 --- M includes/api/ApiFormatBase.php A tests/phpunit/includes/api/format/ApiFormatBaseTest.php M tests/phpunit/includes/api/format/ApiFormatTestBase.php 3 files changed, 382 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/70/401770/1 diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 4348fc8..5b72d44 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -308,11 +308,13 @@ // T68776: wfMangleFlashPolicy() is needed to avoid a nasty bug in // Flash, but what it does isn't friendly for the API, so we need to // work around it. + // @codeCoverageIgnoreStart if ( preg_match( '/\<\s*cross-domain-policy\s*\>/i', $json ) ) { $json = preg_replace( '/\<(\s*cross-domain-policy\s*)\>/i', '\\u003C$1\\u003E', $json ); } + // @codeCoverageIgnoreEnd echo $json; } else { diff --git a/tests/phpunit/includes/api/format/ApiFormatBaseTest.php b/tests/phpunit/includes/api/format/ApiFormatBaseTest.php new file mode 100644 index 000..e85ef27 --- /dev/null +++ b/tests/phpunit/includes/api/format/ApiFormatBaseTest.php @@ -0,0 +1,338 @@ +setRequest( new FauxRequest( [], true ) ); + $main = new ApiMain( $context ); + } + + $mock = $this->getMockBuilder( ApiFormatBase::class ) + ->setConstructorArgs( [ $main, $format ] ) + ->setMethods( array_unique( array_merge( $methods, [ 'getMimeType', 'execute' ] ) ) ) + ->getMock(); + if ( !in_array( 'getMimeType', $methods, true ) ) { + $mock->method( 'getMimeType' )->willReturn( 'text/x-mock' ); + } + return $mock; + } + + protected function encodeData( array $params, array $data, $options = [] ) { + $options += [ + 'name' => 'mock', + 'class' => ApiFormatBase::class, + 'factory' => function ( ApiMain $main, $format ) use ( $options ) { + $mock = $this->getMockFormatter( $main, $format ); + $mock->expects( $this->once() )->method( 'execute' ) + ->willReturnCallback( function () use ( $mock ) { + $mock->printText( "Format {$mock->getFormat()}: " ); + $mock->printText( "ok" ); + } ); + + if ( isset( $options['status'] ) ) { + $mock->setHttpStatus( $options['status'] ); + } + + return $mock; + }, + 'returnPrinter' => true, + ]; + + $this->setMwGlobals( [ + 'wgApiFrameOptions' => 'DENY', + ] ); + + $ret = parent::encodeData( $params, $data, $options ); + $printer = TestingAccessWrapper::newFromObject( $ret['printer'] ); + $text = $ret['text']; + + if ( $options['name'] !== 'mockfm' ) { + $ct = 'text/x-mock'; + $file = 'api-result.mock'; + $status = isset( $options['status'] ) ? $options['status'] : null; + } elseif ( isset( $params['wrappedhtml'] ) ) { + $ct = 'text/mediawiki-api-prettyprint-wrapped'; + $file = 'api-result-wrapped.json'; + $status = null; + + // Replace varying field + $text = preg_replace( '/"time":\d+/', '"time":1234', $text ); + } else { + $ct = 'text/html'; + $file = 'api-result.html'; +
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiComparePages: Add 'fromsection' and 'tosection' parameters
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401090 ) Change subject: ApiComparePages: Add 'fromsection' and 'tosection' parameters .. ApiComparePages: Add 'fromsection' and 'tosection' parameters The deprecated diffing in prop=revisions and such used a 'rvsection' parameter. To enable migration of things using that, action=compare needs corresponding section parameters. Bug: T183823 Change-Id: If1a0e2df614c083b37640418c69cca367ce0e895 --- M includes/api/ApiComparePages.php M includes/api/i18n/en.json M includes/api/i18n/qqq.json M tests/phpunit/includes/api/ApiComparePagesTest.php 4 files changed, 72 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/401090/1 diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index eb67bab..5486594 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -94,6 +94,26 @@ $this->dieWithError( 'apierror-baddiff' ); } + // Extract sections, if told to + if ( isset( $params['fromsection'] ) ) { + $fromContent = $fromContent->getSection( $params['fromsection'] ); + if ( !$fromContent ) { + $this->dieWithError( + [ 'apierror-compare-nosuchfromsection', wfEscapeWikiText( $params['fromsection'] ) ], + 'nosuchfromsection' + ); + } + } + if ( isset( $params['tosection'] ) ) { + $toContent = $toContent->getSection( $params['tosection'] ); + if ( !$toContent ) { + $this->dieWithError( + [ 'apierror-compare-nosuchtosection', wfEscapeWikiText( $params['tosection'] ) ], + 'nosuchtosection' + ); + } + } + // Get the diff $context = new DerivativeContext( $this->getContext() ); if ( $relRev && $relRev->getTitle() ) { @@ -444,6 +464,7 @@ 'text' => [ ApiBase::PARAM_TYPE => 'text' ], + 'section' => null, 'pst' => false, 'contentformat' => [ ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(), diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index e1360c8..cceed01 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -64,6 +64,7 @@ "apihelp-compare-param-fromid": "First page ID to compare.", "apihelp-compare-param-fromrev": "First revision to compare.", "apihelp-compare-param-fromtext": "Use this text instead of the content of the revision specified by fromtitle, fromid or fromrev.", + "apihelp-compare-param-fromsection": "Only use the specified section of the specified 'from' content.", "apihelp-compare-param-frompst": "Do a pre-save transform on fromtext.", "apihelp-compare-param-fromcontentmodel": "Content model of fromtext. If not supplied, it will be guessed based on the other parameters.", "apihelp-compare-param-fromcontentformat": "Content serialization format of fromtext.", @@ -72,6 +73,7 @@ "apihelp-compare-param-torev": "Second revision to compare.", "apihelp-compare-param-torelative": "Use a revision relative to the revision determined from fromtitle, fromid or fromrev. All of the other 'to' options will be ignored.", "apihelp-compare-param-totext": "Use this text instead of the content of the revision specified by totitle, toid or torev.", + "apihelp-compare-param-tosection": "Only use the specified section of the specified 'to' content.", "apihelp-compare-param-topst": "Do a pre-save transform on totext.", "apihelp-compare-param-tocontentmodel": "Content model of totext. If not supplied, it will be guessed based on the other parameters.", "apihelp-compare-param-tocontentformat": "Content serialization format of totext.", @@ -1675,6 +1677,8 @@ "apierror-chunk-too-small": "Minimum chunk size is $1 {{PLURAL:$1|byte|bytes}} for non-final chunks.", "apierror-cidrtoobroad": "$1 CIDR ranges broader than /$2 are not accepted.", "apierror-compare-no-title": "Cannot pre-save transform without a title. Try specifying fromtitle or totitle.", + "apierror-compare-nosuchfromsection": "There is no section $1 in the 'from' content.", + "apierror-compare-nosuchtosection": "There is no section $1 in the 'to' content.", "apier
[MediaWiki-commits] [Gerrit] mediawiki...TemplateSandbox[master]: Add missing visibility declarations
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401089 ) Change subject: Add missing visibility declarations .. Add missing visibility declarations And re-enable Squiz.Scope.MethodScope.Missing Change-Id: Ibafb0608942d195630355b4e6b69329a1f3b54ea --- M .phpcs.xml M SpecialTemplateSandbox.php 2 files changed, 5 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateSandbox refs/changes/89/401089/1 diff --git a/.phpcs.xml b/.phpcs.xml index bcfe27a..198c91b 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -6,7 +6,6 @@ - . diff --git a/SpecialTemplateSandbox.php b/SpecialTemplateSandbox.php index ee20ab7..43f8e5e 100644 --- a/SpecialTemplateSandbox.php +++ b/SpecialTemplateSandbox.php @@ -12,7 +12,7 @@ */ private $output = null; - function __construct() { + public function __construct() { parent::__construct( 'TemplateSandbox' ); } @@ -20,7 +20,7 @@ return 'wiki'; } - function execute( $par ) { + public function execute( $par ) { $this->setHeaders(); $this->checkPermissions(); @@ -115,7 +115,7 @@ * @param array $allData * @return bool|String */ - function validatePageParam( $value, $allData ) { + public function validatePageParam( $value, $allData ) { if ( $value === '' || $value === null ) { return true; } @@ -134,7 +134,7 @@ * @param array $allData * @return bool|String */ - function validateRevidParam( $value, $allData ) { + public function validateRevidParam( $value, $allData ) { if ( $value === '' || $value === null ) { return true; } @@ -150,7 +150,7 @@ * @param array $allData * @return bool|String */ - function validatePrefixParam( $value, $allData ) { + public function validatePrefixParam( $value, $allData ) { if ( $value === '' || $value === null ) { return true; } -- To view, visit https://gerrit.wikimedia.org/r/401089 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibafb0608942d195630355b4e6b69329a1f3b54ea Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TemplateSandbox Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ApiFeatureUsage[master]: Add missing visibility declarations
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401088 ) Change subject: Add missing visibility declarations .. Add missing visibility declarations And re-enable Squiz.Scope.MethodScope.Missing Change-Id: Ied209262eb592f80fe37b4ba684cf5844d7808d9 --- M .phpcs.xml M ApiQueryFeatureUsage.php M SpecialApiFeatureUsage.php 3 files changed, 3 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApiFeatureUsage refs/changes/88/401088/1 diff --git a/.phpcs.xml b/.phpcs.xml index 28c8136..d87bc24 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -6,7 +6,6 @@ - . diff --git a/ApiQueryFeatureUsage.php b/ApiQueryFeatureUsage.php index a3a32c6..edbac7e 100644 --- a/ApiQueryFeatureUsage.php +++ b/ApiQueryFeatureUsage.php @@ -5,7 +5,7 @@ parent::__construct( $query, $moduleName, 'afu' ); } - function execute() { + public function execute() { $params = $this->extractRequestParams(); $agent = $params['agent'] === null diff --git a/SpecialApiFeatureUsage.php b/SpecialApiFeatureUsage.php index d965053..28f11b9 100644 --- a/SpecialApiFeatureUsage.php +++ b/SpecialApiFeatureUsage.php @@ -2,11 +2,11 @@ class SpecialApiFeatureUsage extends SpecialPage { private $engine = null; - function __construct() { + public function __construct() { parent::__construct( 'ApiFeatureUsage' ); } - function execute( $par ) { + public function execute( $par ) { $this->setHeaders(); $this->checkPermissions(); -- To view, visit https://gerrit.wikimedia.org/r/401088 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ied209262eb592f80fe37b4ba684cf5844d7808d9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ApiFeatureUsage Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399913 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Change-Id: Ibc013a41f4a463f4014fbbce7ce27f8690161728 --- M includes/ApiQueryExtracts.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TextExtracts refs/changes/13/399913/1 diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php index 9b0e845..f4470e6 100644 --- a/includes/ApiQueryExtracts.php +++ b/includes/ApiQueryExtracts.php @@ -219,7 +219,9 @@ $apiException = null; if ( !$this->parserOptions ) { $this->parserOptions = new ParserOptions( new User( '127.0.0.1' ) ); - if ( is_callable( [ $this->parserOptions, 'setWrapOutputClass' ] ) ) { + if ( is_callable( [ $this->parserOptions, 'setWrapOutputClass' ] ) && + !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' ) + ) { $this->parserOptions->setWrapOutputClass( false ); } } @@ -227,7 +229,7 @@ if ( $page->shouldCheckParserCache( $this->parserOptions, 0 ) ) { $pout = MediaWikiServices::getInstance()->getParserCache()->get( $page, $this->parserOptions ); if ( $pout ) { - $text = $pout->getText(); + $text = $pout->getText( [ 'unwrap' => true ] ); if ( $this->params['intro'] ) { $text = $this->getFirstSection( $text, false ); } -- To view, visit https://gerrit.wikimedia.org/r/399913 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc013a41f4a463f4014fbbce7ce27f8690161728 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TextExtracts Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399914 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Change-Id: Ie936dff918dc0869503a924298b4580402038b52 Depends-On: Iba16e78c41be992467101e7d83e9c3134765b101 --- M client/tests/phpunit/includes/DataAccess/ParserFunctions/PropertyParserFunctionIntegrationTest.php M client/tests/phpunit/includes/DataAccess/ParserFunctions/StatementsParserFunctionIntegrationTest.php 2 files changed, 14 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/14/399914/1 diff --git a/client/tests/phpunit/includes/DataAccess/ParserFunctions/PropertyParserFunctionIntegrationTest.php b/client/tests/phpunit/includes/DataAccess/ParserFunctions/PropertyParserFunctionIntegrationTest.php index 82bdc1c..cf2f8f7 100644 --- a/client/tests/phpunit/includes/DataAccess/ParserFunctions/PropertyParserFunctionIntegrationTest.php +++ b/client/tests/phpunit/includes/DataAccess/ParserFunctions/PropertyParserFunctionIntegrationTest.php @@ -76,7 +76,7 @@ public function testPropertyParserFunction_byPropertyLabel() { $result = $this->parseWikitextToHtml( '{{#property:LuaTestStringProperty}}' ); - $this->assertSame( "Lua :)\n", $result->getText() ); + $this->assertSame( "Lua :)\n", $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -88,7 +88,7 @@ public function testPropertyParserFunction_byPropertyId() { $result = $this->parseWikitextToHtml( '{{#property:P342}}' ); - $this->assertSame( "Lua :)\n", $result->getText() ); + $this->assertSame( "Lua :)\n", $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -100,7 +100,7 @@ public function testPropertyParserFunction_arbitraryAccess() { $result = $this->parseWikitextToHtml( '{{#property:P342|from=Q32488}}' ); - $this->assertSame( "Lua :)\n", $result->getText() ); + $this->assertSame( "Lua :)\n", $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -112,7 +112,7 @@ public function testPropertyParserFunction_multipleValues() { $result = $this->parseWikitextToHtml( '{{#property:P342|from=Q32489}}' ); - $this->assertSame( "Lua :), Lua :)\n", $result->getText() ); + $this->assertSame( "Lua :), Lua :)\n", $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -124,7 +124,7 @@ public function testPropertyParserFunction_arbitraryAccessNotFound() { $result = $this->parseWikitextToHtml( '{{#property:P342|from=Q1234567}}' ); - $this->assertSame( '', $result->getText() ); + $this->assertSame( '', $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -138,7 +138,7 @@ $this->assertRegExp( '/.*P2147483647.*<\/p>/', - $result->getText() + $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); @@ -154,7 +154,7 @@ 'A page not connected to an item' ); - $this->assertSame( '', $result->getText() ); + $this->assertSame( '', $result->getText( [ 'unwrap' => true ] ) ); $usageAccumulator = new ParserOutputUsageAccumulator( $result ); $this->assertArrayEquals( @@ -171,12 +171,6 @@ */ private function parseWikitextToHtml( $wikiText, $title = 'WikibaseClientDataAccessTest' ) { $popt = new ParserOptions( User::newFromId( 0 ), Language::factory( 'en' ) ); - - // FIXME: The conditional is a temporary workaround, remove when done! See T37247. - if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) ) { - $popt->setWrapOutputClass( false ); - } - $parser = new Parser( [ 'class' => 'Parser' ] )
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove wrapclass from parser cache key
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399908 ) Change subject: Remove wrapclass from parser cache key .. Remove wrapclass from parser cache key This will result in an exception from WikiPage::getParserOutput() if anything was missed. This also hard-deprecates ParserOptions::setWrapOutputClass( false ) Bug: T181846 Change-Id: Ica541e1f6b52f5eec6d28cff60ba64bf525258c7 Depends-On: Ie5d6c5ce34c05b8fe2353d3bb36b2a3a4166ec4b Depends-On: Ibfaefde2f3811151ec712554cbc9cf2415ed017f Depends-On: I55048bbae5d4d2d0c79c241c1784448b82db3bb4 Depends-On: I23a26ba0dfbe83007cd40e97d71a2139a5ecddc7 Depends-On: Ibc013a41f4a463f4014fbbce7ce27f8690161728 Depends-On: Ie936dff918dc0869503a924298b4580402038b52 --- M RELEASE-NOTES-1.31 M includes/parser/ParserOptions.php M tests/phpunit/includes/parser/ParserOptionsTest.php 3 files changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/08/399908/1 diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 31d3f51..c6ae6dc 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -148,6 +148,9 @@ * WatchedItem::DEPRECATED_USAGE_TIMESTAMP * Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the 'unwrap' transform to ParserOutput::getText() instead. +* ParserOutput objects generated using a non-default value for + ParserOptions::setWrapOutputClass() can no longer be added to the parser + cache. == Compatibility == MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index a40ef12..21dfcb2 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -65,7 +65,6 @@ 'stubthreshold' => true, 'printable' => true, 'userlang' => true, - 'wrapclass' => true, ]; /** @@ -788,6 +787,9 @@ if ( $className === true ) { // DWIM, they probably want the default class name $className = 'mw-parser-output'; } + if ( $className === false ) { + wfDeprecated( __METHOD__ . '( false )', '1.31' ); + } return $this->setOption( 'wrapclass', $className ); } diff --git a/tests/phpunit/includes/parser/ParserOptionsTest.php b/tests/phpunit/includes/parser/ParserOptionsTest.php index f941b8d..a8f542f 100644 --- a/tests/phpunit/includes/parser/ParserOptionsTest.php +++ b/tests/phpunit/includes/parser/ParserOptionsTest.php @@ -18,7 +18,6 @@ 'stubthreshold' => true, 'printable' => true, 'userlang' => true, - 'wrapclass' => true, ]; } @@ -63,6 +62,9 @@ ] ], 'Non-in-key options are not ok' => [ false, [ 'removeComments' => false, + ] ], + 'Non-in-key options are not ok (2)' => [ false, [ + 'wrapclass' => 'foobar', ] ], 'Canonical override, not default (1)' => [ true, [ 'tidy' => true, @@ -210,7 +212,7 @@ $wgHooks['ParserOptionsRegister'] = []; $this->assertSame( [ 'dateformat', 'numberheadings', 'printable', 'stubthreshold', - 'thumbsize', 'userlang', 'wrapclass', + 'thumbsize', 'userlang' ], ParserOptions::allCacheVaryingOptions() ); self::clearCache(); @@ -228,7 +230,7 @@ }; $this->assertSame( [ 'dateformat', 'foo', 'numberheadings', 'printable', 'stubthreshold', - 'thumbsize', 'userlang', 'wrapclass', + 'thumbsize', 'userlang' ], ParserOptions::allCacheVaryingOptions() ); } -- To view, visit https://gerrit.wikimedia.org/r/399908 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica541e1f6b52f5eec6d28cff60ba64bf525258c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ParsoidBatchAPI[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399911 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Change-Id: I55048bbae5d4d2d0c79c241c1784448b82db3bb4 --- M includes/ApiParsoidBatch.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParsoidBatchAPI refs/changes/11/399911/1 diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php index 7bbf4e9..cc5b95b 100644 --- a/includes/ApiParsoidBatch.php +++ b/includes/ApiParsoidBatch.php @@ -241,12 +241,14 @@ $contentHandler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT ); $options = $contentHandler->makeParserOptions( $this->getContext() ); $options->enableLimitReport( false ); - if ( is_callable( [ $options, 'setWrapOutputClass' ] ) ) { + if ( is_callable( [ $options, 'setWrapOutputClass' ] ) && + !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' ) + ) { $options->setWrapOutputClass( false ); // Parsoid doesn't want the output wrapper } $out = $wgParser->parse( $text, $title, $options, true, true, $revid ); return [ - 'text' => $out->getText(), + 'text' => $out->getText( [ 'unwrap' => true ] ), 'modules' => array_values( array_unique( $out->getModules() ) ), 'modulescripts' => array_values( array_unique( $out->getModuleScripts() ) ), 'modulestyles' => array_values( array_unique( $out->getModuleStyles() ) ), -- To view, visit https://gerrit.wikimedia.org/r/399911 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I55048bbae5d4d2d0c79c241c1784448b82db3bb4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ParsoidBatchAPI Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399910 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when available To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Change-Id: Ibfaefde2f3811151ec712554cbc9cf2415ed017f --- M includes/api/ApiMobileView.php M tests/phpunit/api/ApiMobileViewTest.php 2 files changed, 10 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/10/399910/1 diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php index c3380c9..81496f4 100644 --- a/includes/api/ApiMobileView.php +++ b/includes/api/ApiMobileView.php @@ -478,7 +478,9 @@ */ protected function makeParserOptions( WikiPage $wp ) { $popt = $wp->makeParserOptions( $this ); - if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) ) { + if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) + !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' ) + ) { // Let the client handle it. $popt->setWrapOutputClass( false ); } @@ -618,7 +620,7 @@ $this->dieWithError( 'apierror-mobilefrontend-badidtitle', 'invalidparams' ); return; } - $html = $parserOutput->getText( [ 'allowTOC' => false ] ); + $html = $parserOutput->getText( [ 'allowTOC' => false, 'unwrap' => true ] ); $cacheExpiry = $parserOutput->getCacheExpiry(); } diff --git a/tests/phpunit/api/ApiMobileViewTest.php b/tests/phpunit/api/ApiMobileViewTest.php index 32dae27..f761ca4 100644 --- a/tests/phpunit/api/ApiMobileViewTest.php +++ b/tests/phpunit/api/ApiMobileViewTest.php @@ -25,7 +25,9 @@ if ( !defined( 'ParserOutput::SUPPORTS_STATELESS_TRANSFORMS' ) ) { $po->setTOCEnabled( false ); } - $po->setText( str_replace( [ "\r", "\n" ], '', $po->getText( [ 'allowTOC' => false ] ) ) ); + $po->setText( str_replace( [ "\r", "\n" ], '', $po->getText( [ + 'allowTOC' => false, 'unwrap' => true, + ] ) ) ); return $po; } @@ -36,7 +38,9 @@ protected function makeParserOptions( WikiPage $wp ) { $popt = new ParserOptions( $this->getUser() ); - if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) ) { + if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) + !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' ) + ) { // Let the client handle it. $popt->setWrapOutputClass( false ); } -- To view, visit https://gerrit.wikimedia.org/r/399910 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibfaefde2f3811151ec712554cbc9cf2415ed017f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add 'unwrap' ParserOutput post-cache transform
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399907 ) Change subject: Add 'unwrap' ParserOutput post-cache transform .. Add 'unwrap' ParserOutput post-cache transform And deprecate passing false for ParserOptions::setWrapOutputClass(). There are three cases for the Parser wrapper: the default mw-parser-output, a custom wrapper, or no wrapper. As things currently stand, we have to fragment the parser cache on each of these options, which uses a nontrival amount of storage space (T167784). Ideally we'd do all the wrapping as a post-cache transform, but TemplateStyles needs to know the wrapper in use in order to properly prefix its CSS rules (that's why we added the wrapper in the first place). So, second best option is to make *un*wrapping be a post-cache transform and make "custom wrapper" be uncacheable. This patch does the first bit (unwrapping as a post-cache transform), and a followup will do the second part once the deprecation process is satisfied. Bug: T181846 Change-Id: Iba16e78c41be992467101e7d83e9c3134765b101 --- M RELEASE-NOTES-1.31 M includes/Message.php M includes/api/ApiParse.php M includes/cache/MessageCache.php M includes/installer/Installer.php M includes/parser/ParserOptions.php M includes/parser/ParserOutput.php M tests/parser/ParserTestRunner.php M tests/phpunit/includes/ExtraParserTest.php M tests/phpunit/includes/parser/ParserOptionsTest.php M tests/phpunit/includes/parser/ParserOutputTest.php M tests/phpunit/includes/parser/TagHooksTest.php 12 files changed, 94 insertions(+), 41 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/07/399907/1 diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 1a1a9f7..31d3f51 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -146,6 +146,8 @@ * WatchedItem::IGNORE_USER_RIGHTS * WatchedItem::CHECK_USER_RIGHTS * WatchedItem::DEPRECATED_USAGE_TIMESTAMP +* Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the + 'unwrap' transform to ParserOutput::getText() instead. == Compatibility == MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for diff --git a/includes/Message.php b/includes/Message.php index e55eaaf..fac9a59 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -1245,7 +1245,14 @@ ); return $out instanceof ParserOutput - ? $out->getText( [ 'enableSectionEditLinks' => false ] ) + ? $out->getText( [ + 'enableSectionEditLinks' => false, + // Wrapping messages in an extra is probably not expected. If + // they're outside the content area they probably shouldn't be + // targeted by CSS that's targeting the parser output, and if + // they're inside they already are from the outer div. + 'unwrap' => true, + ] ) : $out; } diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index ec015da..d512397 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -346,6 +346,7 @@ $result_array['text'] = $p_result->getText( [ 'allowTOC' => !$params['disabletoc'], 'enableSectionEditLinks' => !$params['disableeditsection'], + 'unwrap' => $params['wrapoutputclass'] === '', ] ); $result_array[ApiResult::META_BC_SUBELEMENTS][] = 'text'; } @@ -540,9 +541,9 @@ if ( $params['disabletidy'] ) { $popts->setTidy( false ); } - $popts->setWrapOutputClass( - $params['wrapoutputclass'] === '' ? false : $params['wrapoutputclass'] - ); + if ( $params['wrapoutputclass'] !== '' ) { + $popts->setWrapOutputClass( $params['wrapoutputclass'] ); + } $reset = null; $suppressCache = false; diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 768f980..9f944b5 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -193,7 +193,6 @@ $po = ParserOptions::newFromAnon(); $po->setEditSection( false ); $po->setAllowUnsafeRawHtml( false ); - $po->setWrapOutputClass( false ); return $po; } @@ -203,11 +202,6 @@ // from malicious sources. As a precaution, disable // the parser
[MediaWiki-commits] [Gerrit] mediawiki...CiteThisPage[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399909 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Depends-On: Iba16e78c41be992467101e7d83e9c3134765b101 Change-Id: Ie5d6c5ce34c05b8fe2353d3bb36b2a3a4166ec4b --- M SpecialCiteThisPage.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CiteThisPage refs/changes/09/399909/1 diff --git a/SpecialCiteThisPage.php b/SpecialCiteThisPage.php index 9a17686..61b0718 100644 --- a/SpecialCiteThisPage.php +++ b/SpecialCiteThisPage.php @@ -186,8 +186,6 @@ */ public function citationTag( $text, $params, Parser $parser ) { $parserOptions = $this->getParserOptions(); - // This will be inserted into the output of another parser, so there will actually be a wrapper - $parserOptions->setWrapOutputClass( false ); $ret = $this->citationParser->parse( $text, @@ -198,6 +196,8 @@ return $ret->getText( [ 'enableSectionEditLinks' => false, + // This will be inserted into the output of another parser, so there will actually be a wrapper + 'unwrap' => true, ] ); } -- To view, visit https://gerrit.wikimedia.org/r/399909 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie5d6c5ce34c05b8fe2353d3bb36b2a3a4166ec4b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CiteThisPage Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...TemplateStyles[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399912 ) Change subject: Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) .. Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ) To reduce parser cache fragmentation, core is deprecating $parserOptions->setWrapOutputClass( false ) in favor of $parserOutput->getText( [ 'unwrap' => true ] ); Change-Id: I23a26ba0dfbe83007cd40e97d71a2139a5ecddc7 Depends-On: Iba16e78c41be992467101e7d83e9c3134765b101 --- M tests/phpunit/TemplateStylesHooksTest.php 1 file changed, 12 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateStyles refs/changes/12/399912/1 diff --git a/tests/phpunit/TemplateStylesHooksTest.php b/tests/phpunit/TemplateStylesHooksTest.php index deb8b7d..16f927b 100644 --- a/tests/phpunit/TemplateStylesHooksTest.php +++ b/tests/phpunit/TemplateStylesHooksTest.php @@ -134,7 +134,7 @@ * tag's output depends on the revision IDs of the input pages. * @dataProvider provideTag */ - public function testTag( ParserOptions $popt, $wikitext, $expect ) { + public function testTag( ParserOptions $popt, $getTextOptions, $wikitext, $expect ) { global $wgParserConf; $this->setMwGlobals( [ @@ -170,7 +170,7 @@ $out = $parser->parse( $wikitext, Title::newFromText( 'Test' ), $popt ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle - $this->assertEquals( $expect, $out->getText() ); + $this->assertEquals( $expect, $out->getText( $getTextOptions ) ); } public static function provideTag() { @@ -178,72 +178,71 @@ $popt->setWrapOutputClass( 'templatestyles-test' ); $popt2 = ParserOptions::newFromContext( RequestContext::getMain() ); - $popt2->setWrapOutputClass( false ); return [ 'Tag without src' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "TemplateStyles' src attribute must not be empty.\n", // @codingStandardsIgnoreEnd ], 'Tag with invalid src' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "Invalid title for TemplateStyles' src attribute.\n", // @codingStandardsIgnoreEnd ], 'Tag with valid but nonexistent title' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "Page Template:ThisDoes'''Not'''Exist has no content.\n", // @codingStandardsIgnoreEnd ], 'Tag with valid but nonexistent title, main namespace' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "Page ThisDoes'''Not'''Exist has no content.\n", // @codingStandardsIgnoreEnd ], 'Tag with wikitext page' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "Page Template:TemplateStyles test/wikitext must have content model \"Sanitized CSS\" for TemplateStyles (current model is \"wikitext\").\n", // @codingStandardsIgnoreEnd ], 'Tag with CSS (not sanitized-css) page' => [ - $popt, + $popt, [], '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong "Page Template:TemplateStyles test/nonsanitized.css must have content model \"Sanitized CSS\" for TemplateStyles (current model is \"CSS\").\n", // @codingStandardsIgnoreEnd
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use new TagMultiselectWidget in ApiSandbox
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399427 ) Change subject: Use new TagMultiselectWidget in ApiSandbox .. Use new TagMultiselectWidget in ApiSandbox It seems to be generally a 1:1 replacement. Bug: T183299 Change-Id: I191a99bd373b0fb320770e9089278a16964d80d2 --- M resources/src/mediawiki.special/mediawiki.special.apisandbox.js 1 file changed, 20 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/27/399427/1 diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js index ff4335a..09b872b 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js @@ -121,9 +121,9 @@ } }, - capsuleWidget: { + tagWidget: { getApiValue: function () { - var items = this.getItemsData(); + var items = this.getValue(); if ( items.join( '' ).indexOf( '|' ) === -1 ) { return items.join( '|' ); } else { @@ -132,13 +132,13 @@ }, setApiValue: function ( v ) { if ( v === undefined || v === '' || v === '\x1f' ) { - this.setItemsFromData( [] ); + this.setValue( [] ); } else { v = String( v ); if ( v.indexOf( '\x1f' ) !== 0 ) { - this.setItemsFromData( v.split( '|' ) ); + this.setValue( v.split( '|' ) ); } else { - this.setItemsFromData( v.substr( 1 ).split( '\x1f' ) ); + this.setValue( v.substr( 1 ).split( '\x1f' ) ); } } }, @@ -149,8 +149,8 @@ if ( !suppressErrors ) { ok = this.getApiValue() !== undefined && !( pi.allspecifier !== undefined && - this.getItemsData().length > 1 && - this.getItemsData().indexOf( pi.allspecifier ) !== -1 + this.getValue().length > 1 && + this.getValue().indexOf( pi.allspecifier ) !== -1 ); } @@ -158,8 +158,8 @@ this.setIconTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() ); return $.Deferred().resolve( ok ).promise(); }, - createItemWidget: function ( data, label ) { - var item = OO.ui.CapsuleMultiselectWidget.prototype.createItemWidget.call( this, data, label ); + createTagItemWidget: function ( data, label ) { + var item = OO.ui.TagMultiselectWidget.prototype.createTagItemWidget.call( this, data, label ); if ( this.paramInfo.deprecatedvalues && this.paramInfo.deprecatedvalues.indexOf( data ) >= 0 ) { @@ -336,13 +336,13 @@ case 'string': case 'user': if ( Util.apiBool( pi.multi ) ) { - widget = new OO.ui.CapsuleMultiselectWidget( { + widget = new OO.ui.TagMultiselectWidget( { allowArbitrary: true, allowDuplicates: Util.apiBool( pi.allowsduplicates ), $overlay: $( '#mw-apisandbox-ui' ) } ); widget.paramInfo = pi; - $.extend( widget, WidgetMethods.capsuleWidget ); + $.extend( widget, WidgetMethods.tagWidget ); } else {
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiBlock: Improve username validation
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399190 ) Change subject: ApiBlock: Improve username validation .. ApiBlock: Improve username validation The current username validation lets any invalid username through, on the assumption that it's an IP address. We can do better: call the backend to get the actual type and target, and reject anything with TYPE_USER where the actual input name is invalid (regardless of underlying mangling for stuff like T31797). Bug: T183211 Change-Id: I676642eee1222447df22a1c32b24f55e6273bcec --- M includes/api/ApiBlock.php 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/399190/1 diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index 4d37af3..366a6df 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -67,12 +67,12 @@ $params['user'] = $username; } } else { - $target = User::newFromName( $params['user'] ); + list( $target, $type ) = SpecialBlock::getTargetAndType( $params['user'] ); // T40633 - if the target is a user (not an IP address), but it // doesn't exist or is unusable, error. - if ( $target instanceof User && - ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $target->getName() ) ) + if ( $type === Block::TYPE_USER && + ( $target->isAnon() /* doesn't exist */ || !User::isUsableName( $params['user'] ) ) ) { $this->dieWithError( [ 'nosuchusershort', $params['user'] ], 'nosuchuser' ); } -- To view, visit https://gerrit.wikimedia.org/r/399190 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I676642eee1222447df22a1c32b24f55e6273bcec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiMain: Fix call to Linker::makeHeadline()
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398850 ) Change subject: ApiMain: Fix call to Linker::makeHeadline() .. ApiMain: Fix call to Linker::makeHeadline() It's required that the $attribs parameter also contain the closing '>'. Bug: T183125 Change-Id: Ic3015067a6b1e95e3487a8580e6a9aa8a6c280ed --- M includes/api/ApiMain.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/50/398850/1 diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index edc1a3e..3bda3e8 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1933,7 +1933,7 @@ $id = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_PRIMARY ); $idFallback = Sanitizer::escapeIdForAttribute( 'main/datatypes', Sanitizer::ID_FALLBACK ); $headline = Linker::makeHeadline( min( 6, $level ), - ' class="apihelp-header"', + ' class="apihelp-header">', $id, $header, '', @@ -1961,7 +1961,7 @@ $id = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_PRIMARY ); $idFallback = Sanitizer::escapeIdForAttribute( 'main/credits', Sanitizer::ID_FALLBACK ); $headline = Linker::makeHeadline( min( 6, $level ), - ' class="apihelp-header"', + ' class="apihelp-header">', $id, $header, '', -- To view, visit https://gerrit.wikimedia.org/r/398850 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3015067a6b1e95e3487a8580e6a9aa8a6c280ed Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix typo in ImportHandleUnknownUser hook documentation
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398512 ) Change subject: Fix typo in ImportHandleUnknownUser hook documentation .. Fix typo in ImportHandleUnknownUser hook documentation Change-Id: Ib37facf546e3088cc64373882bb276d2703575b4 --- M docs/hooks.txt 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/12/398512/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index 29883b2..ee38ea9 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1840,7 +1840,7 @@ Return false to stop further processing of the tag $reader: XMLReader object -'ImportHandleUnknownUser': When a user does exist locally, this hook is called +'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name: User name -- To view, visit https://gerrit.wikimedia.org/r/398512 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib37facf546e3088cc64373882bb276d2703575b4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/puppet[production]: Fix 'sql' script for multi-instance hosts
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/397912 ) Change subject: Fix 'sql' script for multi-instance hosts .. Fix 'sql' script for multi-instance hosts It needs to extract the port, if one is present, to pass host and port separately to mysql's `-h` and `--port` options. Bug: T182713 Change-Id: Icc0fdf43e226f21dbb5e7de7b7cf74f834382cf3 --- M modules/scap/files/sql 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/12/397912/1 diff --git a/modules/scap/files/sql b/modules/scap/files/sql index 05fa44d..01fe9c9 100755 --- a/modules/scap/files/sql +++ b/modules/scap/files/sql @@ -68,7 +68,13 @@ exit 1 fi +port=0 +if echo "$host" | grep -qP ':\d+\z'; then +port=`echo "$host" | sed 's/.*://'` +host=`echo "$host" | sed 's/:[0-9]\+$//'` +fi + pass=`echo 'echo \$wgDBadminpassword;' | /usr/local/bin/mwscript eval.php --wiki="$lookupdb"` # Execute mysql. -exec mysql -u wikiadmin -p$pass -h $host -D $db "$@" +exec mysql -u wikiadmin -p$pass -h "$host" --port $port -D $db "$@" -- To view, visit https://gerrit.wikimedia.org/r/397912 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icc0fdf43e226f21dbb5e7de7b7cf74f834382cf3 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/puppet[production]: Add --replica parameter to sql script
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/397913 ) Change subject: Add --replica parameter to sql script .. Add --replica parameter to sql script I've often had a need to connect to a specific replica for debugging. Let's make it easy to do so. Also, add a --list-replicas parameter to list those replica names. Change-Id: Ic08bdf59693feec8cb75ea3954cb5e9de09f8fb2 --- M modules/scap/files/sql 1 file changed, 28 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/13/397913/1 diff --git a/modules/scap/files/sql b/modules/scap/files/sql index 01fe9c9..46f84a7 100755 --- a/modules/scap/files/sql +++ b/modules/scap/files/sql @@ -11,7 +11,7 @@ shift if [ -z "$db" ] || [ "$db" = "--help" ]; then -echo 'Usage: sql [--write | --group group] [mysqloptions]' +echo 'Usage: sql [--write | --group group | --replica name | --list-replicas] [mysqloptions]' exit 0 elif [ "$db" = "--write" ]; then hostcode="echo \$lb->getServerName(0);" @@ -28,7 +28,27 @@ echo "group must be a string containing only lowercase letters" exit 1 fi -hostcode="\$index = \$lb->getReaderIndex('"$group"'); if(\$index === false) exit(101); echo \$lb->getServerName(\$index);" +hostcode="\$index = \$lb->getReaderIndex('$group'); if(\$index === false) exit(101); echo \$lb->getServerName(\$index);" + +# Database is the next param +db=$1 +shift +elif [ "$db" = "--replica" ]; then +# Explicitly asked for a replica by name +name=$1 +shift + +if echo $name | grep -qvP '^[a-z0-9:]+\z'; then +echo "replica name must be a string containing only lowercase letters, numbers, and colons" +exit 1 +fi +hostcode="\$serverCount = \$lb->getServerCount(); for ( \$i = 0; \$i < \$serverCount; ++\$i ) { if ( \$lb->getServerName(\$i) === '$name' ) break; } if ( \$i >= \$serverCount ) exit(102); echo \$lb->getServerName(\$i);" + +# Database is the next param +db=$1 +shift +elif [ "$db" = "--list-replicas" ]; then +hostcode="\$serverCount = \$lb->getServerCount(); for ( \$i = 0; \$i < \$serverCount; ++\$i ) { echo ( \$i ? ' ' : '' ) . \$lb->getServerName(\$i); } exit(103);" # Database is the next param db=$1 @@ -55,13 +75,18 @@ else lbcode="\$lb = wfGetLB();" fi -host=`echo $lbcode $hostcode | /usr/local/bin/mwscript eval.php --wiki="$lookupdb"` +host=`echo "$lbcode $hostcode" | /usr/local/bin/mwscript eval.php --wiki="$lookupdb"` exitCode=$? if [ $exitCode -ne 0 ]; then # PHP error, probably an invalid DB or group if [ $exitCode -eq 101 ]; then echo "Error looking up group \"$group\"" 1>&2 +elif [ $exitCode -eq 102 ]; then +echo "Error looking up replica \"$name\"" 1>&2 +elif [ $exitCode -eq 103 ]; then +echo "$host" +exit 1 else echo "Error looking up DB \"$db\"" 1>&2 fi -- To view, visit https://gerrit.wikimedia.org/r/397913 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic08bdf59693feec8cb75ea3954cb5e9de09f8fb2 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WIP: Migrate HistoryBlob to alternatives without PHP seriali...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/397632 ) Change subject: WIP: Migrate HistoryBlob to alternatives without PHP serialization .. WIP: Migrate HistoryBlob to alternatives without PHP serialization DONE: * Write the replacements for HistoryBlob. * Tests for the replacements. * Adjust code to be able to handle receiving them (untested). TODO: * Update the compression maintenance scripts. * Search for any other relevant unserialize() calls. * Actually write the new maintenance script(s). The ExternalStore multi-content HistoryBlob subclasses are migrated to the new MultiContentBlob classes. HistoryBlobCurStub is re-saved using modern methods, as should have been done long ago. HistoryBlobStub is an error. If for some reason you have some of these in your database, run the existing maintenance/storage/resolveStubs.php script first. Bug: T181555 Change-Id: Ia712c794c65ba9048462f223382e7953c5eb253f --- M autoload.php M includes/HistoryBlob.php M includes/Revision.php A includes/externalstore/ConcatenatedMultiContentBlob.php A includes/externalstore/DiffMultiContentBlob.php M includes/externalstore/ExternalStoreDB.php A includes/externalstore/MultiContentBlob.php A maintenance/storage/migrateHistoryBlobs.php M tests/common/TestsAutoLoader.php A tests/phpunit/includes/externalstore/ConcatenatedMultiContentBlobTest.php A tests/phpunit/includes/externalstore/DiffMultiContentBlobTest.php A tests/phpunit/includes/externalstore/MultiContentBlobTest.php A tests/phpunit/includes/externalstore/TestMultiContentBlob.php 13 files changed, 1,685 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/32/397632/1 diff --git a/autoload.php b/autoload.php index cd01828..6ecab67 100644 --- a/autoload.php +++ b/autoload.php @@ -885,6 +885,9 @@ 'MediaWiki\\EditPage\\TextConflictHelper' => __DIR__ . '/includes/editpage/TextConflictHelper.php', 'MediaWiki\\EditPage\\TextboxBuilder' => __DIR__ . '/includes/editpage/TextboxBuilder.php', 'MediaWiki\\Edit\\PreparedEdit' => __DIR__ . '/includes/edit/PreparedEdit.php', + 'MediaWiki\\ExternalStore\\ConcatenatedMultiContentBlob' => __DIR__ . '/includes/externalstore/ConcatenatedMultiContentBlob.php', + 'MediaWiki\\ExternalStore\\DiffMultiContentBlob' => __DIR__ . '/includes/externalstore/DiffMultiContentBlob.php', + 'MediaWiki\\ExternalStore\\MultiContentBlob' => __DIR__ . '/includes/externalstore/MultiContentBlob.php', 'MediaWiki\\HeaderCallback' => __DIR__ . '/includes/HeaderCallback.php', 'MediaWiki\\Interwiki\\ClassicInterwikiLookup' => __DIR__ . '/includes/interwiki/ClassicInterwikiLookup.php', 'MediaWiki\\Interwiki\\InterwikiLookup' => __DIR__ . '/includes/interwiki/InterwikiLookup.php', @@ -1004,6 +1007,7 @@ 'MessageSpecifier' => __DIR__ . '/includes/libs/MessageSpecifier.php', 'MigrateComments' => __DIR__ . '/maintenance/migrateComments.php', 'MigrateFileRepoLayout' => __DIR__ . '/maintenance/migrateFileRepoLayout.php', + 'MigrateHistoryBlobs' => __DIR__ . '/maintenance/storage/migrateHistoryBlobs.php', 'MigrateUserGroup' => __DIR__ . '/maintenance/migrateUserGroup.php', 'MimeAnalyzer' => __DIR__ . '/includes/libs/mime/MimeAnalyzer.php', 'MimeMagic' => __DIR__ . '/includes/MimeMagic.php', diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 14d22ec..07a7760 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -24,6 +24,7 @@ * Base class for general text storage via the "object" flag in old_flags, or * two-part external storage URLs. Used for represent efficient concatenated * storage, and migration-related pointer objects. + * @deprecated since 1.31, MediaWiki\ExternalStore\MultiContentBlob is the successor. */ interface HistoryBlob { /** @@ -69,6 +70,8 @@ /** * Concatenated gzip (CGZ) storage * Improves compression ratio by concatenating like objects before gzipping + * @deprecated since 1.31, MediaWiki\ExternalStore\ConcatenatedMultiContentBlob is the successor. + * Use maintenance/storage/migrateHistoryBlobs.php to replace references in the DB. */ class ConcatenatedGzipHistoryBlob implements HistoryBlob { public $mVersion = 0, $mCompressed = false, $mItems = [], $mDefaultHash = ''; @@ -183,6 +186,9 @@ /** * Pointer object for an item within a CGZ blob stored in the text table. + * @deprecated since 1.31, but really should have been so since 1.5. + * Use maintenance/storage/resolveStubs.php or + * maintenance/storage/migrateHistoryBlobs.php to replace references in the DB. */ class HistoryBlobStub { /** @@ -307,6 +313,9 @@ * * Serialized HistoryBlobCurStub objects will be inserted into the text table * on conversion if $wgLegacySchemaConversion is set to true. + * + * @deprecated si
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix MWDebugTest::testAppendDebugInfoToApiResultXmlFormat
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396427 ) Change subject: Fix MWDebugTest::testAppendDebugInfoToApiResultXmlFormat .. Fix MWDebugTest::testAppendDebugInfoToApiResultXmlFormat When this test was added in Ifb2e392d3, it did not pass the correct number of arguments to ApiFormatXml::recXmlPrint(). Bug: T182368 Change-Id: I63aee08307054137c6b50b6fbd271e03f6d4e45f --- M tests/phpunit/includes/debug/MWDebugTest.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/27/396427/1 diff --git a/tests/phpunit/includes/debug/MWDebugTest.php b/tests/phpunit/includes/debug/MWDebugTest.php index 5c65483..25cfd3c 100644 --- a/tests/phpunit/includes/debug/MWDebugTest.php +++ b/tests/phpunit/includes/debug/MWDebugTest.php @@ -110,7 +110,7 @@ $this->assertArrayHasKey( $expectedKey, $data['debuginfo'], "debuginfo has $expectedKey" ); } - $xml = ApiFormatXml::recXmlPrint( 'help', $data ); + $xml = ApiFormatXml::recXmlPrint( 'help', $data, null ); // exception not thrown $this->assertInternalType( 'string', $xml ); -- To view, visit https://gerrit.wikimedia.org/r/396427 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63aee08307054137c6b50b6fbd271e03f6d4e45f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiQueryBase: Fix addWhereFld for PHP 7.2
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396426 ) Change subject: ApiQueryBase: Fix addWhereFld for PHP 7.2 .. ApiQueryBase: Fix addWhereFld for PHP 7.2 Idfe23a07d didn't go far enough with this method, it can be passed arbitrary other scalars in addition to null and arrays. Bug: T182377 Change-Id: I63ec23f70d6d7ad638aa382b740ec44d0ca47f85 --- M includes/api/ApiQueryBase.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/26/396426/1 diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 8e9b1b4..179e6f7 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -262,7 +262,7 @@ * @param string|string[] $value Value; ignored if null or empty array; */ protected function addWhereFld( $field, $value ) { - if ( $value !== null && count( $value ) ) { + if ( $value !== null && !( is_array( $value ) && !$value ) ) { $this->where[$field] = $value; } } -- To view, visit https://gerrit.wikimedia.org/r/396426 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63ec23f70d6d7ad638aa382b740ec44d0ca47f85 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_30]: ImageListPager: Don't stomp on $join_conds
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396035 ) Change subject: ImageListPager: Don't stomp on $join_conds .. ImageListPager: Don't stomp on $join_conds When adding a join to the oldimage table to get counts, don't stomp on any existing values in $join_conds. Just add the condition. Bug: T182245 Change-Id: I4cd3332355f9974bdf35dc083be5bba537fcfb5f (cherry picked from commit 149081f1a7edbb3d8c81aac779e91d08faed1a99) --- M includes/specials/pagers/ImageListPager.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/35/396035/1 diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index 1c46f4c..008573b 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -288,7 +288,7 @@ $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) ); $options = [ 'GROUP BY' => array_merge( [ 'img_user' ], $columnlist ) ]; - $join_conds = [ 'oldimage' => [ 'LEFT JOIN', 'oi_name = img_name' ] ]; + $join_conds['oldimage'] = [ 'LEFT JOIN', 'oi_name = img_name' ]; } return [ -- To view, visit https://gerrit.wikimedia.org/r/396035 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4cd3332355f9974bdf35dc083be5bba537fcfb5f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_30 Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ImageListPager: Don't stomp on $join_conds
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/396019 ) Change subject: ImageListPager: Don't stomp on $join_conds .. ImageListPager: Don't stomp on $join_conds When adding a join to the oldimage table to get counts, don't stomp on any existing values in $join_conds. Just add the condition. Bug: T182245 Change-Id: I4cd3332355f9974bdf35dc083be5bba537fcfb5f --- M includes/specials/pagers/ImageListPager.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/19/396019/1 diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php index 1c46f4c..008573b 100644 --- a/includes/specials/pagers/ImageListPager.php +++ b/includes/specials/pagers/ImageListPager.php @@ -288,7 +288,7 @@ $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) ); $options = [ 'GROUP BY' => array_merge( [ 'img_user' ], $columnlist ) ]; - $join_conds = [ 'oldimage' => [ 'LEFT JOIN', 'oi_name = img_name' ] ]; + $join_conds['oldimage'] = [ 'LEFT JOIN', 'oi_name = img_name' ]; } return [ -- To view, visit https://gerrit.wikimedia.org/r/396019 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4cd3332355f9974bdf35dc083be5bba537fcfb5f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Revert "Set wgCommentTableSchemaMigrationStage = MIGRATION_W...
Hello Legoktm, jenkins-bot, I'd like you to do a code review. Please visit https://gerrit.wikimedia.org/r/395077 to review the following change. Change subject: Revert "Set wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_BOTH on test wikis" .. Revert "Set wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_BOTH on test wikis" This reverts commit 04bdc0534da4bdb32d7bfb37ecc8af83794d4894. Breaks with CentralAuth and ForeignDBViaLBRepo. Change-Id: I939b27c759c0ecd50b4ebd5c0358de9fb61f8b09 --- M wmf-config/InitialiseSettings.php 1 file changed, 0 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/77/395077/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 4309626..83b85cb 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -19764,9 +19764,6 @@ 'wgCommentTableSchemaMigrationStage' => [ 'default' => MIGRATION_OLD, - 'testwiki' => MIGRATION_WRITE_BOTH, - 'test2wiki' => MIGRATION_WRITE_BOTH, - 'testwikidatawiki' => MIGRATION_WRITE_BOTH, ], ]; -- To view, visit https://gerrit.wikimedia.org/r/395077 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I939b27c759c0ecd50b4ebd5c0358de9fb61f8b09 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Anomie Gerrit-Reviewer: Legoktm Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Set wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_BOT...
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395073 ) Change subject: Set wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_BOTH on test wikis .. Set wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_BOTH on test wikis The schema change is complete there. Let's start using it to see if stuff breaks. Bug: T166733 Change-Id: I08830984846cdc78698fcd34a0acaf36cd2d54fc --- M wmf-config/InitialiseSettings.php 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/73/395073/1 diff --git a/wmf-config/InitialiseSettings.php b/wmf-config/InitialiseSettings.php index 83b85cb..4309626 100644 --- a/wmf-config/InitialiseSettings.php +++ b/wmf-config/InitialiseSettings.php @@ -19764,6 +19764,9 @@ 'wgCommentTableSchemaMigrationStage' => [ 'default' => MIGRATION_OLD, + 'testwiki' => MIGRATION_WRITE_BOTH, + 'test2wiki' => MIGRATION_WRITE_BOTH, + 'testwikidatawiki' => MIGRATION_WRITE_BOTH, ], ]; -- To view, visit https://gerrit.wikimedia.org/r/395073 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I08830984846cdc78698fcd34a0acaf36cd2d54fc Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: API: Account for PHP 7.2 change
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395064 ) Change subject: API: Account for PHP 7.2 change .. API: Account for PHP 7.2 change PHP 7.2 broke existing functionality in making count( null ) raise a warning. So add tests for null all over the place, or change tests where we know the value is null or an array (but not false, empty-string, or 0) to just cast to boolean. Bug: T182004 Change-Id: Idfe23a07daa9f60eee72f2daf04304be87057a29 --- M includes/api/ApiDelete.php M includes/api/ApiEditPage.php M includes/api/ApiImageRotate.php M includes/api/ApiOptions.php M includes/api/ApiQueryAllPages.php M includes/api/ApiQueryBacklinks.php M includes/api/ApiQueryBacklinksprop.php M includes/api/ApiQueryBase.php M includes/api/ApiQueryCategoryMembers.php M includes/api/ApiQueryExtLinksUsage.php M includes/api/ApiQueryLinks.php M includes/api/ApiRevisionDelete.php M includes/api/ApiRollback.php M includes/api/ApiSetPageLanguage.php M includes/api/ApiTag.php M includes/api/ApiUserrights.php 16 files changed, 27 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/64/395064/1 diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index 7766acd..96c291c 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -59,7 +59,7 @@ // If change tagging was requested, check that the user is allowed to tag, // and the tags are valid - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( !$tagStatus->isOK() ) { $this->dieStatus( $tagStatus ); diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 94d6e97..26d4fd1 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -334,7 +334,7 @@ } // Apply change tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); if ( $tagStatus->isOK() ) { $requestArray['wpChangeTags'] = implode( ',', $params['tags'] ); diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 71bda6d..0568403 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -43,7 +43,7 @@ ] ); // Check if user can add tags - if ( count( $params['tags'] ) ) { + if ( $params['tags'] ) { $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $this->getUser() ); if ( !$ableToTag->isOK() ) { $this->dieStatus( $ableToTag ); diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 5b0d86a..14bd089 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -64,7 +64,7 @@ } $changes = []; - if ( count( $params['change'] ) ) { + if ( $params['change'] ) { foreach ( $params['change'] as $entry ) { $array = explode( '=', $entry, 2 ); $changes[$array[0]] = isset( $array[1] ) ? $array[1] : null; diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 315def0..a084279 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -136,12 +136,12 @@ } // Page protection filtering - if ( count( $params['prtype'] ) || $params['prexpiry'] != 'all' ) { + if ( $params['prtype'] || $params['prexpiry'] != 'all' ) { $this->addTables( 'page_restrictions' ); $this->addWhere( 'page_id=pr_page' ); $this->addWhere( "pr_expiry > {$db->addQuotes( $db->timestamp() )} OR pr_expiry IS NULL" ); - if ( count( $params['prtype'] ) ) { + if ( $params['prtype'] ) { $this->addWhereFld( 'pr_type', $params['prtype'] ); if ( isset( $params['prlevel'] ) ) { diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 54be254..830cc48 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -138,7 +138,7 @@ if ( count( $this->cont ) >= 2 ) { $op = $this->params['dir'] == 'descending' ? '<' : '>'; - if ( count( $this->params['namespace
[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[master]: Avoid passing null to count()
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395023 ) Change subject: Avoid passing null to count() .. Avoid passing null to count() PHP 7.2 made the questionable decision to raise a warning for count( null ). So test for null explicitly before calling count in the one place where null is expected. Bug: T181891 Change-Id: I94146c14b63e32ad1e9f2ab9de9ebc403b251102 --- M engines/LuaStandalone/LuaStandaloneEngine.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto refs/changes/23/395023/1 diff --git a/engines/LuaStandalone/LuaStandaloneEngine.php b/engines/LuaStandalone/LuaStandaloneEngine.php index d381590..728e3c0 100644 --- a/engines/LuaStandalone/LuaStandaloneEngine.php +++ b/engines/LuaStandalone/LuaStandaloneEngine.php @@ -432,7 +432,7 @@ } // Convert to a 1-based array - if ( count( $result ) ) { + if ( $result !== null && count( $result ) ) { $result = array_combine( range( 1, count( $result ) ), $result ); } else { $result = []; -- To view, visit https://gerrit.wikimedia.org/r/395023 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I94146c14b63e32ad1e9f2ab9de9ebc403b251102 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Scribunto Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Remove 'wbIsEditView' JS config var
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394642 ) Change subject: Remove 'wbIsEditView' JS config var .. Remove 'wbIsEditView' JS config var The PHP code doesn't know any longer whether the output will eventually be editable or not, since that's determine post-cache when something calls ParserOutput::getText(). Instead, have the JS code check for an element with class wikibase-toolbar-button-edit directly. Follows up I140ff32373430b61b92226689ef9b58cca317450, which brought Wikibase's behavior when previewing a diff to the current revision in line with MediaWiki core's behavior. Bug: T181807 Change-Id: I342cc900bd3fb8aaede97820d96a3488e3db0dff --- M repo/includes/Actions/ViewEntityAction.php M repo/resources/wikibase.ui.entityViewInit.js M repo/tests/phpunit/includes/Actions/ViewEntityActionTest.php 3 files changed, 21 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/42/394642/1 diff --git a/repo/includes/Actions/ViewEntityAction.php b/repo/includes/Actions/ViewEntityAction.php index 88946ce..89f5c9c 100644 --- a/repo/includes/Actions/ViewEntityAction.php +++ b/repo/includes/Actions/ViewEntityAction.php @@ -54,18 +54,6 @@ } /** -* Returns true if this view action is performing a plain view (not a diff, print version, etc.) -* of the page's current revision. -* -* @return bool -*/ - private function isEditable() { - return !$this->isDiff() - && !$this->getOutput()->isPrintable() - && $this->page->isCurrent(); - } - - /** * @return bool */ private function isDiff() { @@ -74,10 +62,7 @@ private function showEntityPage() { $outputPage = $this->getOutput(); - $editable = $this->isEditable(); - // NOTE: page-wide property, independent of user permissions - $outputPage->addJsConfigVars( 'wbIsEditView', $editable ); $this->page->view(); $this->overridePageMetaTags( $outputPage ); diff --git a/repo/resources/wikibase.ui.entityViewInit.js b/repo/resources/wikibase.ui.entityViewInit.js index b6c1382..96f09b0 100644 --- a/repo/resources/wikibase.ui.entityViewInit.js +++ b/repo/resources/wikibase.ui.entityViewInit.js @@ -11,8 +11,8 @@ * @return {boolean} */ function isEditable() { - return mw.config.get( 'wbIsEditView' ) - && mw.config.get( 'wgRelevantPageIsProbablyEditable' ); + return mw.config.get( 'wgRelevantPageIsProbablyEditable' ) + && $( '.wikibase-toolbar-button-edit' ).length; } /** diff --git a/repo/tests/phpunit/includes/Actions/ViewEntityActionTest.php b/repo/tests/phpunit/includes/Actions/ViewEntityActionTest.php index 73b6e88..6d7d89a 100644 --- a/repo/tests/phpunit/includes/Actions/ViewEntityActionTest.php +++ b/repo/tests/phpunit/includes/Actions/ViewEntityActionTest.php @@ -88,7 +88,7 @@ ], $metaTags ); } - public function testShowDiff() { + public function testShowDiff_latest() { $page = $this->getTestItemPage( 'Berlin' ); $latest = $page->getRevision(); @@ -97,6 +97,23 @@ $params = [ 'diff' => $latest->getId(), 'oldid' => $previous->getId() + ]; + + $output = $this->executeViewAction( $page, $params ); + + $this->assertContains( 'diff-currentversion-title', $output->getHTML(), 'is diff view' ); + $this->assertEditable( $output ); + } + + public function testShowDiff_notLatest() { + $page = $this->getTestItemPage( 'Berlin' ); + + $previous = $page->getRevision()->getPrevious(); + $previousPrevious = $latest->getPrevious(); + + $params = [ + 'diff' => $previous->getId(), + 'oldid' => $previousPrevious->getId() ]; $output = $this->executeViewAction( $page, $params ); @@ -181,9 +198,8 @@ $jsConfigVars = $output->getJSVars(); // This mirrors the check the front does in isEditable() in wikibase.ui.entityViewInit.js. - $this->assertArrayHasKey( 'wbIsEditView', $jsConfigVars ); + $this->assertContains( 'wikibase-toolbar-button-edit', $html ); $this->assertArrayHasKey( 'wgRelevantPageIsProbablyEditable', $jsConfigVars ); - $this->assertTrue( $jsConfigVars['wbIsEditView'], 'wbIsEditView is enabled' ); $this->assertTrue( $jsConfigVars['wgRelevantPageIsProbablyEditable'],
[MediaWiki-commits] [Gerrit] mediawiki...TemplateStyles[master]: Cache processed stylesheets during the parse
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394369 ) Change subject: Cache processed stylesheets during the parse .. Cache processed stylesheets during the parse If we've already processed a stylesheet once, there's no point in processing it again. Change-Id: I83f7aab82cc7674037974b0de43ccae6c77ff39f --- M TemplateStylesHooks.php M extension.json 2 files changed, 37 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateStyles refs/changes/69/394369/1 diff --git a/TemplateStylesHooks.php b/TemplateStylesHooks.php index 4742cab..5587a46 100644 --- a/TemplateStylesHooks.php +++ b/TemplateStylesHooks.php @@ -126,6 +126,7 @@ */ public static function onParserFirstCallInit( &$parser ) { $parser->setHook( 'templatestyles', 'TemplateStylesHooks::handleTag' ); + $parser->extTemplateStylesCache = new MapCacheLRU( 100 ); // 100 is arbitrary return true; } @@ -176,6 +177,14 @@ return false; } return true; + } + + /** +* Clear our cache when the parser is reset +* @param Parser $parser +*/ + public static function onParserClearState( Parser $parser ) { + $parser->extTemplateStylesCache->clear(); } /** @@ -235,13 +244,32 @@ ''; } - // For the moment just output the styles inline. - // @todo: If T160563 happens, it would be good to convert this to use that. + // If the revision actually has an ID, cache based on that. + // Otherwise, cache by hash. + if ( $rev->getId() ) { + $cacheKey = 'r' . $rev->getId(); + } else { + $cacheKey = sha1( $content->getNativeData() ); + } + + // Include any non-default wrapper class in the cache key too + $wrapClass = $parser->getOptions()->getWrapOutputClass(); + if ( $wrapClass === false ) { + $wrapClass = 'mw-parser-output'; + } + if ( $wrapClass !== 'mw-parser-output' ) { + $cacheKey .= '/' . $wrapClass; + } + + // Already cached? + if ( $parser->extTemplateStylesCache->has( $cacheKey ) ) { + return $parser->extTemplateStylesCache->get( $cacheKey ); + } $status = $content->sanitize( [ 'flip' => $parser->getTargetLanguage()->getDir() !== $wgContLang->getDir(), 'minify' => !ResourceLoader::inDebugMode(), - 'class' => $parser->getOptions()->getWrapOutputClass(), + 'class' => $wrapClass, ] ); $style = $status->isOk() ? $status->getValue() : '/* Fatal error, no CSS will be output */'; @@ -270,7 +298,9 @@ // Return the inline
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix timestamps in ImportTest
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394321 ) Change subject: Fix timestamps in ImportTest .. Fix timestamps in ImportTest They need to be passed through $db->timestamp(). Bug: T75174 Change-Id: I94ff961ae27220bcf15eda201677159f6c2d38ef --- M tests/phpunit/includes/import/ImportTest.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/21/394321/1 diff --git a/tests/phpunit/includes/import/ImportTest.php b/tests/phpunit/includes/import/ImportTest.php index 505653d..347d0fc 100644 --- a/tests/phpunit/includes/import/ImportTest.php +++ b/tests/phpunit/includes/import/ImportTest.php @@ -294,7 +294,7 @@ $row = $db->selectRow( 'revision', [ 'rev_user', 'rev_user_text' ], - [ 'rev_timestamp' => "201601010{$n}" ], + [ 'rev_timestamp' => $db->timestamp( "201601010{$n}" ) ], __METHOD__ ); $this->assertSame( @@ -306,7 +306,7 @@ $row = $db->selectRow( 'revision', [ 'rev_user', 'rev_user_text' ], - [ 'rev_timestamp' => "201601010{$n}0001" ], + [ 'rev_timestamp' => $db->timestamp( "201601010{$n}0001" ) ], __METHOD__ ); $this->assertSame( ( $assign ? '' : 'Xxx>' ) . $user->getName(), $row->rev_user_text ); -- To view, visit https://gerrit.wikimedia.org/r/394321 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I94ff961ae27220bcf15eda201677159f6c2d38ef Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Database: Fix degenerate parenthesized joins
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394140 ) Change subject: Database: Fix degenerate parenthesized joins .. Database: Fix degenerate parenthesized joins The SQL standard supports parenthesized joins like a JOIN (b JOIN c ON (...)) ON (...) But it doesn't support parenthesizing a single table name, i.e. a one-table "join", like a JOIN (b) ON (...) Detect the degenerate single-table case and omit the parentheses. Bug: T181674 Change-Id: I82cacd80465092aa67ff19bdcfd6682001bf12ab --- M includes/libs/rdbms/database/Database.php M tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php 2 files changed, 20 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/40/394140/1 diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index e04566e..b936779 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -2019,9 +2019,19 @@ if ( is_array( $table ) ) { // A parenthesized group - $joinedTable = '(' - . $this->tableNamesWithIndexClauseOrJOIN( $table, $use_index, $ignore_index, $join_conds ) - . ')'; + if ( count( $table ) > 1 ) { + $joinedTable = '(' + . $this->tableNamesWithIndexClauseOrJOIN( $table, $use_index, $ignore_index, $join_conds ) + . ')'; + } else { + // Degenerate case + $innerTable = reset( $table ); + $innerAlias = key( $table ); + $joinedTable = $this->tableNameWithAlias( + $innerTable, + is_string( $innerAlias ) ? $innerAlias : $innerTable + ); + } } else { $joinedTable = $this->tableNameWithAlias( $table, $alias ); } diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php index ee7ad2f..7933f19 100644 --- a/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php +++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseTest.php @@ -120,6 +120,13 @@ ], 'table1 LEFT JOIN (table2 JOIN table3 ON ((t2_id = t3_id))) ON ((t1_id = t2_id))' ], + 'join with degenerate parenthesized group' => [ + [ 'table1', 'n' => [ 't2' => 'table2' ] ], + [ + 'n' => [ 'LEFT JOIN', 't1_id = t2_id' ], + ], + 'table1 LEFT JOIN table2 t2 ON ((t1_id = t2_id))' + ], ]; } -- To view, visit https://gerrit.wikimedia.org/r/394140 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I82cacd80465092aa67ff19bdcfd6682001bf12ab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add wfWaitForSlaves() to maintenance/migrateComments.php
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394121 ) Change subject: Add wfWaitForSlaves() to maintenance/migrateComments.php .. Add wfWaitForSlaves() to maintenance/migrateComments.php Change-Id: Idb8d21116a52c473cc4658883fe13855bad9 --- M maintenance/migrateComments.php 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/21/394121/1 diff --git a/maintenance/migrateComments.php b/maintenance/migrateComments.php index 01ee9f8..c000871 100644 --- a/maintenance/migrateComments.php +++ b/maintenance/migrateComments.php @@ -144,6 +144,7 @@ $primaryKey = (array)$primaryKey; $pkFilter = array_flip( $primaryKey ); $this->output( "Beginning migration of $table.$oldField to $table.$newField\n" ); + wfWaitForSlaves(); $dbw = $this->getDB( DB_MASTER ); $next = '1=1'; @@ -206,6 +207,7 @@ } $prompt = join( ' ', array_reverse( $prompt ) ); $this->output( "... $prompt\n" ); + wfWaitForSlaves(); } $this->output( @@ -231,6 +233,7 @@ protected function migrateToTemp( $table, $primaryKey, $oldField, $newPrimaryKey, $newField ) { $newTable = $table . '_comment_temp'; $this->output( "Beginning migration of $table.$oldField to $newTable.$newField\n" ); + wfWaitForSlaves(); $dbw = $this->getDB( DB_MASTER ); $next = []; @@ -279,6 +282,7 @@ // Calculate the "next" condition $next = [ $primaryKey . ' > ' . $dbw->addQuotes( $row->$primaryKey ) ]; $this->output( "... {$row->$primaryKey}\n" ); + wfWaitForSlaves(); } $this->output( -- To view, visit https://gerrit.wikimedia.org/r/394121 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idb8d21116a52c473cc4658883fe13855bad9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Drop archive.ar_text and ar_flags
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/393929 ) Change subject: Drop archive.ar_text and ar_flags .. Drop archive.ar_text and ar_flags This should have been done long ago. Now it is being done. This also changes ar_text_id to NOT NULL, since it should never be null anymore. Bug: T33223 Change-Id: I18f1c740b7537c7dc3cfeba9b241d0a9f31caa34 --- M includes/Revision.php M includes/api/ApiQueryAllDeletedRevisions.php M includes/api/ApiQueryDeletedRevisions.php M includes/api/ApiQueryDeletedrevs.php M includes/installer/DatabaseUpdater.php M includes/page/PageArchive.php M includes/page/WikiPage.php A maintenance/archives/patch-drop-ar_text.sql M maintenance/migrateArchiveText.php A maintenance/mssql/archives/patch-drop-ar_text.sql M maintenance/mssql/tables.sql A maintenance/oracle/archives/patch-drop-ar_text.sql M maintenance/oracle/tables.sql A maintenance/postgres/archives/patch-drop-ar_text.sql M maintenance/postgres/tables.sql A maintenance/sqlite/archives/patch-drop-ar_text.sql M maintenance/storage/trackBlobs.php M maintenance/tables.sql M tests/phpunit/includes/RevisionTest.php 19 files changed, 127 insertions(+), 106 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/29/393929/1 diff --git a/includes/Revision.php b/includes/Revision.php index 25c89c2..8712d0b 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -219,13 +219,6 @@ $attribs['title'] = Title::makeTitle( $row->ar_namespace, $row->ar_title ); } - if ( isset( $row->ar_text ) && !$row->ar_text_id ) { - // Pre-1.5 ar_text row - $attribs['text'] = self::getRevisionText( $row, 'ar_' ); - if ( $attribs['text'] === false ) { - throw new MWException( 'Unable to load text from archive row (possibly T24624)' ); - } - } return new self( $attribs ); } @@ -492,7 +485,6 @@ 'ar_id', 'ar_page_id', 'ar_rev_id', - 'ar_text', 'ar_text_id', 'ar_timestamp', 'ar_user_text', @@ -646,7 +638,6 @@ 'ar_id', 'ar_page_id', 'ar_rev_id', - 'ar_text', 'ar_text_id', 'ar_timestamp', 'ar_user_text', diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index 765b5c7..9c5dce6 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -138,16 +138,11 @@ } if ( $this->fetchContent ) { - // Modern MediaWiki has the content for deleted revs in the 'text' - // table using fields old_text and old_flags. But revisions deleted - // pre-1.5 store the content in the 'archive' table directly using - // fields ar_text and ar_flags, and no corresponding 'text' row. So - // we have to LEFT JOIN and fetch all four fields. $this->addTables( 'text' ); $this->addJoinConds( [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ] ); - $this->addFields( [ 'ar_text', 'ar_flags', 'old_text', 'old_flags' ] ); + $this->addFields( [ 'old_text', 'old_flags' ] ); // This also means stricter restrictions $this->checkUserRightsAny( [ 'deletedtext', 'undelete' ] ); diff --git a/includes/api/ApiQueryDeletedRevisions.php b/includes/api/ApiQueryDeletedRevisions.php index 3339fec..edb3afb 100644 --- a/includes/api/ApiQueryDeletedRevisions.php +++ b/includes/api/ApiQueryDeletedRevisions.php @@ -90,16 +90,11 @@ } if ( $this->fetchContent ) { - // Modern MediaWiki has the content for deleted revs in the 'text' - // table using fields old_text and old_flags. But revisions deleted - // pre-1.5 store the content in the 'archive' table directly using - // fields ar_text and ar_flags, and no corresponding 'text' row. So - // we have to LEFT JOIN and fetch all four fields. $this->addTables( 'text' ); $this->addJoinConds( [ 'text' => [ 'LEFT JOIN', [ 'ar_text_id=old_id' ] ] ]
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Migrate ar_text to modern storage
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/393928 ) Change subject: Migrate ar_text to modern storage .. Migrate ar_text to modern storage This really should have been done a very long time ago. This adds a maintenance script to migrate rows with ar_text_id null to modern storage, either the text table or ExternalStore. Bug: T36925 Change-Id: I5608c6b6d3ecad516b785e13d668427c1b762e41 --- M autoload.php M includes/installer/DatabaseUpdater.php M includes/installer/MssqlUpdater.php M includes/installer/MysqlUpdater.php M includes/installer/OracleUpdater.php M includes/installer/PostgresUpdater.php M includes/installer/SqliteUpdater.php A maintenance/migrateArchiveText.php 8 files changed, 158 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/28/393928/1 diff --git a/autoload.php b/autoload.php index 51daced..7cf20a0 100644 --- a/autoload.php +++ b/autoload.php @@ -1001,6 +1001,7 @@ 'MessageContent' => __DIR__ . '/includes/content/MessageContent.php', 'MessageLocalizer' => __DIR__ . '/languages/MessageLocalizer.php', 'MessageSpecifier' => __DIR__ . '/includes/libs/MessageSpecifier.php', + 'MigrateArchiveText' => __DIR__ . '/maintenance/migrateArchiveText.php', 'MigrateComments' => __DIR__ . '/maintenance/migrateComments.php', 'MigrateFileRepoLayout' => __DIR__ . '/maintenance/migrateFileRepoLayout.php', 'MigrateUserGroup' => __DIR__ . '/maintenance/migrateUserGroup.php', diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 54ff712..6639fc8 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -1230,4 +1230,15 @@ } } + /** +* Migrate ar_text to modern storage +* @since 1.31 +*/ + protected function migrateArchiveText() { + $this->output( "Migrating archive ar_text to modern storage.\n" ); + $task = $this->maintenance->runChild( 'MigrateArchiveText', 'migrateArchiveText.php' ); + $task->execute(); + $this->output( "done.\n" ); + } + } diff --git a/includes/installer/MssqlUpdater.php b/includes/installer/MssqlUpdater.php index 411d2c8..cb5e59e 100644 --- a/includes/installer/MssqlUpdater.php +++ b/includes/installer/MssqlUpdater.php @@ -105,6 +105,9 @@ // 1.30 [ 'modifyField', 'image', 'img_media_type', 'patch-add-3d.sql' ], [ 'addIndex', 'site_stats', 'PRIMARY', 'patch-site_stats-pk.sql' ], + + // 1.31 + [ 'migrateArchiveText' ], ]; } diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 466ad0f..572a73b 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -329,6 +329,9 @@ [ 'renameIndex', 'l10n_cache', 'lc_lang_key', 'PRIMARY', false, 'patch-l10n_cache-primary-key.sql' ], [ 'doUnsignedSyncronisation' ], + + // 1.31 + [ 'migrateArchiveText' ], ]; } diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index 040b54a..73f37af 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -127,6 +127,9 @@ [ 'doAutoIncrementTriggers' ], [ 'addIndex', 'site_stats', 'PRIMARY', 'patch-site_stats-pk.sql' ], + // 1.31 + [ 'migrateArchiveText' ], + // KEEP THIS AT THE BOTTOM!! [ 'doRebuildDuplicateFunction' ], diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 91f569f..77d25d4 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -482,6 +482,9 @@ [ 'addPgField', 'protected_titles', 'pt_reason_id', 'INTEGER NOT NULL DEFAULT 0' ], [ 'addTable', 'comment', 'patch-comment-table.sql' ], [ 'addIndex', 'site_stats', 'site_stats_pkey', 'patch-site_stats-pk.sql' ], + + // 1.31 + [ 'migrateArchiveText' ], ]; } diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 9f71001..48cb991 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -193,6 +193,9 @@ [ 'migrateComments' ], [ 'renameIndex', 'l10n_cache', 'lc_lang_key', 'PRIMARY', false,
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/393790 ) Change subject: DNM .. DNM Testing something. Change-Id: Ib112f5ec43a23caf6b77d3d11665f77384e9890b --- M tests/phpunit/includes/api/ApiMainTest.php 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/90/393790/1 diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php index ad334e9..0af0aeb 100644 --- a/tests/phpunit/includes/api/ApiMainTest.php +++ b/tests/phpunit/includes/api/ApiMainTest.php @@ -11,6 +11,10 @@ */ class ApiMainTest extends ApiTestCase { + public function testFail() { + $this->fail( 'test' ); + } + /** * Test that the API will accept a FauxRequest and execute. */ -- To view, visit https://gerrit.wikimedia.org/r/393790 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib112f5ec43a23caf6b77d3d11665f77384e9890b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...TemplateStyles[master]: Deduplicate embedded style rules
Anomie has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/393285 ) Change subject: Deduplicate embedded style rules .. Deduplicate embedded style rules Use the facility added in core change I055abdf4d to deduplicate the embedded style rules. Bug: T168333 Change-Id: I98c6d5ca4b474de8826b19355f15a5230aef5650 Depends-On: I055abdf4d73ec65771eaa4fe0999ec907c831568 --- M TemplateStylesHooks.php M tests/phpunit/TemplateStylesHooksTest.php 2 files changed, 27 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateStyles refs/changes/85/393285/1 diff --git a/TemplateStylesHooks.php b/TemplateStylesHooks.php index 4742cab..0a14b75 100644 --- a/TemplateStylesHooks.php +++ b/TemplateStylesHooks.php @@ -235,13 +235,15 @@ ''; } - // For the moment just output the styles inline. - // @todo: If T160563 happens, it would be good to convert this to use that. + $wrapClass = $parser->getOptions()->getWrapOutputClass(); + if ( $wrapClass === false ) { + $wrapClass = 'mw-parser-output'; + } $status = $content->sanitize( [ 'flip' => $parser->getTargetLanguage()->getDir() !== $wgContLang->getDir(), 'minify' => !ResourceLoader::inDebugMode(), - 'class' => $parser->getOptions()->getWrapOutputClass(), + 'class' => $wrapClass, ] ); $style = $status->isOk() ? $status->getValue() : '/* Fatal error, no CSS will be output */'; @@ -270,7 +272,13 @@ // Return the inline , which the Parser will wrap in a 'general' // strip marker. - return Html::inlineStyle( $marker ); + $dedup = 'TemplateStyles:' . $rev->getId(); + if ( $wrapClass !== 'mw-parser-output' ) { + $dedup .= '/' . $wrapClass; + } + return Html::inlineStyle( $marker, 'all', [ + 'mw-deduplicate' => $dedup, + ] ); } } diff --git a/tests/phpunit/TemplateStylesHooksTest.php b/tests/phpunit/TemplateStylesHooksTest.php index deb8b7d..468e25d 100644 --- a/tests/phpunit/TemplateStylesHooksTest.php +++ b/tests/phpunit/TemplateStylesHooksTest.php @@ -170,6 +170,9 @@ $out = $parser->parse( $wikitext, Title::newFromText( 'Test' ), $popt ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle + $expect = preg_replace_callback( '/\{\{REV:(.*?)\}\}/', function ( $m ) { + return Title::newFromText( 'Template:TemplateStyles test/' . $m[1] )->getLatestRevID(); + }, $expect ); $this->assertEquals( $expect, $out->getText() ); } @@ -227,20 +230,22 @@ $popt, '', // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - "