[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Styles not applied during installer due to ResourceLoader trying to cache to the database
Closed, ResolvedPublic

Description

Refused to apply style from 'https://url/w/mw-config/?css=1' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

So I get a very great looking installer...

Screenshot 2020-03-13 at 21.20.25.png (1×1 px, 168 KB)

Visiting the url in question

[5be3d5e6960d7beba7ce3596] /w/mw-config/?css=1 Wikimedia\Services\ServiceDisabledException from line 415 of /var/www/wiki/w/includes/libs/services/ServiceContainer.php: Service disabled: DBLoadBalancer

Backtrace:

#0 /var/www/wiki/w/includes/MediaWikiServices.php(624): Wikimedia\Services\ServiceContainer->getService(string)
#1 /var/www/wiki/w/includes/ServiceWiring.php(828): MediaWiki\MediaWikiServices->getDBLoadBalancer()
#2 /var/www/wiki/w/includes/libs/services/ServiceContainer.php(451): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#3 /var/www/wiki/w/includes/libs/services/ServiceContainer.php(419): Wikimedia\Services\ServiceContainer->createService(string)
#4 /var/www/wiki/w/includes/MediaWikiServices.php(1009): Wikimedia\Services\ServiceContainer->getService(string)
#5 /var/www/wiki/w/includes/installer/WebInstallerOutput.php(141): MediaWiki\MediaWikiServices->getResourceLoader()
#6 /var/www/wiki/w/includes/installer/WebInstaller.php(1241): WebInstallerOutput->getCSS()
#7 /var/www/wiki/w/includes/installer/WebInstaller.php(179): WebInstaller->outputCss()
#8 /var/www/wiki/w/mw-config/index.php(82): WebInstaller->execute(array)
#9 /var/www/wiki/w/mw-config/index.php(40): wfInstallerMain()
#10 {main}

If we click one step further in the installer, I'd presume it's related to Could not find a suitable database driver! You need to install a database driver for PHP. The following database types are supported: MariaDB, MySQL, or compatible, PostgreSQL, SQLite. (I didn't have a db connector installed), which is fine, but it shouldn't result in a stack trace, and it shouldn't result in broken styles...

However, installing php7.3-sqlite and restarting nginx still results in the same error

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy updated the task description. (Show Details)
Reedy updated the task description. (Show Details)
Reedy renamed this task from Refused to apply style because its MIME type ('text/html') is not a supported stylesheet MIME type to Trying to install MW without a php database module installed doesn't work well.Mar 13 2020, 9:27 PM
Reedy added a project: Platform Engineering.

Right. During the installer the LBFactory service isn't allowed to be instantiated.

The ResourceLoader class is used during the installer, and in commit 5282a0296 (T113916) some of the internal calls to wfGetDB (I guess only in method that the Installer never used) were abstracted through the injected LBFactory dependency. This meant where previous some parts just happen to work, it is now consistently trying to construct LBFactory.

We'll likely need to do one of the following:

  • Bypass the service wiring in Installer and construct it a different way.
  • Use wgResourceLoaderUseObjectCacheForDeps or some other setting in the installer context so that the service wiring for RL won't use LBFactory.
  • Replace the service wiring for the installer (setService ?), with a simpler instance that passes an EmptyBagOStuff here.
Reedy triaged this task as High priority.Mar 13 2020, 9:29 PM
Reedy updated the task description. (Show Details)
Anomie renamed this task from Trying to install MW without a php database module installed doesn't work well to Styles not applied during installer due to ResourceLoader trying to cache to the database.Mar 16 2020, 5:34 PM
Anomie subscribed.

This has nothing to do with having PHP database abstractions installed or not. As @Krinkle pointed out, it's due to 5282a029 causing ResourceLoader to try to cache to the database before the database is set up.

Fortunately we can work around it by having the installer force $wgResourceLoaderUseObjectCacheForDeps = true.

Change 580088 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] installer: Avoid ResourceLoader trying to cache to the database

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

Change 580088 merged by jenkins-bot:
[mediawiki/core@master] installer: Avoid ResourceLoader trying to cache to the database

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