jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/349785 )
Change subject: Improve cache consistency
..
Improve cache consistency
* Check if origin file is still present, else cache is considered outdated
* When the main cache file becomes outdated, delete also the other cache files
to avoid cache inconsistency.
Change-Id: I487ffdc8b806f807ecd2a8d9010bee8ba05821db
---
M src/MediaWikiFarm.php
M tests/phpunit/MediaWikiFarmTestCase.php
2 files changed, 11 insertions(+), 3 deletions(-)
Approvals:
Seb35: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/MediaWikiFarm.php b/src/MediaWikiFarm.php
index 055e529..6705369 100644
--- a/src/MediaWikiFarm.php
+++ b/src/MediaWikiFarm.php
@@ -712,7 +712,8 @@
$fresh = true;
$myfreshness = filemtime( $this->cacheDir . '/wikis/' .
$host . '.php' );
foreach( $result['$CORECONFIG'] as $coreconfig ) {
- if( filemtime( $this->configDir . '/' .
$coreconfig ) > $myfreshness ) {
+ if( !is_file( $this->configDir . '/' .
$coreconfig ) ||
+ filemtime( $this->configDir . '/' .
$coreconfig ) > $myfreshness ) {
$fresh = false;
break;
}
@@ -723,8 +724,14 @@
unset( $result['$CORECONFIG'] );
$this->variables = $result;
return;
- } elseif( is_file( $this->cacheDir . '/LocalSettings/'
. $host . '.php' ) ) {
- unlink( $this->cacheDir . '/LocalSettings/' .
$host . '.php' );
+ } else {
+ unlink( $this->cacheDir . '/wikis/' . $host .
'.php' );
+ if( is_file( $this->cacheDir .
'/LocalSettings/' . $host . '.php' ) ) {
+ unlink( $this->cacheDir .
'/LocalSettings/' . $host . '.php' );
+ }
+ if( is_file( $this->cacheDir . '/composer/' .
$host . '.php' ) ) {
+ unlink( $this->cacheDir . '/composer/'
. $host . '.php' );
+ }
}
}
diff --git a/tests/phpunit/MediaWikiFarmTestCase.php
b/tests/phpunit/MediaWikiFarmTestCase.php
index 479c45a..696a453 100644
--- a/tests/phpunit/MediaWikiFarmTestCase.php
+++ b/tests/phpunit/MediaWikiFarmTestCase.php
@@ -93,6 +93,7 @@
'wgParamDefinitions',
'wgParser',
'wgFlowActions',
+ 'wgReadOnly', // T163640 - bug in PHPUnit
subprogram global-state (issue #10)
)
);
}
--
To view, visit https://gerrit.wikimedia.org/r/349785
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I487ffdc8b806f807ecd2a8d9010bee8ba05821db
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MediaWikiFarm
Gerrit-Branch: master
Gerrit-Owner: Seb35
Gerrit-Reviewer: Seb35
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits