From rutger at dds.nl Thu Jan 25 11:24:37 2007 From: rutger at dds.nl (Rutger Wessels) Date: Thu Jan 25 11:24:08 2007 Subject: [greg-dev] Delete items Message-ID: <45B89375.4090106@dds.nl> Hello, I use Gregaris for a few months now and I like it very much. It solves my RSS reading problems with multiple locations and systems. The only problem is that my Gregarius installation is hosted on a virtual server with limited memory (96Mb) and that causes problems when the number of items is growing. So pruning items is the solution. I started with a plugin for this that lets the user define an interval X and a period (days, weeks, months, years). So items that are older than X period will be deleted. I won't delete sticky and unread items (maybe configurable). My plan is to run this plugin based on the hook rss.plugins.updates.before. But that will delete items every time the frontpage is (re)loaded. Is that correct? Maybe too much load? Is that hook also triggered when the update.php script is run? My guess is that I can copy the procedure in item_admin(). Is that right? regards, Rutger Wessels From marco.bonetti at kaywa.com Thu Jan 25 15:04:37 2007 From: marco.bonetti at kaywa.com (Marco Bonetti) Date: Thu Jan 25 15:05:03 2007 Subject: [greg-dev] Delete items In-Reply-To: <45B89375.4090106@dds.nl> References: <45B89375.4090106@dds.nl> Message-ID: <45B8C705.4080507@kaywa.com> Rutger, hello, actually, the rss.plugins.updates.before (and rss.plugins.updates.after) plugin hooks are only called when the Update class (cls/update.php) is instantiated, and right after the update process is finished, respectively. So I'd say you could safely have your plugin do the pruning at that moment. Re: item_admin() copying, I don't think that is a good idea. What I would do is: a) check that the user is authorized to prune items (with rss_user_check_user_level(RSS_USER_LEVEL_PRIVATE)) b) pollute the request superglobals, e.g.: $_REQUEST['prune_period'] = 'days'; $_REQUEST[CST_ADMIN_CONFIRMED] = true; .... c) include admin/items.php and call item_admin(); (Yes, this is quite a nasty hack. :) Alternatively you could isolate the pruning code from item_admin() and have a new function in admin/items.php, e.g. items_prune($period, $includeSticky, $excludedTags, ...) ...which you could call directly from your plugin, without having to pollute the superglobals. I'd be very pleased to commit the resulting admin/items.php to the development code, so that other users could use your plugin too. How does that sound? Best, -m Rutger Wessels wrote: > Hello, > > I use Gregaris for a few months now and I like it very much. It solves > my RSS reading problems with multiple locations and systems. The only > problem is that my Gregarius installation is hosted on a virtual server > with limited memory (96Mb) and that causes problems when the number of > items is growing. So pruning items is the solution. > > I started with a plugin for this that lets the user define an interval X > and a period (days, weeks, months, years). So items that are older than > X period will be deleted. I won't delete sticky and unread items (maybe > configurable). > > My plan is to run this plugin based on the hook > rss.plugins.updates.before. But that will delete items every time the > frontpage is (re)loaded. Is that correct? Maybe too much load? > > Is that hook also triggered when the update.php script is run? > > My guess is that I can copy the procedure in item_admin(). Is that right? > > regards, > Rutger Wessels > _______________________________________________ > gregarius-dev mailing list > gregarius-dev@sinless.org > http://sinless.org/mailman/listinfo/gregarius-dev >