Page MenuHomePhabricator

Warning: file_put_contents(/en.l10n.php): failed to open stream: Permission denied in /var/www/html/includes/cache/localisation/LCStoreStaticArray.php on line 123
Closed, ResolvedPublic

Description

Requiring DevelopmentSettings.php from LocalSettings.php results in this error, because wgCacheDirectory defaults to false.

( ! ) Warning: file_put_contents(/en.l10n.php): failed to open stream: Permission denied in /var/www/html/includes/cache/localisation/LCStoreStaticArray.php on line 123
Call Stack
#	Time	Memory	Function	Location
1	0.0004	418088	{main}( )	.../index.php:0
2	0.0293	2745592	MediaWiki->run( )	.../index.php:47
3	0.0296	2745592	MediaWiki->main( )	.../MediaWiki.php:535
4	0.0452	3258008	MediaWiki->performRequest( )	.../MediaWiki.php:972
5	0.0525	3562968	MediaWiki->performAction( )	.../MediaWiki.php:305
6	0.0535	3563296	ViewAction->show( )	.../MediaWiki.php:519
7	0.0542	3563584	Article->view( )	.../ViewAction.php:63
8	0.0544	3563608	OutputPage->setPageTitle( )	.../Article.php:663
9	0.0558	3667368	OutputPage->setHTMLTitle( )	.../OutputPage.php:972
10	0.0558	3667368	Message->text( )	.../OutputPage.php:923
11	0.0558	3667368	Message->toString( )	.../Message.php:946
12	0.0558	3667368	Message->fetchMessage( )	.../Message.php:854
13	0.0564	3672768	MessageCache->get( )	.../Message.php:1299
14	0.0564	3672832	MessageCache->getMessageFromFallbackChain( )	.../MessageCache.php:922
15	0.0565	3672856	MessageCache->getMessageForLang( )	.../MessageCache.php:980
16	0.0565	3672920	MessageCache->getMsgFromNamespace( )	.../MessageCache.php:1010
17	0.0565	3672920	MessageCache->load( )	.../MessageCache.php:1083
18	0.0565	3672920	LocalisationCache->getSubitemList( )	.../MessageCache.php:283
19	0.0565	3672920	LocalisationCache->getSubitem( )	.../LocalisationCache.php:345
20	0.0565	3672920	LocalisationCache->loadSubitem( )	.../LocalisationCache.php:325
21	0.0565	3672920	LocalisationCache->loadItem( )	.../LocalisationCache.php:400
22	0.0565	3672920	LocalisationCache->initLanguage( )	.../LocalisationCache.php:363
23	0.0568	3673320	LocalisationCache->recache( )	.../LocalisationCache.php:489
24	0.1753	6923736	LCStoreStaticArray->finishWrite( )	.../LocalisationCache.php:1044
25	0.2945	8021824	file_put_contents ( )	.../LCStoreStaticArray.php:123

Event Timeline

kostajh created this task.Feb 29 2020, 8:39 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 29 2020, 8:39 PM

Change 575724 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/core@master] DevelopmentSettings: Set cache dir to system temp by default

https://gerrit.wikimedia.org/r/575724

brennen moved this task from Backlog to Watching on the User-brennen board.
Krinkle added a subscriber: Krinkle.Mar 3 2020, 4:03 PM

@kostajh Having a cache directory enabled by default is tracked as part of T218207.

However, the error you got is definitely not how MediaWiki should behave by default even if that is still off (or turned off intentionally). Did you have any LocalSettings relating to "Localisation" or "Cache" besides including DevelopmentSettings.php?

As I understand it, the service wiring is meant to only use a file-based LCStore if the cacheDirectory option is set, which it isn't in your case, so that should never have triggered.

@Krinkle you should be able to reproduce by cloning core into a new repo, then running these setup commands (https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/DEVELOPERS.md#start-environment-and-install-mediawiki), then adding require_once "$IP/includes/DevelopmentSettings.php;.

brennen added a subscriber: brennen.Mar 4 2020, 7:05 PM

@Krinkle you should be able to reproduce by cloning core into a new repo, then running these setup commands (https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/DEVELOPERS.md#start-environment-and-install-mediawiki), then adding require_once "$IP/includes/DevelopmentSettings.php;.

Thanks. I guess the problem then is that the otherwise-optional cacheDirectory key becomes required once $wgLocalisationCacheConf['store'] = 'array'; is set, and we don't check for or enforce this anywhere. This boolean false suddenly gets slapped together with a path to create weird (luckily unwritable) paths somewhere in the root of your disk. That's definitely an issue that LocalisationCache::getStoreFromConf should be catching. This will be obsolete with T218207 though, at which point we'll no longer support running MW without some form of cache directory.

Change 575724 merged by jenkins-bot:
[mediawiki/core@master] DevelopmentSettings: Set cache dir to system temp + wiki ID

https://gerrit.wikimedia.org/r/575724

Krinkle closed this task as Resolved.Mar 25 2020, 5:39 PM
Krinkle claimed this task.
Krinkle reassigned this task from Krinkle to kostajh.
Krinkle removed a project: Patch-For-Review.
brennen moved this task from Watching to Done / Defunct on the User-brennen board.Apr 3 2020, 10:25 PM