https://bugzilla.wikimedia.org/show_bug.cgi?id=59355

--- Comment #2 from Bugzilla Bug Importer (valhallasw) 
<wmf.bugconver...@gmail.com> ---
-------------------------------------------------------------------------------
From: Dereckson <dereck...@espace-win.org>
Date: Wed, 22 Sep 2010 21:17:08
-------------------------------------------------------------------------------

SQL queries to compute the statistics:

#Creates a temporary table to store the result  
CREATE TABLE images_NASA (  
`page_id` bigint(20) DEFAULT NULL,  
`page_namespace` tinyint(4) DEFAULT NULL,  
`vic` tinyint(4) DEFAULT NULL,  
`fp` tinyint(4) DEFAULT NULL  
);

#Inserts files containing the `PD-USGov-NASA` template into our table  
INSERT INTO images_NASA (page_id, page_namespace) SELECT tl_from,
page_namespace FROM commonswiki_p.templatelinks t, commonswiki_p.page p WHERE
tl_namespace = 10 AND tl_title = 'PD-USGov-NASA' AND p.page_id = t.tl_from;

#Deletes non files entries  
DELETE FROM images_NASA WHERE page_namespace != 6;

#Finds features picture (they've the template `Assessments`)  
UPDATE images_NASA SET fp = 1 WHERE page_id IN (SELECT tl_from FROM
commonswiki_p.templatelinks WHERE tl_namespace = 10 AND tl_title =
'Assessments');

#Finds VIC pictures (they've the template `VI}, {{Vi` or `Valued image`})  
UPDATE images_NASA SET vic = 1 WHERE page_id IN (SELECT tl_from FROM
commonswiki_p.templatelinks WHERE tl_namespace = 10 AND (tl_title = 'Vi' ||
tl_title = 'VI' || tl_title = 'Valued image'));

#Gets the total number of images  
SELECT count![][1] FROM images_NASA;  
SELECT count![][1] FROM images_NASA WHERE fp = 1;  
SELECT count![][1] FROM images_NASA WHERE vic = 1;

   [1]: https://jira.toolserver.org/images/icons/emoticons/star_yellow.gif

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to