Within one of our older internal extensions, we have these 2 lines: $targetAsImage = Image::newFromTitle($onePage); $allPagesLinkedToTarget = $targetAsImage->getLinksTo();
We were trying to get a list of wiki titles that link to an image. This does not seem to work anymore with media wiki 1.15. Now that it is truly deprecated, what should we replace this with?
We are using the following: MediaWikihttp://www.mediawiki.org/ 1.15.3 PHPhttp://www.php.net/ 5.2.8 (cgi-fcgi) MySQLhttp://www.mysql.com/ 5.1.40-community
Thanks, Mary Beebe
On 11/01/11 08:56, Beebe, Mary J wrote:
Within one of our older internal extensions, we have these 2 lines: $targetAsImage = Image::newFromTitle($onePage); $allPagesLinkedToTarget = $targetAsImage->getLinksTo();
We were trying to get a list of wiki titles that link to an image. This does not seem to work anymore with media wiki 1.15. Now that it is truly deprecated, what should we replace this with?
$targetAsImage = wfFindFile( $onePage ); if ( $targetAsImage ) { $allPagesLinkedToTarget = $targetAsImage->getLinksTo(); }
wfFindFile() will return false if the image does not exist, so you need to guard against that case to avoid a fatal error.
GetLinksTo() seems to be returning no results even though there are image pages with links to them. It seems to be a problem with the select statement within the File class. I looked at the query and if I run the query within mySQL it works if I remove the extra quotes.
Are other people having trouble with this method?
Mary Beebe
-----Original Message----- From: wikitech-l-bounces@lists.wikimedia.org [mailto:wikitech-l-bounces@lists.wikimedia.org] On Behalf Of Tim Starling Sent: Monday, January 10, 2011 6:32 PM To: wikitech-l@lists.wikimedia.org Subject: Re: [Wikitech-l] Image.php is deprecated need to replace with something else
On 11/01/11 08:56, Beebe, Mary J wrote:
Within one of our older internal extensions, we have these 2 lines: $targetAsImage = Image::newFromTitle($onePage); $allPagesLinkedToTarget = $targetAsImage->getLinksTo();
We were trying to get a list of wiki titles that link to an image. This does not seem to work anymore with media wiki 1.15. Now that it is truly deprecated, what should we replace this with?
$targetAsImage = wfFindFile( $onePage ); if ( $targetAsImage ) { $allPagesLinkedToTarget = $targetAsImage->getLinksTo(); }
wfFindFile() will return false if the image does not exist, so you need to guard against that case to avoid a fatal error.
_______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Beebe, Mary J wrote:
GetLinksTo() seems to be returning no results even though there are image pages with links to them. It seems to be a problem with the select statement within the File class. I looked at the query and if I run the query within mySQL it works if I remove the extra quotes.
Are other people having trouble with this method?
Mary Beebe
Which extra quotes? Can you give the Select statement you are seeing ?
On 12/01/11 09:03, Beebe, Mary J wrote:
GetLinksTo() seems to be returning no results even though there are image pages with links to them. It seems to be a problem with the select statement within the File class. I looked at the query and if I run the query within mySQL it works if I remove the extra quotes.
This should be fixed as of r80442.
Are other people having trouble with this method?
Nobody else uses that method.
-- Tim Starling
wikitech-l@lists.wikimedia.org