[MediaWiki-commits] [Gerrit] Fix stack space crasher with large tables. - change (mediawiki...Parsoid)
Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/61169 Change subject: Fix stack space crasher with large tables. .. Fix stack space crasher with large tables. For a page which has lots of table lines (not necessarily belonging to the same table) the tokenizer would get into the following recursive call tree: nested_block - block - block_lines - block_line - table_lines - table_line - table_data_tags - table_data_tag - nested_block Instead of finishing the table_data_tag with the next table_line, the 'nested_block*' in the table_data_tag production attempted to snarf all succeeding blocks of the file (pushing 8 additional stack frames for every line of the file). Change the nested_block* production to exclude table_lines, preventing the harmful recursion. Test case is: http://ru.wikipedia.org/wiki/Чемпионат_России_по_хоккею_с_мячом_1999/2000 Change-Id: I83b9803cd7a0f6450d8a4137fb245b7d36019e01 --- M js/lib/pegTokenizer.pegjs.txt 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid refs/changes/69/61169/1 diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt index 1b14aad..33b005b 100644 --- a/js/lib/pegTokenizer.pegjs.txt +++ b/js/lib/pegTokenizer.pegjs.txt @@ -558,6 +558,12 @@ nested_block = !inline_breaks b:block { return b; } /* + * The same, but suitable for use inside a table construct. + */ +nested_block_not_td + = !(sol (optionalSpaceToken sol)? pipe) b:nested_block { return b; } + +/* * Line-based block constructs. */ block_lines @@ -1901,7 +1907,7 @@ = p:pipe + args:single_cell_table_args? tagEndPos:({return pos;}) -c:nested_block* { +c:nested_block_not_td* { return buildTableTokens(caption, |+, args, [pos0, tagEndPos], pos, c) .concat([new EndTagTk('caption')]); } @@ -1973,7 +1979,7 @@ // { console.warn(past attrib, pos= + pos + input.substr(pos,10)); return true; } // use inline_breaks to break on tr etc tagEndPos:({return pos;}) -td:nested_block* +td:nested_block_not_td* { return buildTableTokens(td, |, arg, [pos0, tagEndPos], pos, td); } @@ -2002,7 +2008,7 @@ table_heading_tag = arg:row_syntax_table_args? tagEndPos:({return pos;}) -c:nested_block* { +c:nested_block_not_td* { //console.warn( 'table_heading_tag: ' + pp( [a, c] ) ); return buildTableTokens(th, !, arg, [pos0, tagEndPos], pos, c); } -- To view, visit https://gerrit.wikimedia.org/r/61169 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I83b9803cd7a0f6450d8a4137fb245b7d36019e01 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: Cscott wikime...@cscott.net ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use more precise type annotation for promise. - change (mediawiki...EventLogging)
Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/61170 Change subject: Use more precise type annotation for promise. .. Use more precise type annotation for promise. Change-Id: Ia56e52a9e1717d17a09bd224254a9c35131f47ee --- M modules/ext.eventLogging.core.js 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging refs/changes/70/61170/1 diff --git a/modules/ext.eventLogging.core.js b/modules/ext.eventLogging.core.js index 239cb32..a876e57 100644 --- a/modules/ext.eventLogging.core.js +++ b/modules/ext.eventLogging.core.js @@ -240,7 +240,7 @@ * * @method dispatch * @param {Object} data Payload to send. -* @return {jQuery.Deferred} Promise object. +* @return {jQuery.Promise} jQuery Promise object for the logging call */ dispatch: function ( data ) { var beacon = document.createElement( 'img' ), @@ -273,7 +273,7 @@ * @method logEvent * @param {String} schemaName Canonical schema name. * @param {Object} eventInstance Event instance. -* @return {jQuery.Deferred} Promise object. +* @return {jQuery.Promise} jQuery Promise object for the logging call */ logEvent: function ( schemaName, eventInstance ) { return self.dispatch( self.encapsulate( schemaName, eventInstance ) ); -- To view, visit https://gerrit.wikimedia.org/r/61170 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia56e52a9e1717d17a09bd224254a9c35131f47ee Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EventLogging Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use more precise type annotation for promise. - change (mediawiki...EventLogging)
jenkins-bot has submitted this change and it was merged. Change subject: Use more precise type annotation for promise. .. Use more precise type annotation for promise. Change-Id: Ia56e52a9e1717d17a09bd224254a9c35131f47ee --- M modules/ext.eventLogging.core.js 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ext.eventLogging.core.js b/modules/ext.eventLogging.core.js index 239cb32..a876e57 100644 --- a/modules/ext.eventLogging.core.js +++ b/modules/ext.eventLogging.core.js @@ -240,7 +240,7 @@ * * @method dispatch * @param {Object} data Payload to send. -* @return {jQuery.Deferred} Promise object. +* @return {jQuery.Promise} jQuery Promise object for the logging call */ dispatch: function ( data ) { var beacon = document.createElement( 'img' ), @@ -273,7 +273,7 @@ * @method logEvent * @param {String} schemaName Canonical schema name. * @param {Object} eventInstance Event instance. -* @return {jQuery.Deferred} Promise object. +* @return {jQuery.Promise} jQuery Promise object for the logging call */ logEvent: function ( schemaName, eventInstance ) { return self.dispatch( self.encapsulate( schemaName, eventInstance ) ); -- To view, visit https://gerrit.wikimedia.org/r/61170 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia56e52a9e1717d17a09bd224254a9c35131f47ee Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/EventLogging Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Ori.livneh o...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Refactor SMWFactbox, make it an instantiable class - change (mediawiki...SemanticMediaWiki)
Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/61171 Change subject: Refactor SMWFactbox, make it an instantiable class .. Refactor SMWFactbox, make it an instantiable class Factbox logic has not been altered (aside from making the interface somewhat sane) + Move to SMW\Factbox + Eliminate all static methods + Re-group code for readability + Move hook related code into SMWHooks + Table formatting has been moved to an extra TableFormatter class to decouple data capturing from formatting + Introduces smwgFactboxUseCache in order for onOutputPageParserOutput() to fetch factbox text from cache instead of regenerating content on each page request. If smwgFactboxUseCache = true only after a page received a new revision (after it is saved) the factbox content will be re-parsed. This enables pages to serve content faster, consume less memory and work more efficient. The Profiler showed two issues when executing onOutputPageParserOutput() without cache, depending on how many properties/values are assigned it takes considerable amount of time identifying properties/values plus the additional text parsing that is needed to convert the text into an output representation. Name Calls Total Each % Mem Non-cached SMWHooks::onOutputPageParserOutput1 461.743 461.743 9.946%184492 ( 461.743 - 461.743) [872] Parser::parse-SMWHooks::onOutputPageParserOutput 1 374.598 374.598 8.069% 57957 ( 374.598 - 374.598) [806] Cached SMWHooks::onOutputPageParserOutput127.05127.051 0.859%168323 ( 27.051 - 27.051) [2] Using the cache also shields against the loss of data attached to the outputpage object which is responsible that on some occasions the factbox disappears and only after a page purge (as the data are re-attached to the outputpage) appears again. + Introduces smwgFactboxCacheRefreshOnPurge which will force the cache to be purged after an action=purge event otherwise only a save event will invalidate the factbox cache object. Change-Id: I5eb8a3e648aa4a4610882776cb6c469a48f88ffc --- M SemanticMediaWiki.hooks.php M SemanticMediaWiki.settings.php A includes/Cache.php A includes/Factbox.php D includes/SMW_Factbox.php M includes/Settings.php M includes/Setup.php M tests/phpunit/includes/FactboxTest.php 8 files changed, 824 insertions(+), 247 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki refs/changes/71/61171/1 diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php index e282a0e..4ba4a8d 100644 --- a/SemanticMediaWiki.hooks.php +++ b/SemanticMediaWiki.hooks.php @@ -452,7 +452,8 @@ * @return true */ public static function onParserAfterTidy( $parser, $text ) { - $cache = ObjectCache::getInstance( $GLOBALS['smwgCacheType'] ); + $pageId = $parser-getTitle()-getArticleID(); + $cache = SMW\Cache::newFromGlobals()-setKey( 'autorefresh', $pageId ); // Separate globals from local state // FIXME Do a new SMW\Settings( $GLOBALS ); @@ -469,11 +470,10 @@ // If an article was was manually purged/moved ensure that the store is // updated as well for all other cases onLinksUpdateConstructed will // initiate the store update - if( $cache-get( 'smw:autorefresh:' . $parser-getTitle()-getPrefixedDBkey() ) ){ + if( $cache-get() ) { $parserData-updateStore(); } - $cache-delete( 'smw:autorefresh:' . $parser-getTitle()-getPrefixedDBkey() ); - + $cache-delete(); return true; } @@ -536,10 +536,16 @@ * @return true */ public static function onArticlePurge( $wikiPage ) { - ObjectCache::getInstance( $GLOBALS['smwgCacheType'] )-set( - 'smw:autorefresh:' . $wikiPage-getTitle()-getPrefixedDBkey(), - $GLOBALS['smwgAutoRefreshOnPurge'] - ); + $pageId = $wikiPage-getTitle()-getArticleID(); + $cache = SMW\Cache::newFromGlobals(); + + $cache-setKey( 'autorefresh', $pageId )-set( $GLOBALS['smwgAutoRefreshOnPurge'] ); + + // Depending on the setting, invalidate the factbox cache + $cache-setCacheEnabled( $GLOBALS['smwgFactboxCacheRefreshOnPurge'] + )-setKey( 'factbox', $pageId + )-delete(); + return true; } @@ -563,10 +569,9 @@ * @return true */ public static function onTitleMoveComplete( $oldTitle, $newTitle, $user, $oldId, $newId ) {
[MediaWiki-commits] [Gerrit] Rename SMW_Factbox.php file - change (mediawiki...SemanticMediaWiki)
Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/61172 Change subject: Rename SMW_Factbox.php file .. Rename SMW_Factbox.php file Rename SMW_Factbox.php file to prevent commit history being deleted. Change-Id: Icae4515435814416745c2309f3eafdf0f93f1a65 --- R includes/Factbox.php M includes/Setup.php 2 files changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki refs/changes/72/61172/1 diff --git a/includes/SMW_Factbox.php b/includes/Factbox.php similarity index 100% rename from includes/SMW_Factbox.php rename to includes/Factbox.php diff --git a/includes/Setup.php b/includes/Setup.php index 693f0e8..86fe0d9 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -120,7 +120,7 @@ $wgAutoloadClasses['SMW\ParameterInput']= $incDir . 'ParameterInput.php'; $wgAutoloadClasses['SMW\MessageReporter']= $incDir . 'MessageReporter.php'; $wgAutoloadClasses['SMW\ObservableMessageReporter'] = $incDir . 'MessageReporter.php'; - $wgAutoloadClasses['SMWFactbox']= $incDir . 'SMW_Factbox.php'; + $wgAutoloadClasses['SMWFactbox']= $incDir . 'Factbox.php'; $wgAutoloadClasses['SMWInfolink'] = $incDir . 'SMW_Infolink.php'; $wgAutoloadClasses['SMWOutputs']= $incDir . 'SMW_Outputs.php'; $wgAutoloadClasses['SMW\ParserTextProcessor'] = $incDir . 'ParserTextProcessor.php'; -- To view, visit https://gerrit.wikimedia.org/r/61172 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icae4515435814416745c2309f3eafdf0f93f1a65 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Mwjames jamesin.hongkon...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Rename SMW_Factbox.php file - change (mediawiki...SemanticMediaWiki)
jenkins-bot has submitted this change and it was merged. Change subject: Rename SMW_Factbox.php file .. Rename SMW_Factbox.php file Rename SMW_Factbox.php file to prevent commit history being deleted. Change-Id: Icae4515435814416745c2309f3eafdf0f93f1a65 --- R includes/Factbox.php M includes/Setup.php 2 files changed, 1 insertion(+), 1 deletion(-) Approvals: Mwjames: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/SMW_Factbox.php b/includes/Factbox.php similarity index 100% rename from includes/SMW_Factbox.php rename to includes/Factbox.php diff --git a/includes/Setup.php b/includes/Setup.php index 693f0e8..86fe0d9 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -120,7 +120,7 @@ $wgAutoloadClasses['SMW\ParameterInput']= $incDir . 'ParameterInput.php'; $wgAutoloadClasses['SMW\MessageReporter']= $incDir . 'MessageReporter.php'; $wgAutoloadClasses['SMW\ObservableMessageReporter'] = $incDir . 'MessageReporter.php'; - $wgAutoloadClasses['SMWFactbox']= $incDir . 'SMW_Factbox.php'; + $wgAutoloadClasses['SMWFactbox']= $incDir . 'Factbox.php'; $wgAutoloadClasses['SMWInfolink'] = $incDir . 'SMW_Infolink.php'; $wgAutoloadClasses['SMWOutputs']= $incDir . 'SMW_Outputs.php'; $wgAutoloadClasses['SMW\ParserTextProcessor'] = $incDir . 'ParserTextProcessor.php'; -- To view, visit https://gerrit.wikimedia.org/r/61172 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icae4515435814416745c2309f3eafdf0f93f1a65 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Mwjames jamesin.hongkon...@gmail.com Gerrit-Reviewer: Mwjames jamesin.hongkon...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Disable debug toolbar unless 'debug' present on request - change (mediawiki/vagrant)
Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/61173 Change subject: Disable debug toolbar unless 'debug' present on request .. Disable debug toolbar unless 'debug' present on request This change set makes the debug toolbar activate only if 'debug' is present on the request, either as a URL parameter or a cookie. I find that the debug toolbar, while useful, makes MediaWiki feel perceptibly more sluggish. This seems like a good compromise. Change-Id: I5b16cf6ab2bef9bac0c28d915e13d7adb7a26133 --- M LocalSettings.php 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant refs/changes/73/61173/1 diff --git a/LocalSettings.php b/LocalSettings.php index 2558480..3623bce 100644 --- a/LocalSettings.php +++ b/LocalSettings.php @@ -6,8 +6,13 @@ $wgArticlePath = /wiki/$1; +// Show the debug toolbar if 'debug' is set on the request, either as a +// parameter or a cookie. +if ( !empty( $_REQUEST['debug'] ) ) { + $wgDebugToolbar = true; +} + // Expose debug info for PHP errors. -$wgDebugToolbar = true; $wgShowExceptionDetails = true; $wgDebugLogFile = __DIR__ . '/vagrant/logs/mediawiki-debug.log'; -- To view, visit https://gerrit.wikimedia.org/r/61173 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5b16cf6ab2bef9bac0c28d915e13d7adb7a26133 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Ori.livneh o...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Disable debug toolbar unless 'debug' present on request - change (mediawiki/vagrant)
jenkins-bot has submitted this change and it was merged. Change subject: Disable debug toolbar unless 'debug' present on request .. Disable debug toolbar unless 'debug' present on request This change set makes the debug toolbar activate only if 'debug' is present on the request, either as a URL parameter or a cookie. I find that the debug toolbar, while useful, makes MediaWiki feel perceptibly more sluggish. This seems like a good compromise. Change-Id: I5b16cf6ab2bef9bac0c28d915e13d7adb7a26133 --- M LocalSettings.php 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/LocalSettings.php b/LocalSettings.php index 2558480..3623bce 100644 --- a/LocalSettings.php +++ b/LocalSettings.php @@ -6,8 +6,13 @@ $wgArticlePath = /wiki/$1; +// Show the debug toolbar if 'debug' is set on the request, either as a +// parameter or a cookie. +if ( !empty( $_REQUEST['debug'] ) ) { + $wgDebugToolbar = true; +} + // Expose debug info for PHP errors. -$wgDebugToolbar = true; $wgShowExceptionDetails = true; $wgDebugLogFile = __DIR__ . '/vagrant/logs/mediawiki-debug.log'; -- To view, visit https://gerrit.wikimedia.org/r/61173 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5b16cf6ab2bef9bac0c28d915e13d7adb7a26133 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Ori.livneh o...@wikimedia.org Gerrit-Reviewer: Ori.livneh o...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] SMW\Test\PropertyStatisticsTableTest issue on Windows - change (mediawiki...SemanticMediaWiki)
jenkins-bot has submitted this change and it was merged. Change subject: SMW\Test\PropertyStatisticsTableTest issue on Windows .. SMW\Test\PropertyStatisticsTableTest issue on Windows I excluded the Datagroup from running tests in the past but now I need those but PropertyStatisticsTableTest still complains on Windows about pow( 2 , 31 ) being MWException: The value to add must be a positive integer and since I don't have to time to research this in detail, I added isWinOS() which checks if the test runs on a Win platform and if so do pow( 2 , 30 ) instead. Doing pow( 2 , 30 ) might not sufficiently serve the test purpose and I do not know why Win is complaining about pow( 2 , 31 ) but I need the group Datagroup tests to be run without failure. Change-Id: Icf5243f37919f9784e884d5cb81faa023a2e2891 --- M tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php 1 file changed, 13 insertions(+), 2 deletions(-) Approvals: Mwjames: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php b/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php index 83f1769..7c52bf8 100644 --- a/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php +++ b/tests/phpunit/includes/storage/sqlstore/PropertyStatisticsTableTest.php @@ -35,6 +35,17 @@ */ class PropertyStatisticsTableTest extends \MediaWikiTestCase { + /** +* On the Windows platform pow( 2 , 31 ) returns with +* MWException: The value to add must be a positive integer therefore +* return true if this test runs on Windows +* +* @return boolean +*/ + private function isWinOS() { + return strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN'; + } + public function testDeleteAll() { if ( !( smwfGetStore() instanceof \SMWSQLStore3 ) ) { $this-markTestSkipped( 'Test only applicable to SMWSQLStore3' ); @@ -62,7 +73,7 @@ $usageCounts[] = array( $propId, mt_rand( 0, 10 ) ); } - $usageCounts[] = array( 9001, pow( 2 , 31 ) - 1 ); + $usageCounts[] = array( 9001, $this-isWinOS() ? pow( 2 , 30 ) : pow( 2 , 31 ) ); return $usageCounts; } @@ -123,7 +134,7 @@ 1 = 42, 2 = 0, 9001 = 9001, - 9002 = pow( 2 , 31 ) - 1, + 9002 = $this-isWinOS() ? pow( 2 , 30 ) : pow( 2 , 31 ), 9003 = 1, ); -- To view, visit https://gerrit.wikimedia.org/r/60622 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icf5243f37919f9784e884d5cb81faa023a2e2891 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Mwjames jamesin.hongkon...@gmail.com Gerrit-Reviewer: Mwjames jamesin.hongkon...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use wfShellExec in parserTest.inc - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Use wfShellExec in parserTest.inc .. Use wfShellExec in parserTest.inc This avoids shell execution with backticks Change-Id: Ib0db0c2ac36ae615f280ed9db82d2ca6aad744b5 --- M tests/parser/parserTest.inc 1 file changed, 4 insertions(+), 3 deletions(-) Approvals: IAlex: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 7c8daf2..a0ede09 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -1174,9 +1174,10 @@ global $wgDiff3; // we assume that people with diff3 also have usual diff - $diff = ( wfIsWindows() !$wgDiff3 ) - ? `fc $shellInfile $shellOutfile` - : `diff -au $shellInfile $shellOutfile`; + $shellCommand = ( wfIsWindows() !$wgDiff3 ) ? 'fc' : 'diff -au'; + + $diff = wfShellExec( $shellCommand $shellInfile $shellOutfile ); + unlink( $infile ); unlink( $outfile ); -- To view, visit https://gerrit.wikimedia.org/r/61019 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib0db0c2ac36ae615f280ed9db82d2ca6aad744b5 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender umherirrender_de...@web.de Gerrit-Reviewer: IAlex coderev...@emsenhuber.ch Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Pass array to Title::getLocalURL instead of an urlencoded st... - change (mediawiki/core)
jenkins-bot has submitted this change and it was merged. Change subject: Pass array to Title::getLocalURL instead of an urlencoded string .. Pass array to Title::getLocalURL instead of an urlencoded string This makes code easier to read and the urlencode is done inside getLocalURL or friends Change-Id: I21b988890356d11835eedba12a90a347bf0905b2 --- M includes/ChangesFeed.php M includes/FeedUtils.php M includes/OutputPage.php M includes/Preferences.php M includes/SkinLegacy.php M includes/SpecialPageFactory.php M includes/UserMailer.php M includes/Wiki.php M includes/WikiPage.php M includes/parser/Parser.php M includes/specials/SpecialRevisiondelete.php M includes/specials/SpecialUndelete.php 12 files changed, 26 insertions(+), 24 deletions(-) Approvals: IAlex: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index 8e710de..1d89888 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -194,10 +194,10 @@ } if ( $obj-rc_this_oldid ) { - $url = $title-getFullURL( - 'diff=' . $obj-rc_this_oldid . - 'oldid=' . $obj-rc_last_oldid - ); + $url = $title-getFullURL( array( + 'diff' = $obj-rc_this_oldid, + 'oldid' = $obj-rc_last_oldid, + ) ); } else { // log entry or something like that. $url = $title-getFullURL(); diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 6f3b42c..1d3b3c8 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -220,9 +220,10 @@ * @return string */ protected static function getDiffLink( Title $title, $newid, $oldid = null ) { - $queryParameters = ($oldid == null) - ? diff={$newid} - : diff={$newid}oldid={$oldid}; + $queryParameters = array( 'diff' = $newid ); + if ( $oldid != null ) { + $queryParameters['oldid'] = $oldid; + } $diffUrl = $title-getFullURL( $queryParameters ); $diffLink = Html::element( 'a', array( 'href' = $diffUrl ), diff --git a/includes/OutputPage.php b/includes/OutputPage.php index bf3c084..08eb3ae 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3324,7 +3324,7 @@ foreach ( $wgAdvertisedFeedTypes as $format ) { $tags[] = $this-feedLink( $format, - $rctitle-getLocalURL( feed={$format} ), + $rctitle-getLocalURL( array( 'feed' = $format ) ), $this-msg( site-{$format}-feed, $wgSitename )-text() # For grep: 'site-rss-feed', 'site-atom-feed'. ); } diff --git a/includes/Preferences.php b/includes/Preferences.php index 5518eb3..64b48dd 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1093,7 +1093,7 @@ } # Create preview link - $mplink = htmlspecialchars( $mptitle-getLocalURL( useskin=$skinkey ) ); + $mplink = htmlspecialchars( $mptitle-getLocalURL( array( 'useskin' = $skinkey ) ) ); $linkTools[] = a target='_blank' href=\$mplink\$previewtext/a; # Create links to user CSS/JS pages diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php index ae65b9d..6f11837 100644 --- a/includes/SkinLegacy.php +++ b/includes/SkinLegacy.php @@ -220,7 +220,7 @@ $s = $wgLang-pipeList( array( $s, - 'a href=' . htmlspecialchars( $title-getLocalURL( 'variant=' . $code ) ) . ' lang=' . $code . ' hreflang=' . $code . '' . htmlspecialchars( $varname ) . '/a' + 'a href=' . htmlspecialchars( $title-getLocalURL( array( 'variant' = $code ) ) ) . ' lang=' . $code . ' hreflang=' . $code . '' . htmlspecialchars( $varname ) . '/a' ) ); } } diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index 675fb83..19adf70 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -463,7 +463,6 @@ if ( $name !=
[MediaWiki-commits] [Gerrit] Illustrate two ways to crash-land namespacing - change (mediawiki/core)
Adamw has uploaded a new change for review. https://gerrit.wikimedia.org/r/61174 Change subject: Illustrate two ways to crash-land namespacing .. Illustrate two ways to crash-land namespacing This is an example of an incremental migration to use namespaces, in which TestUser is refactored under a namespace hierarchy. Two tests are affected, but different actions are taken in each case. * UploadStashTest is given a proper namespace as well, and therefore its dependencies must be declared explicitly. * ApiTestCase would be more annoying to refactor, since that would force a cascade of changes. Instead, the TestUser namespace is aliased away and inheriting test cases do not need further repair, for now. This would be the easiest path to take when migrating a large or interdependent codebase, such as all of mediawiki-core, but the point is that both approaches can coexist. Change-Id: Ibf56a9c1a8ad65d210fe68bb23a778fb1a7e2e57 --- M tests/TestsAutoLoader.php M tests/phpunit/includes/TestUser.php M tests/phpunit/includes/api/ApiTestCase.php M tests/phpunit/includes/upload/UploadStashTest.php 4 files changed, 18 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/61174/1 diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php index 017a1b4..1df364f 100644 --- a/tests/TestsAutoLoader.php +++ b/tests/TestsAutoLoader.php @@ -21,6 +21,8 @@ * @ingroup Testing */ +AutoLoader::registerNamespace( 'mediawiki\core\tests\phpunit', __DIR__ . /phpunit/includes ); + global $wgAutoloadClasses; $testDir = __DIR__; @@ -40,7 +42,6 @@ 'MediaWikiPHPUnitCommand' = $testDir/phpunit/MediaWikiPHPUnitCommand.php, 'MediaWikiLangTestCase' = $testDir/phpunit/MediaWikiLangTestCase.php, 'MediaWikiProvide' = $testDir/phpunit/includes/Providers.php, - 'TestUser' = $testDir/phpunit/includes/TestUser.php, # tests/phpunit/includes 'BlockTest' = $testDir/phpunit/includes/BlockTest.php, diff --git a/tests/phpunit/includes/TestUser.php b/tests/phpunit/includes/TestUser.php index c4d8945..b2f8d20 100644 --- a/tests/phpunit/includes/TestUser.php +++ b/tests/phpunit/includes/TestUser.php @@ -1,4 +1,6 @@ -?php +?php namespace mediawiki\core\tests\phpunit; + +use \User; /* Wraps the user object, so we can also retain full access to properties like password if we log in via the API */ class TestUser { diff --git a/tests/phpunit/includes/api/ApiTestCase.php b/tests/phpunit/includes/api/ApiTestCase.php index 552fbfb..e73f56f 100644 --- a/tests/phpunit/includes/api/ApiTestCase.php +++ b/tests/phpunit/includes/api/ApiTestCase.php @@ -1,5 +1,7 @@ ?php +use mediawiki\core\tests\phpunit\TestUser; + abstract class ApiTestCase extends MediaWikiLangTestCase { protected static $apiUrl; diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php index 7a0fea4..bad7d03 100644 --- a/tests/phpunit/includes/upload/UploadStashTest.php +++ b/tests/phpunit/includes/upload/UploadStashTest.php @@ -1,4 +1,14 @@ -?php +?php namespace mediawiki\core\tests\phpunit\upload; + +use \FauxRequest; +use \RepoGroup; +use \UploadFromStash; +use \UploadStash; + +use \MediaWikiTestCase; + +use mediawiki\core\tests\phpunit\TestUser; + /** * @group Database */ -- To view, visit https://gerrit.wikimedia.org/r/61174 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibf56a9c1a8ad65d210fe68bb23a778fb1a7e2e57 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Adamw awi...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Split line and fixed spacing in skins folder - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/61175 Change subject: Split line and fixed spacing in skins folder .. Split line and fixed spacing in skins folder Change-Id: I669033b45f34353e201ffe2718ee54fed41fa450 --- M skins/CologneBlue.php M skins/Modern.php M skins/MonoBook.php M skins/Vector.php 4 files changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/75/61175/1 diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 1669de7..0182d76 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -532,7 +532,7 @@ $search = $this-getSkin()-getRequest()-getText( 'search' ); $action = $this-data['searchaction']; - $s = form id=\searchform- . htmlspecialchars($which) . \ method=\get\ class=\inline\ action=\$action\; + $s = form id=\searchform- . htmlspecialchars( $which ) . \ method=\get\ class=\inline\ action=\$action\; if ( $which == 'footer' ) { $s .= wfMessage( 'qbfind' )-text() . : ; } diff --git a/skins/Modern.php b/skins/Modern.php index 9177895..52f9fa2 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -83,7 +83,7 @@ for the margins -- div id=mw_contentholder class=mw-body div class='mw-topboxes' - div id=mw-js-message style=display:none;?php $this-html( 'userlangattributes' )?/div + div id=mw-js-message style=display:none;?php $this-html( 'userlangattributes' ) ?/div div class=mw-topbox id=siteSub?php $this-msg( 'tagline' ) ?/div ?php if ( $this-data['newtalk'] ) { ?div class=usermessage mw-topbox?php $this-html( 'newtalk' ) ?/div @@ -139,7 +139,7 @@ ?php foreach ( $this-getFooterLinks( flat ) as $aLink ) { if ( isset( $this-data[$aLink] ) $this-data[$aLink] ) { -? li id=?php echo$aLink??php $this-html($aLink) ?/li +? li id=?php echo $aLink ??php $this-html( $aLink ) ?/li ?php } } ? diff --git a/skins/MonoBook.php b/skins/MonoBook.php index b704173..aeeb0f8 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -95,7 +95,7 @@ ?php if ( $this-data['undelete'] ) { ? div id=contentSub2?php $this-html( 'undelete' ) ?/div ?php } ??php if ( $this-data['newtalk'] ) { ? - div class=usermessage?php $this-html( 'newtalk' ) ?/div + div class=usermessage?php $this-html( 'newtalk' ) ?/div ?php } ??php if ( $this-data['showjumplinks'] ) { ? div id=jump-to-nav class=mw-jump?php $this-msg( 'jumpto' ) ? a href=#column-one?php $this-msg( 'jumptonavigation' ) ?/a?php $this-msg( 'comma-separator' ) ?a href=#searchInput?php $this-msg( 'jumptosearch' ) ?/a/div ?php } ? @@ -107,7 +107,7 @@ div class=visualClear/div /div /div/div -div id=column-one?php $this-html( 'userlangattributes' ) ? +div id=column-one?php $this-html( 'userlangattributes' ) ? h2?php $this-msg( 'navigation-heading' ) ?/h2 ?php $this-cactions(); ? div class=portlet id=p-personal role=navigation @@ -146,7 +146,7 @@ $footerEnd = ''; } foreach ( $validFooterIcons as $blockName = $footerIcons ) { ? - div id=f-?php echo htmlspecialchars($blockName); ?ico + div id=f-?php echo htmlspecialchars( $blockName ); ?ico ?php foreach ( $footerIcons as $icon ) { ? ?php echo $this-getSkin()-makeFooterIcon( $icon ); ? @@ -159,7 +159,7 @@ ? ul id=f-list ?php foreach ( $validFooterLinks as $aLink ) { ? - li id=?php echo $aLink ??php $this-html($aLink) ?/li + li id=?php echo $aLink ??php $this-html( $aLink ) ?/li ?php } ? @@ -306,9 +306,10 @@ $portletAttribs['title'] = $tooltip; } echo ' ' . Html::openElement( 'div', $portletAttribs ); + $msgObj = wfMessage( $bar ); ? - h3?php $msg = wfMessage( $bar ); echo htmlspecialchars( $msg-exists() ? $msg-text() : $bar ); ?/h3 + h3?php echo htmlspecialchars( $msgObj-exists() ? $msgObj-text() : $bar ); ?/h3 div class='pBody' ?php if ( is_array( $cont ) ) { ? ul diff --git a/skins/Vector.php b/skins/Vector.php index 1e4643e..0bdf2fb 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -333,9 +333,10 @@ if ( $msg === null ) { $msg = $name; } + $msgObj = wfMessage( $msg ); ? div class=portal role=navigation id='?php echo Sanitizer::escapeId(
[MediaWiki-commits] [Gerrit] Fixed spacing around parenthesis in languages/tests/maintenance - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/61176 Change subject: Fixed spacing around parenthesis in languages/tests/maintenance .. Fixed spacing around parenthesis in languages/tests/maintenance Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24 --- M languages/LanguageConverter.php M languages/utils/CLDRPluralRuleEvaluator.php M maintenance/Maintenance.php M maintenance/cleanupUploadStash.php M maintenance/convertLinks.php M maintenance/createAndPromote.php M maintenance/dumpBackup.php M maintenance/dumpIterator.php M maintenance/fetchText.php M maintenance/fileOpPerfTest.php M maintenance/generateSitemap.php M maintenance/install.php M maintenance/jsparse.php M maintenance/language/transstat.php M maintenance/mwdoc-filter.php M maintenance/oracle/alterSharedConstraints.php M maintenance/parse.php M maintenance/proxyCheck.php M maintenance/rebuildrecentchanges.php M maintenance/refreshImageMetadata.php M maintenance/renderDump.php M maintenance/sql.php M maintenance/storage/checkStorage.php M maintenance/storage/compressOld.php M maintenance/updateSpecialPages.php M tests/RunSeleniumTests.php M tests/parser/ParserTestResult.php M tests/parserTests.php 28 files changed, 63 insertions(+), 63 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/76/61176/1 diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 512736b..d9227d7 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -258,7 +258,7 @@ // Get language variant preference from logged in users // Don't call this on stub objects because that causes infinite // recursion during initialisation - if ( $wgUser-isLoggedIn() ) { + if ( $wgUser-isLoggedIn() ) { $ret = $wgUser-getOption( 'variant' ); } else { // figure out user lang without constructing wgLang to avoid @@ -833,7 +833,7 @@ * @author Nikola Smolenski smole...@eunet.rs * @since 1.19 */ - public function guessVariant($text, $variant) { + public function guessVariant( $text, $variant ) { return false; } diff --git a/languages/utils/CLDRPluralRuleEvaluator.php b/languages/utils/CLDRPluralRuleEvaluator.php index 1910aaf..43e8aaf 100644 --- a/languages/utils/CLDRPluralRuleEvaluator.php +++ b/languages/utils/CLDRPluralRuleEvaluator.php @@ -67,7 +67,7 @@ public static function evaluateCompiled( $number, array $rules ) { // The compiled form is RPN, with tokens strictly delimited by // spaces, so this is a simple RPN evaluator. - foreach ( $rules as $i = $rule ) { + foreach ( $rules as $i = $rule ) { $stack = array(); $zero = ord( '0' ); $nine = ord( '9' ); @@ -104,7 +104,7 @@ */ private static function doOperation( $token, $left, $right ) { if ( in_array( $token, array( 'in', 'not-in', 'within', 'not-within' ) ) ) { - if ( !($right instanceof CLDRPluralRuleEvaluator_Range ) ) { + if ( !( $right instanceof CLDRPluralRuleEvaluator_Range ) ) { $right = new CLDRPluralRuleEvaluator_Range( $right ); } } diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index d68b831..2162869 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -766,7 +766,7 @@ $this-output( \n ); $scriptDependantParams = $this-mDependantParameters; - if ( count($scriptDependantParams) 0 ) { + if ( count( $scriptDependantParams ) 0 ) { $this-output( Script dependant parameters:\n ); // Parameters description foreach ( $scriptDependantParams as $par = $info ) { @@ -791,7 +791,7 @@ $this-mGenericParameters, $this-mDependantParameters ); - if ( count($scriptSpecificParams) 0 ) { + if ( count( $scriptSpecificParams ) 0 ) { $this-output( Script specific parameters:\n ); // Parameters description foreach ( $scriptSpecificParams as $par = $info ) { @@ -1077,7 +1077,7 @@ * @param $db DatabaseBase object */ private function unlockSearchindex( $db ) { - $db-unlockTables( __CLASS__ . '::' . __METHOD__ ); + $db-unlockTables( __CLASS__ . '::' . __METHOD__ ); } /** diff --git a/maintenance/cleanupUploadStash.php
[MediaWiki-commits] [Gerrit] Fixed spacing around parenthesis in includes - change (mediawiki/core)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/61177 Change subject: Fixed spacing around parenthesis in includes .. Fixed spacing around parenthesis in includes Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397 --- M includes/ChangesList.php M includes/Export.php M includes/GlobalFunctions.php M includes/HistoryBlob.php M includes/Hooks.php M includes/IP.php M includes/Init.php M includes/Sanitizer.php M includes/StringUtils.php M includes/Timestamp.php M includes/User.php M includes/actions/WatchAction.php M includes/api/ApiFeedContributions.php M includes/api/ApiQueryAllImages.php M includes/api/ApiQueryBase.php M includes/api/ApiQueryCategoryMembers.php M includes/api/ApiQuerySearch.php M includes/cache/HTMLFileCache.php M includes/cache/LocalisationCache.php M includes/content/WikitextContent.php M includes/db/Database.php M includes/db/DatabaseMysql.php M includes/db/DatabaseOracle.php M includes/db/LBFactory.php M includes/externalstore/ExternalStoreDB.php M includes/filerepo/FileRepo.php M includes/installer/Installer.php M includes/installer/MysqlInstaller.php M includes/installer/WebInstaller.php M includes/job/jobs/RefreshLinksJob.php M includes/logging/LogPager.php M includes/media/DjVu.php M includes/media/GIF.php M includes/media/PNG.php M includes/media/SVG.php M includes/media/SVGMetadataExtractor.php M includes/media/XCF.php M includes/objectcache/MemcachedClient.php M includes/profiler/ProfilerSimpleUDP.php M includes/resourceloader/ResourceLoader.php M includes/search/SearchPostgres.php M includes/specials/SpecialLog.php M includes/specials/SpecialMergeHistory.php M includes/specials/SpecialPrefixindex.php M includes/specials/SpecialProtectedpages.php M includes/specials/SpecialProtectedtitles.php M includes/specials/SpecialRecentchanges.php M includes/specials/SpecialUploadStash.php M includes/templates/UsercreateVForm.php M includes/templates/UserloginVForm.php 50 files changed, 68 insertions(+), 68 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/77/61177/1 diff --git a/includes/ChangesList.php b/includes/ChangesList.php index b589057..73d3b61 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -1083,7 +1083,7 @@ } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this-getUser() ) ) { $link = 'span class=history-deleted' . $rcObj-timestamp . '/span '; } else { - if ( $rcObj-unpatrolled $type == RC_NEW) { + if ( $rcObj-unpatrolled $type == RC_NEW ) { $params['rcid'] = $rcObj-mAttribs['rc_id']; } diff --git a/includes/Export.php b/includes/Export.php index 9400c41..e533dbc 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -599,7 +599,7 @@ $out = page\n; $title = Title::makeTitle( $row-page_namespace, $row-page_title ); $out .= '' . Xml::elementClean( 'title', array(), self::canonicalTitle( $title ) ) . \n; - $out .= '' . Xml::element( 'ns', array(), strval( $row-page_namespace) ) . \n; + $out .= '' . Xml::element( 'ns', array(), strval( $row-page_namespace ) ) . \n; $out .= '' . Xml::element( 'id', array(), strval( $row-page_id ) ) . \n; if ( $row-page_is_redirect ) { $page = WikiPage::factory( $title ); @@ -1191,7 +1191,7 @@ // Suppress annoying useless crap from p7zip // Unfortunately this could suppress real error messages too $command .= ' ' . wfGetNull() . ' 21'; - return( $command ); + return $command; } /** diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 320a57d..50287b3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2418,7 +2418,7 @@ try { $timestamp = new MWTimestamp( $ts ); return $timestamp-getTimestamp( $outputtype ); - } catch( TimestampException $e ) { + } catch ( TimestampException $e ) { wfDebug( wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts\n ); return false; } diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 8d83751..46cf238 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -143,7 +143,7 @@ * Compress the bulk data in the object */ public function compress() { - if ( !$this-mCompressed ) { + if ( !$this-mCompressed ) { $this-mItems = gzdeflate( serialize( $this-mItems ) ); $this-mCompressed =
[MediaWiki-commits] [Gerrit] Add a SpacesAroundSomeTokensSniff - change (mediawiki...codesniffer)
Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/61178 Change subject: Add a SpacesAroundSomeTokensSniff .. Add a SpacesAroundSomeTokensSniff This sniff was used to find and fixed many spacing issues in mediawiki core, see https://gerrit.wikimedia.org/r/#/q/project:mediawiki/core+branch:master+topic:fix-spacing,n,z for an overview. This sniff has still false positive, so be carefully, when using. Feel free to expand or rename it. Change-Id: I2cbacf9b9987d23aec6b0f10a6d3f9e760126087 --- A MediaWiki/Sniffs/NamingConventions/SpacesAroundSomeTokensSniff.php 1 file changed, 427 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer refs/changes/78/61178/1 diff --git a/MediaWiki/Sniffs/NamingConventions/SpacesAroundSomeTokensSniff.php b/MediaWiki/Sniffs/NamingConventions/SpacesAroundSomeTokensSniff.php new file mode 100644 index 000..23abd6c --- /dev/null +++ b/MediaWiki/Sniffs/NamingConventions/SpacesAroundSomeTokensSniff.php @@ -0,0 +1,427 @@ +?php +/** + * Check, if there are correct number of spaces around some tokens + */ +class MediaWiki_Sniffs_NamingConventions_SpacesAroundSomeTokensSniff implements PHP_CodeSniffer_Sniff { + + private $spaceOptions = array( + # string operations + T_STRING_CONCAT = array( // . + 'before' = 1, + 'after' = 1, + ), + T_CONCAT_EQUAL = array( // .= + 'before' = 1, + 'after' = 1, + ), + + # logical operations + T_GREATER_THAN = array( // + 'before' = 1, + 'after' = 1, + ), + T_IS_GREATER_OR_EQUAL = array( // = + 'before' = 1, + 'after' = 1, + ), + T_IS_EQUAL = array( // == + 'before' = 1, + 'after' = 1, + ), + T_IS_IDENTICAL = array( // === + 'before' = 1, + 'after' = 1, + ), + T_IS_NOT_EQUAL = array( // != or + 'before' = 1, + 'after' = 1, + ), + T_IS_NOT_IDENTICAL = array( // !== + 'before' = 1, + 'after' = 1, + ), + T_IS_SMALLER_OR_EQUAL = array( // = + 'before' = 1, + 'after' = 1, + ), + T_LESS_THAN = array( // + 'before' = 1, + 'after' = 1, + ), + + # Shifting + T_SL = array( // + 'before' = 1, + 'after' = 1, + ), + T_SL_EQUAL = array( // = + 'before' = 1, + 'after' = 1, + ), + T_SR = array( // + 'before' = 1, + 'after' = 1, + ), + T_SR_EQUAL = array( // = + 'before' = 1, + 'after' = 1, + ), + + # operations + T_PLUS = array( // + + 'before' = 1, + 'after' = 1, + ), + T_MINUS = array( // - + 'before' = 1, 'beforeOK' = T_OPEN_SQUARE_BRACKET, # okay as array index + # no test after, because -1 standalone is okay + ), + T_MULTIPLY = array( // * + 'before' = 1, + 'after' = 1, + ), + T_DIVIDE = array( // / + 'before' = 1, + 'after' = 1, + ), + T_MODULUS = array( // % + 'before' = 1, + 'after' = 1, + ), + T_POWER = array( // ^ + 'before' = 1, + 'after' = 1, + ), + + # operation and assignment + T_AND_EQUAL = array( // = + 'before' = 1, + 'after' = 1, + ), + T_OR_EQUAL = array( // |= + 'before' = 1, + 'after' = 1, + ), + T_XOR_EQUAL = array( // ^= + 'before' = 1, + 'after' = 1, + ), + T_PLUS_EQUAL = array( // += + 'before' = 1, + 'after' = 1, + ), + T_MINUS_EQUAL = array( // -= + 'before' = 1, +
[MediaWiki-commits] [Gerrit] Extend SMW\SpecialsTest - change (mediawiki...SemanticMediaWiki)
Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/61179 Change subject: Extend SMW\SpecialsTest .. Extend SMW\SpecialsTest Change-Id: I86a27728349fc3bacddb3e6425dc7f7940d4cf85 --- M includes/Setup.php M tests/phpunit/includes/specials/SpecialsTest.php 2 files changed, 53 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki refs/changes/79/61179/1 diff --git a/includes/Setup.php b/includes/Setup.php index 641d8c5..ebbe10c 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -362,45 +362,70 @@ * Register all SMW special pages with MediaWiki. */ function smwfRegisterSpecialPages() { - global $wgSpecialPages, $wgSpecialPageGroups; + $specials = array( + 'Ask' = array( + 'page' = 'SMWAskPage', + 'group' = 'smw_group' + ), + 'Browse' = array( + 'page' = 'SMWSpecialBrowse', + 'group' = 'smw_group' + ), + 'PageProperty' = array( + 'page' = 'SMWPageProperty', + 'group' = 'smw_group' + ), + 'SearchByProperty' = array( + 'page' = 'SMWSearchByProperty', + 'group' = 'smw_group' + ), + 'SMWAdmin' = array( + 'page' = 'SMWAdmin', + 'group' = 'smw_group' + ), + 'SemanticStatistics' = array( + 'page' = 'SMW\SpecialSemanticStatistics', + 'group' = 'wiki' + ), + 'ExportRDF' = array( + 'page' = 'SMWSpecialOWLExport', + 'group' = 'smw_group' + ), + 'Types' = array( + 'page' = 'SMWSpecialTypes', + 'group' = 'pages' + ), + ); - $wgSpecialPages['Ask'] = 'SMWAskPage'; - $wgSpecialPageGroups['Ask'] = 'smw_group'; + // Register data + foreach ( $specials as $special = $page ) { + $GLOBALS['wgSpecialPages'][$special] = $page['page']; -// $wgSpecialPages['QueryCreator'] = 'SMWQueryCreatorPage'; -// $wgSpecialPageGroups['QueryCreator']= 'smw_group'; + if ( isset( $page['group'] ) ) { + $GLOBALS['wgSpecialPageGroups'][$special] = $page['group']; + } + } - $wgSpecialPages['Browse'] = 'SMWSpecialBrowse'; - $wgSpecialPageGroups['Browse'] = 'smw_group'; + // $wgSpecialPages['QueryCreator'] = 'SMWQueryCreatorPage'; + // $wgSpecialPageGroups['QueryCreator']= 'smw_group'; - $wgSpecialPages['PageProperty'] = 'SMWPageProperty'; - $wgSpecialPageGroups['PageProperty']= 'smw_group'; - - $wgSpecialPages['SearchByProperty'] = 'SMWSearchByProperty'; - $wgSpecialPageGroups['SearchByProperty']= 'smw_group'; - + // FIXME Test fails with Undefined index: HTTP_ACCEPT $wgSpecialPages['URIResolver'] = 'SMWURIResolver'; - $wgSpecialPages['SMWAdmin'] = 'SMWAdmin'; - $wgSpecialPageGroups['SMWAdmin']= 'smw_group'; - - $wgSpecialPages['SemanticStatistics'] = 'SMW\SpecialSemanticStatistics'; - $wgSpecialPageGroups['SemanticStatistics'] = 'wiki'; // Similar to Special:Statistics - - $wgSpecialPages['ExportRDF']= 'SMWSpecialOWLExport'; - $wgSpecialPageGroups['ExportRDF'] = 'smw_group'; - + // FIXME Test fails with (SMWSpecialProperties) Use of wfViewPrevNext was deprecated in MediaWiki 1.19 $wgSpecialPages['Properties'] = 'SMWSpecialProperties'; $wgSpecialPageGroups['Properties'] = 'pages'; - $wgSpecialPages['Types']= 'SMWSpecialTypes'; - $wgSpecialPageGroups['Types'] = 'pages'; - + // FIXME Test fails with (SMWSpecialUnusedProperties) Use of wfViewPrevNext was deprecated in MediaWiki 1.19. $wgSpecialPages['UnusedProperties'] = 'SMWSpecialUnusedProperties'; $wgSpecialPageGroups['UnusedProperties']= 'maintenance'; + // FIXME Test fails with (SMWSpecialWantedProperties) Use of Linker::makeLinkObj was deprecated in MediaWiki 1.21 $wgSpecialPages['WantedProperties'] = 'SMWSpecialWantedProperties'; $wgSpecialPageGroups['WantedProperties']= 'maintenance'; + + // $specials is used in SpecialsTest therefore above
[MediaWiki-commits] [Gerrit] AlienNode stores original DOM elements instead of HTML - change (mediawiki...VisualEditor)
Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/61180 Change subject: AlienNode stores original DOM elements instead of HTML .. AlienNode stores original DOM elements instead of HTML As jQuery hash problems in some cases converting HTML, it is easier just to store the original DOM elements. The bulk of this commit is fixing the tests as although we have an assertion for comparing DOM elements, we don't have one for comparing objects or arrays which may contain DOM elements. ve.js * copyObject copyArray fixed to run cloneNode(true) on any item of type Node. * Added callback function so an object/array can be copied with modifications. ve.qunit.js * Added deepEqualWithDomElements: Using the new copyObect/Array callbcak, we can copy the incoming object and convert any nodes to node summaries, then just run the normal deep equal comparison. ve.dm.AlienNodes.js * Instead of storing html we store cloned DOM elements which we can send straight back to the converter without any processing. ve.dm.example.js * Updated tests to expect DOM elements instead of HTML. ve.dm.Converter.test.js * Updated tests to use deepEqualWithDomElements Bug: 47737 Change-Id: I3df8f49b170c31da9610129d53cf8cb65dd5d5f8 --- M modules/ve/dm/nodes/ve.dm.AlienNode.js M modules/ve/test/dm/ve.dm.Converter.test.js M modules/ve/test/dm/ve.dm.example.js M modules/ve/test/ve.qunit.js M modules/ve/ve.js 5 files changed, 73 insertions(+), 62 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/80/61180/1 diff --git a/modules/ve/dm/nodes/ve.dm.AlienNode.js b/modules/ve/dm/nodes/ve.dm.AlienNode.js index a17b29a..2cfe9c5 100644 --- a/modules/ve/dm/nodes/ve.dm.AlienNode.js +++ b/modules/ve/dm/nodes/ve.dm.AlienNode.js @@ -35,34 +35,18 @@ ve.dm.AlienNode.static.toDataElement = function ( domElements, converter ) { var isInline = this.isHybridInline( domElements, converter ), - type = isInline ? 'alienInline' : 'alienBlock', - html = $( 'div', domElements[0].ownerDocument ).append( $( domElements ).clone() ).html(); + type = isInline ? 'alienInline' : 'alienBlock'; return { 'type': type, 'attributes': { - 'html': html + 'domElements': ve.copyArray( domElements ) } }; }; -ve.dm.AlienNode.static.toDomElements = function ( dataElement, doc ) { - var wrapper = doc.createElement( 'div' ); - - // Filthy hack: Parsoid is currently sending us unescaped angle brackets - // inside data-parsoid. For some reason FF picks this up as html and tries - // to sanitise it, converting ref/ to ref/span (!?). - // As a *very temporary* fix we can regex replace them here. - $( wrapper ).html( - dataElement.attributes.html.replace( - /data-parsoid=([^]+)/g, - function( r0, r1 ) { - return 'data-parsoid=' + r1.replace( //g, 'lt;' ).replace( //g, 'gt;' ) + ''; - } - ) - ); - // Convert wrapper.children to an array - return Array.prototype.slice.call( wrapper.childNodes, 0 ); +ve.dm.AlienNode.static.toDomElements = function ( dataElement ) { + return dataElement.attributes.domElements; }; /* Concrete subclasses */ diff --git a/modules/ve/test/dm/ve.dm.Converter.test.js b/modules/ve/test/dm/ve.dm.Converter.test.js index ca0c100..6dc1d88 100644 --- a/modules/ve/test/dm/ve.dm.Converter.test.js +++ b/modules/ve/test/dm/ve.dm.Converter.test.js @@ -63,7 +63,7 @@ store = new ve.dm.IndexValueStore(); internalList = new ve.dm.InternalList(); ve.dm.example.preprocessAnnotations( cases[msg].data, store ); - assert.deepEqual( + assert.deepEqualWithDomElements( ve.dm.converter.getDataFromDom( ve.createDocumentFromHTML( cases[msg].html ), store, internalList ).getData(), cases[msg].data, msg @@ -100,9 +100,8 @@ store.index( cases[msg].storeItems[i].value, cases[msg].storeItems[i].hash ); } } - // functions won't be copied by ve.copyObject - if( ve.dm.example.domToDataCases[msg].modify ) { - ve.dm.example.domToDataCases[msg].modify( cases[msg].data ); + if( cases[msg].modify ) { + cases[msg].modify( cases[msg].data ); } doc = new ve.dm.Document( ve.dm.example.preprocessAnnotations( cases[msg].data, store ) ); originalData = ve.copyArray( doc.getFullData()
[MediaWiki-commits] [Gerrit] Pass length of ogg file to TimedMediaTransformOutput - change (mediawiki...Score)
J has uploaded a new change for review. https://gerrit.wikimedia.org/r/61181 Change subject: Pass length of ogg file to TimedMediaTransformOutput .. Pass length of ogg file to TimedMediaTransformOutput This way the player can load without opening the audio file to determin duration and will load faster. (Depends on change I227b5b1b7 in TimedMediaHandler) Bug: 47533 Change-Id: I34d583c6b803e8db5eabceb07552a391eec2519c --- M Score.body.php 1 file changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score refs/changes/81/61181/1 diff --git a/Score.body.php b/Score.body.php index 3201c4b..0077d16 100644 --- a/Score.body.php +++ b/Score.body.php @@ -423,6 +423,7 @@ if ( $options['generate_ogg'] ) { if ( $options['override_midi'] ) { $oggUrl = $options['ogg_url']; + $oggPath = $options['ogg_storage_path']; $exists = $backend-fileExists( array( 'src' = $options['ogg_storage_path'] ) ); if ( !$exists ) { $backend-prepare( array( 'dir' = $options['ogg_storage_dir'] ) ); @@ -435,6 +436,7 @@ } else { $oggFileName = {$options['file_name_prefix']}.ogg; $oggUrl = {$options['dest_url']}/$oggFileName; + $oggPath = {$options['dest_storage_path']}/$oggFileName; if ( !isset( $existingFiles[$oggFileName] ) ) { // Maybe we just generated it $sourcePath = {$options['factory_directory']}/file.midi; @@ -447,7 +449,7 @@ self::generateOgg( $sourcePath, $options['factory_directory'], - {$options['dest_storage_path']}/$oggFileName ); + $oggPath ); } } } @@ -488,6 +490,7 @@ if ( $options['generate_ogg'] ) { if ( class_exists( 'TimedMediaTransformOutput' ) ){ $player = new TimedMediaTransformOutput( array( + 'length' = self::getLength( $oggPath ), 'sources' = array( array( 'src' = $oggUrl, @@ -850,6 +853,20 @@ } /** +* get length of ogg vorbis file +* +* @param $path path to file +* +* @return float duration in seconds +*/ + private static function getLength( $path ) { + $backend = self::getBackend(); + $props = $backend-getFileProps( array( 'src' = $path ) ); + $metadata = unserialize( $props['metadata'] ); + return $metadata['length']; + } + + /** * Trims an image with ImageMagick. * * @param $source string Local path to the source image. -- To view, visit https://gerrit.wikimedia.org/r/61181 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I34d583c6b803e8db5eabceb07552a391eec2519c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Score Gerrit-Branch: master Gerrit-Owner: J jger...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add a copy of jquery.client so the standalone still works - change (mediawiki...VisualEditor)
jenkins-bot has submitted this change and it was merged. Change subject: Add a copy of jquery.client so the standalone still works .. Add a copy of jquery.client so the standalone still works The tests passed just fine in Gerrit, because it runs the tests via MediaWiki using ResourceLoader, which was able to load jquery.client just fine from MW core. Change-Id: I004514ab761107b687be2fe1ff49ecfd25bead5b --- M demos/ve/index.php A modules/jquery/jquery.client.js M modules/ve/test/index.php 3 files changed, 235 insertions(+), 0 deletions(-) Approvals: Esanders: Looks good to me, approved jenkins-bot: Verified diff --git a/demos/ve/index.php b/demos/ve/index.php index 6d279d6..43218f4 100644 --- a/demos/ve/index.php +++ b/demos/ve/index.php @@ -68,6 +68,7 @@ !-- Generated by maintenance/makeStaticLoader.php -- !-- Dependencies -- script src=../../modules/jquery/jquery.js/script + script src=../../modules/jquery/jquery.client.js/script script src=../../modules/rangy/rangy-core.js/script script src=../../modules/rangy/rangy-position.js/script script src=../../modules/unicodejs/unicodejs.js/script diff --git a/modules/jquery/jquery.client.js b/modules/jquery/jquery.client.js new file mode 100644 index 000..b0bd685 --- /dev/null +++ b/modules/jquery/jquery.client.js @@ -0,0 +1,233 @@ +/** + * User-agent detection + */ +( function ( $ ) { + + /* Private Members */ + + /** +* @var profileCache {Object} Keyed by userAgent string, +* value is the parsed $.client.profile object for that user agent. +*/ + var profileCache = {}; + + /* Public Methods */ + + $.client = { + + /** +* Get an object containing information about the client. +* +* @param nav {Object} An object with atleast a 'userAgent' and 'platform' key. +* Defaults to the global Navigator object. +* @return {Object} The resulting client object will be in the following format: +* { +* 'name': 'firefox', +* 'layout': 'gecko', +* 'layoutVersion': 20101026, +* 'platform': 'linux' +* 'version': '3.5.1', +* 'versionBase': '3', +* 'versionNumber': 3.5, +* } +*/ + profile: function ( nav ) { + /*jshint boss: true */ + + if ( nav === undefined ) { + nav = window.navigator; + } + // Use the cached version if possible + if ( profileCache[nav.userAgent] === undefined ) { + + var + versionNumber, + + /* Configuration */ + + // Name of browsers or layout engines we don't recognize + uk = 'unknown', + // Generic version digit + x = 'x', + // Strings found in user agent strings that need to be conformed + wildUserAgents = ['Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3'], + // Translations for conforming user agent strings + userAgentTranslations = [ + // Tons of browsers lie about being something they are not + [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], + // Chrome lives in the shadow of Safari still + ['Chrome Safari', 'Chrome'], + // KHTML is the layout engine not the browser - LIES! + ['KHTML', 'Konqueror'], + // Firefox nightly builds + ['Minefield', 'Firefox'], + // This helps keep differnt versions consistent + ['Navigator', 'Netscape'], + // This prevents version extraction issues, otherwise translation would happen later + ['PLAYSTATION 3', 'PS3'] + ], + // Strings which precede a version number in a user agent string - combined and used as
[MediaWiki-commits] [Gerrit] MathJax: Allow user to configure MathJax - change (mediawiki...Math)
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/61182 Change subject: MathJax: Allow user to configure MathJax .. MathJax: Allow user to configure MathJax The user can provide his own mathJax.config object. Change-Id: I97800317366aafcaad87ecf6644e9417c698c5da Supersedes: Ic05659eaca35a939289bf49b17084299319d8c4d Bug: 35478 --- M modules/ext.math.mathjax.enabler.js 1 file changed, 22 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/82/61182/1 diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index e1343a8..faa5b89 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -11,27 +11,29 @@ mathJax.loaded = false; - mathJax.Config = function () { -MathJax.Hub.Config({ - root: mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax', - config: ['TeX-AMS-texvc_HTML.js'], - 'v1.0-compatible': false, - styles: { -'.mtext': { - 'font-family': 'sans-serif ! important', - 'font-size': '80%' -} - }, - displayAlign: 'left', - menuSettings: { -zoom: 'Click' - }, - 'HTML-CSS': { -imageFont: null, -availableFonts: ['TeX'] + mathJax.config = $.extend( true, { +root: mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax', +config: ['TeX-AMS-texvc_HTML.js'], +'v1.0-compatible': false, +styles: { + '.mtext': { +'font-family': 'sans-serif ! important', +'font-size': '80%' } -}); -MathJax.OutputJax.fontDir = mathJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; +}, +displayAlign: 'left', +menuSettings: { + zoom: 'Click' +}, +'HTML-CSS': { + imageFont: null, + availableFonts: ['TeX'] +} + }, mathJax.config ); + + mathJax.Config = function () { +MathJax.Hub.Config( mathJax.config ); +MathJax.OutputJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; }; mathJax.Load = function () { -- To view, visit https://gerrit.wikimedia.org/r/61182 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I97800317366aafcaad87ecf6644e9417c698c5da Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] MathJax: Add a renderTex hook to render elements on demand - change (mediawiki...Math)
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/61183 Change subject: MathJax: Add a renderTex hook to render elements on demand .. MathJax: Add a renderTex hook to render elements on demand This supersedes: https://gerrit.wikimedia.org/r/23073 Bug: 35478 Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b --- M modules/ext.math.mathjax.enabler.js 1 file changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/83/61183/1 diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index e1343a8..7369b77 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -34,6 +34,31 @@ MathJax.OutputJax.fontDir = mathJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; }; + /** + * Renders all Math TeX inside the given elements. + * @param {function} callback to be executed after text elements have rendered [optional] + */ + $.fn.renderTex = function ( callback ) { +var elem = this.find( '.tex' ).parent().toArray(); + +if ( !$.isFunction( callback ) ) { + callback = $.noop; +} + +function render () { + MathJax.Hub.Queue( ['Typeset', MathJax.Hub, elem, callback] ); +} + +mw.loader.using( 'ext.math.mathjax', function () { + if ( MathJax.isReady ) { +render(); + } else { +MathJax.Hub.Startup.signal.MessageHook( 'End', render ); + } +}); +return this; + }; + mathJax.Load = function () { var config, script; if (this.loaded) { -- To view, visit https://gerrit.wikimedia.org/r/61183 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 35556) Allow MathJax to report errors. - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: (bug 35556) Allow MathJax to report errors. .. (bug 35556) Allow MathJax to report errors. Change-Id: Ibed05d3a4a28f7f99bc379f765d633256a8ddc12 --- M modules/MathJax/config/TeX-AMS-texvc_HTML.js 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/MathJax/config/TeX-AMS-texvc_HTML.js b/modules/MathJax/config/TeX-AMS-texvc_HTML.js index be49553..f3d799c 100644 --- a/modules/MathJax/config/TeX-AMS-texvc_HTML.js +++ b/modules/MathJax/config/TeX-AMS-texvc_HTML.js @@ -1,6 +1,6 @@ MathJax.Hub.Config({ extensions: [wiki2jax.js,MathEvents.js,MathZoom.js,MathMenu.js,toMathML.js], jax: [input/TeX,output/HTML-CSS], - TeX: {extensions: [noErrors.js,noUndefined.js,AMSmath.js,AMSsymbols.js,texvc.js, color.js, cancel.js]} + TeX: {extensions: [noUndefined.js,AMSmath.js,AMSsymbols.js,texvc.js, color.js, cancel.js]} }); MathJax.Ajax.loadComplete([MathJax]/config/TeX-AMS-texvc_HTML.js); -- To view, visit https://gerrit.wikimedia.org/r/23069 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibed05d3a4a28f7f99bc379f765d633256a8ddc12 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Liangent liang...@gmail.com Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 36855) escape literal % in tex input - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: (bug 36855) escape literal % in tex input .. (bug 36855) escape literal % in tex input This removes support for MathML % comments, just as with texvc PS2: Fix for regex lookbehind issue Change-Id: I0cb026d749733ed3dbba8faacb163be4438fc6bb --- M modules/MathJax/extensions/wiki2jax.js 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Mormegil: Looks good to me, but someone else must approve Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/MathJax/extensions/wiki2jax.js b/modules/MathJax/extensions/wiki2jax.js index 606ac75..5870c59 100644 --- a/modules/MathJax/extensions/wiki2jax.js +++ b/modules/MathJax/extensions/wiki2jax.js @@ -39,6 +39,9 @@ tex = tex.replace(/lt;/g,).replace(/gt;/g,).replace(/amp;/g,).replace(/nbsp;/g, ); } +// We don't allow comments (%) in texvc and escape all literal % by default. +tex = tex.replace(/([^\\])%/g, $1\\% ); + tex = tex.replace(/\\iiint([^!]*)!\\!\\!\\!\\!.*\\subset\\!\\supset/g,\\iiint$1mkern-2.5em\\subset\\!\\supset).replace(/\\iint([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\subset\\!\\supset/g,\\iint$1mkern-1.65em$2\\subset\\!\\!\\supset).replace(/\\int\\!\\!\\!(\\!)+\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!.*\\bigcirc(\\,)*/g,\\iiint$3mkern-2.5em\\subset\\!\\supset).replace(/\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\bigcirc(\\,)*/g,\\iint$2mkern-1.65em$3\\subset\\!\\!\\supset); if (mode === ) { tex = tex.replace(/ *\\scriptstyle(\W)/g,\\textstyle$1).replace(/ *\\scriptscriptstyle(\W)/g,\\scriptstyle$1); -- To view, visit https://gerrit.wikimedia.org/r/23063 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0cb026d749733ed3dbba8faacb163be4438fc6bb Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Liangent liang...@gmail.com Gerrit-Reviewer: Mormegil morme...@centrum.cz Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] MathJax: Remove support for wikEd and AjaxPreview - change (mediawiki...Math)
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/61184 Change subject: MathJax: Remove support for wikEd and AjaxPreview .. MathJax: Remove support for wikEd and AjaxPreview With the new renderTex hook of https://gerrit.wikimedia.org/r/61183 there is no need for hardcoded support for these 2 scripts. The scripts in question should call the hook themselves. Change-Id: I9811832430e9ddd8a4c03f265d07529a76efc38a Supersedes: https://gerrit.wikimedia.org/r/23073 Bug: 35478 --- M modules/ext.math.mathjax.enabler.js 1 file changed, 1 insertion(+), 32 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math refs/changes/84/61184/1 diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index 7369b77..33ef5e7 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -84,39 +84,8 @@ return false; }; - mathJax.Init = function () { -this.Load( document.getElementById('bodyContent') || document.body ); - -// compatibility with wikEd -if ( typeof wikEd === 'undefined' ) { - wikEd = {}; -} -if ( wikEd.config === undefined ) { - wikEd.config = {}; -} -if ( wikEd.config.previewHook === undefined ) { - wikEd.config.previewHook = []; -} -wikEd.config.previewHook.push( function (){ - if (window.mathJax.Load(document.getElementById('wikEdPreviewBox') || document.body)) { -MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'wikEdPreviewBox']); - } -} ); - -// compatibility with ajaxPreview -this.oldAjaxPreviewExec = window.ajaxPreviewExec; -window.ajaxPreviewExec = function (previewArea) { - if ( mathJax.oldAjaxPreviewExec !== undefined ) { -mathJax.oldAjaxPreviewExec(previewArea); - } - if ( mathJax.Load(previewArea) ) { -MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] ); - } -}; - }; - $( document ).ready( function () { -mathJax.Init(); +mathJax.Load(); } ); }( mediaWiki, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/61184 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9811832430e9ddd8a4c03f265d07529a76efc38a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] remove unused code - change (mediawiki...Math)
TheDJ has submitted this change and it was merged. Change subject: remove unused code .. remove unused code This code is never used and will not be used in the future. Adressing the equation for search will be handled by the MathSearch extension. There will be a hook function to label the equations. Change-Id: Ia2149460134b361fb44f8ad85660793b1951d988 --- M Math.hooks.php M MathRenderer.php 2 files changed, 0 insertions(+), 20 deletions(-) Approvals: TheDJ: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/Math.hooks.php b/Math.hooks.php index a70da28..a1d9fea 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -50,7 +50,6 @@ $renderer = MathRenderer::getRenderer( $content, $attributes, $mode ); - $renderer-setAnchorID( $parser-nextLinkID() ); // Add an ID for referencing the equation later on only used by LaTeXML $renderedMath = $renderer-render(); if ( $wgUseMathJax $mode == MW_MATH_MATHJAX ) { $parser-getOutput()-addModules( array( 'ext.math.mathjax.enabler' ) ); diff --git a/MathRenderer.php b/MathRenderer.php index e81b02f..feaf38e 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -28,7 +28,6 @@ var $conservativeness = 0; var $params = ''; protected $recall; - protected $anchorID = 0; /** * Constructs a base MathRenderer @@ -202,24 +201,6 @@ */ public function isRecall() { return $this-recall; - } - - /** -* Gets anchor ID -* -* @return string anchor ID -*/ - public function getAnchorID() { - return $this-anchorID; - } - - /** -* Sets anchor ID -* -* @param string ID anchor ID -*/ - public function setAnchorID( $ID ) { - $this-anchorID = $ID; } /** -- To view, visit https://gerrit.wikimedia.org/r/60629 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia2149460134b361fb44f8ad85660793b1951d988 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: Cjucovschi jucovs...@gmail.com Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Ori.livneh o...@wikimedia.org Gerrit-Reviewer: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Worden.lee worden@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update the target language direction when changing the language - change (mediawiki...Translate)
Amire80 has uploaded a new change for review. https://gerrit.wikimedia.org/r/61185 Change subject: Update the target language direction when changing the language .. Update the target language direction when changing the language Change-Id: I66f30a255567bace9893b80e5b27f45ce6b64bee --- M resources/js/ext.translate.special.translate.js 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/85/61185/1 diff --git a/resources/js/ext.translate.special.translate.js b/resources/js/ext.translate.special.translate.js index 0c0075a..76ec11d 100644 --- a/resources/js/ext.translate.special.translate.js +++ b/resources/js/ext.translate.special.translate.js @@ -111,7 +111,10 @@ } $( '.ext-translate-language-selector .uls' ).text( $.uls.data.getAutonym( language ) ); - $( '.tux-messagelist' ).data( 'targetlangcode', language ); + $( '.tux-messagelist' ).data( { + targetlangcode: language, + targetlangdir: $.uls.data.getDir( language ) + } ); mw.translate.changeUrl( changes ); $( '.tux-statsbar' ).trigger( 'refresh', language ); -- To view, visit https://gerrit.wikimedia.org/r/61185 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66f30a255567bace9893b80e5b27f45ce6b64bee Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Amire80 amir.ahar...@mail.huji.ac.il ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added extra condition types to secure pages: by Title (exact... - change (mediawiki...SimpleSecurity)
Timboven has uploaded a new change for review. https://gerrit.wikimedia.org/r/61186 Change subject: Added extra condition types to secure pages: by Title (exact/regex/startsWith) .. Added extra condition types to secure pages: by Title (exact/regex/startsWith) Change-Id: I8bcf96719b99141738f6abe103c4830d2e8a55c9 --- M SimpleSecurity_body.php 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SimpleSecurity refs/changes/86/61186/1 diff --git a/SimpleSecurity_body.php b/SimpleSecurity_body.php index e345948..8ac5731 100644 --- a/SimpleSecurity_body.php +++ b/SimpleSecurity_body.php @@ -338,6 +338,15 @@ case Namespace: $deny = $data == $title-getNsText(); break; + case Title: + $deny = $this-startsWith($title-getFullText(), $data); + break; + case TitleRegEx: + $deny = preg_match(/.$data./i, $title-getFullText()); + break; + case TitleEq: + $deny = $data == $title-getFullText(); + break; } # If the rule applies to this title, check if we're a member of the required groups, @@ -362,6 +371,13 @@ } } + private function startsWith($haystack, $needle, $case = true) { + if ($case) { + return strpos($haystack, $needle, 0) === 0; + } + return stripos($haystack, $needle, 0) === 0; + } + /** * Create the new Database class with hooks in its query() and fetchObject() methods and use our LBFactory_SimpleSecurity class */ -- To view, visit https://gerrit.wikimedia.org/r/61186 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8bcf96719b99141738f6abe103c4830d2e8a55c9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SimpleSecurity Gerrit-Branch: master Gerrit-Owner: Timboven tim.bo...@telenet.be ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Added extra Notice-type (for those that use a 'folder' struc... - change (mediawiki...PageNotice)
Timboven has uploaded a new change for review. https://gerrit.wikimedia.org/r/61187 Change subject: Added extra Notice-type (for those that use a 'folder' structure in their pagenames. Also refactored the lookup of the content that must be used for the notice-message, the retrievel of the content is now extracted to a seperate method. .. Added extra Notice-type (for those that use a 'folder' structure in their pagenames. Also refactored the lookup of the content that must be used for the notice-message, the retrievel of the content is now extracted to a seperate method. Change-Id: I8cb62a8c8b94960c1cc6a595d6b62602645b6321 --- M PageNotice.php 1 file changed, 45 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageNotice refs/changes/87/61187/1 diff --git a/PageNotice.php b/PageNotice.php index dddad48..aa56087 100644 --- a/PageNotice.php +++ b/PageNotice.php @@ -36,22 +36,55 @@ $name = $out-getTitle()-getPrefixedDBKey(); $ns = $out-getTitle()-getNamespace(); - $opt = array( - 'parseinline', - ); + $folders = explode(/, $name); + + $header = getPageNotice(Notice/top-$name); + $nsheader = getPageNotice(Notice/top-ns-$ns); - $header = wfMsgExt(top-notice-$name, $opt); - $nsheader = wfMsgExt(top-notice-ns-$ns, $opt); + $footer = getPageNotice(Notice/bottom-$name); + $nsfooter = getPageNotice(Notice/bottom-ns-$ns); + + $folderHeader = ; + if (count($folders) 1) { + $msgName = Notice/top-.folders[0]; + $folderHeader = getPageNotice($msgName); + } - $footer = wfMsgExt(bottom-notice-$name, $opt); - $nsfooter = wfMsgExt(bottom-notice-ns-$ns, $opt); + if ($header != null) { + $text = div$header/div\n$text; + } else if ($folderHeader != null) { + $text = div id=\folderHeader\$folderHeader/div\n$text; + } + if ($nsheader != null) $text = div$nsheader/div\n$text; - if (!wfEmptyMsg(top-notice-$name, $header)) $text = div$header/div\n$text; - if (!wfEmptyMsg(top-notice-ns-$ns, $nsheader)) $text = div$nsheader/div\n$text; - - if (!wfEmptyMsg(bottom-notice-$name, $footer)) $text = $text\ndiv$footer/div; - if (!wfEmptyMsg(bottom-notice-ns-$ns, $nsfooter)) $text = $text\ndiv$nsfooter/div; + if ($footer != null) $text = $text\ndiv$footer/div; + if ($nsfooter != null) $text = $text\ndiv$nsfooter/div; return true; } +function getPageNotice($key) { + $opt = array( + 'parseinline', + ); + + $res = wfMsgExt($key, $opt); + if (wfEmptyMsg($key, $res)) { + $title = Title::newFromText( $key, NS_MEDIAWIKI ); + if (is_null($title)) { + return null; + } + $article = new Article($title); + if ($article-exists()) { + $title2 = $article-followRedirect(); + if (isset($title2) $title2 != null) { + $article = new Article($title2); + } + $res = MessageCache::singleton()-parse($article-getContent(), $title, true, true)-getText(); + } else { + $res = null; + } + } + + return $res; +} -- To view, visit https://gerrit.wikimedia.org/r/61187 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8cb62a8c8b94960c1cc6a595d6b62602645b6321 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageNotice Gerrit-Branch: master Gerrit-Owner: Timboven tim.bo...@telenet.be ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Check if the current request if for an edit - and if it's fo... - change (mediawiki...PageNotice)
Timboven has uploaded a new change for review. https://gerrit.wikimedia.org/r/61188 Change subject: Check if the current request if for an edit - and if it's for an edit, skip the notice .. Check if the current request if for an edit - and if it's for an edit, skip the notice Change-Id: I4acebec2c3ead3d639393bbb7828def112507492 --- M PageNotice.php 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageNotice refs/changes/88/61188/1 diff --git a/PageNotice.php b/PageNotice.php index dddad48..43d5dee 100644 --- a/PageNotice.php +++ b/PageNotice.php @@ -35,6 +35,11 @@ function wfPageNoticeHook( $out, $text ) { $name = $out-getTitle()-getPrefixedDBKey(); $ns = $out-getTitle()-getNamespace(); + + $index = strpos($_SERVER[REQUEST_URI], action=edit); + if ($index 0) { + return true; + } $opt = array( 'parseinline', -- To view, visit https://gerrit.wikimedia.org/r/61188 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4acebec2c3ead3d639393bbb7828def112507492 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageNotice Gerrit-Branch: master Gerrit-Owner: Timboven tim.bo...@telenet.be ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Web installer: always autoselect some DB type - change (mediawiki/core)
MarkAHershberger has submitted this change and it was merged. Change subject: Web installer: always autoselect some DB type .. Web installer: always autoselect some DB type If the PHP mysql extension were not available, none of the DB type radio buttons would be selected, and if the form were submitted without selecting any of them, a PHP fatal error would occur because of a lack of input validation. So have the installer autoselect a DB type other than mysql if necessary, and add a simple check to prevent a fatal error if all radio buttons nevertheless end up deselected for some unknown reason. Bug: 47489 Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 --- M RELEASE-NOTES-1.21 M includes/installer/WebInstallerPage.php 2 files changed, 13 insertions(+), 1 deletion(-) Approvals: MarkAHershberger: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 6c68d82..5adf80e 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -209,6 +209,8 @@ * (bug 45143) jquery.badge: Treat non-Latin variants of zero as zero as well. * (bug 46151) mwdocgen.php should not ignore exit code of doxygen command. * (bug 41889) Fix $.tablesorter rowspan exploding for complex cases. +* (bug 47489) Installer now automatically selects the next-best database type if + the PHP mysql extension is not loaded, preventing fatal errors in some cases. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index b640fb8..382288c 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -467,7 +467,14 @@ $this-addHTML( $this-parent-getInfoBox( wfMessage( 'config-support-info', trim( $dbSupport ) )-text() ) ); - foreach ( $this-parent-getVar( '_CompiledDBs' ) as $type ) { + // It's possible that the library for the default DB type is not compiled in. + // In that case, instead select the first supported DB type in the list. + $compiledDBs = $this-parent-getVar( '_CompiledDBs' ); + if ( !in_array( $defaultType, $compiledDBs ) ) { + $defaultType = $compiledDBs[0]; + } + + foreach ( $compiledDBs as $type ) { $installer = $this-parent-getDBInstaller( $type ); $types .= 'li' . @@ -503,6 +510,9 @@ public function submit() { $r = $this-parent-request; $type = $r-getVal( 'DBType' ); + if ( !$type ) { + return Status::newFatal( 'config-invalid-db-type' ); + } $this-setVar( 'wgDBtype', $type ); $installer = $this-parent-getDBInstaller( $type ); if ( !$installer ) { -- To view, visit https://gerrit.wikimedia.org/r/60369 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: PleaseStand pleasest...@live.com Gerrit-Reviewer: Demon ch...@wikimedia.org Gerrit-Reviewer: MarkAHershberger mhershber...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Web installer: always autoselect some DB type - change (mediawiki/core)
MarkAHershberger has uploaded a new change for review. https://gerrit.wikimedia.org/r/61189 Change subject: Web installer: always autoselect some DB type .. Web installer: always autoselect some DB type If the PHP mysql extension were not available, none of the DB type radio buttons would be selected, and if the form were submitted without selecting any of them, a PHP fatal error would occur because of a lack of input validation. So have the installer autoselect a DB type other than mysql if necessary, and add a simple check to prevent a fatal error if all radio buttons nevertheless end up deselected for some unknown reason. Bug: 47489 Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 --- M RELEASE-NOTES-1.21 M includes/installer/WebInstallerPage.php 2 files changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/89/61189/1 diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index bda38f6..28a039d 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -215,6 +215,8 @@ * (bug 45143) jquery.badge: Treat non-Latin variants of zero as zero as well. * (bug 46151) mwdocgen.php should not ignore exit code of doxygen command. * (bug 41889) Fix $.tablesorter rowspan exploding for complex cases. +* (bug 47489) Installer now automatically selects the next-best database type if + the PHP mysql extension is not loaded, preventing fatal errors in some cases. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 085456d..7883029 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -460,7 +460,14 @@ $this-addHTML( $this-parent-getInfoBox( wfMessage( 'config-support-info', trim( $dbSupport ) )-text() ) ); - foreach ( $this-parent-getVar( '_CompiledDBs' ) as $type ) { + // It's possible that the library for the default DB type is not compiled in. + // In that case, instead select the first supported DB type in the list. + $compiledDBs = $this-parent-getVar( '_CompiledDBs' ); + if ( !in_array( $defaultType, $compiledDBs ) ) { + $defaultType = $compiledDBs[0]; + } + + foreach ( $compiledDBs as $type ) { $installer = $this-parent-getDBInstaller( $type ); $types .= 'li' . @@ -494,6 +501,9 @@ public function submit() { $r = $this-parent-request; $type = $r-getVal( 'DBType' ); + if ( !$type ) { + return Status::newFatal( 'config-invalid-db-type' ); + } $this-setVar( 'wgDBtype', $type ); $installer = $this-parent-getDBInstaller( $type ); if ( !$installer ) { -- To view, visit https://gerrit.wikimedia.org/r/61189 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_21 Gerrit-Owner: MarkAHershberger mhershber...@wikimedia.org Gerrit-Reviewer: PleaseStand pleasest...@live.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Disable $wgContentHandlerUseDB during upgrade where fields d... - change (mediawiki/core)
MarkAHershberger has submitted this change and it was merged. Change subject: Disable $wgContentHandlerUseDB during upgrade where fields don't exist. .. Disable $wgContentHandlerUseDB during upgrade where fields don't exist. They can cause problems if, for example, the installation has hooks for UserSaveSettings or UserSaveOptions that try to update a user page. Change-Id: I31078678e8939c897b1357bcb77eb2d26f806f29 Bug: 47271 --- M RELEASE-NOTES-1.21 M includes/installer/DatabaseUpdater.php M includes/installer/MysqlUpdater.php M includes/installer/OracleUpdater.php M includes/installer/SqliteUpdater.php 5 files changed, 43 insertions(+), 0 deletions(-) Approvals: MarkAHershberger: Verified; Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 33acbf8..bda38f6 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -124,6 +124,7 @@ quotmarks, order and whitespace in the attribute list). === Bug fixes in 1.21 === +* (bug 47271) $wgContentHandlerUseDB should be set to false during the upgrade * (bug 46084) Sanitize $limitReport before outputting. * (bug 46859) Disable external entities in XMLReader. * (bug 47251) Disable external entities in Import. diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index f190196..25f751c 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -89,6 +89,11 @@ protected $skipSchema = false; /** +* Hold the value of $wgContentHandlerUseDB during the upgrade. +*/ + protected $wgContentHandlerUseDB = true; + + /** * Constructor * * @param $db DatabaseBase object to perform updates on @@ -998,4 +1003,30 @@ $cl-execute(); $this-output( done.\n ); } + + /** +* Turns off content handler fields during parts of the upgrade +* where they aren't available. +*/ + protected function disableContentHandlerUseDB() { + global $wgContentHandlerUseDB; + + if( $wgContentHandlerUseDB ) { + $this-output( Turning off Content Handler DB fields for this part of upgrade.\n ); + $this-holdContentHandlerUseDB = $wgContentHandlerUseDB; + $wgContentHandlerUseDB = false; + } + } + + /** +* Turns content handler fields back on. +*/ + protected function enableContentHandlerUseDB() { + global $wgContentHandlerUseDB; + + if( $this-holdContentHandlerUseDB ) { + $this-output( Content Handler DB fields should be usable now.\n ); + $wgContentHandlerUseDB = $this-holdContentHandlerUseDB; + } + } } diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index d8fa64e..9d73e62 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -31,6 +31,8 @@ protected function getCoreUpdateList() { return array( + array( 'disableContentHandlerUseDB' ), + // 1.2 array( 'addField', 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ), array( 'addField', 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ), @@ -218,6 +220,8 @@ array( 'addField', 'archive', 'ar_content_format','patch-archive-ar_content_format.sql' ), array( 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ), array( 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ), + array( 'enableContentHandlerUseDB' ), + array( 'dropField', 'site_stats', 'ss_admins', 'patch-drop-ss_admins.sql' ), array( 'dropField', 'recentchanges', 'rc_moved_to_title','patch-rc_moved.sql' ), array( 'addTable', 'sites', 'patch-sites.sql' ), diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index cafe8cd..b416f4b 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -38,6 +38,8 @@ protected function getCoreUpdateList() { return array( + array( 'disableContentHandlerUseDB' ), + // 1.17 array( 'doNamespaceDefaults' ), array( 'doFKRenameDeferr' ), @@ -75,6 +77,8 @@ array( 'addField', 'archive',
[MediaWiki-commits] [Gerrit] Make ve.ce.Surface.getSelectionRect() work on Opera - change (mediawiki...VisualEditor)
Matmarex has uploaded a new change for review. https://gerrit.wikimedia.org/r/61190 Change subject: Make ve.ce.Surface.getSelectionRect() work on Opera .. Make ve.ce.Surface.getSelectionRect() work on Opera .getClientRects() on a collapsed native range returns an empty collection on Opera, causing an exception to be thrown by rangy. Handle collapsed ranges separately, by using .surroundContents() to insert an empty span into the DOM, then read the span's offset. Bug: 47772 Change-Id: I4bad882d1d6fb83bcdcfd0de3bfc9af52960c2ff --- M modules/ve/ce/ve.ce.Surface.js 1 file changed, 31 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/90/61190/1 diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js index ff7403c..82816ad 100644 --- a/modules/ve/ce/ve.ce.Surface.js +++ b/modules/ve/ce/ve.ce.Surface.js @@ -136,14 +136,40 @@ * @static */ ve.ce.Surface.getSelectionRect = function () { + var rangySel, span, offset; if ( !rangy.initialized ) { rangy.init(); } - var rangySel = rangy.getSelection(); - return { - start: rangySel.getStartDocumentPos(), - end: rangySel.getEndDocumentPos() - }; + + rangySel = rangy.getSelection(); + + if ( rangySel.rangeCount === 0 ) { + // We can't do anything if there's no selection + return null; + } else if ( rangySel.isCollapsed ) { + // Empty selection - just a caret + // .getClientRects() on a collapsed native range returns an empty collection on Opera, + // causing an exception to be thrown by rangy + span = document.createElement( 'span' ); + rangySel.getRangeAt( 0 ).surroundContents( span ); + offset = $( span ).offset(); + span.parentNode.removeChild( span ); + + // Calculate offset relative to window + offset.top -= $( window ).scrollTop(); + offset.left -= $( window ).scrollLeft(); + + return { + start: { x: offset.left, y: offset.top }, + end: { x: offset.left, y: offset.top } + }; + } else { + // Normal selection + return { + start: rangySel.getStartDocumentPos(), + end: rangySel.getEndDocumentPos() + }; + } }; -- To view, visit https://gerrit.wikimedia.org/r/61190 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4bad882d1d6fb83bcdcfd0de3bfc9af52960c2ff Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Matmarex matma@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Web installer: always autoselect some DB type - change (mediawiki/core)
MarkAHershberger has submitted this change and it was merged. Change subject: Web installer: always autoselect some DB type .. Web installer: always autoselect some DB type If the PHP mysql extension were not available, none of the DB type radio buttons would be selected, and if the form were submitted without selecting any of them, a PHP fatal error would occur because of a lack of input validation. So have the installer autoselect a DB type other than mysql if necessary, and add a simple check to prevent a fatal error if all radio buttons nevertheless end up deselected for some unknown reason. Bug: 47489 Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 --- M RELEASE-NOTES-1.21 M includes/installer/WebInstallerPage.php 2 files changed, 13 insertions(+), 1 deletion(-) Approvals: MarkAHershberger: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index bda38f6..28a039d 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -215,6 +215,8 @@ * (bug 45143) jquery.badge: Treat non-Latin variants of zero as zero as well. * (bug 46151) mwdocgen.php should not ignore exit code of doxygen command. * (bug 41889) Fix $.tablesorter rowspan exploding for complex cases. +* (bug 47489) Installer now automatically selects the next-best database type if + the PHP mysql extension is not loaded, preventing fatal errors in some cases. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 085456d..7883029 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -460,7 +460,14 @@ $this-addHTML( $this-parent-getInfoBox( wfMessage( 'config-support-info', trim( $dbSupport ) )-text() ) ); - foreach ( $this-parent-getVar( '_CompiledDBs' ) as $type ) { + // It's possible that the library for the default DB type is not compiled in. + // In that case, instead select the first supported DB type in the list. + $compiledDBs = $this-parent-getVar( '_CompiledDBs' ); + if ( !in_array( $defaultType, $compiledDBs ) ) { + $defaultType = $compiledDBs[0]; + } + + foreach ( $compiledDBs as $type ) { $installer = $this-parent-getDBInstaller( $type ); $types .= 'li' . @@ -494,6 +501,9 @@ public function submit() { $r = $this-parent-request; $type = $r-getVal( 'DBType' ); + if ( !$type ) { + return Status::newFatal( 'config-invalid-db-type' ); + } $this-setVar( 'wgDBtype', $type ); $installer = $this-parent-getDBInstaller( $type ); if ( !$installer ) { -- To view, visit https://gerrit.wikimedia.org/r/61189 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic456899028c054a761d172df8ec32f6a26dc5b97 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_21 Gerrit-Owner: MarkAHershberger mhershber...@wikimedia.org Gerrit-Reviewer: MarkAHershberger mhershber...@wikimedia.org Gerrit-Reviewer: PleaseStand pleasest...@live.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] MathJax: Allow user to configure MathJax - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: MathJax: Allow user to configure MathJax .. MathJax: Allow user to configure MathJax The user can provide his own mathJax.config object. Supersedes: https://gerrit.wikimedia.org/r/61182 PS2: Add relevant info for this feature to README Bug: 35478 Change-Id: I97800317366aafcaad87ecf6644e9417c698c5da --- M README M modules/ext.math.mathjax.enabler.js 2 files changed, 35 insertions(+), 20 deletions(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/README b/README index 54123a8..8846d84 100644 --- a/README +++ b/README @@ -7,6 +7,19 @@ See the README in the math subdirectory for more info on setting up the low-level conversion tools. +MathJax configuration: +Client-side configuration of MathJax can be done by specifying a mathJax.config +table, which takes a table as described in: +http://docs.mathjax.org/en/v1.1-latest/options/index.html#configuration + +Example: +if ( typeof mathJax === 'undefined' ) { + mathJax = {}; + mathJax.config = { +showProcessingMessages: true + }; +} + For testing your installation run php tests/phpunit/phpunit.php extensions/Math/tests/ from your MediWiki home path. diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index e1343a8..faa5b89 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -11,27 +11,29 @@ mathJax.loaded = false; - mathJax.Config = function () { -MathJax.Hub.Config({ - root: mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax', - config: ['TeX-AMS-texvc_HTML.js'], - 'v1.0-compatible': false, - styles: { -'.mtext': { - 'font-family': 'sans-serif ! important', - 'font-size': '80%' -} - }, - displayAlign: 'left', - menuSettings: { -zoom: 'Click' - }, - 'HTML-CSS': { -imageFont: null, -availableFonts: ['TeX'] + mathJax.config = $.extend( true, { +root: mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax', +config: ['TeX-AMS-texvc_HTML.js'], +'v1.0-compatible': false, +styles: { + '.mtext': { +'font-family': 'sans-serif ! important', +'font-size': '80%' } -}); -MathJax.OutputJax.fontDir = mathJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; +}, +displayAlign: 'left', +menuSettings: { + zoom: 'Click' +}, +'HTML-CSS': { + imageFont: null, + availableFonts: ['TeX'] +} + }, mathJax.config ); + + mathJax.Config = function () { +MathJax.Hub.Config( mathJax.config ); +MathJax.OutputJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; }; mathJax.Load = function () { -- To view, visit https://gerrit.wikimedia.org/r/61182 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I97800317366aafcaad87ecf6644e9417c698c5da Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] (bug 35188) Do not poison the tex formula with markup - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: (bug 35188) Do not poison the tex formula with markup .. (bug 35188) Do not poison the tex formula with markup We move the block/inline styling (aka display vs textstyle) markup into a filter used just before rendering. This way the 'used' formula will not suddenly contain styling information that wasn't part of the original formula. Change-Id: Ie0c308c31d38581e556dc73109879c7a3d365121 --- M modules/MathJax/extensions/wiki2jax.js 1 file changed, 13 insertions(+), 4 deletions(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/MathJax/extensions/wiki2jax.js b/modules/MathJax/extensions/wiki2jax.js index 606ac75..baf6536 100644 --- a/modules/MathJax/extensions/wiki2jax.js +++ b/modules/MathJax/extensions/wiki2jax.js @@ -20,12 +20,23 @@ if (this.config.Augment) {MathJax.Hub.Insert(this,this.config.Augment)} this.previewClass = MathJax.Hub.config.preRemoveClass; + this.setupPrefilter(); this.configured = true; } var that = this; $('span.tex, img.tex', element || document).each(function(i, span) { that.ConvertMath(span); }); + }, + + setupPrefilter: function() { // used to fix a number of common wiki math hacks +MathJax.Hub.Register.StartupHook(TeX Jax Ready, function() { + MathJax.InputJax.TeX.prefilterHooks.Add( function(data) { +data.math = data.math.replace(/^\s*\\scriptstyle(\W)/,\\textstyle$1).replace(/^\s*\\scriptscriptstyle(\W)/,\\scriptstyle$1); +if (data.script.type.match(/(;|\s|\n)mode\s*=\s*display-nobreak(;|\s|\n|$)/) != null) + data.math = \\displaystyle + data.math; + }); +}); }, ConvertMath: function (node) { @@ -40,10 +51,8 @@ } tex = tex.replace(/\\iiint([^!]*)!\\!\\!\\!\\!.*\\subset\\!\\supset/g,\\iiint$1mkern-2.5em\\subset\\!\\supset).replace(/\\iint([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\subset\\!\\supset/g,\\iint$1mkern-1.65em$2\\subset\\!\\!\\supset).replace(/\\int\\!\\!\\!(\\!)+\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!.*\\bigcirc(\\,)*/g,\\iiint$3mkern-2.5em\\subset\\!\\supset).replace(/\\int\\!\\!\\!(\\!)+\\int([^!]*)!\\!\\!\\!\\!\\!\\!\\!\\!(.*)\\bigcirc(\\,)*/g,\\iint$2mkern-1.65em$3\\subset\\!\\!\\supset); -if (mode === ) { - tex = tex.replace(/ *\\scriptstyle(\W)/g,\\textstyle$1).replace(/ *\\scriptscriptstyle(\W)/g,\\scriptstyle$1); - if (parent.firstChild === node) tex = \\displaystyle +tex; -} + +if (mode === parent.firstChild === node) mode = ; mode=display-nobreak; var script = document.createElement(script); script.type = math/tex + mode; -- To view, visit https://gerrit.wikimedia.org/r/23079 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie0c308c31d38581e556dc73109879c7a3d365121 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Cjucovschi jucovs...@gmail.com Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: Ross Andrews ross.andr...@gmail.com Gerrit-Reviewer: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] MathJax: Remove support for wikEd and AjaxPreview - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: MathJax: Remove support for wikEd and AjaxPreview .. MathJax: Remove support for wikEd and AjaxPreview With the new renderTex hook of https://gerrit.wikimedia.org/r/61183 there is no need for hardcoded support for these 2 scripts. The scripts in question should call the hook themselves. PS2: Fix wikEd reference of jsHint Supersedes: https://gerrit.wikimedia.org/r/23073 Bug: 35478 Change-Id: I9811832430e9ddd8a4c03f265d07529a76efc38a --- M modules/ext.math.mathjax.enabler.js 1 file changed, 2 insertions(+), 33 deletions(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index f3ab7cd..fe6de6c 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -1,7 +1,7 @@ /** * From https://en.wikipedia.org/wiki/User:Nageh/mathJax.js */ -/*global mathJax:true, MathJax, wikEd:true */ +/*global mathJax:true, MathJax */ ( function ( mw, $ ) { if ( typeof mathJax === 'undefined' ) { mathJax = {}; @@ -86,39 +86,8 @@ return false; }; - mathJax.Init = function () { -this.Load( document.getElementById('bodyContent') || document.body ); - -// compatibility with wikEd -if ( typeof wikEd === 'undefined' ) { - wikEd = {}; -} -if ( wikEd.config === undefined ) { - wikEd.config = {}; -} -if ( wikEd.config.previewHook === undefined ) { - wikEd.config.previewHook = []; -} -wikEd.config.previewHook.push( function (){ - if (window.mathJax.Load(document.getElementById('wikEdPreviewBox') || document.body)) { -MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'wikEdPreviewBox']); - } -} ); - -// compatibility with ajaxPreview -this.oldAjaxPreviewExec = window.ajaxPreviewExec; -window.ajaxPreviewExec = function (previewArea) { - if ( mathJax.oldAjaxPreviewExec !== undefined ) { -mathJax.oldAjaxPreviewExec(previewArea); - } - if ( mathJax.Load(previewArea) ) { -MathJax.Hub.Queue( ['Typeset', MathJax.Hub, previewArea] ); - } -}; - }; - $( document ).ready( function () { -mathJax.Init(); +mathJax.Load(); } ); }( mediaWiki, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/61184 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9811832430e9ddd8a4c03f265d07529a76efc38a Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] MathJax: Add a renderTex hook to render elements on demand - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: MathJax: Add a renderTex hook to render elements on demand .. MathJax: Add a renderTex hook to render elements on demand Example usage: $('#wikiPreview').renderTex(); This supersedes: https://gerrit.wikimedia.org/r/23073 Bug: 35478 Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b --- M modules/ext.math.mathjax.enabler.js 1 file changed, 25 insertions(+), 0 deletions(-) Approvals: Physikerwelt: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ext.math.mathjax.enabler.js b/modules/ext.math.mathjax.enabler.js index faa5b89..f3ab7cd 100644 --- a/modules/ext.math.mathjax.enabler.js +++ b/modules/ext.math.mathjax.enabler.js @@ -36,6 +36,31 @@ MathJax.OutputJax.fontDir = mw.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts'; }; + /** + * Renders all Math TeX inside the given elements. + * @param {function} callback to be executed after text elements have rendered [optional] + */ + $.fn.renderTex = function ( callback ) { +var elem = this.find( '.tex' ).parent().toArray(); + +if ( !$.isFunction( callback ) ) { + callback = $.noop; +} + +function render () { + MathJax.Hub.Queue( ['Typeset', MathJax.Hub, elem, callback] ); +} + +mw.loader.using( 'ext.math.mathjax', function () { + if ( MathJax.isReady ) { +render(); + } else { +MathJax.Hub.Startup.signal.MessageHook( 'End', render ); + } +}); +return this; + }; + mathJax.Load = function () { var config, script; if (this.loaded) { -- To view, visit https://gerrit.wikimedia.org/r/61183 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I18e2f089d56e42b8e603ac45d726942bb478580b Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: TheDJ hartman.w...@gmail.com Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove even more unused variables - change (mediawiki...Math)
jenkins-bot has submitted this change and it was merged. Change subject: Remove even more unused variables .. Remove even more unused variables * $inputhash is also never used. * Additional comments. * allow creation of math renderer without $tex code Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5 --- M MathRenderer.php 1 file changed, 27 insertions(+), 8 deletions(-) Approvals: Mattflaschen: Looks good to me, approved jenkins-bot: Verified diff --git a/MathRenderer.php b/MathRenderer.php index feaf38e..78ba02b 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -9,7 +9,12 @@ */ /** - * Abstract base class for math renderers using different technologies. + * Abstract base class with static methods for rendering the math tags using + * different technologies. These static methods create a new instance of the + * extending classes and render the math tags based on the mode setting of the user. + * Furthermore this class handles the caching of the rendered output and provides + * debug information, + * if run in mathdebug mode. * * @author Tomasz Wegrzanowski * @author Brion Vibber @@ -17,11 +22,15 @@ */ abstract class MathRenderer { /** -* The following variables should made private, as soon it can be verified that they are not being directly accessed by other extensions. +* The following variables should made private, as soon it can be verified +* that they are not being directly accessed by other extensions. */ var $mode = MW_MATH_PNG; var $tex = ''; - var $inputhash = ''; + /** +* is calculated by texvc. +* @var string +*/ var $hash = ''; var $html = ''; var $mathml = ''; @@ -32,10 +41,10 @@ /** * Constructs a base MathRenderer * -* @param string $tex LaTeX markup -* @param array $params HTML attributes +* @param string $tex (optional) LaTeX markup +* @param array $params (optional) HTML attributes */ - public function __construct( $tex, $params = array() ) { + public function __construct( $tex='', $params = array() ) { $this-tex = $tex; $this-params = $params; } @@ -77,17 +86,21 @@ default: $renderer = new MathTexvc( $tex, $params ); } + wfDebugLog ( Math, 'start rendering $' . $renderer-tex . '$' ); return $renderer; } /** -* Returns TeX to HTML +* Performs the rendering and returns the rendered element that needs to be embedded. * * @return string of rendered HTML */ abstract public function render(); + /** +* texvc error messages +* TODO: update to MathML * Returns an internationalized HTML error string * * @param string $msg message key for specific error @@ -147,7 +160,13 @@ } /** -* Writes rendering entry to database +* Writes rendering entry to database. +* +* WARNING: Use writeCache() instead of this method to be sure that all +* renderer specific (such as squid caching) are taken into account. +* This function stores the values that are currently present in the class to the database even if they are empty. +* +* This function can be seen as protected function. */ public function writeToDatabase() { # Now save it back to the DB: -- To view, visit https://gerrit.wikimedia.org/r/60642 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I64c181408e8acd16aee7a53a81a176b62a6726b5 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Math Gerrit-Branch: master Gerrit-Owner: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: Cjucovschi jucovs...@gmail.com Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de Gerrit-Reviewer: Worden.lee worden@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove doubled _buttonClass default. - change (mediawiki...guiders)
Mattflaschen has submitted this change and it was merged. Change subject: Remove doubled _buttonClass default. .. Remove doubled _buttonClass default. Change-Id: Iebe31c0dfb09c637a2f32f4abedfba9bc961a1f5 --- M guiders.js 1 file changed, 0 insertions(+), 1 deletion(-) Approvals: Ori.livneh: Looks good to me, approved Mattflaschen: Verified diff --git a/guiders.js b/guiders.js index 83716bf..bb9f0ba 100644 --- a/guiders.js +++ b/guiders.js @@ -229,7 +229,6 @@ guiderButtonsContainer.append(thisButtonElem); var thisButtonName = thisButton.name.toLowerCase(); - guiders._buttonClass = guider_button; if (thisButton.onclick) { thisButtonElem.bind(click, thisButton.onclick); } else { -- To view, visit https://gerrit.wikimedia.org/r/61166 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iebe31c0dfb09c637a2f32f4abedfba9bc961a1f5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GuidedTour/guiders Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org Gerrit-Reviewer: Ori.livneh o...@wikimedia.org Gerrit-Reviewer: Swalling swall...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] contint: tweak apache logs - change (operations/puppet)
Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/61195 Change subject: contint: tweak apache logs .. contint: tweak apache logs We had logs in access.log and some of them in other_vhosts_access.log. That is a bit confusing when tailing the log files. This patch creates three new access log files with they error files counterparts: doc_access.log : doc.(mediawiki|wikimedia).org integration_access.log : integration.(mediawiki|wikimedia).org qunit_access.log : for qunit.localhost (that is the QUnit tests being run in a headless browser). Still have to fix the Jenkins and Zuul proxies to log to different files but that will be in another patch :) Change-Id: I53c01978e509cf27b5b12d73e10088736d071757 --- M modules/contint/files/apache/doc.wikimedia.org M modules/contint/files/apache/integration.mediawiki.org M modules/contint/files/apache/integration.wikimedia.org M modules/contint/files/apache/qunit.localhost 4 files changed, 30 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/95/61195/1 diff --git a/modules/contint/files/apache/doc.wikimedia.org b/modules/contint/files/apache/doc.wikimedia.org index a9cacba..4ce7c06 100644 --- a/modules/contint/files/apache/doc.wikimedia.org +++ b/modules/contint/files/apache/doc.wikimedia.org @@ -7,11 +7,19 @@ VirtualHost *:80 ServerName doc.mediawiki.org + LogLevel warn + ErrorLog /var/log/apache2/doc_error.log + CustomLog /var/log/apache2/doc_access.log vhost_combined + Redirect permanent / https://doc.wikimedia.org/ /VirtualHost VirtualHost *:443 ServerName doc.mediawiki.org + + LogLevel warn + ErrorLog /var/log/apache2/doc_error.log + CustomLog /var/log/apache2/doc_access.log vhost_combined SSLEngine on SSLCertificateFile /etc/ssl/certs/star.mediawiki.org.pem @@ -24,6 +32,10 @@ VirtualHost *:80 ServerName doc.wikimedia.org + LogLevel warn + ErrorLog /var/log/apache2/doc_error.log + CustomLog /var/log/apache2/doc_access.log vhost_combined + Redirect permanent / https://doc.wikimedia.org/ /VirtualHost @@ -33,9 +45,9 @@ DocumentRoot /srv/org/wikimedia/doc - ErrorLog /var/log/apache2/error.log LogLevel warn - CustomLog /var/log/apache2/access.log combined + ErrorLog /var/log/apache2/doc_error.log + CustomLog /var/log/apache2/doc_access.log vhost_combined SSLEngine on SSLCertificateFile /etc/ssl/certs/star.wikimedia.org.pem diff --git a/modules/contint/files/apache/integration.mediawiki.org b/modules/contint/files/apache/integration.mediawiki.org index 28bf24a..9f99a0e 100644 --- a/modules/contint/files/apache/integration.mediawiki.org +++ b/modules/contint/files/apache/integration.mediawiki.org @@ -8,6 +8,10 @@ VirtualHost *:80 ServerName integration.mediawiki.org + LogLevel warn + ErrorLog /var/log/apache2/integration_error.log + CustomLog /var/log/apache2/integration_access.log vhost_combined + Redirect permanent / https://integration.wikimedia.org/ /VirtualHost VirtualHost *:443 @@ -18,5 +22,9 @@ SSLCertificateKeyFile /etc/ssl/private/star.mediawiki.org.key SSLCACertificateFile /etc/ssl/certs/RapidSSL_CA.pem + LogLevel warn + ErrorLog /var/log/apache2/integration_error.log + CustomLog /var/log/apache2/integration_access.log vhost_combined + Redirect permanent / https://integration.wikimedia.org/ /VirtualHost diff --git a/modules/contint/files/apache/integration.wikimedia.org b/modules/contint/files/apache/integration.wikimedia.org index 94e5e49..6fd883f 100644 --- a/modules/contint/files/apache/integration.wikimedia.org +++ b/modules/contint/files/apache/integration.wikimedia.org @@ -8,6 +8,10 @@ VirtualHost *:80 ServerName integration.wikimedia.org + LogLevel warn + ErrorLog /var/log/apache2/integration_error.log + CustomLog /var/log/apache2/integration_access.log vhost_combined + # Force Jenkins request through HTTPS Redirect permanent / https://integration.wikimedia.org/ /VirtualHost @@ -23,13 +27,9 @@ SSLCertificateKeyFile /etc/ssl/private/star.wikimedia.org.key SSLCACertificateFile /etc/ssl/certs/RapidSSL_CA.pem - ErrorLog /var/log/apache2/error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. LogLevel warn - - CustomLog /var/log/apache2/access.log combined + ErrorLog /var/log/apache2/integration_error.log + CustomLog /var/log/apache2/integration_access.log vhost_combined Directory / Order Deny,Allow diff --git a/modules/contint/files/apache/qunit.localhost b/modules/contint/files/apache/qunit.localhost index 9181fe9..344201e 100644 ---
[MediaWiki-commits] [Gerrit] zuul: pass puppet-lint (whitespaces) - change (operations/puppet)
Hashar has uploaded a new change for review. https://gerrit.wikimedia.org/r/61244 Change subject: zuul: pass puppet-lint (whitespaces) .. zuul: pass puppet-lint (whitespaces) Convert the Zuul manifest to use spaces instead of tabs. Also fix up arrows alignements. No functionals changes. Change-Id: I71f105800ccb944e440e3da45daef18608df9788 --- M modules/zuul/manifests/init.pp 1 file changed, 110 insertions(+), 110 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/44/61244/1 diff --git a/modules/zuul/manifests/init.pp b/modules/zuul/manifests/init.pp index c2bad0c..de4cf54 100644 --- a/modules/zuul/manifests/init.pp +++ b/modules/zuul/manifests/init.pp @@ -23,132 +23,132 @@ $push_change_refs, ) { - # Dependencies as mentionned in zuul:tools/pip-requires - $packages = [ - 'python-yaml', - 'python-webob', - 'python-daemon', - 'python-lockfile', - 'python-paramiko', - 'python-jenkins', - 'python-paste', + # Dependencies as mentionned in zuul:tools/pip-requires + $packages = [ +'python-yaml', +'python-webob', +'python-daemon', +'python-lockfile', +'python-paramiko', +'python-jenkins', +'python-paste', - # GitPython at least 0.3.2RC1 which is neither in Lucid nor in Precise - # We had to backport it and its dependencies from Quantal: - 'python-git', - 'python-gitdb', - 'python-async', - 'python-smmap', +# GitPython at least 0.3.2RC1 which is neither in Lucid nor in Precise +# We had to backport it and its dependencies from Quantal: +'python-git', +'python-gitdb', +'python-async', +'python-smmap', - 'python-extras', # backported in Precise (bug 47122) - 'python-statsd', +'python-extras', # backported in Precise (bug 47122) +'python-statsd', - 'python-setuptools', - ] +'python-setuptools', + ] - package { $packages: - ensure = present, - } + package { $packages: +ensure = present, + } - # We have packaged the python voluptuous module under - # operations/debs/python-voluptuous. Zuul does not work - # AT ALL with version 0.7 so make sure we have 0.6.x - package { 'python-voluptuous': - ensure = '0.6.1-1~wmf1', - } + # We have packaged the python voluptuous module under + # operations/debs/python-voluptuous. Zuul does not work + # AT ALL with version 0.7 so make sure we have 0.6.x + package { 'python-voluptuous': +ensure = '0.6.1-1~wmf1', + } - # Used to be in /var/lib/git/zuul but /var/lib/git can be used - # to replicate git bare repositories. - $zuul_source_dir = '/usr/local/src/zuul' + # Used to be in /var/lib/git/zuul but /var/lib/git can be used + # to replicate git bare repositories. + $zuul_source_dir = '/usr/local/src/zuul' - git::clone { 'integration/zuul': - ensure = present, - directory = $zuul_source_dir, - origin = $git_source_repo, - branch = $git_branch, - } + git::clone { 'integration/zuul': +ensure= present, +directory = $zuul_source_dir, +origin= $git_source_repo, +branch= $git_branch, + } - # We do not ship `statsd` python module so ignore it - # it is gracefully ignored by Zuul. - exec { 'remove_statsd_dependency': - command = '/bin/sed -i s/^statsd/#statsd/ tools/pip-requires', - cwd = $zuul_source_dir, - refreshonly = true, - subscribe = Git::Clone['integration/zuul'], - } + # We do not ship `statsd` python module so ignore it + # it is gracefully ignored by Zuul. + exec { 'remove_statsd_dependency': +command = '/bin/sed -i s/^statsd/#statsd/ tools/pip-requires', +cwd = $zuul_source_dir, +refreshonly = true, +subscribe = Git::Clone['integration/zuul'], + } - exec { 'install_zuul': - # Make sure to install without downloading from pypi - command = 'python setup.py easy_install --allow-hosts=None .', - cwd = $zuul_source_dir, - path = '/bin:/usr/bin', - refreshonly = true, - subscribe = Git::Clone['integration/zuul'], - require = [ - Exec['remove_statsd_dependency'], - Package['python-setuptools'], - ], - } + exec { 'install_zuul': +# Make sure to install without downloading from pypi +command = 'python setup.py easy_install
[MediaWiki-commits] [Gerrit] AlienNode stores original DOM elements instead of HTML - change (mediawiki...VisualEditor)
jenkins-bot has submitted this change and it was merged. Change subject: AlienNode stores original DOM elements instead of HTML .. AlienNode stores original DOM elements instead of HTML As jQuery hash problems in some cases converting HTML, it is easier just to store the original DOM elements. The bulk of this commit is fixing the tests as although we have an assertion for comparing DOM elements, we don't have one for comparing objects or arrays which may contain DOM elements. ve.js * copyObject copyArray fixed to run cloneNode(true) on any item of type Node. * Added callback function so an object/array can be copied with modifications. ve.qunit.js * Added deepEqualWithDomElements: Using the new copyObect/Array callback, we can copy the incoming object and convert any nodes to node summaries, then just run the normal deep equal comparison. ve.dm.AlienNodes.js * Instead of storing HMTL we store cloned DOM elements which we can send straight back to the converter without any processing. ve.dm.example.js * Updated tests to expect DOM elements instead of HTML. ve.dm.Converter.test.js * Updated tests to use deepEqualWithDomElements Bug: 47737 Change-Id: I3df8f49b170c31da9610129d53cf8cb65dd5d5f8 --- M modules/ve/dm/nodes/ve.dm.AlienNode.js M modules/ve/test/dm/ve.dm.Converter.test.js M modules/ve/test/dm/ve.dm.example.js M modules/ve/test/ve.qunit.js M modules/ve/ve.js 5 files changed, 77 insertions(+), 61 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve/dm/nodes/ve.dm.AlienNode.js b/modules/ve/dm/nodes/ve.dm.AlienNode.js index a17b29a..2cfe9c5 100644 --- a/modules/ve/dm/nodes/ve.dm.AlienNode.js +++ b/modules/ve/dm/nodes/ve.dm.AlienNode.js @@ -35,34 +35,18 @@ ve.dm.AlienNode.static.toDataElement = function ( domElements, converter ) { var isInline = this.isHybridInline( domElements, converter ), - type = isInline ? 'alienInline' : 'alienBlock', - html = $( 'div', domElements[0].ownerDocument ).append( $( domElements ).clone() ).html(); + type = isInline ? 'alienInline' : 'alienBlock'; return { 'type': type, 'attributes': { - 'html': html + 'domElements': ve.copyArray( domElements ) } }; }; -ve.dm.AlienNode.static.toDomElements = function ( dataElement, doc ) { - var wrapper = doc.createElement( 'div' ); - - // Filthy hack: Parsoid is currently sending us unescaped angle brackets - // inside data-parsoid. For some reason FF picks this up as html and tries - // to sanitise it, converting ref/ to ref/span (!?). - // As a *very temporary* fix we can regex replace them here. - $( wrapper ).html( - dataElement.attributes.html.replace( - /data-parsoid=([^]+)/g, - function( r0, r1 ) { - return 'data-parsoid=' + r1.replace( //g, 'lt;' ).replace( //g, 'gt;' ) + ''; - } - ) - ); - // Convert wrapper.children to an array - return Array.prototype.slice.call( wrapper.childNodes, 0 ); +ve.dm.AlienNode.static.toDomElements = function ( dataElement ) { + return dataElement.attributes.domElements; }; /* Concrete subclasses */ diff --git a/modules/ve/test/dm/ve.dm.Converter.test.js b/modules/ve/test/dm/ve.dm.Converter.test.js index ca0c100..6dc1d88 100644 --- a/modules/ve/test/dm/ve.dm.Converter.test.js +++ b/modules/ve/test/dm/ve.dm.Converter.test.js @@ -63,7 +63,7 @@ store = new ve.dm.IndexValueStore(); internalList = new ve.dm.InternalList(); ve.dm.example.preprocessAnnotations( cases[msg].data, store ); - assert.deepEqual( + assert.deepEqualWithDomElements( ve.dm.converter.getDataFromDom( ve.createDocumentFromHTML( cases[msg].html ), store, internalList ).getData(), cases[msg].data, msg @@ -100,9 +100,8 @@ store.index( cases[msg].storeItems[i].value, cases[msg].storeItems[i].hash ); } } - // functions won't be copied by ve.copyObject - if( ve.dm.example.domToDataCases[msg].modify ) { - ve.dm.example.domToDataCases[msg].modify( cases[msg].data ); + if( cases[msg].modify ) { + cases[msg].modify( cases[msg].data ); } doc = new ve.dm.Document( ve.dm.example.preprocessAnnotations( cases[msg].data, store ) ); originalData = ve.copyArray( doc.getFullData() ); @@ -111,6 +110,6 @@
[MediaWiki-commits] [Gerrit] {{PAGESIZE:{{FULLPAGENAME}}}}, {{{{FULLPAGENAME}}}} not outd... - change (mediawiki/core)
MarkTraceur has submitted this change and it was merged. Change subject: {{PAGESIZE:{{FULLPAGENAME, FULLPAGENAME not outdated .. {{PAGESIZE:{{FULLPAGENAME, FULLPAGENAME not outdated Previously, when parsing {{PAGESIZE:{{FULLPAGENAME or {{ {{FULLPAGENAME}} }} (a self-transclusion), we used the version currently in the db, which is outdated because the moment we save the page there will be a new version. This often causes confusion when testing templates that often have examples of template use in the doc section which would be one version out of date. This change causes those variables to give results for the most recent version of the page. For self-templates that's done by reparsing the page after save. For self page sizes this is done by taking the size of the input to Parser::parse. Note that {{subst:PAGESIZE:{{subst:FULLPAGENAME will still yield previous revision like before. bug: 39590 Change-Id: Idfac13de37d05317f65e4131534543e66cf74873 --- M RELEASE-NOTES-1.22 M includes/parser/CoreParserFunctions.php M includes/parser/Parser.php 3 files changed, 20 insertions(+), 5 deletions(-) Approvals: MarkTraceur: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index eda1e7c..ec424d3 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -61,6 +61,8 @@ * mw.util.tooltipAccessKeyRegexp: The regex now matches option- as well. Support for Mac option was added in 1.16, but the regex was never updated. * (bug 46768) Usernames of blocking users now display correctly, even if numeric. +* (bug 39590) {{PAGESIZE}} for the current page and self-transclusions now + show the most up to date result always instead of being a revision behind. === API changes in 1.22 === * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index e6342e4..493611a 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -671,8 +671,6 @@ * Return the size of the given page, or 0 if it's nonexistent. This is an * expensive parser function and can't be called too many times per page. * -* @todo FIXME: This doesn't work correctly on preview for getting the size -* of the current page. * @todo FIXME: Title::getLength() documentation claims that it adds things * to the link cache, so the local cache here should be unnecessary, but * in fact calling getLength() repeatedly for the same $page does seem to @@ -680,8 +678,8 @@ * @todo Document parameters * * @param $parser Parser -* @param string $page TODO DOCUMENT (Default: empty string) -* @param $raw TODO DOCUMENT (Default: null) +* @param $page String Name of page to check (Default: empty string) +* @param $raw String Should number be human readable with commas or just number * @return string */ static function pagesize( $parser, $page = '', $raw = null ) { @@ -697,7 +695,13 @@ $page = $title-getPrefixedText(); $length = 0; - if ( isset( $cache[$page] ) ) { + if ( $title-equals( $parser-getTitle() ) +$parser-mInputSize !== false + ) { + # We are on current page (and not in PST), so + # take length of input to parser. + $length = $parser-mInputSize; + } elseif( isset( $cache[$page] ) ) { $length = $cache[$page]; } elseif ( $parser-incrementExpensiveFunctionCount() ) { $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 836ddf5..957aa6a 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -193,6 +193,7 @@ var $mRevisionTimestamp; # The timestamp of the specified revision ID var $mRevisionUser; # User to display in {{REVISIONUSER}} tag var $mRevIdForTs; # The revision ID which was used to fetch the timestamp + var $mInputSize = false; # For {{PAGESIZE}} on current page. /** * @var string @@ -361,6 +362,8 @@ $this-startParse( $title, $options, self::OT_HTML, $clearState ); + $this-mInputSize = strlen( $text ); + # Remove the strip marker tag prefix from the input, if present. if ( $clearState ) { $text = str_replace( $this-mUniqPrefix, '', $text ); @@ -519,6 +522,7 @@ $this-mRevisionObject = $oldRevisionObject; $this-mRevisionTimestamp = $oldRevisionTimestamp;
[MediaWiki-commits] [Gerrit] Use 'recent contributors' instead of 'contributors this month'. - change (mediawiki/core)
Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/61246 Change subject: Use 'recent contributors' instead of 'contributors this month'. .. Use 'recent contributors' instead of 'contributors this month'. Bug: 47753 Change-Id: Ic3a9bf025cca338218a7dde2fe02d0409d3db2d5 --- M languages/messages/MessagesEn.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/46/61246/1 diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 8191f59..32138c5 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1137,7 +1137,7 @@ 'createacct-benefit-body2'= 'pages', 'createacct-benefit-icon3'= 'icon-contributors', 'createacct-benefit-head3'= '{{NUMBEROFACTIVEUSERS}}', -'createacct-benefit-body3'= 'contributors this month', +'createacct-benefit-body3'= 'recent contributors', 'badretype'= 'The passwords you entered do not match.', 'userexists' = 'Username entered already in use. Please choose a different name.', -- To view, visit https://gerrit.wikimedia.org/r/61246 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3a9bf025cca338218a7dde2fe02d0409d3db2d5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Don't underline a elements with the mw-ui-button class: - change (mediawiki/core)
Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/61247 Change subject: Don't underline a elements with the mw-ui-button class: .. Don't underline a elements with the mw-ui-button class: This is in addition to an existing 'text-decoration: none' on the class itself. This is being kept for other elements (e.g. button), but is not specific enough to beat a conflicting declaration in commonElements.css Change-Id: I8ec7efd97abad0ca75dea9b1c28e1fb91323741f --- M resources/mediawiki.ui/mediawiki.ui.default.css M resources/mediawiki.ui/mediawiki.ui.vector.css M resources/mediawiki.ui/sourcefiles/scss/components/default/_buttons.scss 3 files changed, 24 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/47/61247/1 diff --git a/resources/mediawiki.ui/mediawiki.ui.default.css b/resources/mediawiki.ui/mediawiki.ui.default.css index c32f54b..0f8d420 100644 --- a/resources/mediawiki.ui/mediawiki.ui.default.css +++ b/resources/mediawiki.ui/mediawiki.ui.default.css @@ -100,7 +100,12 @@ width: 100%; } -/* line 48, sourcefiles/scss/components/default/_buttons.scss */ +/* line 49, sourcefiles/scss/components/default/_buttons.scss */ +a.mw-ui-button { + text-decoration: none; +} + +/* line 56, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group * { -webkit-border-radius: 0; -moz-border-radius: 0; @@ -109,7 +114,7 @@ border-radius: 0; float: left; } -/* line 52, sourcefiles/scss/components/default/_buttons.scss */ +/* line 60, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group *:first-child { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; @@ -118,7 +123,7 @@ -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } -/* line 57, sourcefiles/scss/components/default/_buttons.scss */ +/* line 65, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group *:last-child { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; diff --git a/resources/mediawiki.ui/mediawiki.ui.vector.css b/resources/mediawiki.ui/mediawiki.ui.vector.css index 5995439..9826526 100644 --- a/resources/mediawiki.ui/mediawiki.ui.vector.css +++ b/resources/mediawiki.ui/mediawiki.ui.vector.css @@ -99,7 +99,12 @@ width: 100%; } -/* line 48, sourcefiles/scss/components/default/_buttons.scss */ +/* line 49, sourcefiles/scss/components/default/_buttons.scss */ +a.mw-ui-button { + text-decoration: none; +} + +/* line 56, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group * { -webkit-border-radius: 0; -moz-border-radius: 0; @@ -108,7 +113,7 @@ border-radius: 0; float: left; } -/* line 52, sourcefiles/scss/components/default/_buttons.scss */ +/* line 60, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group *:first-child { -moz-border-radius-topleft: 3px; -webkit-border-top-left-radius: 3px; @@ -117,7 +122,7 @@ -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; } -/* line 57, sourcefiles/scss/components/default/_buttons.scss */ +/* line 65, sourcefiles/scss/components/default/_buttons.scss */ .mw-ui-button-group *:last-child { -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 3px; diff --git a/resources/mediawiki.ui/sourcefiles/scss/components/default/_buttons.scss b/resources/mediawiki.ui/sourcefiles/scss/components/default/_buttons.scss index 1ea9a18..d67810f 100644 --- a/resources/mediawiki.ui/sourcefiles/scss/components/default/_buttons.scss +++ b/resources/mediawiki.ui/sourcefiles/scss/components/default/_buttons.scss @@ -44,6 +44,14 @@ } } +// This overrides an underline declaration on a:hover and a:focus in commonElements.css, which the +// class alone isn't specific enough to do +a.mw-ui-button { +text: { +decoration: none; +} +} + // Button groups .mw-ui-button-group * { @include border-radius(0); -- To view, visit https://gerrit.wikimedia.org/r/61247 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ec7efd97abad0ca75dea9b1c28e1fb91323741f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mattflaschen mflasc...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] SMW\HooksTests add unit test - change (mediawiki...SemanticMediaWiki)
Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/61248 Change subject: SMW\HooksTests add unit test .. SMW\HooksTests add unit test + Simplified wikipage creation/clean-up (borrowed from WikiPageTest) + Add testOnArticlePurge() + Add testOnTitleMoveComplete() + Add some @codeCoverageIgnoreEnd where tests deemed unnecessary Change-Id: Ie7db33c976d0c189f698d8302bdb2c1f65a3d9b0 --- M SemanticMediaWiki.hooks.php M tests/phpunit/includes/HooksTest.php 2 files changed, 159 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki refs/changes/48/61248/1 diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php index 27afa39..72ece68 100644 --- a/SemanticMediaWiki.hooks.php +++ b/SemanticMediaWiki.hooks.php @@ -24,9 +24,11 @@ * @return boolean */ public static function onSchemaUpdate( DatabaseUpdater $updater = null ) { + // @codeCoverageIgnoreStart $updater-addExtensionUpdate( array( 'SMWStore::setupStore' ) ); return true; + // @codeCoverageIgnoreEnd } /** @@ -37,8 +39,11 @@ * @return boolean */ public static function onPageSchemasRegistration() { + // @codeCoverageIgnoreStart $GLOBALS['wgPageSchemasHandlerClasses'][] = 'SMWPageSchemas'; + return true; + // @codeCoverageIgnoreEnd } /** @@ -51,6 +56,7 @@ * @return boolean */ public static function addToAdminLinks( ALTree $admin_links_tree ) { + // @codeCoverageIgnoreStart $data_structure_section = new ALSection( wfMessage( 'smw_adminlinks_datastructure' )-text() ); $smw_row = new ALRow( 'smw' ); @@ -89,6 +95,7 @@ $browse_search_section-addRow( $smw_row ); return true; + // @codeCoverageIgnoreEnd } @@ -132,6 +139,7 @@ $parser-setFunctionHook( 'set', array( 'SMW\SetParserFunction', 'render' ) ); $parser-setFunctionHook( 'set_recurring_event', array( 'SMW\RecurringEventsParserFunction', 'render' ) ); $parser-setFunctionHook( 'declare', array( 'SMW\DeclareParserFunction', 'render' ), SFH_OBJECT_ARGS ); + return true; } @@ -145,8 +153,10 @@ * @return boolean */ public static function addSemanticExtensionType( array $aExtensionTypes ) { + // @codeCoverageIgnoreStart $aExtensionTypes = array_merge( array( 'semantic' = wfMessage( 'version-semantic' )-text() ), $aExtensionTypes ); return true; + // @codeCoverageIgnoreEnd } /** @@ -159,12 +169,14 @@ * @return boolean */ public static function onParserTestTables( array $tables ) { + // @codeCoverageIgnoreStart $tables = array_merge( $tables, smwfGetStore()-getParserTestTables() ); return true; + // @codeCoverageIgnoreEnd } /** @@ -180,7 +192,7 @@ * @return boolean */ public static function showBrowseLink( $skintemplate ) { - + // @codeCoverageIgnoreStart if ( $skintemplate-data['isarticle'] ) { $browselink = SMWInfolink::newBrowsingLink( wfMessage( 'smw_browselink' )-text(), $skintemplate-data['titleprefixeddbkey'], false ); @@ -188,6 +200,7 @@ } return true; + // @codeCoverageIgnoreEnd } /** @@ -202,7 +215,7 @@ * @return boolean */ public static function onSkinTemplateNavigation( SkinTemplate $skinTemplate, array $links ) { - + // @codeCoverageIgnoreStart if ( $skinTemplate-getUser()-isAllowed( 'purge' ) ) { $links['actions']['purge'] = array( 'class' = false, @@ -212,6 +225,7 @@ } return true; + // @codeCoverageIgnoreEnd } /** @@ -495,6 +509,7 @@ public static function onLinksUpdateConstructed( $linksUpdate ) { $parserData = new SMW\ParserData( $linksUpdate-getTitle(), $linksUpdate-getParserOutput() ); $parserData-updateStore(); + return true; } @@ -518,6 +533,7 @@ */ public static function onArticleDelete( $wikiPage, $user, $reason, $error ) { smwfGetStore()-deleteSubject( $wikiPage-getTitle() ); + return true; } @@ -568,8 +584,8 @@
[MediaWiki-commits] [Gerrit] Use $.each() instead of for loop - change (mediawiki...UploadWizard)
Nischayn22 has uploaded a new change for review. https://gerrit.wikimedia.org/r/61249 Change subject: Use $.each() instead of for loop .. Use $.each() instead of for loop Bug: 47771 Change-Id: I583dbb8e196b7b87137ac9de2c4747d1e99405fc --- M resources/mw.UploadWizardDetails.js 1 file changed, 2 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard refs/changes/49/61249/1 diff --git a/resources/mw.UploadWizardDetails.js b/resources/mw.UploadWizardDetails.js index e1859bf..29cf093 100644 --- a/resources/mw.UploadWizardDetails.js +++ b/resources/mw.UploadWizardDetails.js @@ -626,11 +626,10 @@ } } ]; - for ( var mx in msgs ) { - var msg = msgs[mx]; + $.each( msgs, function( index, msg ) { var $lbl = $( 'label[for=' + msg.title + ']' ); $lbl.text( mw.msg( msg.title, msg.counter() ) ); - } + } ); $lbl = $( '.mwe-upwiz-details-copy-metadata a', _this.$form ); $lbl.text( mw.msg( 'mwe-upwiz-copy-metadata', _this.upload.wizard.uploads.length - 1 ) ); }, -- To view, visit https://gerrit.wikimedia.org/r/61249 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I583dbb8e196b7b87137ac9de2c4747d1e99405fc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Nischayn22 nischay...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits