Project:Support desk

About this board

Welcome to the MediaWiki Support desk, where you can ask MediaWiki questions!

(Read this message in a different language)

See also

Before you post

Post a new question

  1. To help us answer your questions, please indicate which versions you are using, as found on your wiki's Special:Version page:
    • MediaWiki version
    • PHP version
    • Database type and version
  2. Please include the web address (URL) to your wiki if possible. It's often easier for us to identify the source of the problem if we can see the error directly.
  3. To start a new thread, click "Start a new topic".

"Fatal error: Cannot declare class ResourceLoader" after installing wikibase

1
2A01:CB11:68E:7F00:454A:B870:B529:16D (talkcontribs)

Hello,

I have a small problem since the installation of Wikibase (Mandatory extension for Infobox), I have the following error message which appears "Fatal error: Cannot declare class ResourceLoader, because the name is already in use in E: \ProgramFiles\XAMPP\htdocs\*\includes\resourceloader\ResourceLoader.php on line 60"


Here's what's on line 60 of resourceLoader.php :

class ResourceLoader implements LoggerAwareInterface { /** @var int */ public const CACHE_VERSION = 9; /** @var string JavaScript/CSS pragma to disable minification. * */ public const FILTER_NAME = '/*@name*/';

How does this happen?

I'm on Windows 10, for now my wiki is in Localhost, and I'm on the latest stable version of Mediawiki.

Thanks for your future help.

Reply to ""Fatal error: Cannot declare class ResourceLoader" after installing wikibase"
Bada Kaji (talkcontribs)

Nepali wiki's logo is currently shown in Hindi not in Nepali. It currently reads "विकिपीडिया" it should be "विकिपिडिया". Can you change it? Thanks.

Malyacko (talkcontribs)
Bawolff (talkcontribs)

Hi, please file a bug at https://phabricator.wikimedia.org - (optionally) in the tags section mark it as site-requests


Because the people who process these requests dont speak nepalu or hindi, linking to a discussion about the issue on nepali wikipedia can help speed the request along.

Reply to "Mobile Nepali Wikipedia logo"

Viewing recent uploaded files at wiki farm website

1
Fokebox (talkcontribs)

Hi,

I am running wiki farm. I have set up uploading files at separate domain files.mysite.com and after uploading a file to my server I can use it at my en.mysite.com. But the proble is when I use VisualEditor to insert an image I don't see it to be appeared at recent uploaded files. Meanwhile it is appeared at files.mysite.com.

Please help to resolve the issue.

Reply to "Viewing recent uploaded files at wiki farm website"

Add class to pages in specific wiki category

3
180.190.212.20 (talkcontribs)

How do I apply a class or script to pages under a certain cateogory only? When a category is created in wiki and pages are added to it, isn't there I classname I can use in to add style in Common.css to target pages under [[Category:Name]]?

Jonathan3 (talkcontribs)

I have a feeling this isn't possible.

It's possible to have CSS per namespace though.

Maybe the pages could be categorised via a template that contains the stuff you want (depending on what you want). Maybe you could then even use JavaScript to change things based on that.

180.190.212.20 (talkcontribs)

Thank you. Extension:TemplateStyles seems to be the answer. I also managed to do this by using this JS code:

$("#firstHeading:contains('keyword')")

Reply to "Add class to pages in specific wiki category"

How to create article series?

20
DStallTX (talkcontribs)

Where can I find help creating article series like this - https://en.wikipedia.org/wiki/Botany ?

or just creating something like this - https://en.wikipedia.org/wiki/Horse ?

or simply how to move TOC to right side of page like this - https://en.wikipedia.org/wiki/Enlightenment ?

I tried following instructions here - https://en.wikipedia.org/wiki/Wikipedia:Article_series but I ended up with some kind of Template loop error. Obviously, I did somethign wrong. Can someone please guide me through this step by step?

Bawolff (talkcontribs)

the information at https://developer.mozilla.org/en-US/docs/Web/CSS/float may be helpful. These are all floated elements.

You can rearrange the table of contents with the __TOC__ magic word - so you can put it in a div that is floated right and has a width set.


E.g. (using wikitext editor not visual editor)

<div style="float:right;width:20em;border thin solid black">__TOC__ or other content here</div>

DStallTX (talkcontribs)
Bawolff (talkcontribs)

the series boxes are also just floated content.

DStallTX (talkcontribs)

But how do you call up a series? Table of contents is _TOC_ yes? So what is series?

Bawolff (talkcontribs)

There is no such thing as a series. Its just a box with some links in it.

DStallTX (talkcontribs)

On my ModWiki | Humanity page, I created right sidebar div like you showed me, and placed source code from this Wikipedia page for sidebar in it. — NOT the source code from there but from Wikipedia:Article series

and this showed up - Template loop detected, Template Documentation.

So I created Template Documentation and added code per Wikipedia Templated:Documentation and then Template Documentation text disappeared and Templates: Sidebar with collapsible lists showed up in its place

So I created Template:Sidebar with collapsible lists by copying/pasting code from Wikipedia Templates:Sidebar with collapsible lists and now I have Template loop detected: and beneath it Template:Sidebar with collapsible lists, but no right sidebar.

Can you please give me some more info about how to create this right sidebar based on Wikipedia code?

I don't know enough about programming to follow How to resolve template loop detected issue in MediaWiki

This post was hidden by DStallTX (history)
Bawolff (talkcontribs)

The version on your wiki looks nothing like the version on wikipedia. It sounds like you copied the usage instructions not the template? The end result is that you made a template that uses Sidebar with collapsible lists, instead of creating that template - hence the loop error, as you tried to define it in terms of itself. Anyways, You have to press edit or view source on the wikipedia page to see the source code of the template.


Additionally this template requires extension:Scribunto to work, so you should install that if you want to copy it.


If you want to copy templates, consider using the page Special:export on wikipedia (be sure to check, include templates), which will download a file, and then use Special:import on your wiki to import. This is a lot easier than manually copying.

DStallTX (talkcontribs)

I pasted code copied from Usage section on https://en.wikipedia.org/wiki/Template:Sidebar#Usage and Template:Sidebar text link shows up on my ModWiki | Humanity page in right sidebar.

Per Wikipedia Special:Export page https://en.wikipedia.org/wiki/Special:Export - I search Wikipedia for Special:Export/Template:Sidebar, and this is what I get -https://en.wikipedia.org/wiki/Special:Export/Template:Sidebar

When I copy and paste that into my Template:Sidebar page, this is what I get - https://dstall.com/MOD/index.php/Template:Sidebar

When I upload Scribunto extension and activate it in LocalSettings, all that Template:Sidebar text is added to right div box at my Humanity page, ending in Script error: No such module "Sidebar".

When I copy code from https://en.wikipedia.org/wiki/Module:Sidebar and paste into Module:Sidebar page on my site I get this - https://dstall.com/MOD/index.php?title=Module:Sidebar&action=submit

Bawolff (talkcontribs)

> Per Wikipedia Special:Export page https://en.wikipedia.org/wiki/Special:Export - I search Wikipedia for Special:Export/Template:Sidebar, and this is what I get -https://en.wikipedia.org/wiki/Special:Export/Template:Sidebar

As i said before, you need to make sure the "include templates" checkbox is checked. You have to go through the form on special:export, writing the page name into the "add pages manually" textbox and checking the include templates checkbox, you cannot do the search for subpage thing as that will not include templates.

> When I copy and paste that into my Template:Sidebar page, this is what I get - https://dstall.com/MOD/index.php/Template:Sidebar

You cannot copy and paste the output of special:export. You have to use the page special:import on your wiki to import the saved file.

> When I copy code from https://en.wikipedia.org/wiki/Module:Sidebar and paste into Module:Sidebar page on my site I get this - https://dstall.com/MOD/index.php?title=Module:Sidebar&action=submit

You get an empty page?

to be clear when you say you copy and paste from https://en.wikipedia.org/wiki/Module:Sidebar you actually mean from the text box on https://en.wikipedia.org/w/index.php?title=Module:Sidebar&action=edit , right ?

DStallTX (talkcontribs)

This is so messed up, I can't begin to tell you what I did with what result.

Pls start over. Tell me what Wikipedia page to name for Special:Export incl template, and what within that export to copy/paste into my nav div on my ModWiki | Humanity page.

I've gotten error message before that there's no Module:Sidebar, so pls be specific and include ALL parts/steps that are needed to get this working. Undoubtedly, there are Templates and Modules involved because I've gotten errors naming such.

I need help understanding what's being explained at MediaWiki Manual:Importing Wikipedia infoboxes tutorial, and on Wikipedia pages - Infobox, Help:Infobox, Wikipedia:List of infoboxes.

I need to outline this procedure step by step - including what Modules and Templates I need to setup, all pieces involved, step by step in order.


Now I can't Special:Import because Wikibase is not installed and I have NO IDEA how to install it on shared hosting. Is that possible? If not, now I'm dead in the water! Could this be yet more complicated?

Import failed: The lua binary (.../domains/dstall.com/public_html/MOD/extensions/Scribunto/includes/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua) is not executable.

After digging around, I was able to download and install Wikibase extension, modify composer.local.json sample file and save as .json file, and modify LocalSettings with extension registration (item 1.Enable Wikibase Repository only - 2nd item)/

But now I get Error: Class 'Diff\Differ\MapDiffer' not found.

After deactivating Wikibase extension in LocalSettings, I was able to successfully import MediaWiki:Common.css from Wikipedia, but now when I go to my my MediaWik:Common.css there's an internal error - MWException: The lua binary is not exectuable https://dstall.com/MOD/index.php/MediaWiki:Common.css

Bawolff (talkcontribs)

wikibase is very complex to install and setup. I would reccomend modifying templates to not use it if possible over trying to set it up.

The lua binary is not executable error suggests there was an error in how you uploaded the extension files. Normally if you extract a tar archive it will maintain executable bits. To fix this you need to change permission on the file to mark it executable. How to do this depends on the type of access you have to tge server. If you have shell (ssh) or ftp access use the chmod comnand. If using cpannel,there should be some dialog in the file manager.

Mediawiki:common.css is not a lua page, so i dont know why you would get lua errors on that page.

I dont know why special:import would need wikibase.


(English) Wikipedia templates can be complex to copy over. It is often less effort to make your own. Sometimes older versions of the template from many years ago are less convoluted and thus easier to copy.

Jonathan3 (talkcontribs)

I definitely wouldn't copy templates from Wikipedia as they're always so complicated. You might get ideas from them though. I also definitely wouldn't use Wikibase or Scribunto/Lua unless you're really confident about that sort of thing. Just draw out on paper what you want your infobox/box of links to look like, and figure out how to implement it. Maybe type it out here and see whether anyone can solve your specific problem rather than general ones that might not need to be solved :-)

DStallTX (talkcontribs)

Yes, I'm thinking the same, that export/import from Wikipedia is overkill for my purposes, and I'd rather KISS to minimize issues.

I think a simple collapsible navbar in box on right side is all I really need, showing index of article series. I'm grouping all my pages into a few series like "Economy" here - https://dstall.com/MOD/index.php/Index_of_economy_articles

There's currently only 2 categories in Economy series (but I might add more) - Agrarianism and Industrialism. Under Industrialism there's currently 5 subcategories - Capitalism, Business, Consumerism, Propaganda, and Science, with sub-subcategories in each of those.

I need to know how to create article series box like on Wikipedia - https://en.wikipedia.org/wiki/Wikipedia:Article_series - with collapsible div boxes, text links, and triangle button (or show/hide link) so I can have expandible/collapsible lists in each box corresponding to subcategories, sub-subcategories in those, etc - however deep that may go.

All I need is to see code sample(s) and I can take it from there. So far, code I've copied from Wikipedia hasn't worked and has just caused issues. I've tried code shown at https://en.wikipedia.org/wiki/Wikipedia:Article_series but that's for Template:History of the United States sidebar. So do I create a Template:Economy sidebar? What code do I enter in it? How do I call it on my Economy page and subpages in Economy series?

Jonathan3 (talkcontribs)

If you really want to keep it simple you could use the CategoryTree extension (which is bundled with core) and use:

{{#categorytree:Economy}}

DStallTX (talkcontribs)

I activated CategoryTree extension in LocalSettings, finally figured out how to define subcategories, and got a menu working.

But I notice that links are to Category pages. Is there any way to link to article pages from Category Tree instead of to Category pages?

I'd rather have div boxes that I can style like the Wikipedia Article Series infobox. Is there a way to do that? - https://en.wikipedia.org/wiki/Wikipedia:Article_series

Jonathan3 (talkcontribs)

The available settings are all here: Extension:CategoryTree.

See also: Manual:Collapsible elements.

There are probably many better ways to do it, but there might be enough here to get you started:

<div style="float: right; width: 400px; background: orange">
<div class="mw-collapsible">
'''Economy'''
<div class="mw-collapsible-content">
[[Agrarianism]] - [[Industrialism]]
</div>
</div>

<div class="mw-collapsible mw-collapsed">
'''Industrialism'''
<div class="mw-collapsible-content">
[[Capitalism]] - [[Business]] - [[Consumerism]] - [[Propaganda]] - [[Science]]
</div>
</div>
</div>
DStallTX (talkcontribs)

I think this could be it. Is there any reason it won't work? It's nothing but a list with CSS. Scroll down to Tree Menu Demo - https://code-boxx.com/css-collapsible-tree-menu/ I guess it all depends on what's allowd - HTML restriction

Would be nice if php could populate the list with categories, and build page links instead of category links. Place code in template, then call navbar template on each page (just like php include).

I just tested it; input type and label tags don't work - https://dstall.com/MOD/index.php/Government

DStallTX (talkcontribs)

That doesn't make sense. Economy category opens with 2 subcategories Agrarianism and Industrialism, but then the Industrialism subcategory is repeated as a category equal to Economy?

Is there no way to redirect Category links in Category Tree to article pages instead of category pages?

I'm looking for a nav menu that's like the Category Tree, but links to pages, and has an active function that opens tree to current page.

For example, on Foreign Policy page, https://dstall.com/MOD/index.php/Foreign_Policy - the page should load with nav menu subcategory "Military" open to reveal "Foreign Policy" which would be active https://www.w3schools.com/html/html_links_colors.asp - with link, visited and hover functions as well.

Search for "result" on this page - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

Could template be constructed (like php include) that would load nav menu in div? How do you code it so it knows when to make link a:active?

Reply to "How to create article series?"

Unable to edit items using website interface

4
82.154.83.59 (talkcontribs)

I believe my issue is related to the apache configuration, is there any default configuration that I could try to solve my problem.

Malyacko (talkcontribs)

Please check "Post a new question" in the sidebar and provide way more information, and how you come to any conclusions.

Joaofalexandre (talkcontribs)

The medawiki version in use is 1.38, the php is 7.4.19 (fpm-fcgi) and is using MariaDB version 10.3.32-MariaDB.

The link for the database item I am trying to change is htt https://profmus.fcsh.unl.pt/static/wiki/index.php/Item:Q56

And the the problem that I am having is access blocked for not having in the header "Access-Control-Allow-Origin", I do not know if this is solvable by changing the apache configuration and what changes should I made.

Bawolff (talkcontribs)

I think it might be related to $wgServer in your LocalSettings.php starting with http:// instead of https://

Reply to "Unable to edit items using website interface"

How to make thumbnails of .tiff, .pdf, .mp4, .webm, .mov, etc files appear on their respective media pages

7
Guillaume Taillefer (talkcontribs)

I'm trying to upload different files to my MediaWiki site to test out if everything was gonna work or not. The uploads were successful, but when I got to each file page for the file I uploaded, it appears that it wasn't showing the thumbnail of the file. For some weird reason, whenever I tried uploading JPEGs or PNGs the thumbnails would show up, but when I tried to upload PDFs, TIFFs, MP4s, WEBMs, MOVs, etc the thumbnails wouldn't show up (or in the case for media files the media player didn't show up). I don't know if it is some sort of extension(s) I have to install or something else but for pdfs I was expecting to see something like this: https://en.wikipedia.org/w/index.php?title=File%3ABonaparte_-_Acte_de_M%C3%A9diation%2C_1803.pdf&page=1. As for any movie or audio files, just the standard Wikimedia Commons players. And for TIFF, just the way that is done with JPEG and PNG. If anyone could help with this I would be grateful, thanks

Bawolff (talkcontribs)
Guillaume Taillefer (talkcontribs)

Thank you for the response! I downloaded each one (except for PDFHandler because it is already downloaded) and added their respective wfLoadExtension(); functions in LocalSettings.php. However when I tried doing the PDFHandler it wouldn't show the pdf like in the link I sent you (I even downloaded that pdf and uploaded it to my site but the problem remained). All that is added is a warning about PDFs. Then I tried the TIFF handler but the same problem happened. Finally I tried to do the TimeMediaHandler but now whenever I try to go to the pages specifically for those files my web browser gives me the error that the page is inaccessible. Thanks

Bawolff (talkcontribs)

These extensions require some additional programs installed on the server which might be the issue (although often they are already installed), check their docs for details. Other than that, are there any error messages? What does mediawiki say the dimensions of the file are.

Also if newly uploaded files work but old ones dont, you might need to purge the old pages.


For the page inaccessible thing - make sure that php error reporting is enabled. See How to debug for details.

Guillaume Taillefer (talkcontribs)

No there isn't any error messages for the TIFF and PDF file formats both of which show 0 x 0 dimentions. However for the case of the media player (of which this problem I was about to post about in its respective Discussion page), my browser either tells me that the page is inaccessible or the page loads and gives me this error message: [YrucAQ2Mk-EubQoECBuYnwAAAM8] 2022-06-29 00:25:37: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

Before I didn't have ffmpeg but then I tried installing the 5.0.1 standard Linux version from this page (which was linked from the official website) https://johnvansickle.com/ffmpeg/, and extracted the files into a folder to which I linked to with the specific function ($wgFFmpegLocation), but the same problems happened.

Jonathan3 (talkcontribs)

"No there isn't any error messages for the TIFF and PDF file formats both of which show 0 x 0 dimentions."

I had this problem with PDFs on a shared server and couldn't get to the bottom of it, despite advice from here. When I set up a VPS from scratch it just started to work. That knowledge might or might not help you!

Bawolff (talkcontribs)

So 0x0 dimension usually means there is a problem extracting width and height. For pdfs, this usually means pdfinfo command is not installed. For tiff, i think this means identify is not installed. Sometimes these values get saved so after changing something you should upload a new file to test (or run refreshImageMetadata.php). It can also mean mediawiki cannot run external programs (check php error log. Also mediawiki debug log may have more info on precisely what command is run)

For the timedmediahandler error - most commonly that means you need to run update.php (or the web installer) . Also consider enabling $wgShowExceptionDetails=true; in LocalSettings.php

Reply to "How to make thumbnails of .tiff, .pdf, .mp4, .webm, .mov, etc files appear on their respective media pages"

Query recent changes from the last 30 seconds

1
Weeklyd3 (talkcontribs)

Is there a way to get the last 30 seconds of recent changes? I used rcstart=(30 seconds before UNIX timestamp), but my computer's time isn't the same as the server time. Weeklyd3 (talk) 15:43, 29 June 2022 (UTC)

Reply to "Query recent changes from the last 30 seconds"

Migrating from 1.9.3 to 1.34 - Geshi no longer available

19
46.232.228.6 (talkcontribs)

I was using the Geshi extension o 1.9.3 with content like


<code xml>

...

    <customcerts

dir="certs"

    />

...

</code>


Now the Geshi extension is gone and I could use Extension:SyntaxHighlight. However, I have hundreds of pages using the <code ''lang''> tag instead of <syntaxhighlight lang="''lang''">. Is there a solution to that apart from manually editing all of them?


Thanks and Regards, Christoph

AhmadF.Cheema (talkcontribs)
46.232.228.6 (talkcontribs)

Thanks for pointing me to Replace Text, @AhmadF.Cheema!

However, I do not get the extension to work on a Windows system:

syntaxhighlight uses Pygmentize directly (such as 'C:\...\SyntaxHighlight_GeSHi\includes/../pygments/pygmentize" "-l" "xml" "-f" "html" "-O" "cssclass"').

pygmentize is a script starting with "#!/usr/bin/env python3" which is going to work on *nix'ish systems fine but won't work on Windows. So I get an expection "PHP Notice: Failed to invoke Pygments" when the extensions tries to render a page.

I installed python 3.8 on the box which seems to run fine (at least, I can get a python prompt with now errors).

So as far as I am concerned, this won't ever work on Windows, does it?

Some googling yields a page saying you need to install ez_install.py and run it. I did so (downloading it from pypi.org) and it bails out saying "SSL required". So I edited it and changed the download URL from http to https.

Now it bails out saying "in self.chown(tarinfo, dirpath) TypeError: chown() missing 1 required positional argument: 'numeric_owner'".

It is frustrating :-|

Am I on the right track with getting ez_install to run?

Or is there a way to tell mediawiki to just call upon python.exe directly?

MarkAHershberger (talkcontribs)
46.232.228.6 (talkcontribs)

@MarkAHershberger you made my day - almost!

here it is in a nutshell:

      [ install python 3.8 ]

python -m ensurepip --default-pip

      python -m pip install --upgrade pip setuptools wheel

      easy_install Pygments

now there is a Windows pygmentize.exe in .../python/Scripts

set "$wgPygmentizePath = "C:/.../python/Scripts/pygmentize.exe"; in LocalSettings.php

I can run pygmentize from the shell.


But: although $wgPygmentizePath is set correctly, I keep getting

PHP Notice: fwrite(): write of 1597 bytes failed with errno=22 Invalid argument in C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\shell\Command.php on line 475

Apparently, proc_open in Command.php cannot start the executable.

Has anyone got SyntaxHighlight_GeSHi to work on a Windows/IIS system? (IIS 8.5, latest PHP 7) ?

MarkAHershberger (talkcontribs)

You seem to have stumbled upon a windows-only bug. Can you get a stacktrace of the error? Try the following:

  • $wgShowExceptionDetails Enable more details (like a stack trace) to be shown on the "Fatal error" page.
  • $wgShowDebug Adds the "log messages" part of wgDebugToolbar as a raw list to the page.
46.232.228.6 (talkcontribs)

@MarkAHershberger


Here is the trace:

PHP Notice:  fwrite(): write of 53 bytes failed with errno=22 Invalid argument in C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\shell\Command.php on line 474

PHP Stack trace:

PHP  17. PPFrame_Hash->expand() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\parser\Parser.php:3330

PHP  18. Parser->extensionSubstitution() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\parser\PPFrame_Hash.php:328

PHP  19. SyntaxHighlight::parserHook() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\parser\Parser.php:4293

PHP  20. SyntaxHighlight::highlight() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:117

PHP  21. WANObjectCache->getWithSetCallback() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:348

PHP  22. WANObjectCache->fetchOrRegenerate() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\libs\objectcache\wancache\WANObjectCache.php:1278

PHP  23. SyntaxHighlight::{closure:C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:306-348}() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\libs\objectcache\wancache\WANObjectCache.php:1424

PHP  24. MediaWiki\Shell\Command->execute() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:320

PHP  25. fwrite() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\shell\Command.php:474

PHP Notice:  Failed to invoke Pygments: Der Befehl "C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\python38\Scripts\pygmentize.exe" "-l" "xml" "-f" "html" "-O" "cssclass" ist entweder falsch geschrieben oder

konnte nicht gefunden werden.

[Called from SyntaxHighlight::highlight in C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php at line 353] in C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\debug\MWDebug.php on line 333

PHP  19. SyntaxHighlight::parserHook() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\parser\Parser.php:4293

PHP  20. SyntaxHighlight::highlight() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:117

PHP  21. wfWarn() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php:353

PHP  22. MWDebug::warning() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\GlobalFunctions.php:1066

PHP  23. MWDebug::sendMessage() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\debug\MWDebug.php:188

PHP  24. trigger_error() C:\inetpub\wwwroot\wiki\mediawiki-1.34.0\includes\debug\MWDebug.php:334


[ I needed to shorten the trace cause mediwaiki was complaining about "Flow spam filter: large amount of consonant/vowel clusters" ]

I saw a note in PHP's doc for popen:

Example #2 proc_open() quirk on Windows

While one may expect the following program to search the file filename.txt for the text search and to print the results, it behaves rather differently.

<?php
$descriptorspec = [STDIN, STDOUT, STDOUT];
$cmd = '"findstr" "search" "filename.txt"';
$proc = proc_open($cmd, $descriptorspec, $pipes);
proc_close($proc);
?>

The above example will output:

'findstr" "search" "filename.txt' is not recognized as an internal or external command,
operable program or batch file.

To work around that behavior, it is usually sufficient to enclose the cmd in additional quotes:

$cmd = '""findstr" "search" "filename.txt""';


But I don't think its true. The symptom is exactly what I saw, however the solution doesn't work.

46.232.228.6 (talkcontribs)

I finally got tired of this and sort of "fixed" it by changing the code in mediawiki-1.34.0\extensions\SyntaxHighlight_GeSHi\includes\SyntaxHighlight.php from

311 				$result = Shell::command(
312 					self::getPygmentizePath(),
313 					'-l', $lexer,
314 					'-f', 'html',
315 					'-O', implode( ',', $optionPairs )
316 				)
317 					->input( $code )
318 					->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK )
319 					->execute();
320 
321 				if ( $result->getExitCode() != 0 ) {
322 					$ttl = WANObjectCache::TTL_UNCACHEABLE;
323 					$error = $result->getStderr();
324 					return null;
325 				}
326                                 
327 				return $result->getStdout();

to:

                                $cmd = '"' . self::getPygmentizePath() . '" ' . 
				                    	'-l ' . '"' . $lexer . '" ' .
			                       		'-f ' . 'html ' . 
		                    			'-O ' . implode( ',', $optionPairs );
                                $filebase = @tempnam(wfTempDir(), "geshi");
                                $ioi = "$filebase-i.txt";
                                file_put_contents($ioi, $code);
                                $pyg = shell_exec("$cmd < \"$ioi\"");
                                if (false) {
                                    // debug, keep in/out put
                                    $ioo = "$filebase-o.txt";
                                    file_put_contents($ioo, $pyg);
                                } else {
                                    unlink($ioi);
                                }
                                return $pyg;

This is of course ugly to say the least but it works somehow and should be fine until a fix is there.

Let me add that I felt the Shell:: code to be overly complicated. However, I was perhaps just not fair cause it refused to work for me for so long ;-)

200.40.50.115 (talkcontribs)

Many thanks! that worked for me. Greetings

Check to the King (talkcontribs)

This fix also worked for me on Windows. Thank you!

How can we get this issue logged and fixed in the production code?

Eddi27L (talkcontribs)

I was just working on something similar, but now just made a copy&paste of your code and it works fine for me too, thanks.

PS: I too was overwhelmed by the complexity of Shell::code

