Wikipedia:Database reports/Unused non-free files/Configuration
Tools
Actions
General
Print/export
In other projects
This report is updated every day.
/*Copyright 2010, 2013 bjweeks, MZMcBride, Tim LandscheidtCopyright 2021 Kunal Mehta <legoktm@debian.org>This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>. */useanyhow::Result;usedbreps2::{str_vec,Frequency,Report};usemysql_async::prelude::*;usemysql_async::Conn;pubstructRow{page_title:String,}pubstructUnusedNonFree{}implReport<Row>forUnusedNonFree{fntitle(&self)->&'staticstr{"Unused non-free files"}fnfrequency(&self)->Frequency{Frequency::Daily}fnquery(&self)->&'staticstr{r#"/* unusednonfree.rs SLOW_OK */SELECT img.page_titleFROM categorylinks AS c1JOIN page AS img ON img.page_id = c1.cl_fromLEFT JOIN categorylinks AS c2 ON c2.cl_from = c1.cl_from AND c2.cl_to = 'All_orphaned_non-free_use_Wikipedia_files'LEFT JOIN imagelinks ON il_to = img.page_title AND il_from_namespace = 0WHERE img.page_namespace = 6 AND c1.cl_to = 'All_non-free_media' AND c2.cl_from IS NULL AND il_from IS NULL AND img.page_is_redirect = 0 AND NOT EXISTS (SELECT 1 FROM redirect JOIN page AS rdr ON rdr.page_id = rd_from JOIN imagelinks ON il_to = rdr.page_title AND il_from_namespace = 0 WHERE rd_namespace = 6 AND rd_title = img.page_title AND rdr.page_namespace = 6)ORDER BY page_title ASC;"#}asyncfnrun_query(&self,conn:&mutConn)->Result<Vec<Row>>{letrows=conn.query_map(self.query(),|page_title|Row{page_title}).await?;Ok(rows)}fnheadings(&self)->Vec<&'staticstr>{vec!["File"]}fnformat_row(&self,row:&Row)->Vec<String>{str_vec![format!("[[:File:{}|]]",row.page_title)]}fncode(&self)->&'staticstr{include_str!("unusednonfree.rs")}}