ProfessionalWiki / chameleon

Provides a highly flexible and customizable skin using Bootstrap 4
https://www.mediawiki.org/wiki/Skin:Chameleon
Other
114 stars 62 forks source link

Exception with MW 1.42.1 #429

Open fol9000 opened 3 months ago

fol9000 commented 3 months ago

I updated Mediawiki from 1.41.0 to 1.42.1 and I get this Exception. Did I make a mistake or is it a compatibility issue? The updated 1.42.1 runs perfectly with the Vector theme.

Thanks Frank

Original exception: [91930cc8dae54bc1cee6a523] /index.php?title=Spezial:Version TypeError: Skins\Chameleon\Chameleon::Skins\Chameleon\{closure}(): Argument #1 ($rl) must be of type ResourceLoader, MediaWiki\ResourceLoader\ResourceLoader given, called in /Users/xyz/wiki-1.42.1/includes/HookContainer/HookContainer.php on line 159
Backtrace:
from /Users/xyz/wiki-1.42.1/skins/chameleon/src/Chameleon.php(86)
#0 /Users/xyz/wiki-1.42.1/includes/HookContainer/HookContainer.php(159): Skins\Chameleon\Chameleon::Skins\Chameleon\{closure}(MediaWiki\ResourceLoader\ResourceLoader)
#1 /Users/xyz/wiki-1.42.1/includes/ResourceLoader/HookRunner.php(46): MediaWiki\HookContainer\HookContainer->run(string, array, array)
#2 /Users/xyz/wiki-1.42.1/includes/ServiceWiring.php(1883): MediaWiki\ResourceLoader\HookRunner->onResourceLoaderRegisterModules(MediaWiki\ResourceLoader\ResourceLoader)
#3 /Users/xyz/wiki-1.42.1/vendor/wikimedia/services/src/ServiceContainer.php(445): Wikimedia\Services\ServiceContainer::{closure}(MediaWiki\MediaWikiServices)
#4 /Users/xyz/wiki-1.42.1/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService(string)
#5 /Users/xyz/wiki-1.42.1/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService(string)
#6 /Users/xyz/wiki-1.42.1/includes/MediaWikiServices.php(1740): MediaWiki\MediaWikiServices->getService(string)
#7 /Users/xyz/wiki-1.42.1/includes/Output/OutputPage.php(3634): MediaWiki\MediaWikiServices->getResourceLoader()
#8 /Users/xyz/wiki-1.42.1/includes/Output/OutputPage.php(3399): MediaWiki\Output\OutputPage->getResourceLoader()
#9 /Users/xyz/wiki-1.42.1/includes/Output/OutputPage.php(3442): MediaWiki\Output\OutputPage->getRlClientContext()
#10 /Users/xyz/wiki-1.42.1/includes/Output/OutputPage.php(3543): MediaWiki\Output\OutputPage->getRlClient()
#11 /Users/xyz/wiki-1.42.1/includes/skins/SkinTemplate.php(328): MediaWiki\Output\OutputPage->headElement(Skins\Chameleon\Chameleon)
#12 /Users/xyz/wiki-1.42.1/skins/chameleon/src/Chameleon.php(111): SkinTemplate->prepareQuickTemplate()
#13 /Users/xyz/wiki-1.42.1/includes/skins/SkinTemplate.php(145): Skins\Chameleon\Chameleon->prepareQuickTemplate()
#14 /Users/xyz/wiki-1.42.1/includes/skins/SkinTemplate.php(176): SkinTemplate->generateHTML()
#15 /Users/xyz/wiki-1.42.1/includes/Output/OutputPage.php(3004): SkinTemplate->outputPage()
#16 /Users/xyz/wiki-1.42.1/includes/actions/ActionEntryPoint.php(162): MediaWiki\Output\OutputPage->output(boolean)
#17 /Users/xyz/wiki-1.42.1/includes/MediaWikiEntryPoint.php(199): MediaWiki\Actions\ActionEntryPoint->execute()
#18 /Users/xyz/wiki-1.42.1/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#19 {main}
coffnix commented 3 months ago

