Page MenuHomePhabricator

'Insert Media' in VE fails to search local repo, returns blank.
Closed, InvalidPublic

Description

Author: tech

Description:
Running an up-to-date VisualEditor extension and parsoid server on mediawiki-1.22.2, when I use 'Insert Media' no matter the search term (exact filenames are no better) nothing is returned.

Checking server logs and debugging client browser data shows that VE only goes as far as a call to the API 'api.php?format=json&action=query&meta=filerepoinfo' which returns:

{

query: {
  repos: [
    {
      name: "local",
      displayname: null,
      rootUrl: "/images",
      local: true
    }
  ]
}

}

There are no further queries to the API after this call.

I can add wikiCommons, with "$wgUseInstantCommons = true", which successfully searches the wikiCommons, but has no effect on local media.

I can manually add media with the standard editor and the [[File:image.ext]] syntax, but if I double click a previously attached image in VE all of the fields in the media dialog box are vacant and I can't change any values or even close the dialog.

A query of 'api.php?action=query&list=allimages&format=json' returns a complete set of media as expected.

Further, looking at the API documentation on the server the example listed for filerepoinfo is 'api.php?action=query&meta=filerepoinfo&friprop=apiurl|name|displayname', but it returns in the warnings field: "Unrecognized value for parameter 'friprop': apiurl". Suggesting that perhaps a variable in LocalSettings.php is missing or inaccurate, I've looked over this several times, but don't see any glaring issues.

The server in question is behind an intranet, but I'm happy to answer any questions.

Thanks,
Patrick


Version: unspecified
Severity: normal
OS: Linux

Details

Reference
bz63989

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:09 AM
bzimport set Reference to bz63989.

Do you have your wiki installed in the server's root (i.e. corp.foo.com/index.php?title=Main_Page rather than corp.foo.com/w/index.php?title=Main_Page)?

This appears to be a quite common configuration, but is explicitly advised against in MediaWiki's documentation because it doesn't work very well with MediaWiki's API and is the cause of similar issues to this for a number of people. :-(

tech wrote:

Yes, I did have it installed on the server's root (with a wiki. subdomain). But I've just tested with the '/w' leading path ($wgScriptPath = "/w") and it's made no difference, no images are showing up even with exact filenames.

filerepoinfo query returns:
{"query":{"repos":[{"name":"local","displayname":null,"rootUrl":"/w/images","local":true}]}}

tech wrote:

Upgraded mediawiki to 1.22.5.

Installed parsoid and VisualEditor as new.

Merged basic LocalSettings.php.

Uploaded a new file.

File and description in Special:ListFiles.

Still no change to this bug, nothing listed, no search results - only call to api is to query filerepoinfo, result as above.

(In reply to Patrick King from comment #0)

Running an up-to-date VisualEditor extension and parsoid server on
mediawiki-1.22.2, when I use 'Insert Media' no matter the search term (exact
filenames are no better) nothing is returned.

Sorry, I completely missed the bit of your question asking about MediaWiki 1.22 – for media search to work, VisualEditor requires APIs that were introduced in MediaWiki 1.23. Indeed, the code intentionally asserts that you are running the right version of MediaWiki to avoid these issues.

For comparison, my local repo (running 1.24 alpha) comes out with:

{

"query": {
    "repos": [
        {
            "name": "local",
            "displayname": "devwiki",
            "rootUrl": "/images",
            "local": true,
            "url": "/images",
            "thumbUrl": "/images/thumb",
            "initialCapital": true,
            "scriptDirUrl": "/w",
            "scriptExtension": ".php",
            "favicon": "http://localhost:8080/favicon.ico"
        }
    ]
}

}

Some of these extra return parts are required for VisualEditor's media search to work.

(In reply to Patrick King from comment #2)

Yes, I did have it installed on the server's root (with a wiki. subdomain).

Quite apart from the MediaWiki 1.22 issue, that's bug 62007 (MediaWiki installed on the server's root is an unsupported configuration by its API, apparently).