Difference between revisions of "Issue:Find unused files"

From FollowTheScore
Jump to: navigation, search
Line 24: Line 24:
 
== Reply ==
 
== Reply ==
 
The problem is that <tt>notlinksfrom</tt> expects an exact article name; it does not understand 'LIKE %'.
 
The problem is that <tt>notlinksfrom</tt> 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 <tt>imageused</tt> clause is false.
 +
 +
<pre><nowiki>
 +
---------------------------------------- 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
 +
</nowiki></pre>
 +
 +
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.
 +
 +
[[User:Gero|Gero]] 21:20, 1 May 2009 (UTC)

Revision as of 22:20, 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)