Jump to content

Topic on Extension talk:Lingo

Use of Hooks deprecated?

12
Summary by Elcapitan68

Proven functionality in the supported environment (Lingo REL1_39 (3.2.0) on MW REL1_39 with a compatible version of PHP).

GobleStL (talkcontribs)

I have been searching and cannot figure this one out. Lingo is operational but when I run update.php I get this:

PHP Deprecated:  Use of Hooks::register was deprecated in MediaWiki 1.35. [Called from Lingo\BasicBackend::registerHooks in /var/www/mediawiki/extensions/Lingo/src/BasicBackend.php at line 58] in /var/www/mediawiki/includes/debug/MWDebug.php on line 386

Any idea?

SG

Cavila (talkcontribs)

It is just a PHP warning that gets thrown if your current version of MediaWiki is v1.35 or over but your version of Lingo lingers behind. Your best bet is to upgrade Lingo.

GobleStL (talkcontribs)

I am at the latest.

GobleStL (talkcontribs)

Tried 3.2.1 also...

Cavila (talkcontribs)
Elcapitan68 (talkcontribs)

It is fixed in REL1_39 (LTS) according to the extension compatibility policy (ltsrel): https://github.com/wikimedia/mediawiki-extensions-Lingo/blob/c88549b25caa48012b915c150115c7100ded82be/src/BasicBackend.php#L56C1-L60C3

If you are on MW 1.39, please checkout REL1_39 branch, rather than a tag.

If you are running MW < 1.39, just ignore the message, as mentioned by @Cavila, it is just a deprecation warning and will go away with the upgrade to 1.39.

As for MW 1.35, it went end-of-life on December 21, 2023.

GobleStL (talkcontribs)

It actually only pops this error when I use VisualEditor. I disable Lingo when I need to use that extension and then have no issues.

Elcapitan68 (talkcontribs)

@GobleStL Please, make sure that you have PHP error reporting off in your LocalSettings.php and repeat testing. In case of failure, please share your current MW version number + PHP version, so that we could try to reproduce the error. A link to your LocalSettings.php will also be very helpful (just wipe the sensitive info out).

GobleStL (talkcontribs)

With error reporting on: "[58a6c0d657e09eaaaf0dc77c] Exception caught: Typed property Parser::$mOutput must not be accessed before initialization"

With error reporting off: "[addf778021d79e091496ce38] Caught exception of type Error"

This only pops up when I attempt to use VisualEditor. Lingo works just fine.

If I disable Lingo extension, VisualEditor opens without an error. I believe it is related to https://phabricator.wikimedia.org/T357686

In troubleshooting this I upgraded everything. I even started using dev branches. (The error started when on stable branch). Currently I am:

Product Version
MediaWiki 1.41.1
PHP 8.3.7 (fpm-fcgi)
ICU 66.1
MariaDB 10.5.23-MariaDB-0+deb11u1
Lua 5.1.5
Pygments 2.16.1
VisualEditor 0.1.2 (6f30783) 16:34, 10 May 2024
Lingo 3.2.1


<?php

#To suppress error messages uncomment the next two lines

error_reporting( 0 );

ini_set( 'display_errors', 0);

#To turn on error reporting uncomment the next four lines

#error_reporting( -1 );

#ini_set( 'display_errors', 1 );

#$wgShowExceptionDetails = true;

#$wgShowDBErrorBacktrace = true;

# This file was automatically generated by the MediaWiki 1.41.1

# installer. If you make manual changes, please keep track in case you

# need to recreate them later.

#

# See includes/MainConfigSchema.php for all configurable settings

# and their default values, but don't forget to make changes in _this_

# file, not there.

#

# Further documentation for configuration settings may be found at:

# https://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry

if ( !defined( 'MEDIAWIKI' ) ) {

        exit;

}

## Uncomment this to disable output compression

# $wgDisableOutputCompression = true;

$wgSitename = "This_Wiki";

## The URL base path to the directory containing the wiki;

## defaults for all runtime URL paths are based off of this.

## For more information on customizing the URLs

## (like /w/index.php/Page_title to /wiki/Page_title) please see:

## https://www.mediawiki.org/wiki/Manual:Short_URL

$wgScriptPath = "/mediawiki";

## The protocol and server name to use in fully-qualified URLs

$wgServer = "https://wiki.com";

## The URL path to static resources (images, scripts, etc.)

$wgResourceBasePath = $wgScriptPath;

## The URL paths to the logo.  Make sure you change this from the default,

## or else you'll overwrite your logo when you upgrade!

$wgLogos = [

        '1x' => "$wgResourceBasePath/resources/assets/wiki.svg",

        'icon' => "$wgResourceBasePath/resources/assets/wiki.svg",

];

$wgFavicon = "$wgResourceBasePath/resources/assets/wiki_icon.svg";