MarkAHershberger (talkcontribs)

It looks like this might be task T193613. Four months later, I don't know why I wrote this. It must be a typo.

Berot3 (talkcontribs)

I have the same problem too... So what you are saying is that this error should disappear with mw 1.35?

MarkAHershberger (talkcontribs)

I'm not sure why I thought a stable interface policy would help. That must be a typo.

79.208.145.217 (talkcontribs)

I have exactly the same problem.

JGTompkins (talkcontribs)
Mwgbell (talkcontribs)

This is still broken in 1.37.1; and in that version the relevant code has been rewritten so the "patch" above no longer works. I could find no bypass, so ended up using Highlightjs_Integration (i.e. wfLoadExtension( 'Highlightjs_Integration' );   )

This uses the identical syntax (i.e. syntaxhighlight).

To enable this functionality, Download the extension and add these lines to LocalSettings.php (ensure that you comment out #wfLoadExtension( 'SyntaxHighlight_GeSHi' ); and #$wgPygmentizePath = "j:/Python3/Scripts/pygmentize.exe";):

wfLoadExtension( 'Highlightjs_Integration' );
Mwgbell (talkcontribs)

(I got the spam warning so had to divide this in 2 parts)

As of Jan 2022, the default version is 9.12. To upgrade to version 10:

  • Go to the download page (https://highlightjs.org/download/) and build a "custom" package with the additional languages you want.
  • Remove or rename the extensions/Highlightjs_Integration/highlight folder.
  • Uncompress the custom package in extensions/Highlightjs_Integration. You should have a fresh new extensions/Highlightjs_Integration/highlight folder.
  • Modify extension.json with the following:
    • Change "highlight.pack.js" to "highlight.min.js", and
    • Change "vs2015.css" to "vs2015.min.css".
Nicolas senechal (talkcontribs)

any new with 1.38.1?

Reply to "Migrating from 1.9.3 to 1.34 - Geshi no longer available"

MediaWiki 1.35.x CategoryTree in Sidebar not working

10
Hags343 (talkcontribs)

Hi,

I've a clean installation of MediaWiki 1.35.0 on Ubuntu 20.04. I've also tried the new version 1.35.1 (installed via patch), but I do not get the CategoryTree displayed in the sidebar. I followed the instruction from the following wiki page: Extension:CategoryTree#Using CategoryTree in the Sidebar


This are the new lines in the LocalSettings.php:

$wgCategoryTreeSidebarRoot = 'Category:forest';

$wgCategoryTreeForceHeaders = true;


If I open the page, I get the error Category not found, but the category exists. I've uploaded some screenshots and the configuration file LocalSettings.php here: https://www.dropbox.com/sh/w2bg2gxmf9th6vl/AACcJEkKeERNBCNedPJJ47CRa


Does anyone have any idea what the problem could be?

If anyone has a working configuration with the latest version, that would help me a lot too.


Thank you very much.

Bawolff (talkcontribs)

idk, is it supposed to have the Category: prefix?

Hags343 (talkcontribs)

I've also tried it without the prefix or even with a normal page.

Jonathan3 (talkcontribs)

Did you add the function AppendCategoryTreeToSidebar code too?

Hags343 (talkcontribs)
Jonathan3 (talkcontribs)

Stick it in the wiki page called MediaWiki:Common.js and see what happens.

Hags343 (talkcontribs)
103.209.207.235 (talkcontribs)

I am facing the same issue . Any update on this?

195.234.58.40 (talkcontribs)
.portal h3, .vector-menu-portal h3 {
	background-size: auto !important;
}

in Vector.css

195.234.58.40 (talkcontribs)
#p-categorytree-portlet {
display: block;
}
Reply to "MediaWiki 1.35.x CategoryTree in Sidebar not working"