[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: Added Localization for CX Translation Trend Graph
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398174 ) Change subject: Added Localization for CX Translation Trend Graph .. Added Localization for CX Translation Trend Graph Bug: T94020 Change-Id: I24e74564b8ec8bbad7248462aea8f8a9ddd313b6 --- M modules/stats/ext.cx.stats.js 1 file changed, 40 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/74/398174/1 diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js index 17c22d9..52af9b6 100644 --- a/modules/stats/ext.cx.stats.js +++ b/modules/stats/ext.cx.stats.js @@ -19,6 +19,7 @@ this.languageTranslationTrend = null; this.$highlights = null; this.$graph = null; + this.chartOptions = {}; } CXStats.prototype.init = function () { @@ -47,6 +48,41 @@ self.renderHighlights(); self.render(); } ); + + this.chartOptions = { + scales: { +xAxes: [ +{ +ticks: { + callback: function( value, index, values ) { + return moment( value ).format( 'L' ); + } +} +} +], +yAxes: [ + { +ticks: { + callback: function( value, index, values ) { + var convertedValue = mw.language.covertNumber( Number( value ) ); + return convertedValue; + } +} + } +] + }, + tooltips: { +callbacks: { +title: function( tooltipItems, data ) { + return moment( tooltipItems[ 0 ].xLabel ).format( 'L' ); +}, +label: function( tooltipItem, data ) { + var convertedValue = mw.language.convertNumber( Number( tooltipItem.yLabel ) ); + return convertedValue + ' :' + data.datasets[ tooltipItem.datasetIndex ].label; +} +}, + } + }; }; /** @@ -596,7 +632,7 @@ new Chart( ctx, { type: 'line', data: data, - options: {} + options: this.chartOptions } ); }; @@ -653,7 +689,7 @@ new Chart( ctx, { type: 'line', data: data, - options: {} + options: this.chartOptions } ); }; @@ -691,7 +727,7 @@ new Chart( ctx, { type: 'bar', data: data, - options: {} + options: this.chartOptions } ); }; @@ -739,7 +775,7 @@ new Chart( ctx, { type: 'bar', data: data, - options: {} + options: this.chartOptions } ); }; -- To view, visit https://gerrit.wikimedia.org/r/398174 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I24e74564b8ec8bbad7248462aea8f8a9ddd313b6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Removed instances of deprecated wfWaitForSlaves
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394729 ) Change subject: Removed instances of deprecated wfWaitForSlaves .. Removed instances of deprecated wfWaitForSlaves Change-Id: Id0edcc95dac26263c48a18534ddfc021ce7fb67d --- M maintenance/cleanupEmptyCategories.php M maintenance/cleanupInvalidDbKeys.php M maintenance/cleanupUploadStash.php M maintenance/cleanupUsersWithNoId.php M maintenance/convertUserOptions.php M maintenance/deleteBatch.php M maintenance/deleteDefaultMessages.php M maintenance/deleteEqualMessages.php M maintenance/deleteSelfExternals.php 9 files changed, 13 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/29/394729/1 diff --git a/maintenance/cleanupEmptyCategories.php b/maintenance/cleanupEmptyCategories.php index 2d22704..4a052a2 100644 --- a/maintenance/cleanupEmptyCategories.php +++ b/maintenance/cleanupEmptyCategories.php @@ -134,7 +134,7 @@ } $this->output( "--mode=$mode --begin=$name\n" ); - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); usleep( $throttle * 1000 ); } @@ -188,7 +188,7 @@ $this->output( "--mode=remove --begin=$name\n" ); - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); usleep( $throttle * 1000 ); } } diff --git a/maintenance/cleanupInvalidDbKeys.php b/maintenance/cleanupInvalidDbKeys.php index 569fd2b..47e7550 100644 --- a/maintenance/cleanupInvalidDbKeys.php +++ b/maintenance/cleanupInvalidDbKeys.php @@ -235,7 +235,7 @@ __METHOD__ ); $affectedRowCount += $dbw->affectedRows(); } - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); $this->outputStatus( "Updated $affectedRowCount rows on $table.\n" ); break; @@ -248,7 +248,7 @@ // recently, so we can just remove these rows. $this->outputStatus( "Deleting invalid $table rows...\n" ); $dbw->delete( $table, [ $idField => $ids ], __METHOD__ ); - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); $this->outputStatus( 'Deleted ' . $dbw->affectedRows() . " rows from $table.\n" ); break; @@ -264,7 +264,7 @@ __METHOD__ ); $affectedRowCount += $dbw->affectedRows(); } - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); $this->outputStatus( "Deleted $affectedRowCount rows from $table.\n" ); break; @@ -286,7 +286,7 @@ __METHOD__ ); } } - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); $this->outputStatus( "Link update jobs have been added to the job queue.\n" ); break; } diff --git a/maintenance/cleanupUploadStash.php b/maintenance/cleanupUploadStash.php index aeaf150..37ec26a 100644 --- a/maintenance/cleanupUploadStash.php +++ b/maintenance/cleanupUploadStash.php @@ -87,7 +87,7 @@ $this->output( "Failed removing stashed upload with key: $key ($type)\n" ); } if ( $i % 100 == 0 ) { - wfWaitForSlaves(); + wfGetLBFactory()->waitForReplication(); $this->output( "$i\n" ); } } diff --git a/maintenance/cleanupUsersWithNoId.php b/maintenance/cleanupUsersWithNoId.php index 74167d1..9b6bf82 100644 --- a/maintenance/cleanupUsersWithNoId.php +++ b/maintenance/cleanupUsersWithNoId.php @@ -199,7 +199,7 @@ list( $next, $display ) = $this->makeNextCond( $dbw, $orderby, $row ); $this->output( "... $display\n" ); - wfWaitForSlaves(); +
[MediaWiki-commits] [Gerrit] mediawiki...MassAction[master]: Added Internationalization For Some Strings
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394777 ) Change subject: Added Internationalization For Some Strings .. Added Internationalization For Some Strings Change-Id: I2da4efff85b71379011026d18ed2129c89f9d2ce --- M i18n/en.json M i18n/qqq.json M src/MassActionSpecialPage.php M src/Targets/WikiPage/Actions/AppendAction.php M src/Targets/WikiPage/Actions/RegexReplaceAction.php M src/Targets/WikiPage/Matchers/TitleRegexMatcher.php 6 files changed, 24 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassAction refs/changes/77/394777/1 diff --git a/i18n/en.json b/i18n/en.json index 8cc2e6a..55fa2ef 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -10,6 +10,7 @@ "massaction-errormessage": "Error: $1", "massaction-newtask": "New task", "massaction-viewtask": "View task", + "massaction-registeredtask": "Task registered and job queued!", "massactionsavechange": "Save change", "specialpages-group-MassAction": "MassAction", "log-name-massaction": "MassAction", @@ -20,5 +21,11 @@ "massaction-specialpage-matchers-section":"Matchers", "massaction-specialpage-actions-section":"Actions", "massaction-target-wikipage-titleregexmatcher-regex-help":"Regex characters allowed: . * ?", - "massaction-queued-count": "Queued [[Special:MassAction|mass action]] jobs" + "massaction-queued-count": "Queued [[Special:MassAction|mass action]] jobs", + "massaction-regexreplace-desc": "Performs a regex replace on the content using the pattern", + "massaction-append-desc": "Appends $1 characters to Page $2", + "massaction-append-trimmed": "... (trimmed to 25 characters)", + "massaction-titleregexmatcher-desc": "Matches pages with titles matches regex", + "massaction-titleregexmatcher-enabled": "Title Regex Matcher Enabled?", + "massaction-titleregexmatcher-label": "Title Regex" } diff --git a/i18n/qqq.json b/i18n/qqq.json index a261986..84fd58f 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -12,6 +12,7 @@ "massaction-errormessage": "Error message for special pages\n{{Identical|Error}}", "massaction-newtask": "New Task special page title", "massaction-viewtask": "View Task special page title", + "massaction-registeredtask": "Message for when a task has been registered and the corresponding job has been added to the queue for later completition", "massactionsavechange": "Save Change special page title\n{{Identical|Save changes}}", "specialpages-group-MassAction": "MassAction special page group\n{{doc-special-group}}", "log-name-massaction": "Name for the MassAction log type", @@ -22,5 +23,11 @@ "massaction-specialpage-matchers-section": "Title for the section containing options for Matchers when creating a new task", "massaction-specialpage-actions-section": "Title for the section containing options for Actions when creating a new task\n{{Identical|Action}}", "massaction-target-wikipage-titleregexmatcher-regex-help": "Help message for the WikiPage TitleRegexMatcher Regex form entry box", - "massaction-queued-count": "Text for row on [[Special:Statistics]]." + "massaction-queued-count": "Text for row on [[Special:Statistics]].", + "massaction-regexreplace-desc": "Description for the action that replaces the following regex pattern", + "massaction-append-desc": "Description for an action that appends characters to a page. Parameters:\n* $1 - the amount of characters appended\n* $2 - a snippet of the page that is being appended to", + "massaction-append-trimmed": "Message that shows that a snippet of text has been truncated past 25 characters", + "massaction-titleregexmatcher-desc": "Description for the matcher that matches the following regex pattern in titles", + "massaction-titleregexmatcher-enabled": "Label for whether or not the matcher for title regex is enabled", + "massaction-titleregexmatcher-label": "Label for the title regex matcher" } diff --git a/src/MassActionSpecialPage.php b/src/MassActionSpecialPage.php index a49ff5e..cb7f46a 100644 --- a/src/MassActionSpecialPage.php +++ b/src/MassActionSpecialPage.php @@ -498,7 +498,7 @@ $job = new TargetListJob( Title::newMainPage(), array( 'taskid' => $task->getId() ) ); JobQueueGroup::singleton()->push( $job ); - $this->getOutput()->addHTML( 'Task registered and job queued!' ); + $this->getOutput()->addHTML( '' . 'massaction-registeredtask' . '' ); $link = Linker::specialLink( 'MassAction/View/' . $task->getId(), 'massaction-viewtask' ); $this->getOutput()->addHTML( '' . $link . '' ); } diff --git a/src/Targets/WikiPage/Actions/AppendAction.php b/src/Targe
[MediaWiki-commits] [Gerrit] mediawiki...MassAction[master]: Revert "Added Internationalization For Some Strings"
Hello Florianschmidtwelzow, D3r1ck01, Addshore, jenkins-bot, Siebrand, I'd like you to do a code review. Please visit https://gerrit.wikimedia.org/r/395647 to review the following change. Change subject: Revert "Added Internationalization For Some Strings" .. Revert "Added Internationalization For Some Strings" This reverts commit d08205d62c503fd331d6446ac2650ad75c7fd52f. Change-Id: Iaa249b6196966024a329956f22a8fd348ef53ea1 --- M i18n/en.json M i18n/qqq.json M src/MassActionSpecialPage.php M src/Targets/WikiPage/Actions/AppendAction.php M src/Targets/WikiPage/Actions/RegexReplaceAction.php M src/Targets/WikiPage/Matchers/TitleRegexMatcher.php 6 files changed, 9 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassAction refs/changes/47/395647/1 diff --git a/i18n/en.json b/i18n/en.json index 2fe10ee..8cc2e6a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -10,7 +10,6 @@ "massaction-errormessage": "Error: $1", "massaction-newtask": "New task", "massaction-viewtask": "View task", - "massaction-registeredtask": "Task registered and job queued!", "massactionsavechange": "Save change", "specialpages-group-MassAction": "MassAction", "log-name-massaction": "MassAction", @@ -21,11 +20,5 @@ "massaction-specialpage-matchers-section":"Matchers", "massaction-specialpage-actions-section":"Actions", "massaction-target-wikipage-titleregexmatcher-regex-help":"Regex characters allowed: . * ?", - "massaction-queued-count": "Queued [[Special:MassAction|mass action]] jobs", - "massaction-append-desc": "Appends $1 characters to Page $2", - "massaction-append-trimmed": "... (trimmed to 25 characters)", - "massaction-regexreplace-desc": "Performs a regex replace on the content using the pattern", - "massaction-titleregexmatcher-desc": "Matches pages with titles matching regex '$1'", - "massaction-titleregexmatcher-enabled": "Title Regex Matcher Enabled?", - "massaction-titleregexmatcher-label": "Title Regex" + "massaction-queued-count": "Queued [[Special:MassAction|mass action]] jobs" } diff --git a/i18n/qqq.json b/i18n/qqq.json index 1d20352..a261986 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -12,7 +12,6 @@ "massaction-errormessage": "Error message for special pages\n{{Identical|Error}}", "massaction-newtask": "New Task special page title", "massaction-viewtask": "View Task special page title", - "massaction-registeredtask": "Message for when a task has been registered and the corresponding job has been added to the queue for later completion", "massactionsavechange": "Save Change special page title\n{{Identical|Save changes}}", "specialpages-group-MassAction": "MassAction special page group\n{{doc-special-group}}", "log-name-massaction": "Name for the MassAction log type", @@ -23,11 +22,5 @@ "massaction-specialpage-matchers-section": "Title for the section containing options for Matchers when creating a new task", "massaction-specialpage-actions-section": "Title for the section containing options for Actions when creating a new task\n{{Identical|Action}}", "massaction-target-wikipage-titleregexmatcher-regex-help": "Help message for the WikiPage TitleRegexMatcher Regex form entry box", - "massaction-queued-count": "Text for row on [[Special:Statistics]].", - "massaction-append-desc": "Description for an action that appends characters to a page. Parameters:\n* $1 - the amount of characters appended\n* $2 - a snippet of the page that is being appended to", - "massaction-append-trimmed": "Message that shows that a snippet of text has been truncated past 25 characters", - "massaction-regexreplace-desc": "Description for the action that replaces the following regex pattern", - "massaction-titleregexmatcher-desc": "Description for the matcher that matches the following regex pattern in titles. Parameters:\n* $1 - the regex pattern that is being matched", - "massaction-titleregexmatcher-enabled": "Label for whether or not the matcher for title regex is enabled", - "massaction-titleregexmatcher-label": "Label for the title regex matcher" + "massaction-queued-count": "Text for row on [[Special:Statistics]]." } diff --git a/src/MassActionSpecialPage.php b/src/MassActionSpecialPage.php index ece1dc1..a49ff5e 100644 --- a/src/MassActionSpecialPage.php +++ b/src/MassActionSpecialPage.php @@ -498,7 +498,7 @@ $job = new TargetListJob( Title::newMainPage(), array( 'taskid' => $task->getId() ) ); JobQueueGroup::singleton()->push( $job ); - $this->getOutput()->addHTML( '' . wfMessage( 'massaction-registeredtask' )->escaped() . '' ); + $this->getOutput()->addHTML( 'Task register
[MediaWiki-commits] [Gerrit] mediawiki...MassAction[master]: Fixed Issues With Internationalization
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395650 ) Change subject: Fixed Issues With Internationalization .. Fixed Issues With Internationalization Bug: T96417 Change-Id: I71285492f8eba6166ede13fd8e9ff7bcca9882c7 --- M i18n/en.json 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassAction refs/changes/50/395650/1 diff --git a/i18n/en.json b/i18n/en.json index 2fe10ee..7b0ae63 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -22,10 +22,10 @@ "massaction-specialpage-actions-section":"Actions", "massaction-target-wikipage-titleregexmatcher-regex-help":"Regex characters allowed: . * ?", "massaction-queued-count": "Queued [[Special:MassAction|mass action]] jobs", - "massaction-append-desc": "Appends $1 characters to Page $2", + "massaction-append-desc": "Appends $1 {{PLURAL:$1|character|characters}} to page \"$2\"", "massaction-append-trimmed": "... (trimmed to 25 characters)", "massaction-regexreplace-desc": "Performs a regex replace on the content using the pattern", - "massaction-titleregexmatcher-desc": "Matches pages with titles matching regex '$1'", - "massaction-titleregexmatcher-enabled": "Title Regex Matcher Enabled?", - "massaction-titleregexmatcher-label": "Title Regex" + "massaction-titleregexmatcher-desc": "Matches pages with titles matching regex \"$1\"", + "massaction-titleregexmatcher-enabled": "Title regex matcher enabled?", + "massaction-titleregexmatcher-label": "Title regex" } -- To view, visit https://gerrit.wikimedia.org/r/395650 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I71285492f8eba6166ede13fd8e9ff7bcca9882c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MassAction Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Changed Instances of rawParams() to plaintextParams()
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/395916 ) Change subject: Changed Instances of rawParams() to plaintextParams() .. Changed Instances of rawParams() to plaintextParams() Bug: T182213 Change-Id: Ibf24dee5ea19092e8a38e57f34c98f513d4c9b21 --- M includes/content/ContentHandler.php M includes/content/WikitextContent.php M includes/widget/search/FullSearchResultWidget.php M includes/widget/search/SimpleSearchResultWidget.php 4 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/16/395916/1 diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index a7b97a5..50cc9b5 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -855,7 +855,7 @@ ); return wfMessage( 'autoredircomment', $newTarget->getFullText() ) - ->rawParams( $truncatedtext )->inContentLanguage()->text(); + ->plaintextParams( $truncatedtext )->inContentLanguage()->text(); case 'changed-redirect-target': $oldTarget = $oldContent->getRedirectTarget(); $newTarget = $newContent->getRedirectTarget(); diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index 942390f..bc20aa0 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -87,7 +87,7 @@ if ( $sectionId === 'new' ) { # Inserting a new section $subject = $sectionTitle ? wfMessage( 'newsectionheaderdefaultlevel' ) - ->rawParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : ''; + ->plaintextParams( $sectionTitle )->inContentLanguage()->text() . "\n\n" : ''; if ( Hooks::run( 'PlaceNewSection', [ $this, $oldtext, $subject, &$text ] ) ) { $text = strlen( trim( $oldtext ) ) > 0 ? "{$oldtext}\n\n{$subject}{$text}" diff --git a/includes/widget/search/FullSearchResultWidget.php b/includes/widget/search/FullSearchResultWidget.php index 5e45c63..2b385de 100644 --- a/includes/widget/search/FullSearchResultWidget.php +++ b/includes/widget/search/FullSearchResultWidget.php @@ -163,7 +163,7 @@ : $this->linkRenderer->makeLink( $title, $text ? new HtmlArmor( $text ) : null ); return "" . - $this->specialPage->msg( $msgKey )->rawParams( $inner )->text() + $this->specialPage->msg( $msgKey )->plaintextParams( $inner )->text() . ""; } diff --git a/includes/widget/search/SimpleSearchResultWidget.php b/includes/widget/search/SimpleSearchResultWidget.php index 8190442..d35cb49 100644 --- a/includes/widget/search/SimpleSearchResultWidget.php +++ b/includes/widget/search/SimpleSearchResultWidget.php @@ -49,7 +49,7 @@ } $redirect = "" . - $this->specialSearch->msg( 'search-redirect' )->rawParams( + $this->specialSearch->msg( 'search-redirect' )->plaintextParams( $this->linkRenderer->makeLink( $redirectTitle, $redirectText ) )->text() . ""; -- To view, visit https://gerrit.wikimedia.org/r/395916 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibf24dee5ea19092e8a38e57f34c98f513d4c9b21 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Replace assertRaises with assertRaisesRegex in isbn_tests.py
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399134 ) Change subject: Replace assertRaises with assertRaisesRegex in isbn_tests.py .. Replace assertRaises with assertRaisesRegex in isbn_tests.py assertRaises is not as good of a test as asserRaisesRegex. The latter has an extra parameter to match the exception message, allowing more more precision when checking an error. Bug: T154281 Change-Id: I0386fd012d6b92dfa776cc8e55bfff265af40e2e --- M tests/isbn_tests.py 1 file changed, 10 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/34/399134/1 diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py index df00417..bc31b0e 100644 --- a/tests/isbn_tests.py +++ b/tests/isbn_tests.py @@ -39,6 +39,8 @@ """Test CosmeticChanges ISBN fix.""" +ISBN_DIGITERROR_RE = 'The ISBN [0-9]+ is not [0-9]+ digits long.' + def test_valid_isbn(self): """Test ISBN.""" cc = CosmeticChangesToolkit(self.site, namespace=0) @@ -54,17 +56,17 @@ cc = CosmeticChangesToolkit(self.site, namespace=0) # Invalid characters -self.assertRaises(AnyIsbnValidationException, - cc.fix_ISBN, 'ISBN 0975229LOL') +self.assertRaisesRegex(AnyIsbnValidationException, + self.ISBN_DIGITERROR_RE, cc.fix_ISBN, 'ISBN 0975229LOL') # Invalid checksum -self.assertRaises(AnyIsbnValidationException, - cc.fix_ISBN, 'ISBN 0975229801') +self.assertRaisesRegex(AnyIsbnValidationException, + 'The ISBN checksum of [0-9]+ is incorrect.', cc.fix_ISBN, 'ISBN 0975229801') # Invalid length -self.assertRaises(AnyIsbnValidationException, - cc.fix_ISBN, 'ISBN 09752298') +self.assertRaisesRegex(AnyIsbnValidationException, + self.ISBN_DIGITERROR_RE, cc.fix_ISBN, 'ISBN 09752298') # X in the middle -self.assertRaises(AnyIsbnValidationException, - cc.fix_ISBN, 'ISBN 09752X9801') +self.assertRaisesRegex(AnyIsbnValidationException, + 'The ISBN [0-9a-zA-Z]+ contains invalid characters.', cc.fix_ISBN, 'ISBN 09752X9801') def test_ignore_invalid_isbn(self): """Test fixing ISBN numbers with an invalid ISBN.""" -- To view, visit https://gerrit.wikimedia.org/r/399134 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0386fd012d6b92dfa776cc8e55bfff265af40e2e Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MediaWikiChat[master]: Added MinusX Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399534 ) Change subject: Added MinusX Support .. Added MinusX Support Bug: T175794 Change-Id: I377e3e0c20c944a79ec4eb7dec34680270b7671d --- M composer.json 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiChat refs/changes/34/399534/1 diff --git a/composer.json b/composer.json index aebd773..9cc3cdd 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,16 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "jakub-onderka/php-console-highlighter": "0.3.2" + "jakub-onderka/php-console-highlighter": "0.3.2", + "mediawiki/minux-x": "0.2.1" }, "scripts": { "test": [ - "parallel-lint . --exclude vendor --exclude node_modules" + "parallel-lint . --exclude vendor --exclude node_modules", + "minux-x.php check ." + ], + "test": [ + "minus-x.php fix ." ] } } -- To view, visit https://gerrit.wikimedia.org/r/399534 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I377e3e0c20c944a79ec4eb7dec34680270b7671d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MediaWikiChat Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MessageCommons[master]: Added MinusX Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399535 ) Change subject: Added MinusX Support .. Added MinusX Support Bug: T175794 Change-Id: Iaad664ac807038a8256e921694848d766fdd0fbe --- M composer.json 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MessageCommons refs/changes/35/399535/1 diff --git a/composer.json b/composer.json index aebd773..9cc3cdd 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,16 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "jakub-onderka/php-console-highlighter": "0.3.2" + "jakub-onderka/php-console-highlighter": "0.3.2", + "mediawiki/minux-x": "0.2.1" }, "scripts": { "test": [ - "parallel-lint . --exclude vendor --exclude node_modules" + "parallel-lint . --exclude vendor --exclude node_modules", + "minux-x.php check ." + ], + "test": [ + "minus-x.php fix ." ] } } -- To view, visit https://gerrit.wikimedia.org/r/399535 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaad664ac807038a8256e921694848d766fdd0fbe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MessageCommons Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...webplatform[master]: Changed &$this in hooks
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399762 ) Change subject: Changed &$this in hooks .. Changed &$this in hooks &$this triggers warnings in PHP 7.1. Renaming the variable before passing it by reference avoids the warning, without breaking backwards compatibility. Bug: T153505 Change-Id: I6d8d61b044eb7b0d0bbb8bd2547665bb85954047 --- M WebPlatformTemplate.class.php 1 file changed, 5 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/webplatform refs/changes/62/399762/1 diff --git a/WebPlatformTemplate.class.php b/WebPlatformTemplate.class.php index 12005ba..e4e7819 100644 --- a/WebPlatformTemplate.class.php +++ b/WebPlatformTemplate.class.php @@ -109,7 +109,9 @@ http://webplatform.org/";>HOME DOCS - + + + @@ -121,7 +123,8 @@ - + + data['sitenotice'] ): ?> -- To view, visit https://gerrit.wikimedia.org/r/399762 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6d8d61b044eb7b0d0bbb8bd2547665bb85954047 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/skins/webplatform Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...NewUserNotif[master]: Changed &$this in hooks
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399763 ) Change subject: Changed &$this in hooks .. Changed &$this in hooks &$this triggers warnings in PHP 7.1. Renaming the variable before passing it by reference avoids the warning, without breaking backwards compatibility. Bug: T153505 Change-Id: Iead52dc11280173c0d9c9081194a086886986038 --- M NewUserNotif.class.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/NewUserNotif refs/changes/63/399763/1 diff --git a/NewUserNotif.class.php b/NewUserNotif.class.php index 975af8c..a760b86 100644 --- a/NewUserNotif.class.php +++ b/NewUserNotif.class.php @@ -87,7 +87,8 @@ private function makeSubject( $recipient, $user ) { global $wgSitename; $subjectLine = ""; - Hooks::run( 'NewUserNotifSubject', array( &$this, &$subjectLine, $wgSitename, $recipient, $user ) ); + $userNotif = $this; + Hooks::run( 'NewUserNotifSubject', array( &$userNotif, &$subjectLine, $wgSitename, $recipient, $user ) ); if (!strlen($subjectLine) ) return wfMessage( 'newusernotifsubj', $wgSitename )->inContentLanguage()->text(); return $subjectLine; @@ -102,7 +103,8 @@ private function makeMessage( $recipient, $user ) { global $wgSitename, $wgContLang; $messageBody = ""; - Hooks::run( 'NewUserNotifBody', array( &$this, &$messageBody, $wgSitename, $recipient, $user ) ); + $userNotif = $this; + Hooks::run( 'NewUserNotifBody', array( &$userNotif, &$messageBody, $wgSitename, $recipient, $user ) ); if (!strlen($messageBody) ) return wfMessage( 'newusernotifbody', -- To view, visit https://gerrit.wikimedia.org/r/399763 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iead52dc11280173c0d9c9081194a086886986038 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/NewUserNotif Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MsInsert[master]: Added Minus-X Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400106 ) Change subject: Added Minus-X Support .. Added Minus-X Support Bug: T175794 Change-Id: Ib511f11638aab8e0591955ce3829a31c34ecac2f --- M composer.json 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MsInsert refs/changes/06/400106/1 diff --git a/composer.json b/composer.json index aebd773..7d306d5 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,16 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "jakub-onderka/php-console-highlighter": "0.3.2" + "jakub-onderka/php-console-highlighter": "0.3.2", + "mediawiki/minus-x": "0.2.1" }, "scripts": { "test": [ - "parallel-lint . --exclude vendor --exclude node_modules" + "parallel-lint . --exclude vendor --exclude node_modules", + "minus-x check ." + ], + "fix": [ + "minus-x fix ." ] } } -- To view, visit https://gerrit.wikimedia.org/r/400106 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib511f11638aab8e0591955ce3829a31c34ecac2f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MsInsert Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MsLinks[master]: Added Minus-X Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400107 ) Change subject: Added Minus-X Support .. Added Minus-X Support Bug: T175794 Change-Id: Ic79361972b7e3df5c574315ad921c3cd7d3d58d2 --- M composer.json 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MsLinks refs/changes/07/400107/1 diff --git a/composer.json b/composer.json index aebd773..7d306d5 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,16 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "jakub-onderka/php-console-highlighter": "0.3.2" + "jakub-onderka/php-console-highlighter": "0.3.2", + "mediawiki/minus-x": "0.2.1" }, "scripts": { "test": [ - "parallel-lint . --exclude vendor --exclude node_modules" + "parallel-lint . --exclude vendor --exclude node_modules", + "minus-x check ." + ], + "fix": [ + "minus-x fix ." ] } } -- To view, visit https://gerrit.wikimedia.org/r/400107 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic79361972b7e3df5c574315ad921c3cd7d3d58d2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MsLinks Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Added a unit test to check that the main page exists
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400137 ) Change subject: Added a unit test to check that the main page exists .. Added a unit test to check that the main page exists Bug: T183632 Change-Id: If424bfd9b820fa93b71b1d6f892fa5941d6d086c --- M tests/specials/SpecialNewsletterCreateTest.php 1 file changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/37/400137/1 diff --git a/tests/specials/SpecialNewsletterCreateTest.php b/tests/specials/SpecialNewsletterCreateTest.php index a928437..057796c 100644 --- a/tests/specials/SpecialNewsletterCreateTest.php +++ b/tests/specials/SpecialNewsletterCreateTest.php @@ -19,4 +19,26 @@ $this->executeSpecialPage( '', null, null, $user->getUser() ); $this->assertTrue( true ); } + + public function testCreateNewsletterMainPageExists() { + $input = [ + 'name' => 'Test Newsletter', + 'description' => 'This is a test newsletter that should return an error for a bad main page.', + 'mainpage' => Title::newFromText( 'BdaMianPage' )->getBaseText() + ]; + + // Mock submission of bad main page + $res = $this->newSpecialPage()->onSubmit( $input ); + + // The main page is nonexistent + $this->assertEquals( + $res->getMessage()->getKey(), 'newsletter-mainpage-non-existent' + ); + + // The newsletter was not created + $store = NewsletterStore::getDefaultInstance(); + $this->assertNull( + $store->getNewsletterFromName( 'Test Newsletter' ) + ); + } } -- To view, visit https://gerrit.wikimedia.org/r/400137 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If424bfd9b820fa93b71b1d6f892fa5941d6d086c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Added a unit test to check that the name must be unique per ...
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400242 ) Change subject: Added a unit test to check that the name must be unique per newsletter .. Added a unit test to check that the name must be unique per newsletter Bug: T183632 Bug: T183637 Change-Id: I0bcdb1d3b8778b5fc01b23f62a83cbfb407f7a09 --- M tests/specials/SpecialNewsletterCreateTest.php 1 file changed, 37 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/42/400242/1 diff --git a/tests/specials/SpecialNewsletterCreateTest.php b/tests/specials/SpecialNewsletterCreateTest.php index d69a5ce..f7a5264 100644 --- a/tests/specials/SpecialNewsletterCreateTest.php +++ b/tests/specials/SpecialNewsletterCreateTest.php @@ -68,4 +68,41 @@ $store->getNewsletterFromName( 'Second Newsletter' ) ); } + + public function testCreateNewsletterNameUnique() { + // Create 1st newsletter that will have a conflicting name + $newsletterTitle = Title::makeTitleSafe( NS_NEWSLETTER, 'Duplicated Newsletter' ); + $firstMainPage = Title::newFromText( 'FirstPage' ); + $store = NewsletterStore::getDefaultInstance(); + $firstNewsletter = new Newsletter( 0, + $newsletterTitle->getText(), + 'This is a test newsletter that will have its name duplicated', + $firstMainPage->getArticleID() + ); + $newsletterCreated = $store->addNewsletter( $firstNewsletter ); + $this->assertTrue( $newsletterCreated ); + + // Create a new Wikipage that will be used as the mainpage of a second newsletter + $mainpageTitle = Title::newFromText( 'SecondPage' ); + $wikiPage = WikiPage::factory( $mainpageTitle ); + $content = new WikitextContent( $text = 'Test mainpage for newsletter' ); + $wikiPage->doEditContent( $content, $summary = 'Test commit' ); + + // Create 2nd newsletter with a duplicated name + $input = [ + 'name' => $newsletterTitle->getText(), + 'description' => 'This is a test newsletter that should return an error for a duplicated name', + 'mainpage' => $wikiPage->getTitle()->getBaseText() + ]; + $res = $this->newSpecialPage()->onSubmit( $input ); + $this->assertEquals( $res->getMessage()->getKey(), 'newsletter-exist-error' ); + + // Remove the original newsletter in order to check if the duplicate was added + $store->deleteNewsletter( $firstNewsletter, 'Make sure a duplicate was not added' ); + + // Make sure that there are no duplicates remaining + $this->assertNull( + $store->getNewsletterFromName( $newsletterTitle->getText() ) + ); + } } -- To view, visit https://gerrit.wikimedia.org/r/400242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0bcdb1d3b8778b5fc01b23f62a83cbfb407f7a09 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Added Tests for Composer Installed
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403086 ) Change subject: Added Tests for Composer Installed .. Added Tests for Composer Installed Bug: T183899 Change-Id: Id822caad044a079884795dbea37baf10514bcf5c --- A tests/phpunit/includes/libs/composer/ComposerInstalledTest.php 1 file changed, 499 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/86/403086/1 diff --git a/tests/phpunit/includes/libs/composer/ComposerInstalledTest.php b/tests/phpunit/includes/libs/composer/ComposerInstalledTest.php new file mode 100644 index 000..c7c9d66 --- /dev/null +++ b/tests/phpunit/includes/libs/composer/ComposerInstalledTest.php @@ -0,0 +1,499 @@ +installed = "$IP/tests/phpunit/data/composer/installed.json"; + } + + /** +* @covers ComposerInstalled::__construct +* @covers ComposerInstalled::getInstalledDependencies +*/ + public function testGetInstalledDependencies() { + $installed = new ComposerInstalled( $this->installed ); + $this->assertArrayEquals( [ + 'leafo/lessphp' => [ + 'version' => '0.5.0', + 'type' => 'library', + 'licenses' => [ 'MIT', 'GPL-3.0' ], + 'authors' => [ + [ + 'name' => 'Leaf Corcoran', + 'email' => 'lea...@gmail.com', + 'homepage' => 'http://leafo.net', + ], + ], + 'description' => 'lessphp is a compiler for LESS written in PHP.', + ], + 'psr/log' => [ + 'version' => '1.0.0', + 'type' => 'library', + 'licenses' => [ 'MIT' ], + 'authors' => [ + [ + 'name' => 'PHP-FIG', + 'homepage' => 'http://www.php-fig.org/', + ], + ], + 'description' => 'Common interface for logging libraries', + ], + 'cssjanus/cssjanus' => [ + 'version' => '1.1.1', + 'type' => 'library', + 'licenses' => [ 'Apache-2.0' ], + 'authors' => [ + ], + 'description' => 'Convert CSS stylesheets between left-to-right ' . + 'and right-to-left.', + ], + 'cdb/cdb' => [ + 'version' => '1.0.0', + 'type' => 'library', + 'licenses' => [ 'GPLv2' ], + 'authors' => [ + [ + 'name' => 'Tim Starling', + 'email' => 'tstarl...@wikimedia.org', + ], + [ + 'name' => 'Chad Horohoe', + 'email' => 'c...@wikimedia.org', + ], + ], + 'description' => 'Constant Database (CDB) wrapper library for PHP. ' . + 'Provides pure-PHP fallback when dba_* functions are absent.', + ], + 'sebastian/version' => [ + 'version' => '2.0.1', + 'type' => 'library', + 'licenses' => [ 'BSD-3-Clause' ], + 'authors' => [ + [ + 'name' => 'Sebastian Bergmann', + 'email' => 'sebast...@phpunit.de', + 'role' => 'lead', + ], + ], + 'description' => 'Library that helps with managing the version ' . + 'number of Git-hosted PHP projects', + ], + 'sebastian/resource-operations' => [ + 'version' => '1.0.0', + 'type' => 'library', + 'licenses' => [ 'BSD-3-Clause' ], + 'authors' => [ + [ + 'name' => 'Sebastian Bergmann', + 'email' => 'sebast...@phpunit.de', + ], + ], + 'description' => 'Provides a list of PHP built-in functions that ' . +
[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Unit test NewsletterDb::getNewsletterFromName
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403576 ) Change subject: Unit test NewsletterDb::getNewsletterFromName .. Unit test NewsletterDb::getNewsletterFromName Bug: T183811 Change-Id: Ic4fad58dc18f1916bb910c2eeb20690c53a1f4d4 --- M tests/NewsletterDbTest.php 1 file changed, 33 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/76/403576/1 diff --git a/tests/NewsletterDbTest.php b/tests/NewsletterDbTest.php index dcd4a27..e7b1a34 100644 --- a/tests/NewsletterDbTest.php +++ b/tests/NewsletterDbTest.php @@ -24,6 +24,9 @@ $mock->expects( $this->any() ) ->method( 'getConnection' ) ->will( $this->returnValue( $db ) ); + $mock->expects( $this->any() ) + ->method( 'getConnectionRef' ) + ->will( $this->returnValue( $db ) ); return $mock; } @@ -326,4 +329,34 @@ $this->assertTrue( $result ); } + /** +* @covers NewsletterDb::getNewsletterFromName +*/ + public function testGetNewsletterFromName() { + $mockWriteDb = $this->getMockIDatabase(); + $newsletter = $this->getTestNewsletter(); + + $mockWriteDb + ->expects( $this->once() ) + ->method( 'selectRow' ) + ->with( + 'nl_newsletters', + [ 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' ], + [ 'nl_name' => $newsletter->getName(), 'nl_active' => 1 ] + ) + ->will( $this->returnValue( + (Object)[ + 'nl_id' => $newsletter->getId(), + 'nl_name' => $newsletter->getName(), + 'nl_desc' => $newsletter->getDescription(), + 'nl_main_page_id' => $newsletter->getPageId(), + ] + ) ); + + $table = new NewsletterDb( $this->getMockLoadBalancer( $mockWriteDb ) ); + + $result = $table->getNewsletterFromName( $newsletter->getName() ); + $this->assertEquals( $newsletter, $result ); + } + } -- To view, visit https://gerrit.wikimedia.org/r/403576 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4fad58dc18f1916bb910c2eeb20690c53a1f4d4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Unit test NewsletterDb::getNewsletter
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404062 ) Change subject: Unit test NewsletterDb::getNewsletter .. Unit test NewsletterDb::getNewsletter Bug: T183810 Change-Id: I59d331ddda77d527496c2d61d52c785b1ac3ebbf --- M tests/NewsletterDbTest.php 1 file changed, 37 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/62/404062/1 diff --git a/tests/NewsletterDbTest.php b/tests/NewsletterDbTest.php index 007e23c..44d9012 100644 --- a/tests/NewsletterDbTest.php +++ b/tests/NewsletterDbTest.php @@ -394,6 +394,43 @@ } /** +* @covers NewsletterDb::getNewsletter +*/ + public function testGetNewsletter() { + $mockWriteDb = $this->getMockIDatabase(); + $newsletter = $this->getTestNewsletter(); + + $mockResWrapper = $this->getMockBuilder( 'ResultWrapper' ) + ->disableOriginalConstructor() + ->getMock(); + $mockResWrapper->expects( $this->once() ) + ->method( 'current' ) + ->will( $this->returnValue( + (Object)[ + 'nl_id' => $newsletter->getId(), + 'nl_name' => $newsletter->getName(), + 'nl_desc' => $newsletter->getDescription(), + 'nl_main_page_id' => $newsletter->getPageId(), + ] + ) ); + + $mockWriteDb + ->expects( $this->once() ) + ->method( 'select' ) + ->with( + 'nl_newsletters', + [ 'nl_id', 'nl_name', 'nl_desc', 'nl_main_page_id' ], + [ 'nl_id' => $newsletter->getId(), 'nl_active' => 1 ] + ) + ->will( $this->returnValue( $mockResWrapper ) ); + + $table = new NewsletterDb( $this->getMockLoadBalancer( $mockWriteDb ) ); + + $result = $table->getNewsletter( $newsletter->getId() ); + $this->assertEquals( $newsletter, $result ); + } + + /** * @covers NewsletterDb::getNewsletterFromName */ public function testGetNewsletterFromName() { -- To view, visit https://gerrit.wikimedia.org/r/404062 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I59d331ddda77d527496c2d61d52c785b1ac3ebbf Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Solve -cc conflict in imagecopy
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404618 ) Change subject: Solve -cc conflict in imagecopy .. Solve -cc conflict in imagecopy imagecopy.py did not support its -cc option because it conflicted with the global option to toggle cosmetic changes Renamed the local implementation and added option descriptions Bug: T182522 Change-Id: I2db4e4ffa313ff3cc043658b3ca3d6d436d65a5b --- M scripts/imagecopy.py 1 file changed, 12 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/18/404618/1 diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py index 7a539b5..6c8a731 100644 --- a/scripts/imagecopy.py +++ b/scripts/imagecopy.py @@ -17,6 +17,16 @@ so he can test at: [[de:Benutzer Diskussion:Magnus Manske]]. You can write him in German and English. +Command line options: + +-always Skip the GUI validation + +-setcat: Set the category of the copied image + +-delete Delete the image after the image has been transferred. This will + only work if the user has sysops privileges, otherwise the image + will only be marked for deletion. + Examples Work on a single image:: @@ -494,8 +504,8 @@ for arg in local_args: if arg == '-always': always = True -elif arg.startswith('-cc:'): -category = arg[len('-cc:'):] +elif arg.startswith('-setcat:'): +category = arg[len('-setcat:'):] elif arg == '-delete': delete_after_done = True else: -- To view, visit https://gerrit.wikimedia.org/r/404618 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2db4e4ffa313ff3cc043658b3ca3d6d436d65a5b Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Newsletter[master]: Unit test NewsletterDb::removePublisher
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400609 ) Change subject: Unit test NewsletterDb::removePublisher .. Unit test NewsletterDb::removePublisher Bug: T183616 Change-Id: I2f1cd5820178c9eafad1bbcdc7c0f3b3e87eff94 --- M tests/NewsletterDbTest.php 1 file changed, 27 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter refs/changes/09/400609/1 diff --git a/tests/NewsletterDbTest.php b/tests/NewsletterDbTest.php index 78c80a6..8701f53 100644 --- a/tests/NewsletterDbTest.php +++ b/tests/NewsletterDbTest.php @@ -138,6 +138,33 @@ } /** +* @covers NewsletterDb::removePublisher +*/ + public function testRemovePublisher() { + $mockWriteDb = $this->getMockIDatabase(); + $user = User::newFromName( 'Test User' ); + $user->addtoDatabase(); + + $mockWriteDb + ->expects( $this->once() ) + ->method( 'delete' ) + ->with( + 'nl_publishers', + [ 'nlp_newsletter_id' => 1, 'nlp_publisher_id' => $user->getId() ] + ); + $mockWriteDb + ->expects( $this->once() ) + ->method( 'affectedRows' ) + ->will ($this->returnValue( 1 ) ); + + $table = new NewsletterDb( $this->getMockLoadBalancer( $mockWriteDb ) ); + + $result = $table->removePublisher( $this->getTestNewsletter(), $user ); + + $this->assertTrue( $result ); + } + + /** * @covers NewsletterDb::addNewsletter */ public function testAddNewsletter() { -- To view, visit https://gerrit.wikimedia.org/r/400609 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f1cd5820178c9eafad1bbcdc7c0f3b3e87eff94 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Newsletter Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Made download_dump.py download process atomic
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400616 ) Change subject: Made download_dump.py download process atomic .. Made download_dump.py download process atomic Bug: T183675 Change-Id: I142629bb89ffc1c810adcf8f1417ecc824594e41 --- M scripts/maintenance/download_dump.py 1 file changed, 34 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/16/400616/1 diff --git a/scripts/maintenance/download_dump.py b/scripts/maintenance/download_dump.py index d3a5123..ee6ee23 100644 --- a/scripts/maintenance/download_dump.py +++ b/scripts/maintenance/download_dump.py @@ -18,10 +18,26 @@ # from __future__ import absolute_import, division, unicode_literals +from datetime import datetime + import os.path import sys -from os import remove, symlink +from os import remove, symlink, fsync + +try: +from os import replace +except ImportError: # py2 +if sys.platform == 'win32': +import os +def replace(src, dst): +try: +os.rename(src, dst) +except OSError: +os.remove(dst) +os.rename(src, dst) +else: +from os import rename as replace import pywikibot @@ -63,7 +79,12 @@ download_filename = self.getOption('wikiname') + \ '-latest-' + self.getOption('filename') -file_storepath = os.path.join( +store_filename = download_filename + '-' + \ +str(datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) + '.part' + +file_temp_storepath = os.path.join( +self.getOption('storepath'), store_filename) +file_final_storepath = os.path.join( self.getOption('storepath'), download_filename) # https://wikitech.wikimedia.org/wiki/Help:Toolforge#Dumps @@ -71,28 +92,32 @@ self.getOption('wikiname'), self.getOption('filename')) if toolforge_dump_filepath: pywikibot.output('Symlinking file from ' + toolforge_dump_filepath) -if os.path.exists(file_storepath): -remove(file_storepath) +if os.path.exists(file_temp_storepath): +remove(file_temp_storepath) -symlink(toolforge_dump_filepath, file_storepath) +symlink(toolforge_dump_filepath, file_temp_storepath) else: url = 'https://dumps.wikimedia.org/' + \ -os.path.join(self.getOption('wikiname'), - 'latest', download_filename) +self.getOption('wikiname') + '/latest/' + download_filename pywikibot.output('Downloading file from ' + url) response = fetch(url, stream=True) if response.status == 200: try: -with open(file_storepath, 'wb') as result_file: +with open(file_temp_storepath, 'wb') as result_file: for chunk in response.data.iter_content(100 * 1024): result_file.write(chunk) + +result_file.flush() +fsync(result_file.fileno()) except IOError: pywikibot.exception() return False else: return -pywikibot.output('Done! File stored as ' + file_storepath) +replace(file_temp_storepath, file_final_storepath) + +pywikibot.output('Done! File stored as ' + file_final_storepath) return -- To view, visit https://gerrit.wikimedia.org/r/400616 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I142629bb89ffc1c810adcf8f1417ecc824594e41 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Added Progress Bar for download_dump.py
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401199 ) Change subject: Added Progress Bar for download_dump.py .. Added Progress Bar for download_dump.py Bug: T183664 Change-Id: Iacfc4ffec3f7b928fa245879c154775a9f692b8a --- M scripts/maintenance/download_dump.py 1 file changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/99/401199/1 diff --git a/scripts/maintenance/download_dump.py b/scripts/maintenance/download_dump.py index 853d33f..a9985d1 100644 --- a/scripts/maintenance/download_dump.py +++ b/scripts/maintenance/download_dump.py @@ -119,8 +119,39 @@ response = fetch(url, stream=True) if response.status == 200: with open(file_current_storepath, 'wb') as result_file: +total = int(response.response_headers.get( +'content-length')) +downloaded = 0 +parts = 50 +B_IN_GB = 1073741824 +B_IN_MB = 1048576 + for data in response.data.iter_content(100 * 1024): result_file.write(data) + +if total is not None: +downloaded += len(data) +done = int(parts * downloaded / + total) +sys.stdout.write("\r|{0}{1}|".format( +'=' * done, '-' * (parts - done))) + +# Format the data size display with units +disp_total = ( +format(total / B_IN_MB, '.2f') + +'M', +format(total / B_IN_GB, '.2f') + +'G')[total > B_IN_GB] +disp_downloaded = ( +format(downloaded / B_IN_MB, '.2f') + +'M', +format(downloaded / B_IN_GB, '.2f') + +'G')[downloaded > B_IN_GB] + +sys.stdout.write('\t{0}/{1}'.format( +disp_downloaded, disp_total)) +sys.stdout.flush() +sys.stdout.write('\n') elif response.status == 404: pywikibot.output( 'File with name "{filename}", ' -- To view, visit https://gerrit.wikimedia.org/r/401199 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iacfc4ffec3f7b928fa245879c154775a9f692b8a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Added Tests for ListToggle
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401833 ) Change subject: Added Tests for ListToggle .. Added Tests for ListToggle Bug: T183898 Change-Id: I1c6cd8ea21127db56701cc6073fa880b2180d846 --- A tests/phpunit/includes/ListToggleTest.php 1 file changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/33/401833/1 diff --git a/tests/phpunit/includes/ListToggleTest.php b/tests/phpunit/includes/ListToggleTest.php new file mode 100644 index 000..92e0907 --- /dev/null +++ b/tests/phpunit/includes/ListToggleTest.php @@ -0,0 +1,31 @@ +getOutput(); + $listToggle = new ListToggle( $output ); + + $this->assertInstanceOf('ListToggle', $listToggle); + } + + /** +* @covers ListToggle::getHTML +*/ + public function testGetHTML() { + $specialpage = new SpecialPage( 'TestPage' ); + $output = $specialpage->getOutput(); + $listToggle = new ListToggle( $output ); + + $html = $listToggle->getHTML(); + $this->assertRegExp('//', + $html); + } +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/401833 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1c6cd8ea21127db56701cc6073fa880b2180d846 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Added Minus-X Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402166 ) Change subject: Added Minus-X Support .. Added Minus-X Support Bug: T175794 Change-Id: Ia94b3e832ff21f9f76bd63924bf289cd2afdefbc --- A .minus-x.json M composer.json 2 files changed, 26 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/66/402166/1 diff --git a/.minus-x.json b/.minus-x.json new file mode 100644 index 000..3f725d8 --- /dev/null +++ b/.minus-x.json @@ -0,0 +1,19 @@ +{ +"ignore": [ +"./maintenance/dev/install.sh", +"./maintenance/dev/installmw.sh", +"./maintenance/dev/installphp.sh", +"./maintenance/dev/start.sh", +"./maintenance/hhvm/run-server", +"./maintenance/language/zhtable/Makefile.py", +"./maintenance/mwjsduck-gen", +"./maintenance/postgres/compare_schemas.pl", +"./maintenance/postgres/mediawiki_mysql2postgres.pl", +"./maintenance/resources/update-oojs-ui.sh", +"./maintenance/resources/update-oojs.sh", +"./maintenance/storage/make-blobs", +"./maintenance/update.php", +"./tests/phan/bin/phan", +"./tests/phpunit/phpunit.php", +] +} \ No newline at end of file diff --git a/composer.json b/composer.json index d92ffc9..926d0eb 100644 --- a/composer.json +++ b/composer.json @@ -55,6 +55,7 @@ "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a", "justinrainbow/json-schema": "~5.2", "mediawiki/mediawiki-codesniffer": "15.0.0", + "mediawiki/minus-x": "0.2.1", "monolog/monolog": "~1.22.1", "nikic/php-parser": "3.1.3", "nmred/kafka-php": "0.1.5", @@ -95,14 +96,18 @@ "scripts": { "lint": "parallel-lint --exclude vendor", "phpcs": "phpcs -p -s", - "fix": "phpcbf", + "fix": [ + "phpcbf", + "minus-x fix ." + ], "pre-install-cmd": "ComposerHookHandler::onPreInstall", "pre-update-cmd": "ComposerHookHandler::onPreUpdate", "post-install-cmd": "ComposerVendorHtaccessCreator::onEvent", "post-update-cmd": "ComposerVendorHtaccessCreator::onEvent", "test": [ "composer lint", - "composer phpcs" + "composer phpcs", + "minus-x check ." ] }, "config": { -- To view, visit https://gerrit.wikimedia.org/r/402166 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia94b3e832ff21f9f76bd63924bf289cd2afdefbc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceUserPreferences[master]: Added Minus-X Support
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402167 ) Change subject: Added Minus-X Support .. Added Minus-X Support Bug: T175794 Change-Id: I49c1f6fd572c6abb8da4f84cd04fc1ea47b44c6b --- M composer.json 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceUserPreferences refs/changes/67/402167/1 diff --git a/composer.json b/composer.json index 18e53fb..ed52e4d 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,8 @@ "description": "Renders the BlueSpice tab in preferences", "license": "GPL-3.0", "require": { - "composer/installers": "~1.0" + "composer/installers": "~1.0", + "mediawiki/minus-x": "0.2.1" }, "autoload": { "psr-4": { @@ -16,7 +17,11 @@ }, "scripts": { "test": [ - "parallel-lint . --exclude vendor --exclude node_modules" + "parallel-lint . --exclude vendor --exclude node_modules", + "minus-x check ." + ], + "fix": [ + "minus-x fix ." ] } } -- To view, visit https://gerrit.wikimedia.org/r/402167 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49c1f6fd572c6abb8da4f84cd04fc1ea47b44c6b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceUserPreferences Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Added Tests for ContentModelLogFormatter
Ryan10145 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402755 ) Change subject: Added Tests for ContentModelLogFormatter .. Added Tests for ContentModelLogFormatter Bug: T183900 Change-Id: I812b477eb45e19a06e5c18bc30da731f4af8cc8f --- A tests/phpunit/includes/logging/ContentModelLogFormatterTest.php 1 file changed, 68 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/55/402755/1 diff --git a/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php b/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php new file mode 100644 index 000..a6fc91a --- /dev/null +++ b/tests/phpunit/includes/logging/ContentModelLogFormatterTest.php @@ -0,0 +1,68 @@ + 'contentmodel', + 'action' => 'new', + 'comment' => 'new content model comment', + 'namespace' => NS_MAIN, + 'title' => 'ContentModelPage', + 'params' => [ + '5::newModel' => 'testcontentmodel', + ], + ], + [ + 'text' => 'User created the page ContentModelPage using a non-default content model "testcontentmodel"', + 'api' => [ + 'newModel' => 'testcontentmodel', + ], + ], + ], + ]; + } + + /** +* @dataProvider provideNewLogDatabaseRows +*/ + public function testNewLogDatabaseRows( $row, $extra ) { + $this->doTestLogFormatter( $row, $extra ); + } + + public static function provideChangeLogDatabaseRows() { + return [ + [ + [ + 'type' => 'contentmodel', + 'action' => 'change', + 'comment' => 'change content model comment', + 'namespace' => NS_MAIN, + 'title' => 'ContentModelPage', + 'params' => [ + '4::oldmodel' => 'wikitext', + '5::newModel' => 'testcontentmodel', + ], + ], + [ + 'text' => 'User changed the content model of the page ContentModelPage from "wikitext" to "testcontentmodel"', + 'api' => [ + 'oldmodel' => 'wikitext', + 'newModel' => 'testcontentmodel', + ], + ], + ], + ]; + } + + /** +* @dataProvider provideChangeLogDatabaseRows +*/ + public function testChangeLogDatabaseRows( $row, $extra ) { + $this->doTestLogFormatter( $row, $extra ); + } +} -- To view, visit https://gerrit.wikimedia.org/r/402755 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I812b477eb45e19a06e5c18bc30da731f4af8cc8f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Ryan10145 ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits