Page MenuHomePhabricator

rest.php doesn't always expose license correctly wrt $wgRightsPage
Open, Needs TriagePublic

Description

Noticed on T362006: Provide a Swagger-UI for exploring the core REST API.

https://www.mediawiki.org/wiki/Manual:$wgRightsUrl

If $wgRightsPage is set then this setting is ignored.

This setting is used in several places, most notably to automatically generate the footer (see $wgRightsText for details) and in API:Meta output.

"query": {
    "rightsinfo": {
        "url": "http://devwiki/wiki/MediaWiki:Copyright",
        "text": "MediaWiki:Copyright"
    }
}

https://www.mediawiki.org/wiki/Manual:$wgRightsText

If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link.

If using $wgRightsUrl then this value must be specified. It's set at install time by the installer, either from its own predefined list or from the data returned from the Creative Commons license chooser.

If using $wgRightsPage then the name of the page will also be used as the link if this variable is not set.

https://www.mediawiki.org/wiki/Manual:$wgRightsPage

Override for copyright metadata. This is the name of the page containing information about the wiki's copyright status, which will be added as a link in the footer if it is specified (see $wgRightsText for details) and in API:Meta output. It overrides $wgRightsUrl if both are specified.

The current code does this, ignoring $wgRightsPage:

	private function getLicenseSpec(): array {
		return [
			'name' => $this->options->get( MainConfigNames::RightsText ),
			'url' => $this->options->get( MainConfigNames::RightsUrl ),
		];
	}

Which outputs:

"license": {
  "name": "",
  "url": ""
},