[Mediawiki-l] How to find "Wanted Images"

Alexis Moinet alexis.moinet at fpms.ac.be
Sat Jun 3 19:28:47 UTC 2006


I tested this and it *seems* to work pretty well :

in includes/specialwantedpages.php, I replaced

		$pagelinks = $dbr->tableName( 'pagelinks' );
		$page      = $dbr->tableName( 'page' );
		return
			"SELECT 'Wantedpages' AS type,
			        pl_namespace AS namespace,
			        pl_title AS title,
			        COUNT(*) AS value
			 FROM $pagelinks
			 LEFT JOIN $page AS pg1
			 ON pl_namespace = pg1.page_namespace AND pl_title = pg1.page_title
			 LEFT JOIN $page AS pg2
			 ON pl_from = pg2.page_id
			 WHERE pg1.page_namespace IS NULL
			 AND pg2.page_namespace != 8
			 GROUP BY pl_namespace, pl_title
			 HAVING COUNT(*) > $count";

with

		$pagelinks = $dbr->tableName( 'imagelinks' );
		$page      = $dbr->tableName( 'image' );
		return
			"SELECT 'Wantedpages' AS type,
			        6 AS namespace,
			        il_to AS title,
			        COUNT(*) AS value
			 FROM $pagelinks
			 WHERE il_to <> ALL(SELECT img_name FROM $page)
			 GROUP BY il_to
			 HAVING COUNT(*) > $count";

HOWEVER,
1. I don't know a lot about mysql, I did this with kind of a "I'm-lucky-and-I-have-a-good-feeling-about-this" method. Any MySQL 
professional may say this is evil (though I hope it's not)
2. it seems to work properly BUT the "(n links)" link beside of the wanted image name doesn't work properly, guess you've got to 
change something in the SpecialWhatlinkshere.php file, but don't know what.
3. I suggest you to create a new special page SpecialWantedimages.php instead of modifying the wanted pages one's. (this was 
just for demo) (see "create a new special page" on mediawiki.org though it seems a little bit outdated)

Ken McDonald a écrit :
> I just realize that "Wanted Pages" doesn't show info on needed images, 
> and none of the other special pages has any obvious relation to such a 
> function. Is there a way to do this easily?
> 
> Thanks,
> Ken




More information about the MediaWiki-l mailing list