Solved. Try this:

Create the composer.local.json file with the following content:

{
  "minimum-stability" : "dev",
  "require": {
    "mediawiki/chameleon-skin": "dev-master"
  }
}

Then run: composer update --no-dev

https://www.area31.net.br/wiki/Especial:Vers%C3%A3o

my system: Gentoo Linux 2.15 MediaWiki | 1.42.1 PHP | 8.2.20 (apache2handler) ICU | 74.2 MariaDB | 10.6.17-MariaDB Pygments | 2.17.2 Chameleon | 5.0.0-dev

malberts commented 2 months ago

Yes, the MW 1.42 fixes are on the master branch (on the unreleased version 5.0.0).

That exception looks like it is coming from a 4.x version.

tjos-bgs commented 2 months ago

So I have a Dockerfile that builds MW:stable. This MW instance has the Chameleon skin and was working perfectly, until I ran the pipeline recently to make a few minor changes. I get this error: "Fatal error: Trait "Wikimedia\NormalizedException\NormalizedExceptionTrait" not found in /var/www/html/includes/Settings/Config/PhpIniSink.php on line 12"

There is a solution described here: https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/5519#issuecomment-2137684545

I tried that, but only added the NormalizedException package. I then got the AtEase package error, so I thought I was on the right track, and added in the AtEase package as well. The error I got after that was just plain weird and I can't find a solution online for it: mw chameleon service container error

I even tried the solution above but it throws the same error....

I thought it could've been some extension that's deprecated in my LocalSettings.php, so I created a new project with a fresh install of MW:Stable, which ran fine without Chameleon. As soon as I added chameleon in, I got all these errors all over again.

This is my LocalSettings.php:

<?php
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

if ( !defined( 'MEDIAWIKI' ) ) {
    exit;
}

$wgSitename = '${SITE_NAME}';

$wgScriptPath = '';

$wgServer = '${PROTOCOL}://${APP_HOSTNAME}';

$wgResourceBasePath = $wgScriptPath;

$wgLogos = [
    '1x' => "$wgResourceBasePath/resources/assets/change-your-logo.svg",
    'icon' => "$wgResourceBasePath/resources/assets/change-your-logo.svg",
];

$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO

$wgEmergencyContact = '<redacted>';
$wgPasswordSender = '<redacted>';

$wgEnotifUserTalk = true; # UPO
$wgEnotifWatchlist = true; # UPO
$wgEmailAuthentication = true;

# Database Settings
require_once "/opt/www-scripts/secure.php";

$wgDBprefix = "mw_";
$wgDBssl = false;

$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

$wgSharedTables[] = "actor";

$wgMainCacheType = CACHE_ACCEL;
$wgMemCachedServers = [];

$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/bin/convert';

$wgUseInstantCommons = true;

$wgPingback = true;

$wgLanguageCode = 'en-gb';

# Increase Memory Limit
$wgMemoryLimit = "128M";

# Time zone
$wgLocaltimezone = "Europe/London";
date_default_timezone_set( $wgLocaltimezone );
$wgAuthenticationTokenVersion = '1';

$wgRightsPage = "";
$wgRightsUrl = '';
$wgRightsText = '';
$wgRightsIcon = "";
$wgDiff3 = '/usr/bin/diff3';

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;

## Default skin: you can change the default skin. Use the internal symbolic
## names, e.g. 'vector' or 'monobook':
$wgDefaultSkin = 'chameleon';

# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MinervaNeue' );
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
wfLoadSkin( 'chameleon' );

# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'AbuseFilter' );
wfLoadExtension( 'CategoryTree' );
wfLoadExtension( 'Cite' );
wfLoadExtension( 'CiteThisPage' );
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'Echo' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'Linter' );
wfLoadExtension( 'Math' );
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'Nuke' );
wfLoadExtension( 'OATHAuth' );
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'ReplaceText' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'SecureLinkFixer' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'TemplateData' );
wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'TitleBlacklist' );
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'Bootstrap' );

$wgDebugLogFile = "/var/log/mediawiki/debug.log";
$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;
$wgShowSQLErrors = true;

Could someone please help? I'm at my wit's end because I've been trying everything for the past 2 weeks but to no avail...

coffnix commented 2 months ago

@tjos-bgs your question would be answered more efficiently if you provided the version of MediaWiki, the version of PHP, and the version of the Chameleon theme. :D

http://www.catb.org/~esr/faqs/smart-questions.html

tjos-bgs commented 2 months ago

Whoops, my bad...

my system: MediaWiki | 1.42.1 PHP | 8.2.20 (apache2handler) MySQL | MySQL Server 9.0.1-1.el9 Chameleon | 5.0.0-dev

Let me know if you require anything else.

tjos-bgs commented 2 months ago

Is there any update on this?

malberts commented 2 months ago

@tjos-bgs The original issue here was already fixed on the master branch, which is definitely running correctly on MediaWiki 1.42.1: Screenshot_20240813_111851

Those other missing classes you showed suggest there's an issue in your environment.

What is MW:Stable? Are you referring to this repo: https://github.com/wikimedia/mediawiki-docker

And how are you installing Chameleon?

tjos-bgs commented 2 months ago

Yes, Mediawiki:Stable is the latest stable Docker image. Currently, the latest stable version is either 1.42 or 1.42.1.

I install chameleon via Composer and run via a shell script in the Dockerfile. It's been done like this for the last 2 years and it works (Every other skin works via this method, apart from the most recent Chameleon skin) The Work Directory is /var/www/html, so all commands in the shell script run in this directory

 # Composer Install
wget -cO - https://getcomposer.org/composer-2.phar > /tmp/composer.phar
mv /tmp/composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
rm -rf /tmp/composer.phar

# Composer Commands for Composer 2
export COMPOSER_NO_INTERACTION=1
COMPOSER=/var/www/html/composer.local.json composer update --no-dev -o

FYI, Composer 2 doesn't get downloaded. It still reverts to version 1. With a self-update, composer does get bumped up to version 2, but the errors are still the same.

This is my composer.local.json file:

 {
  "require": {
    "mediawiki/validator": "2.2.*",
    "mediawiki/chameleon-skin": "~4.0",
    "wikimedia/normalized-exception": "^1.0",
    "wikimedia/at-ease": "^2.1"
  },
  "config": {
    "allow-plugins": {
      "composer/installers": true,
      "wikimedia/composer-merge-plugin": false
    }
  },
  "extra": {
    "merge-plugin": {
      "include": [
        "extensions/*/composer.json",
        "skins/*/composer.json"
      ]
    }
  }
}
WouterRademaker commented 2 months ago

You can try the change the line in composer.local.json to "mediawiki/chameleon-skin": "dev-master",

tjos-bgs commented 2 months ago

You can try the change the line in composer.local.json to "mediawiki/chameleon-skin": "dev-master",

Did that as well, as per the suggestion right at the top. Had the same error.

vamshinilagiri2 commented 2 months ago

The Solution provided by the @coffnix Worked !,thanks alot man you saved alot of time , i have been struggling to fix this since many weeks !

vamshinilagiri2 commented 2 months ago

@coffnix , i have coloured boxes(styles on my current site which was running

Chameleon | 1.3 | GPLv3+ | The Chameleon skin | Stephan Gambke Vector | – | GPL-2.0+ | Kattouw and others

Bootstrap | 1.1.5 | GPLv3+

Below is the screenshot of my current page which has above configuration

image

I have updated mine to the latest verssion

Chameleon 5.0.0 - Dev Boostrap 5.0.0

i dont see these styles , check below Screenshot PLEASE HELP ME FIX THIS

image

malberts commented 2 months ago

@vamshinilagiri2 your colour issue is unrelated to this issue, please log a different issue if you feel there is a bug or if something is still unclear. Your old version of Chameleon uses Bootstrap 3, whereas Chameleon 2 and later use Bootstrap 4. Most likely the issue you see is due to different classes for colours/borders/panels. I have not touched Bootstrap 3 in many years, so the best I can suggest right now is to look at the Bootstrap 4 docs to find the new classes: https://getbootstrap.com/docs/4.6