## UPO means: this is also a user preference option

$wgEnableEmail = true;

$wgEnableUserEmail = true; # UPO

$wgEmergencyContact = "an.email@abc.com";

$wgPasswordSender = "an.email@abc.com";

$wgSMTP = [

    'host'      => 'ssl://smtp.email.com', // could also be an IP address. Where the SMTP server is located. If using SSL or TLS, add the prefix "ssl://" or "tls://".

    'IDHost'    => 'wiki.com',      // Generally this will be the domain name of your website (aka mywiki.org)

    'localhost' => 'wiki.com,

    'port'      => 465,                // Port to use when connecting to the SMTP server

    'auth'      => true,               // Should we use SMTP authentication (true or false)

    'username'  => 'an.email@abc.com',     // Username to use for SMTP authentication (if being used)

    'password'  => 'somethinghere'       // Password to use for SMTP authentication (if being used)

];

$wgEnotifUserTalk = true; # UPO

$wgEnotifWatchlist = true; # UPO

$wgEmailAuthentication = true;

## Database settings

$wgDBtype = "mysql";

$wgDBserver = "localhost";

$wgDBname = "this_wiki";

$wgDBuser = "wiki_dude";

$wgDBpassword = "apassword";

# MySQL specific settings

$wgDBprefix = "";

$wgDBssl = false;

# MySQL table options to use during installation or update

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

# Shared database table

# This has no effect unless $wgSharedDB is also set.

$wgSharedTables[] = "actor";

## Shared memory settings

$wgMainCacheType = CACHE_ACCEL;

$wgMemCachedServers = [];

## To enable image uploads, make sure the 'images' directory

## is writable, then set this to true:

$wgEnableUploads = true;

$wgUseImageMagick = true;

$wgImageMagickConvertCommand = "/usr/bin/convert";

$wgGenerateThumbnailOnParse = true;

$wgSVGConverter = 'ImageMagick';

# InstantCommons allows wiki to use images from https://commons.wikimedia.org

$wgUseInstantCommons = false;

# Periodically send a pingback to https://www.mediawiki.org/ with basic data

# about this MediaWiki instance. The Wikimedia Foundation shares this data

# with MediaWiki developers to help guide future development efforts.

$wgPingback = false;

# Site language code, should be one of the list in ./includes/languages/data/Names.php

$wgLanguageCode = "en";

# Time zone

#$wgLocaltimezone = "UTC";

$wgLocaltimezone = "America/Chicago";

## Set $wgCacheDirectory to a writable directory on the web server

## to make your wiki go slightly faster. The directory should not

## be publicly accessible from the web.

#$wgCacheDirectory = "$IP/cache";

$wgTmpDirectory = "/var/www/mediawiki/temp";

$wgSecretKey = "abc123";

# Changing this will log out all existing sessions.

$wgAuthenticationTokenVersion = "1";

# Site upgrade key. Must be set to a string (default provided) to turn on the

# web installer while LocalSettings.php is in place

$wgUpgradeKey = "1234567890";

## For attaching licensing metadata to pages, and displaying an

## appropriate copyright notice / icon. GNU Free Documentation

## License and Creative Commons licenses are supported so far.

$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright

$wgRightsUrl = "";

$wgRightsText = "";

$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.

$wgDiff3 = "/usr/bin/diff3";

# The following permissions were set based on your choice in the installer

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

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

$wgGroupPermissions['*']['read'] = false;

## Default skin: you can change the default skin. Use the internal symbolic

## names, e.g. 'vector' or 'monobook':

$wgDefaultSkin = "monobook";

# Enabled skins.

# The following skins were automatically enabled:

wfLoadSkin( 'MinervaNeue' );

wfLoadSkin( 'MonoBook' );

wfLoadSkin( 'Timeless' );

wfLoadSkin( 'Vector' );

# 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( 'AccessControl' );

wfLoadExtension( 'AutoCreateCategoryPages' );

wfLoadExtension( 'CategoryTree' );

wfLoadExtension( 'Cite' );

wfLoadExtension( 'CiteThisPage' );

wfLoadExtension( 'CodeEditor' );

wfLoadExtension( 'ConfirmEdit' );

wfLoadExtension( 'DataDump' );

wfLoadExtension( 'DiscussionTools' );

wfLoadExtension( 'DumpsOnDemand' );

wfLoadExtension( 'Echo' );

wfLoadExtension( 'Gadgets' );

wfLoadExtension( 'ImageMap' );

wfLoadExtension( 'InputBox' );

wfLoadExtension( 'Interwiki' );

#wfLoadExtension( 'LinkTitles' );

wfLoadExtension( 'Linter' );

wfLoadExtension( 'LoginNotify' );

wfLoadExtension( 'Maintenance' );

wfLoadExtension( 'Math' );

wfLoadExtension( 'MultimediaViewer' );

wfLoadExtension( 'Nuke' );

wfLoadExtension( 'OATHAuth' );

wfLoadExtension( 'PageForms' );

wfLoadExtension( 'PageImages' );

wfLoadExtension( 'ParserFunctions' );

wfLoadExtension( 'PdfHandler' );

wfLoadExtension( 'Poem' );

wfLoadExtension( 'Renameuser' );

wfLoadExtension( 'ReplaceText' );

wfLoadExtension( 'Scribunto' );

wfLoadExtension( 'SecureLinkFixer' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'TemplateData' );

wfLoadExtension( 'TextExtracts' );

wfLoadExtension( 'Thanks' );

wfLoadExtension( 'TitleBlacklist' );

wfLoadExtension( 'VisualEditor' );

wfLoadExtension( 'WikiEditor' );

# End of automatically generated settings.

# Add more configuration options below.

//DataDump Configuration

$wgDataDumpDirectory = "<path>${wgDBname}/";

$wgDataDump = [

    'xml' => [

        'file_ending' => '.xml.gz',

        'generate' => [

            'type' => 'mwscript',

            'script' => "$IP/maintenance/dumpBackup.php",

            'options' => [

                '--full',

                '--output',

                "gzip:${wgDataDumpDirectory}" . '${filename}',

            ],

        ],

        'limit' => 1,

        'permissions' => [

            'view' => 'view-dump',

            'generate' => 'generate-dump',

            'delete' => 'delete-dump',

        ],

    ],

    'image' => [

        'file_ending' => '.zip',

        'generate' => [

            'type' => 'script',

            'script' => '/usr/bin/zip',

            'options' => [

                '-r',

                '<path>${filename}',

                "<path>${wgDBname}/"

            ],

        ],

        'limit' => 1,

        'permissions' => [

            'view' => 'view-dump',

            'generate' => 'view-image-dump',

            'delete' => 'delete-dump',

        ],

    ],

];

// create DataDump right

$wgAvailableRights[] = 'view-dump';

$wgAvailableRights[] = 'view-image-dump';

$wgAvailableRights[] = 'generate-dump';

$wgAvailableRights[] = 'delete-dump';

// add DataDump to the user group

$wgGroupPermissions['user']['view-image-dump'] = true;

$wgGroupPermissions['sysop']['view-image-dump'] = true;

$wgGroupPermissions['user']['generate-dump'] = true;

$wgGroupPermissions['sysop']['generate-dump'] = true;

$wgGroupPermissions['sysop']['delete-dump'] = true;

// add DataDump to the 'basic' grant so we can use our DataDump over an API request

$wgGrantPermissions['basic']['view-image-dump'] = true;

$wgGrantPermissions['basic']['generate-dump'] = true;

$wgGrantPermissions['basic']['delete-dump'] = true;

//For mobile adding extension and settings

$wgUrlProtocols[] = "file://";

$wgFileExtensions[] = 'iso';

$wgFileExtensions[] = 'pdf';

$wgFileExtensions[] = 'doc';

$wgFileExtensions[] = 'xls';

$wgMaxShellMemory = 8000000;

$wgMaxShellFileSize = 1000000;

$wgMaxShellTime = 300;

$wgAllowTitlesInSVG = true;

$wgLinkTitlesParseOnEdit = true;

$wgLinkTitlesBlackList[] = 'B6200';

// Add Lingo

wfLoadExtension( 'Lingo' );

#The following hook is needed for Lingo to function

$wgHooks['SetupAfterCache'][] = function() {

    // specify a different name for the terminology page (Default: 'Terminology' (or localised ve>

    $GLOBALS['wgexLingoPage'] = 'Glossary';

    // specify that each term should be annotated only once per page (Default: false)

    //$GLOBALS['wgexLingoDisplayOnce'] = false;

    // specify what namespaces should or should not be used (Default: Empty, i.e. use all namespa>

    //$GLOBALS['wgexLingoUseNamespaces'][NS_SPECIAL] = false;

    // set default cache type (Default: null, i.e. use main cache)

    //$GLOBALS['wgexLingoCacheType'] = CACHE_NONE;

    // use ApprovedRevs extension on the Terminology page (Default: false)

    //$GLOBALS['wgexLingoEnableApprovedRevs'] = true;

};

Tosfos (talkcontribs)

We only support LTS branches of MediaWiki. You can try the REL1_39 branch's code and it might work with 1.41. Probably unrelated, running MediaWiki with version 8.3 might cause issues.

GobleStL (talkcontribs)

Thank you. I realize this. This is why I just disable the extension when I want to use VisualEditor.

Elcapitan68 (talkcontribs)

I changed the resume to reflect the issue and solution correctly.