jenkins-bot has submitted this change and it was merged.
Change subject: Track internal links to Video: pages in the pagelinks table
......................................................................
Track internal links to Video: pages in the pagelinks table
Yay for parser voodoo!
Change-Id: I7017e09570ba3f076acc04dd13a2dd02f592c73e
---
M VideoHooks.php
M VideoPage.php
2 files changed, 10 insertions(+), 8 deletions(-)
Approvals:
Jack Phoenix: Looks good to me, approved
jenkins-bot: Verified
diff --git a/VideoHooks.php b/VideoHooks.php
index cbeaced..cec7f2f 100644
--- a/VideoHooks.php
+++ b/VideoHooks.php
@@ -146,6 +146,10 @@
$output = '';
$video = Video::newFromName( $video_name,
RequestContext::getMain() );
if ( $video->exists() ) {
+ // If there's such a video, register an internal link
+ // so that Special:WhatLinksHere works as intended.
+ $parser->getOutput()->addLink( $video->getTitle() );
+
$video->setWidth( $width );
$video->setHeight( $height );
@@ -321,3 +325,4 @@
return true;
}
}
+
diff --git a/VideoPage.php b/VideoPage.php
index 64128bb..b860ae6 100644
--- a/VideoPage.php
+++ b/VideoPage.php
@@ -49,6 +49,9 @@
$out->addHTML( $this->getEmbedThisTag() );
$this->videoHistory();
+
+ $out->addWikiText( '== ' . $ctx->msg( 'video-links'
)->escaped() . " ==\n" );
+ $this->videoLinks();
} else {
// Video doesn't exist, so give a link allowing user to
add one with this name
$title = SpecialPage::getTitleFor( 'AddVideo' );
@@ -60,20 +63,14 @@
);
$out->addHTML( $ctx->msg( 'video-novideo', $link
)->text() );
- //$wgOut->addHTML( $videoLinksHTML );
- //$this->videoLinks();
+ $out->addWikiText( '== ' . $ctx->msg( 'video-links'
)->escaped() . " ==\n" );
+ $this->videoLinks();
$this->mPage->doViewUpdates( $ctx->getUser() );
}
}
/**
* Display pages linking to that video on the video page.
- *
- * @todo FIXME: this does not work at the moment; there are no NS_VIDEO
- * entries in the pagelinks table. I think it is because
the
- * [[Video:Foo]] links are not links per se, but they just
- * look like links to the end-user; to MediaWiki, they are
- * parser hooks, like <video name="Foo" />...how to fix
this?
*/
function videoLinks() {
$out = $this->getContext()->getOutput();
--
To view, visit https://gerrit.wikimedia.org/r/258687
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7017e09570ba3f076acc04dd13a2dd02f592c73e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Video
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits