Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Deleting Static Pages and Directory of Defunct Cat or Subcat

Quote Reply
Deleting Static Pages and Directory of Defunct Cat or Subcat
Hi All

Would there be a way to have the script delete any pages and the directory of any defunct category or subcat?

This would be a nice site maintenance feature.

Better yet, just in case some visitors have bookmarked those now defunct pages, what would be really neat is if admin could have the option of having the script replace the defunct stuff with a custom 404 that redirected the visitor to the home page.

I'm going to post this same inquiry in the Links 2 Discussion forum, too, since it would be nice if this worked in both scripts.

Thanks very much. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Mmmm....sounds like a cool idea....I would guess a seperate script, that goes through all of the folders, and compares their build dates to the main index.html file would do the job. I may have a look at this in a little bit ;) Still finishing off my Basic_Banner and Ace_News Plugins ;)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [DogTags] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
What do you class as defunct?.....it would probably be easiest to make a small modification to the script so that when you delete categories from admin it deletes the directories.
Quote Reply
Re: [DogTags] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
I wrote a script which removed all categories which were both:
  • Empty - no links
  • No subcategories under them


I combined this with the Directory Depth plugin and removed the bottom guys first.

But, it depends on what you mean by defunt, as Paul says.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Is that in the ToolBox Ian?
Quote Reply
Re: [Teambldr] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Actually its not, as it is still a very crude tool. I wrote it for Categories. It needs some fixing up before it could be released with toolbox (which is where it would fit in nicely).

I would certainly back up your directory before using it! It works on mysite for my purposes but it may not work on yours.

It is one cgi file with no options... you just run it.

Edit: I can send you a copy to use at your own risk if you like?


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Aug 14, 2002, 10:53 AM
Quote Reply
Re: [Ian] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Ahh...thanks!Smile
Quote Reply
Re: [Teambldr] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Actually there are multiple cgi files now that I look. One has to create a 'has children' column and calculate these values for every one of your categories, before the clean up tool can go to work....

So yes, it is still a little "beta" and messy.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Defunct would be defined as "Drop this cat or subcat from the list....vamoose"

So, I guess there could be something like a checkbox next to each cat/subcat that says something like "delete static" when electing to delete a cat or subcat. You would have to check this box at the time that you are deleting the category or subcategory.

Cheers!! Smile

------------------------------------------
Quote Reply
Re: [DogTags] Deleting Static Pages and Directory of Defunct Cat or Subcat In reply to
Quote:
admin could have the option of having the script replace the defunct stuff with a custom 404 that redirected the visitor to the home page.
I've been trying to come up with some way with .htaccess to redirect requests for the old static categories to the corresponding dynamic ones, but I haven't had much luck. My hope was to either query the database or manually build a category -> id array that could forward the user to a specific location instead of just the general home page redirect. Doesn't seem like Apache allows that sort of thing, though...

The other problem I was running into is trying to come up with a reliable regex to match requested static categories/pages, where the category depth and existence of a file name is unknown.

Has anyone else tackled such a project?

Dan