Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2008-12-20 14:20:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

jstubbs wrote:

The new form is called “minima_photo_header” and where used does not find that either.

Thanks for the login. But it looks like it’s working ok for me :-\

For example:

  • search for ‘header’ and you’ll see all your Pages where a Form with “header” in its title are referred: namely archive, default, error_default, minima_photo_archive, minima_photo_default, minima_photo_error_default all refer to your Form ‘minima_photo_header’ or contain the word ‘header’ in some capacity. The plugin correctly omits all of your Forms themselves, because none of them contain the word ‘header’ (the Form names do indeed contain the word, but the Form contents’ don’t)
  • search for ‘head’ and you’ll see the same list of Pages, plus two Forms (minima_photo_header and popup_comments) because those two forms contain a <head> tag
  • search for ‘archive’ and you’ll see that you have 3 Sections that use a Page with the name ‘archive’ in it, plus two Pages, two Forms and 3 Articles that contain the word ‘archive’ in them
  • search for orphans (i.e. empty the “Find:” box and click Search). Note the list of orphans includes the Page “archive”. A moment ago we searched for that very word and it found reference to it in your Pages. How can that be?! The answer is that it was actually referring to “minima_photo_archive” — which indeed contains the word you were looking for. The orphan check will look for actual concrete references to existing Pages and Forms, and show you if they are not used, thus you can be fairly sure that the ‘archive’ page can be deleted with no ill effect to your site. Similarly the ‘default’ page can be axed because you’re using your own pages in their place on the Sections tab

I think it’s just a conceptual thing with the bizarre way this plugin works. That’s why I asked if ‘header’ was “used”. It is, in fact, not used in the content of your forms to refer to anything else, nor is it used (as a word) in an Article, nor do any of your Sections make reference to any Pages that have the word ‘header’ anywhere in their title.

Think of the plugin as essentially “Where have I used this Page/Form/Stylesheet/Plugin in my site”, not “Where have I typed this word anywhere in my site”. Subtle difference, and it is kind of confusing (especially on weekends) and can catch you out ;-)

EDIT: That’s also why I haven’t implemented a ‘replace’ feature since it doesn’t do a true search, it does a ‘directed search’ from: Section —> Page —> Form <—> Article (and also Article —> Plugin, Form —> Plugin, Section —> Plugin, Section —> Stylesheet and Article —> Form, depending on the mode)

Last edited by Bloke (2008-12-20 14:24:56)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#62 2008-12-20 15:33:19

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: smd_where_used: help keep your admin side tidy

Stef, thanks for the exhaustive help. OK now I get it – the search checks the contents of the form, but not the name of the form…I was originally looking for references to the form name “header”, because I wanted to change it from header to “minima_photo_default”. I did it manually. Thanks again…

Offline

#63 2008-12-20 15:46:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

jstubbs wrote:

OK now I get it – the search checks the contents of the form, but not the name of the form…

Yes and no. That’s why it’s so tricky to explain cos it’s sort of doing a bit of both, but it depends on context! It checks if the name of the form is mentioned from elsewhere (but doesn’t explicitly tell you there is a form with that name) and also checks the contents of the Form to see if it contains the word (which might imply a reference to another thing you want to find; like another Form!) :-S

I was originally looking for references to the form name “header”, because I wanted to change it from header to “minima_photo_default”

Yeah, that makes sense. So anything you saw listed under Pages or Articles would have implied that the word ‘header’ appeared in the returned locations. It may have made reference to the form named header or it may have just found the word ‘header’ in the Page or Article (e.g. an HTML comment <-- header --> would match in the Page, and so would <txp:output_form name="header" />). Either way, it’s telling you that what you searched for exists in some corner of your site and it’s up to you to click the link to find out if it’s the thing you’re interested in.

Phew! Well, you didn’t expect one of my plugins to be straightforward did you? :-P


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#64 2009-03-20 16:55:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Minor improvement in v0.19 to auto-focus the cursor in the search box. Should have done it a millennia ago and I just forgot.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#65 2009-08-11 21:15:20

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: smd_where_used: help keep your admin side tidy

Thanks for this useful plugin.

Request new feature, if it possible…

Add new Checkbox: “Look in: Custom fields ” (and search too :-)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#66 2009-08-11 21:29:10

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: smd_where_used: help keep your admin side tidy

Click (Sorry, too fast: no new checkboxes.)

Last edited by uli (2009-08-11 21:30:01)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#67 2009-08-11 21:37:07

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: smd_where_used: help keep your admin side tidy

uli wrote:

Click (Sorry, too fast: no new checkboxes.)

Thanks, It worked!

But, maybe checkbox too? :-)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#68 2009-08-11 21:57:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

makss wrote:

Add new Checkbox: “Look in: Custom fields ” (and search too :-)

Configuration options are something I’d ilke to look into one day. What I’ll probably end up doing is a jQuery foldout section on the where_used panel that contains all the look in checkboxes. You can then choose where your search takes place and your selections are saved in the prefs. I did consider hooking into wet_haystack and searching the locations set by that plugin, but figured that might cause too much confusion. Plus I’d like to offer the ability to natively search any extended custom fields, which will become possible in TXP 4.2.0.

This feature will probably be worth doing when I can search stylesheets (i.e. CSS is not base64-encoded) because that’s a very good excuse to revisit the code!

Last edited by Bloke (2009-08-11 21:58:45)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#69 2009-08-12 01:01:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

… or perhaps I’ll do it now :-) If you’re running TXP 4.2.0 / SVN you can try the next version which allows you to choose which article fields to search, storing them as a plugin pref. Your look in checkbox choices are also automatically saved so when you revisit the tab you return to where you left off. Note that the filter options are always reset at the moment: might change that in future.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#70 2009-08-29 19:09:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Version 0.2 is officially out, which adds the ability to… well you can read about it in the above couple of posts :-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#71 2010-01-29 05:40:15

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: smd_where_used: help keep your admin side tidy

I was wondering if this (very useful!) plugin could be modified to include a magic button to automatically disable any plugins that aren’t being used?

After awhile it’s difficult to remember which plugins are being used, and so currently I manually copy/paste the name of each one into smd_where_used to check.

Just a thought … :)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#72 2010-01-29 09:39:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: smd_where_used: help keep your admin side tidy

speeke wrote:

I was wondering if this (very useful!) plugin could be modified to include a magic button to automatically disable any plugins that aren’t being used?

Sadly no. “In use” is a very esoteric term that the plugin interprets like this: is there any reference to the plugin from any Page or Form (can’t remember if it checks articles as well… it may do).

This is fine for most cases, but it has a few shortfalls:

  • admin side plugins are missed entirely (hence the fact you can choose to exclude them by clicking the button again to toggle ‘C’ and ‘A+C’)
  • library plugins such as smd_lib may be required but are never “used” (as such)
  • plugins such as rvm_maintenance may be switched on so you don’t expose your site to the outside world. It too is never ‘used’ — just toggled on and off — so an auto switch in smd_where_used would switch it off, which is undesirable

There are probably other reasons, but that kind of thing is why I chose to make the plugin report only on what it finds and not take any direct action like delete stuff or change anything — I’m bound to get it wrong and kill something important! My philosophy is: leave humans in the loop :-) So, sorry: no can do.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB