Furry stuff, oekaki stuff, and other stuff.
You are not logged in.
Pages: 1
Simple patch to tweak behaviour of clean_picture_slots(), if $cfg['pic_store'] is set to zero pictures will never be pruned.
Patched against 1.3.10
diff -rNu wacpoteto-1.3.10/oekaki/language/english.php devel/oekaki/language/english.php --- wacpoteto-1.3.10/oekaki/language/english.php 2007-07-06 04:19:06.000000000 -0700 +++ devel/oekaki/language/english.php 2007-11-24 00:28:02.000000000 -0800 @@ -581,7 +581,7 @@ $langop_install_picstore = "Number of pictures to store"; //the max number of pictures the OP can store at a time -$langop_install_picstoresub = "the max number of pictures the board can store at a time"; +$langop_install_picstoresub = "the max number of pictures the board can store at a time, set to zero to disable limit"; //Registration $langop_install_reg = "Registration"; diff -rNu wacpoteto-1.3.10/oekaki/paintsave.php devel/oekaki/paintsave.php --- wacpoteto-1.3.10/oekaki/paintsave.php 2007-07-19 03:38:42.000000000 -0700 +++ devel/oekaki/paintsave.php 2007-11-24 00:26:22.000000000 -0800 @@ -110,25 +110,27 @@ // Need CFG, DB, names global $cfg, $dbconn, $OekakiPoteto_Prefix, $p_pic, $r_pic, $t_pic; - // Get slots to delete - $result = mysql_query ("SELECT COUNT(ID_2) FROM {$OekakiPoteto_Prefix}oekakidta"); - if (!$result) - return FALSE; + if ( $cfg['pic_store'] > 0 ) { + // Get slots to delete + $result = mysql_query ("SELECT COUNT(ID_2) FROM {$OekakiPoteto_Prefix}oekakidta"); + if (!$result) + return FALSE; - $total_slots = (int) mysql_result ($result, 0); + $total_slots = (int) mysql_result ($result, 0); - // If total rows is more than allowed, trim non-archived pics - $trim_slots = $total_slots - $cfg['pic_store']; - if ($trim_slots > 0) { - // Don't blow up - if ($trim_slots > 10) - $trim_slots = 10; + // If total rows is more than allowed, trim non-archived pics + $trim_slots = $total_slots - $cfg['pic_store']; + if ($trim_slots > 0) { + // Don't blow up + if ($trim_slots > 10) + $trim_slots = 10; - // Remove oldest, non-archived pictures - $result = mysql_query ("SELECT PIC_ID FROM {$OekakiPoteto_Prefix}oekakidta WHERE archive=0 ORDER BY postdate ASC LIMIT {$trim_slots}"); + // Remove oldest, non-archived pictures + $result = mysql_query ("SELECT PIC_ID FROM {$OekakiPoteto_Prefix}oekakidta WHERE archive=0 ORDER BY postdate ASC LIMIT {$trim_slots}"); - while ($result && ($row = mysql_fetch_array ($result))) { - kill_picture_slot($row['PIC_ID']); + while ($result && ($row = mysql_fetch_array ($result))) { + kill_picture_slot($row['PIC_ID']); + } } } diff -rNu wacpoteto-1.3.10/oekaki/testinfo.php devel/oekaki/testinfo.php --- wacpoteto-1.3.10/oekaki/testinfo.php 2007-07-07 21:27:38.000000000 -0700 +++ devel/oekaki/testinfo.php 2007-11-24 00:26:16.000000000 -0800 @@ -40,7 +40,11 @@ $db_info['DB version'] = mysql_result ($result, 0); $result = mysql_query ("SELECT COUNT(ID_2) FROM {$OekakiPoteto_Prefix}oekakidta"); - $db_info['Total pics'] = (int) mysql_result ($result, 0)." (out of {$cfg['pic_store']})"; + $db_info['Total pics'] = (int) mysql_result ($result, 0); + + if ( $cfg['pic_store'] > 0 ) { + $db_info['Total pics'] .= " (out of {$cfg['pic_store']})"; + } $result = mysql_query ("SELECT COUNT(ID_2) FROM {$OekakiPoteto_Prefix}oekakidta WHERE archive=1"); $db_info['Archives'] = (int) mysql_result ($result, 0);
Offline
I'm not sure that setting "pic_store" to zero is a good idea, because there's other code that depends on a non-zero value. The control panel won't even allow it. Setting the storage to a really high number would be better.
The picture slot cleaner counts the number of rows in the database before deciding to trim anything, and the count is actually a cached value and doesn't hurt performance at all. It could be 100,000 rows and the query would still be instantaneous.
Offline
Waccoon wrote:
I'm not sure that setting "pic_store" to zero is a good idea, because there's other code that depends on a non-zero value. The control panel won't even allow it. Setting the storage to a really high number would be better.
The picture slot cleaner counts the number of rows in the database before deciding to trim anything, and the count is actually a cached value and doesn't hurt performance at all. It could be 100,000 rows and the query would still be instantaneous.
I see, I'm sorry .. I stripped out the control panel and the picture cleaner completely from my installation.
Offline
Pages: 1