• Previous message: [greg-dev] Delete items
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    [greg-dev] Delete items

    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 at sinless.org
    > http://sinless.org/mailman/listinfo/gregarius-dev
    > 
    
    Posted by Marco Bonetti [reply] at Thu Jan 25 15:04:37 GMT 2007