Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2008-06-17 17:17:11

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

Re: smd_where_used: help keep your admin side tidy

3. Every section that has no articles in it

I’ve one section with individual unique goods (i.e. articles) that can well be sold out at a certain point in time. This section shouldn’t be deleted in a moment of dullness, though. My idea is to flag certain things, f.i. by using the smd_vars table. Could also be used to flag plugins requiring a de-installation.

  1. should per se exclude plugins type 1 and 2 (you’ll have meant so, Stef).

And one more thing to consider: I remember there are some plugins out there that use names for functions/tags diverging from their own ones (like “xyz_img_sel” and “xyz_image_selector”). That will be more difficult, I think.


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

Offline

#26 2008-06-17 19:09:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

uli wrote:

I’ve one section with individual unique goods (i.e. articles) that can well be sold out at a certain point in time.

Unfortunately, the plugin cannot legislate for that. If it’s empty, it gets flagged. I leave it up to the site author to make sure they don’t delete stuff they really want, which is why the search results in this mode have a heading labelled “Possible orphans” ;-)

fwiw, I don’t think adding a ‘delete’ mechanism directly from this plugin is a particularly good idea, but I’m willing to be corrected. There is a link to each suspected item for you to check it over first and I think deletion should be handled via the normal TXP admin page. My reasoning is partly because of situations just like you highlighted; partly because it is too easy to click an ‘x’ in a column to the left of the one you meant to click the link for; and partly (mostly!) because it’s a pig to code. The ‘x’ system would have to be done manually because I cannot re-use the dLink() functionality in the core without writing my own delete function. And I think the checkboxes/with-selected->delete thing can only be applied to tables with unique rows.

  1. should per se exclude plugins type 1 and 2

Definitely.

I remember there are some plugins out there that use names for functions/tags diverging from their own ones… That will be more difficult, I think.

Yes. For “more difficult”, read “impossible without searching the plugin source code”. However, I have an idea about that.

As it stands, I have the code working and it’s potentially useful functionality (thank you again for the idea). Unfortunately the code that produces it is currently as pretty as Peter Beardsley so it needs refactorisation before I let anyone see it.

Last edited by Bloke (2008-08-10 07:55:33)


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

#27 2008-06-17 22:00:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Alrighty, give v0.14 | compressed a shot.

It adds tentative ‘orphan’ search functionality when you leave the Find box empty and hit ‘Search’. It’s not perfect and could probably do with some feedback from prolonged use to hone it towards greatness. Please skim the Notes in the plugin help to find the gotchas.

The code is prettier than earlier — perhaps elevated to a slightly gormless Matt Le Tissier — but I could not find a way to make the form and plugin queries work all-in-one. Instead of programmatically hunkering through the result sets I cheated and made hundreds of little calls to the database. And I mean hundreds; on an average-sized site you’re probably looking at 150 – 200 or more.

I’ve tried to be a bit intelligent about it and abort the calls early each time it finds a match, but it still hammers the database and for this I apologise. It is remarkably quick considering what it’s doing, but if that causes serious performance problems or someone is worried about the sheer number of calls in such a short space of time, let me know and I’ll try to find a way to re-re-factorise the logic. Code donations to fix my half-assed SQL skills are always welcome.

Until next time we meet… enjoy!


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

#28 2008-06-17 22:12:27

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_where_used: help keep your admin side tidy

Stef, Thanks for this plug-in.
When I first saw the thread I thought “Oh, I won’t need that.”
Then I switched my site to testing mode and noticed I had a deprecated tag in use somewhere.
Moments later I’ve fixed it with your help.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#29 2008-06-17 22:17:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

MattD wrote:

… noticed I had a deprecated tag in use somewhere. Moments later I’ve fixed it with your help.

*beam* glad it’s been of service.

When I first saw the thread I thought “Oh, I won’t need that.”

That’s a good point. I’ve updated the topic title to better reflect what it does after 4 revisions in 24 hours. Ta!


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

#30 2008-06-17 22:23:17

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_where_used: help keep your admin side tidy

Hi Bloke,
don’t want to hijack this thread. I just chimed in to share with you some ugly football players pictures, in case you run out of them in future plug-in developments.

Jairo Patiño
‘Carucha’ Muller (“Carucha” means something like “funny/ugly face”)
Carlitos Tevez


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#31 2008-06-17 22:35:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Bloody hell, Tevez is a real Frankenstein :-D

Makes me feel a whole lot better about myself, that’s for sure. Thanks maniqui!


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

#32 2008-06-17 22:57:17

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

Re: smd_where_used: help keep your admin side tidy

Wow! You’ve managed it! Fine!

In the initial stage I tend to be chaotic and test more and faster than I can delete. smd_wu is the antidote! Thanks, Stef!

I just saw it doesn’t perform search in article titles. Did you consciously leave that out?


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

Offline

#33 2008-06-17 23:12:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

uli wrote:

I just saw it doesn’t perform search in article titles. Did you consciously leave that out?

Yes, since you can’t refer to other things with it — it’s just text.

The primary goal of the plugin (when I started it at least) was to find stuff that articles / forms / pages pointed to or referred to. Currently it only looks at article Body, Excerpt, override_form and section because they are the only things that can refer to other admin-side things. I omitted keywords, article_image and custom fields because they’re just text/numbers and may bloat the search results.

At least, that’s my theory. Feel free to convince me otherwise!

P.S. I think I’ve figured a way to process function aliases inside plugins, so that should fix the stupid plugins list. Just trying it out now.

P.S.2 : Should the plugin list really include admin-side plugins, since they can expose client side tags? e.g. MLP, tru_tags, smd_vars… etc. What do you think?


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

#34 2008-06-17 23:48:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Yep, indeed fixed it. Sorry to keep bombarding you all with updates.

v0.15 | compressed now does a “deep” search inside plugin source code and pulls out all function names. It treats those as aliases of the ‘visible’ plugin name, so any reference to any of those functions implies the plugin is “used” and will therefore not be listed as an orphan.

It is still limited to working on type 0 (client side) plugins until the consensus decide which it should be, or I find a natty way of giving you the option in the plugin.


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

#35 2008-06-17 23:53:01

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

Re: smd_where_used: help keep your admin side tidy

The primary goal of the plugin (when I started it at least) was to find stuff that articles / forms / pages pointed to or referred to.

Stef, you’re absolutely right, hadn’t that in mind anymore. It’s just that I really quickly don’t stick to things’ intended uses.
I think applied this way it could serve very well as a searchbox for article contents, thus saving oneself of installing a special plugin. If this in turn renders its intended use impossible, I’m the first to drop the idea.

Re P.S. 2: The assignment for client side/admin side/library works like a radio button, either … or? Phoo! *scrapes head* I don’t think I want to be challenged to delete smd_vars ;)

Good luck with quelling the function aliases!


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

Offline

#36 2008-06-18 00:59:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,286
Website GitHub

Re: smd_where_used: help keep your admin side tidy

Final update of the night, I promise as I need some sleep now.

v0.16 | compressed adds two features, both courtesy of uli:

  1. When searching for orphans a new toggle button appears next to the ‘search’ button. This allows you to switch between showing client-side plugins and both client side + admin-side plugins that are orphaned. This allows admin plugins with client-side tags to be searched, though it will list pure admin plugins as well since there is no distinction
  2. Article search extended to title and keywords, just for the hell of it

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