Difference between revisions of "Issue:Find unused files"

From FollowTheScore
Jump to: navigation, search
m (Work around)
 
(2 intermediate revisions by the same user not shown)
Line 51: Line 51:
  
 
[[User:Gero|Gero]] 21:20, 1 May 2009 (UTC)
 
[[User:Gero|Gero]] 21:20, 1 May 2009 (UTC)
 +
:Oh thanks for the code. It returns the pages it checked as well. But those links which are images are really unused. [http://www.mixesdb.com/db/index.php/MixesDB:Tests/Unused_Images Link] (will remove my link after next reply).
 +
:Ok so I guessed right that there is no standard way to return unlinked pages (pages which are not linked to on other pages)? What about a new format symbol for that? There is the BOOL page.il_to, so it should be easy query. E.g.
 +
<pre>{{dpl:
 +
|namespace=File
 +
|format=,%UNLINKED%
 +
}}</pre>
 +
:Result: All unused image pages. --[[User:Subfader|Subfader]] 21:44, 1 May 2009 (UTC)

Latest revision as of 23:13, 1 May 2009

Description: Return unused files
Extension / Version: DPL   /   ?
Type / Status: Change Request   /   open

Problem

Is there a way to select images that are used (il_to NOT NULL, linked to by any other page)) or unsed?
I want to return a simple list of unused images, but also in combination, e.g. unused files, uploaded by a specifed user.
This should actually return a simple list of 5 unused files (if I understand the parameter correctly), but it doesn't.

{{#dpl:
|debug=3
|namespace=Image
|notlinksfrom=%
|count=5
}}

Reply

The problem is that notlinksfrom expects an exact article name; it does not understand 'LIKE %'.

Work around

You can nest two queries; the first one produces a list of all images and calls another template for each ofg the images. The second query produces output only if the imageused clause is false.

---------------------------------------- Code in a page named 'check list for unused images' (e.g.)
===Unused Images===
{{#dpl:
 |namespace=Image
 |format=,²{Unused Image¦%PAGE%}²,
 |count=100
}}
---------------------------------------- Code in page 'Template:Unused Image'
{{#replace:
{{#dpl:
 |imageused={{{1}}}
 |resultsheader=OOKK
 |noresultsheader=\n* [[{{{1}}}]]
}}|/.*OOKK.*/|
}}
---------------------------------------- end

The code in the second template generates the lsit of articles which use an image; the #replace throws the whole list away if there was at least one match; otherwise it outputs the name of the image under question.

Gero 21:20, 1 May 2009 (UTC)

Oh thanks for the code. It returns the pages it checked as well. But those links which are images are really unused. Link (will remove my link after next reply).
Ok so I guessed right that there is no standard way to return unlinked pages (pages which are not linked to on other pages)? What about a new format symbol for that? There is the BOOL page.il_to, so it should be easy query. E.g.
{{dpl:
|namespace=File
|format=,%UNLINKED%
}}
Result: All unused image pages. --Subfader 21:44, 1 May 2009 (UTC)