jenkins-bot has submitted this change and it was merged.
Change subject: Fix rel="copyright" for ApiHelp
......................................................................
Fix rel="copyright" for ApiHelp
Bug: T94038
Bug: T93995
Change-Id: I06e9bb6797c4e4ee00e5d72eda1e273800b2c7f4
---
M includes/OutputPage.php
M includes/api/ApiHelp.php
2 files changed, 30 insertions(+), 8 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index a8fc01d..3b9da40 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -305,6 +305,11 @@
private $mEnableSectionEditLinks = true;
/**
+ * @var string|null The URL to send in a <link> element with
rel=copyright
+ */
+ private $copyrightUrl;
+
+ /**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will
implicitly create
* a OutputPage tied to that context.
@@ -338,6 +343,18 @@
*/
public function getRedirect() {
return $this->mRedirect;
+ }
+
+ /**
+ * Set the copyright URL to send with the output.
+ * Empty string to omit, null to reset.
+ *
+ * @since 1.26
+ *
+ * @param string|null $url
+ */
+ public function setCopyrightUrl( $url ) {
+ $this->copyrightUrl = $url;
}
/**
@@ -3432,17 +3449,21 @@
}
# Copyright
- $copyright = '';
- if ( $config->get( 'RightsPage' ) ) {
- $copy = Title::newFromText( $config->get( 'RightsPage'
) );
+ if ( $this->copyrightUrl !== null ) {
+ $copyright = $this->copyrightUrl;
+ } else {
+ $copyright = '';
+ if ( $config->get( 'RightsPage' ) ) {
+ $copy = Title::newFromText( $config->get(
'RightsPage' ) );
- if ( $copy ) {
- $copyright = $copy->getLocalURL();
+ if ( $copy ) {
+ $copyright = $copy->getLocalURL();
+ }
}
- }
- if ( !$copyright && $config->get( 'RightsUrl' ) ) {
- $copyright = $config->get( 'RightsUrl' );
+ if ( !$copyright && $config->get( 'RightsUrl' ) ) {
+ $copyright = $config->get( 'RightsUrl' );
+ }
}
if ( $copyright ) {
diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php
index a81ae3f..f6d124f 100644
--- a/includes/api/ApiHelp.php
+++ b/includes/api/ApiHelp.php
@@ -45,6 +45,7 @@
$context->setLanguage( $this->getMain()->getLanguage() );
$context->setTitle( SpecialPage::getTitleFor( 'ApiHelp' ) );
$out = new OutputPage( $context );
+ $out->setCopyrightUrl(
'https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright' );
$context->setOutput( $out );
self::getHelp( $context, $modules, $params );
--
To view, visit https://gerrit.wikimedia.org/r/216676
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I06e9bb6797c4e4ee00e5d72eda1e273800b2c7f4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Ricordisamoa <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits