1 (edited by Kolya 2007-01-26 14:50:37)

Topic: Bump (saging/aging)

From conf.php:

define("FEATURE_SAGE",20);            // Number of replies before no longer bumped, or false

What happens when I set this to false, can it get bumped infinitely?
When does the thread die?

2

Re: Bump (saging/aging)

If you set it to false, it will always bump regardless of the number of replies. It won't die.

Re: Bump (saging/aging)

Oh, the dying threads (after a certain amount of posts) are a useful feature of imageboards. 
Is there another automatic way to prune old threads then?
Because without it on a busy forum your server will soon be stuffed.

4 (edited by Kolya 2007-01-27 05:27:37)

Re: Bump (saging/aging)

Could you give some help on how to implement such a feature h3? I'm a PHP newbie.

I think it would be best if the admin could set a certain amount of threads to be allowed in a category. When it is reached and a new thread is created the thread at the end of the board gets deleted. That should complement saging/aging nicely.

5

Re: Bump (saging/aging)

Ahh, pruning.

This is one of those things that is pretty easy in something like kareha, where "boards" are self-contained, but a lot more complicated in ochiba where "boards" are really just label filters. I also had a a bunch of new ideas in mind (prune by date, prune by space on disk, prune by thread count, prune by post count). Plus, this kinda thing is harder to test for obvious reasons.

Anyway, those are my excuses. Here's some stop-gap code to provide pruning until the time I do this properly (probably ochiba v2).

conf.php

--- release/ochiba-1.1/conf.php 2005-09-21 19:46:39.000000000 -0700
+++ conf.php    2007-01-28 14:51:42.000000000 -0800
@@ -67,6 +67,7 @@
 define("FEATURE_RSS",true);                    // Enable RSS feed?
 define("FEATURE_FETCH",false);         // Enable URL fetch instead of upload?
 define("FEATURE_SAGE",20);                 // Number of replies before no longer bumped, or false
+define("FEATURE_PRUNE",35);         // Number of threads to retain; false to retain all
 define("FEATURE_MULTIPLE_CATEGORY",true);   // Allow multiple categories per post?
 
 // Restrict posting? If so, only tripcodes provided in a comma-separated list will

includes/post.php

--- release/ochiba-1.1/includes/post.php   2006-01-07 11:40:39.000000000 -0800
+++ includes/post.php   2007-01-28 14:52:46.000000000 -0800
@@ -313,6 +315,11 @@
         }
     }
 
+    //----- Prune? If FEATURE_PRUNE is set to a number, delete off old stuff
+    if(is_numeric(FEATURE_PRUNE) && FEATURE_PRUNE>0) {
+        prune($_POST['categories']);
+    }
+
     echo $STRINGS["postthanks"];
     echo JS_AUTO_CLOSE;

includes/functions.php - add the following function to the file

function prune($categories) {
    global $db;
    // Have to do this for each category posted...
    foreach($categories as $c) {
        // Get threads to delete, if any
        $q = "select id from images where category like '%/$c/%' order by date desc";
        if(eregi("^mysql",DB)) {
            // Fuck you mysql
            $q .= " limit " . FEATURE_PRUNE . ",10";
        } else {
            $q .= " limit 10 offset " . FEATURE_PRUNE;
        }
        $threads = $db->getCol($q);
        $allchildren = getComments($threads);
        foreach($allchildren as $children) {
            foreach($children as $child) {
                deleteImage($child["id"]);
            }
        }
        foreach($threads as $thread) {
            deleteImage($thread);
        }
    }
}