Mediawiki-wysiwyg / WYSIWYG-CKeditor

Mediawiki extension: WYSIWYG. Includes extension and other components required by it
GNU General Public License v3.0
67 stars 34 forks source link

Compatibility with Mediawiki 1.31 (LTS) #115

Closed ITMaya closed 5 years ago

ITMaya commented 6 years ago

Hello,

I'm working on upgrade our Mediawiki instance from 1.30 to 1.31. I've the following error that seems to be related to WYSIWYG-CKeditor.

Could you please help on resolving it?

MediaWiki internal error.

Original exception: [Wvmavr54j4APrbObu6L4TQAAAAc] /index.php/Main_Page UnexpectedValueException from line 239 of /var/www/http-mediawiki.mayahtt.ca/includes/Hooks.php: Invalid return from CKeditor_MediaWiki::onBeforePageDisplay for unabortable BeforePageDisplay. Backtrace:

0 /var/www/http-mediawiki.mayahtt.ca/includes/OutputPage.php(2385): Hooks::runWithoutAbort(string, array)

1 /var/www/http-mediawiki.mayahtt.ca/includes/MediaWiki.php(868): OutputPage->output(boolean)

2 /var/www/http-mediawiki.mayahtt.ca/includes/MediaWiki.php(880): MediaWiki->{closure}()

3 /var/www/http-mediawiki.mayahtt.ca/includes/MediaWiki.php(524): MediaWiki->main()

4 /var/www/http-mediawiki.mayahtt.ca/index.php(42): MediaWiki->run()

5 {main}

Exception caught inside exception handler: [Wvmavr54j4APrbObu6L4TQAAAAc] /index.php/Main_Page UnexpectedValueException from line 239 of /var/www/http-mediawiki.mayahtt.ca/includes/Hooks.php: Invalid return from CKeditor_MediaWiki::onBeforePageDisplay for unabortable BeforePageDisplay. Backtrace:

0 /var/www/http-mediawiki.mayahtt.ca/includes/OutputPage.php(2385): Hooks::runWithoutAbort(string, array)

1 /var/www/http-mediawiki.mayahtt.ca/includes/exception/MWExceptionRenderer.php(135): OutputPage->output()

2 /var/www/http-mediawiki.mayahtt.ca/includes/exception/MWExceptionRenderer.php(54): MWExceptionRenderer::reportHTML(UnexpectedValueException)

3 /var/www/http-mediawiki.mayahtt.ca/includes/exception/MWExceptionHandler.php(75): MWExceptionRenderer::output(UnexpectedValueException, integer)

4 /var/www/http-mediawiki.mayahtt.ca/includes/exception/MWExceptionHandler.php(149): MWExceptionHandler::report(UnexpectedValueException)

5 /var/www/http-mediawiki.mayahtt.ca/includes/MediaWiki.php(551): MWExceptionHandler::handleException(UnexpectedValueException)

6 /var/www/http-mediawiki.mayahtt.ca/index.php(42): MediaWiki->run()

7 {main}

Thanks in advance. Regards, John

riparap commented 6 years ago

Current stable version of mediawiki is 1.30 (at ~5/2018 https://www.mediawiki.org/wiki/MediaWiki). Version 1.5.6_0 [B551+19.05.2018] of wysiwyg should work with MW1.30.

I have not yet tested wysiwyg with MW1.31.

ITMaya commented 6 years ago

Thank you for your reply. Indeed, it does work with version 1.30, I'll stick to it then.

Have a great day! John

Matthiator commented 6 years ago

I got the same error with version 1.31. Latest stable Version is 1.31 now.. any news here?

riparap commented 6 years ago

There are three issues which prevent WYSIWYG (Version 1.5.6_0 [B551+19.05.2018]) to start in MW 1.31.0:

  1. Error: "The configuration setting 'wgDefaultUserOptions' was already set by MediaWiki core or another extension, and cannot be set again in..."

  2. The global functions wfProfileIn and wfProfileOut, deprecated in 1.25, have been removed in MW 1.31.0.

  3. Methods BeforePageDisplay and OutputPageParserOutput (and matching hooks) do not work for some reason.

As workaround for issue 1, I first had to disable this check in MW 1.31.0 (includes/registration/ExtensionProcessor.php). Something is preventing usage of this variable in MW1.31.0, I can not find any comments in release notes that usage of wgDefaultUserOptions might be forbidden in MW1.31.0, but it looks like extensions can not anymore change values of this variable directly, it must be done using LocalSettings.php.

Fix for issue 2 is easy by just commenting out those calls because they seem to be for some kind of tracking functions. If I understand it right all things related to profiling can be taken care by using file StartProfiler.php in >=MW 1.25 see:Profiling in MW.

Reason to issue 3 is not clear to me, I suspect some of the OutputPage class changes in MW 1.31.0 but I am not sure of this. Related modifications in Wysiwyg are trying to fix some old IE related problem with big amount of css style sheets, I am not sure if this is still needed with current browsers. They also set compatibility mode to EDGE which is still needed. It looks like if return value in onBeforePageDisplay is changed form "$out" to "true", that error message disappears. I wonder if this is proper solution.

I am not expert on this field so help is highly appreciated in solving these issues.

riparap commented 6 years ago

Version 1.5.6_0 [B551++23.06.2018] can be tested with MW1.31.0.

If these are missing in your LocalSettings.php, you will get error messages related to them.

    $wgDefaultUserOptions['riched_disable']               = false;
    $wgDefaultUserOptions['riched_start_disabled']        = false;
    $wgDefaultUserOptions['riched_use_toggle']            = true; 
    $wgDefaultUserOptions['riched_use_popup']             = false;
    $wgDefaultUserOptions['riched_toggle_remember_state'] = true;
    $wgDefaultUserOptions['riched_link_paste_text']       = true;