Gossamer Forum
Home : Products : Links 2.0 : Customization :

Deleting old static pages

Quote Reply
Deleting old static pages
Hi All

Has anyone figured out a way to delete old static category pages through admin?

Let's say that you re-organize your site and then no longer use a certain category. Well, when you rebuild the site, the new categories will all be there, but the old stuff will still be sitting in their directories.

Instead, it would be nice if the script could look for the now defunct pages and delete them as a way to keep your site clutter-free.

Many thanks Smile

------------------------------------------
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
do a search for "wipe out" in the forum... you should be able to hack the delete category routine to include the recursive deleting command found in that script.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy thoughts] Deleting old static pages In reply to
Thanks.

I can't believe it....I asked the same darn question a long time ago. Here is the wipeout link:

http://www.cybernox.com/scripts/wipeout.html

I'll take a look at the delete category thing to see what I can come up with.

Even beyond deleting unused categories, it would be great if the script could clean up active categories, like if a lot of links are dropped, and the number of category pages changes from, say, 20 to 10. The 10 unused pages would get dinged, too. The script would act as a total clean-up tool.

Thanks, again. Smile

------------------------------------------

Last edited by:

DogTags: Jan 10, 2003, 6:28 AM
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
Other thing is to just delete the entire /pages/ folder before the creation of the pages is done, and then it will re-create it all, minus all the pages you dont need :)

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: [Andy] Deleting old static pages In reply to
Yeah, I've thought of that. What I'd like to do is have a system that didn't need a tech guy all the time. Instead, a logged in admin could just click a few buttons and the site would get cleaned up. I also know that you could use Fileman, but I don't want to give that kind of access to anyone.

One of the downsides of manually deleting directories before a new build is that current visitors would suddenly be without content. They would wonder "Hey, where the heck did everything go?".

So, here's what I have in mind for the clean-up build routine:

1. admin clicks Build All
2. script looks at category directory
3. if script determines that only 1 page is needed (based on number of links per page, etc.), then the 1 new page is built and then the rest are deleted ------- better yet, since the other pages might still be listed in search engines or even have existing visitors, the remaining pages would be converted to redirect pages that would have a "sorry, we're updating our site and redirecting you to the current content." Then, anyone going to one of the old URLs would be sent to the top of that respective category

Admin could select whether to have the old, unused pages deleted or converted to redirects

This could be a cool plugin for LinksSQL. I think I'm gonna mention this over there, too. I just thought that it would be a nice site maintenance feature for Links 2.0, as well.

Thanks so much. Smile

Last edited by:

DogTags: Jan 10, 2003, 9:14 AM
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
Quote:
This could be a cool plugin for LinksSQL. I think I'm gonna mention this over there, too. I just thought that it would be a nice site maintenance feature for Links 2.0, as well.

I'm already working on this Wink

Cheers

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: [Andy] Deleting old static pages In reply to
No lie! This would a very useful addition to a great system. Site maintenance has long been a nagging problem. Thanks very much, Andy! Cool

------------------------------------------
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
Paul had an idea over in the LinksSQL forum of going through the directories right after a build and deleting the unused, or redundant, pages.

http://www.gossamer-threads.com/...;;page=unread#unread

Would it be possible to create such a thing for Links 2 as well? Maybe this would be the easiest answer.

Thanks Smile

------------------------------------------
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
>> Delete the entire data directory...

> What I'd like to do is have a system that didn't need a tech guy all the time.

If you have an ftp program like FTP pro, it can do that easily. Your site most likely allows ftp since I don't know how you'd install links without it. FTP pro has a nice user interface that makes it easy to point and click. You can delete the remote directory with one click (careful, that can also be a bad thing... :)) and then links will rebuild the directories it needs.
Quote Reply
Re: [Bob Harbison] Deleting old static pages In reply to
Thanks, Bob. The prob is that if you have hundreds of categories and subcats, you could be in for quite a job. What I was going for was something that would evaluate things as the Build was taking place. This way, there would be the least down time of current pages, and the Build routine would take care of things automatically.

Many thanks for your thoughts on this Smile

------------------------------------------
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
> The prob is that if you have hundreds of categories
> and subcats, you could be in for quite a job.

No, not really. I use FTP Pro, and if you change the default settings a bit, it will delete sub-directories when you delete a directory. (allow deletion of non-empty folders is the one you're looking for.) One click on the directory that contains all your sub-directories and "poof" they're gone. :)

So if you have a directory named links with hundreds of sub-directories, it will delete them all with one single click. One word of warning, that will also delete your style sheet assuming it's in the links directory, as well as any graphics you may be storing there. Links won't put those back, but it will re-generate all of the cat and subcat pages.
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
Hmmm. This is one of those problems that seem simple on the face of it, but are actually horribly complex if you want to make sure the entire site remains available to people browsing your pages during the update.

Links 2 doesn't keep track of deleted categories, so once they're gone it has no way of knowing at build time which categories have been made redundant. A deletedcats.db file is an option I guess, but checking yet another db file during the build is going to slow things down.

If the physical directories are deleted at the same time the category is removed from the database, then there will still be links to them on the site until it's rebuilt.

Ideally it should rebuild that "branch" just before deletion.

The excess pages problem is a little easier, in that a "DEL more*.html" type command could be used just before the links pages are built for each category.

An extra subroutine would have to be added that checked for - and deleted - unused detail pages after the rest of the site has been updated. This shouldn't be too difficult if the default behaviour of the script hasn't been changed, as it would just need to go through the detailed directory and check the first part of each filename against ID numbers in the database. Any file without a matching link ID would then be removed.

I suggest that all this is done only when specifically asked for, perhaps via a "clean and build" option in the admin panel. Checking for dead links and cats during the build when you know nothing has been deleted and the links per page number hasn't been changed would slow things down needlessly.

Of course it would be much easier just to delete the entire build directory and start over, but as has already been mentioned, that means the site will give 404 errors until the build is complete. This will be more of a problem for larger, busier sites, where the build process has to be staggered.
Quote Reply
Re: [wysardry] Deleting old static pages In reply to
Sounds right on all points, wysardry. Deleting directories, subdirectories is no problem. The question is whether there is a halfway decent way to keep the site alive during the clean and re-build. Smile Thanks for your suggestions, Bob.

Last edited by:

DogTags: Jan 24, 2003, 5:12 AM
Quote Reply
Re: [DogTags] Deleting old static pages In reply to
Well... If disk space isn't a problem, there's a sledgehammer on a walnut way to do it.

If your pages are built in a directory called "pages", build them in "newpages" instead. Once the build process is complete, rename "pages" to "oldpages" and "newpages" to "pages", then delete the entire "oldpages" tree.

You'd need to edit the script in a few places of course, but it would be a lot simpler than adding all the processes I mentioned before.
Quote Reply
Re: [wysardry] Deleting old static pages In reply to
Yep...been there, done that, got the T-shirt Smile

Overall, I think what I have in mind would overwork the system and take too long for large sites. I know that Andy is working on a plugin for LinksSQL, and that might be the only way to go, but I thought I'd bring this up here, too, to see if it could work somehow. 'fraid not Frown

Thanks for your help, wysardry Smile