• Next message: [greg-dev] Restricting updates to cron only
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    [greg-dev] Don't delete unread messages

    A while back I asked about an ability to delete items leaving unread
    items in the database. At that time, it wasn't possibly and a plugin was
    suggested.
    
    Well, a plugin was beyond me to do this, at least in the time I had to
    commit to it, so I patched the code for the items.php.
    
    I'm attaching my diff if anybody else wants it. It hasn't been heavily
    tested (especially various combinations like sticky on, tag lists, etc.)
    but it seems to do what I need.
    
    Thanks for the great Gregarius tool!
    
    Bruce
    -------------- next part --------------
    Index: intl/en.php
    ===================================================================
    --- intl/en.php	(revision 1559)
    +++ intl/en.php	(working copy)
    @@ -175,6 +175,7 @@
     define ('LBL_ADMIN_PRUNE_YEARS','years');
     define ('LBL_ADMIN_PRUNE_KEEP','Keep the most recent items: ');
     define ('LBL_ADMIN_PRUNE_INCLUDE_STICKY','Delete Sticky items too: ');
    +define ('LBL_ADMIN_PRUNE_INCLUDE_UNREAD','Delete Unread items too: ');
     define ('LBL_ADMIN_PRUNE_EXCLUDE_TAGS','Do not delete items tagged... ');
     define ('LBL_ADMIN_ALLTAGS_EXPL','(Enter <strong>*</strong> to keep all tagged items)');
     
    Index: .htaccess
    ===================================================================
    --- .htaccess	(revision 1559)
    +++ .htaccess	(working copy)
    @@ -60,3 +60,4 @@
       RewriteCond  %{env:static} ^$
       RewriteRule ^(.+)\/?$   feed.php?channel=$1 [L,QSA]
     </IfModule>
    +
    Index: admin/items.php
    ===================================================================
    --- admin/items.php	(revision 1559)
    +++ admin/items.php	(working copy)
    @@ -51,6 +51,8 @@
         . "</p>\n"
         . "<p><label for=\"prune_include_sticky\">".LBL_ADMIN_PRUNE_INCLUDE_STICKY."</label>\n"
         . "<input type=\"checkbox\" id=\"prune_include_sticky\" name=\"prune_include_sticky\" value=\"1\"/></p>\n"
    +    . "<p><label for=\"prune_include_unread\">".LBL_ADMIN_PRUNE_INCLUDE_UNREAD."</label>\n"
    +    . "<input type=\"checkbox\" id=\"prune_include_unread\" name=\"prune_include_unread\" value=\"1\"/></p>\n"
         . "<p><label for=\"prune_exclude_tags\">".LBL_ADMIN_PRUNE_EXCLUDE_TAGS."</label>\n"
         . "<input type=\"text\" id=\"prune_exclude_tags\" name=\"prune_exclude_tags\" value=\"\"/></p>\n"
         . "<p style=\"font-size:small; padding:0;margin:0\">".LBL_ADMIN_ALLTAGS_EXPL."</p>\n"
    @@ -115,6 +117,13 @@
                     $sql .= " and not(unread & " .RSS_MODE_STICKY_STATE .") ";
                 }
     
    +            if (!array_key_exists('prune_include_unread', $_REQUEST)
    +                    || $_REQUEST['prune_include_unread'] != '1') {
    +
    +                $sql .= " and not(unread & " .RSS_MODE_UNREAD_STATE .") ";
    +            }
    +
    +
                 if (array_key_exists('prune_exclude_tags', $_REQUEST)
                         && trim($_REQUEST['prune_exclude_tags'])) {
     
    
    Posted by Bruce C. Dillahunty [reply] at Tue Sep 5 16:30:22 CEST 2006