Difference between revisions of "Issue:Find unused files"

From FollowTheScore
Jump to: navigation, search
(Work around)
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 doesn't seem to work right returns a list like this: [check each image] -OKOK, -pages with that image (if any), -image page. [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? E.g.
 +
<pre>{{dpl:
 +
|namespace=File
 +
|format=,%UNLINKED%
 +
</pre>
 +
:Result: All unused image pages. --[[User:Subfader|Subfader]] 21:44, 1 May 2009 (UTC)

Revision as of 22:44, 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 doesn't seem to work right returns a list like this: [check each image] -OKOK, -pages with that image (if any), -image page. 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? E.g.
{{dpl:
|namespace=File
|format=,%UNLINKED%
Result: All unused image pages. --Subfader 21:44, 1 May 2009 (UTC)