[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Add documentation to calculateLuminance
jenkins-bot has submitted this change and it was merged. Change subject: Add documentation to calculateLuminance .. Add documentation to calculateLuminance Also rename the function, because I believe it actually calculates luminance (linear), not luma (gamma-compressed). Change-Id: I8a3c30a9aada91048661f8365151000c2cf5e5dd --- M wikibase/queryService/ui/resultBrowser/BubbleChartResultBrowser.js M wikibase/queryService/ui/resultBrowser/GraphResultBrowser.js M wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js 3 files changed, 13 insertions(+), 9 deletions(-) Approvals: Thiemo Mättig (WMDE): Looks good to me, approved jenkins-bot: Verified diff --git a/wikibase/queryService/ui/resultBrowser/BubbleChartResultBrowser.js b/wikibase/queryService/ui/resultBrowser/BubbleChartResultBrowser.js index 6169085..329200d 100644 --- a/wikibase/queryService/ui/resultBrowser/BubbleChartResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/BubbleChartResultBrowser.js @@ -139,7 +139,7 @@ } } ).style( 'fill', function( d ) { if ( d.color ) { - return self._getFormatter().calculateLuma( d.color ) <= 0.5 ? '#FFF' : '#000'; + return self._getFormatter().calculateLuminance( d.color ) <= 0.5 ? '#FFF' : '#000'; } } ).style( 'cursor', 'pointer' ); }; diff --git a/wikibase/queryService/ui/resultBrowser/GraphResultBrowser.js b/wikibase/queryService/ui/resultBrowser/GraphResultBrowser.js index 3d70163..de9ca73 100644 --- a/wikibase/queryService/ui/resultBrowser/GraphResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/GraphResultBrowser.js @@ -154,7 +154,7 @@ if ( key === 'rgb' && format.isColor( field ) ) { node.color = format.getColorForHtml( field ); if ( node.shape !== 'dot' && node.shape !== 'image' ) { - var foreground = format.calculateLuma( field.value ) <= 0.5 ? '#FFF' : '#000'; + var foreground = format.calculateLuminance( field.value ) <= 0.5 ? '#FFF' : '#000'; node.font = { color: foreground }; } } diff --git a/wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js b/wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js index 9ccf2cc..ff7fdfb 100644 --- a/wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js +++ b/wikibase/queryService/ui/resultBrowser/helper/FormatterHelper.js @@ -408,13 +408,17 @@ }; /** -* Calculate the luma of the given sRGB color. +* Calculate the luminance of the given sRGB color. * - * @private +* This uses the reverse sRGB transformation, +* as documented on https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation, +* to calculate the luminance (Y coordinate in the CIE XYZ model). +* +* @private * @param {string} color as six hex digits (no #) -* @return {number} luma of the color, or NaN if the color string is invalid +* @return {number} luminance of the color, or NaN if the color string is invalid */ - SELF.prototype.calculateLuma = function( color ) { + SELF.prototype.calculateLuminance = function( color ) { var r = parseInt( color.substr( 1, 2 ), 16 ) / 255; var g = parseInt( color.substr( 3, 2 ), 16 ) / 255; var b = parseInt( color.substr( 5, 2 ), 16 ) / 255; @@ -423,9 +427,9 @@ r = r <= 0.04045 ? r / 12.92 : Math.pow( ( r + 0.055 ) / 1.055, 2.4 ); g = g <= 0.04045 ? g / 12.92 : Math.pow( ( g + 0.055 ) / 1.055, 2.4 ); b = b <= 0.04045 ? b / 12.92 : Math.pow( ( b + 0.055 ) / 1.055, 2.4 ); - // calculate luma using Rec. 709 coefficients - var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b; - return luma; + // calculate luminance using Rec. 709 coefficients + var luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b; + return luminance; } else { return NaN; } -- To view, visit https://gerrit.wikimedia.org/r/305333 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8a3c30a9aada91048661f8365151000c2cf5e5dd Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Lucas WerkmeisterGerrit-Reviewer: Jonas Kress (WMDE) Gerrit-Reviewer: Lucas
[MediaWiki-commits] [Gerrit] translatewiki[master]: Increase export timeout
jenkins-bot has submitted this change and it was merged. Change subject: Increase export timeout .. Increase export timeout Saw regular timeouts in exports. Change-Id: Ice15a063cc37e965fc0cb8c357ee6b5678e00dab --- M repong/repong.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/repong/repong.php b/repong/repong.php index 6b4ed14..d2a4cd4 100644 --- a/repong/repong.php +++ b/repong/repong.php @@ -83,7 +83,7 @@ $process = new Process( $command ); $process->mustRun(); - $process->setTimeout( 120 ); + $process->setTimeout( 180 ); print $process->getOutput(); // Then message documentation -- To view, visit https://gerrit.wikimedia.org/r/305454 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ice15a063cc37e965fc0cb8c357ee6b5678e00dab Gerrit-PatchSet: 2 Gerrit-Project: translatewiki Gerrit-Branch: master Gerrit-Owner: NikerabbitGerrit-Reviewer: Nikerabbit Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] translatewiki[master]: Increase export timeout
Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/305454 Change subject: Increase export timeout .. Increase export timeout Saw regular timeouts exports. Change-Id: Ice15a063cc37e965fc0cb8c357ee6b5678e00dab --- M repong/repong.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/54/305454/1 diff --git a/repong/repong.php b/repong/repong.php index 6b4ed14..d2a4cd4 100644 --- a/repong/repong.php +++ b/repong/repong.php @@ -83,7 +83,7 @@ $process = new Process( $command ); $process->mustRun(); - $process->setTimeout( 120 ); + $process->setTimeout( 180 ); print $process->getOutput(); // Then message documentation -- To view, visit https://gerrit.wikimedia.org/r/305454 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ice15a063cc37e965fc0cb8c357ee6b5678e00dab Gerrit-PatchSet: 1 Gerrit-Project: translatewiki Gerrit-Branch: master Gerrit-Owner: Nikerabbit___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/puppet[production]: redis::instance: use specific aof/rdb file names by default
Giuseppe Lavagetto has submitted this change and it was merged. Change subject: redis::instance: use specific aof/rdb file names by default .. redis::instance: use specific aof/rdb file names by default There is no point, and would be harmful, not to have a default per-instance aof/rdb file, as the common files are declaring a common value for it. Bug: T134400 Change-Id: I5f2e00bed5a0d38f05302d4f64812642e782deae --- M modules/redis/manifests/instance.pp 1 file changed, 8 insertions(+), 5 deletions(-) Approvals: Giuseppe Lavagetto: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/redis/manifests/instance.pp b/modules/redis/manifests/instance.pp index 71f2e28..1f6a4f4 100644 --- a/modules/redis/manifests/instance.pp +++ b/modules/redis/manifests/instance.pp @@ -63,12 +63,15 @@ fail('redis::instance title must be a TCP port or absolute path to UNIX socket.') } +$dbname = "${::hostname}-${title}" $defaults = { -pidfile=> "/var/lib/redis/${instance_name}.pid", -logfile=> "/var/log/redis/${instance_name}.log", -port => $port, -unixsocket => $unixsocket, -daemonize => true, +pidfile=> "/var/lib/redis/${instance_name}.pid", +logfile=> "/var/log/redis/${instance_name}.log", +port => $port, +unixsocket => $unixsocket, +daemonize => true, +appendfilename => "${dbname}.aof", +dbfilename => "${dbname}.rdb", } -- To view, visit https://gerrit.wikimedia.org/r/301789 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5f2e00bed5a0d38f05302d4f64812642e782deae Gerrit-PatchSet: 3 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe LavagettoGerrit-Reviewer: Giuseppe Lavagetto Gerrit-Reviewer: Ori.livneh Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add sanity check to getScopedLockAndFlush() for pending writes
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/305453 Change subject: Add sanity check to getScopedLockAndFlush() for pending writes .. Add sanity check to getScopedLockAndFlush() for pending writes Also made a few related exception message more uniform. Change-Id: I4491f16493b3d9f8ab8fad45fc6373e0d7f7d67b --- M includes/db/Database.php 1 file changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/53/305453/1 diff --git a/includes/db/Database.php b/includes/db/Database.php index be0399d..933bea6 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2673,7 +2673,7 @@ if ( $this->mTrxLevel ) { if ( $this->mTrxAtomicLevels ) { $levels = implode( ', ', $this->mTrxAtomicLevels ); - $msg = "Got explicit BEGIN from $fname while atomic section(s) $levels are open."; + $msg = "$fname: Got explicit BEGIN while atomic section(s) $levels are open."; throw new DBUnexpectedError( $this, $msg ); } elseif ( !$this->mTrxAutomatic ) { $msg = "$fname: Explicit transaction already active (from {$this->mTrxFname})."; @@ -2727,7 +2727,7 @@ $levels = implode( ', ', $this->mTrxAtomicLevels ); throw new DBUnexpectedError( $this, - "Got COMMIT while atomic sections $levels are still open." + "$fname: Got COMMIT while atomic sections $levels are still open." ); } @@ -3286,6 +3286,14 @@ } public function getScopedLockAndFlush( $lockKey, $fname, $timeout ) { + if ( $this->writesOrCallbacksPending() ) { + // This only flushes transactions to clear snapshots, not to write data + throw new DBUnexpectedError( + $this, + "$fname: Cannot COMMIT to clear snapshot because writes are pending." + ); + } + if ( !$this->lock( $lockKey, $fname, $timeout ) ) { return null; } -- To view, visit https://gerrit.wikimedia.org/r/305453 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4491f16493b3d9f8ab8fad45fc6373e0d7f7d67b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow defining cache size for page props
Smalyshev has uploaded a new change for review. https://gerrit.wikimedia.org/r/305449 Change subject: Allow defining cache size for page props .. Allow defining cache size for page props May be useful for batch processing where size of the batch is known and the batch should fit in cache. Change-Id: Ib6d6e6ab7e12788c934cd0e973bc35e133aeccbb --- M includes/PageProps.php 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/49/305449/1 diff --git a/includes/PageProps.php b/includes/PageProps.php index 3654384..aa9185d 100644 --- a/includes/PageProps.php +++ b/includes/PageProps.php @@ -79,9 +79,10 @@ /** * Create a PageProps object +* @param int|null $size Cache size, by default self::CACHE_SIZE */ - private function __construct() { - $this->cache = new ProcessCacheLRU( self::CACHE_SIZE ); + private function __construct( $size = null ) { + $this->cache = new ProcessCacheLRU( $size ?: self::CACHE_SIZE ); } /** -- To view, visit https://gerrit.wikimedia.org/r/305449 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib6d6e6ab7e12788c934cd0e973bc35e133aeccbb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Smalyshev___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: getScopedLockAndFlush() should not commit when exceptions ar...
jenkins-bot has submitted this change and it was merged. Change subject: getScopedLockAndFlush() should not commit when exceptions are thrown .. getScopedLockAndFlush() should not commit when exceptions are thrown Previously it would commit() since the __destruct() call happens as an exception is thrown but before it reached MWExceptionHandler. Change-Id: I3d4186eb9ec02cf4d42ac84590869e2cf29b30b4 --- M includes/db/Database.php M includes/db/IDatabase.php M tests/phpunit/includes/db/DatabaseTest.php 3 files changed, 61 insertions(+), 5 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/db/Database.php b/includes/db/Database.php index 940c3f7..be0399d 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -3291,8 +3291,16 @@ } $unlocker = new ScopedCallback( function () use ( $lockKey, $fname ) { - $this->commit( __METHOD__, self::FLUSHING_INTERNAL ); - $this->unlock( $lockKey, $fname ); + if ( $this->trxLevel() ) { + // There is a good chance an exception was thrown, causing any early return + // from the caller. Let any error handler get a chance to issue rollback(). + // If there isn't one, let the error bubble up and trigger server-side rollback. + $this->onTransactionResolution( function () use ( $lockKey, $fname ) { + $this->unlock( $lockKey, $fname ); + } ); + } else { + $this->unlock( $lockKey, $fname ); + } } ); $this->commit( __METHOD__, self::FLUSHING_INTERNAL ); diff --git a/includes/db/IDatabase.php b/includes/db/IDatabase.php index 772d824..bdab09e 100644 --- a/includes/db/IDatabase.php +++ b/includes/db/IDatabase.php @@ -1359,6 +1359,10 @@ * Begin a transaction. If a transaction is already in progress, * that transaction will be committed before the new transaction is started. * +* Only call this from code with outer transcation scope. +* See https://www.mediawiki.org/wiki/Database_transactions for details. +* Nesting of transactions is not supported. +* * Note that when the DBO_TRX flag is set (which is usually the case for web * requests, but not for maintenance scripts), any previous database query * will have started a transaction automatically. @@ -1377,6 +1381,8 @@ * Commits a transaction previously started using begin(). * If no transaction is in progress, a warning is issued. * +* Only call this from code with outer transcation scope. +* See https://www.mediawiki.org/wiki/Database_transactions for details. * Nesting of transactions is not supported. * * @param string $fname @@ -1397,7 +1403,11 @@ * Rollback a transaction previously started using begin(). * If no transaction is in progress, a warning is issued. * -* No-op on non-transactional databases. +* Only call this from code with outer transcation scope. +* See https://www.mediawiki.org/wiki/Database_transactions for details. +* Nesting of transactions is not supported. If a serious unexpected error occurs, +* throwing an Exception is preferrable, using a pre-installed error handler to trigger +* rollback (in any case, failure to issue COMMIT will cause rollback server-side). * * @param string $fname * @param string $flush Flush flag, set to a situationally valid IDatabase::FLUSHING_* @@ -1568,10 +1578,14 @@ /** * Acquire a named lock, flush any transaction, and return an RAII style unlocker object * +* Only call this from outer transcation scope and when only one DB will be affected. +* See https://www.mediawiki.org/wiki/Database_transactions for details. +* * This is suitiable for transactions that need to be serialized using cooperative locks, * where each transaction can see each others' changes. Any transaction is flushed to clear * out stale REPEATABLE-READ snapshot data. Once the returned object falls out of PHP scope, -* any transaction will be committed and the lock will be released. +* the lock will be released unless a transaction is active. If one is active, then the lock +* will be released when it either commits or rolls back. * * If the lock acquisition failed, then no transaction flush happens, and null is returned. * diff --git a/tests/phpunit/includes/db/DatabaseTest.php