Ok ..
In the main site index.php, find this block of code at approx line 128
Text Formatted Code
// Scan for any stories that have expired and should be archived or deleted
$expiresql = DB_query ("SELECT sid,tid,title,expire,statuscode FROM {$_TABLES['stories']} WHERE (expire <= NOW()) AND (statuscode = " . STORY_ARCHIVE_ON_EXPIRE . " OR statuscode = " . STORY_DELETE_ON_EXPIRE . ")");
while (list ($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetchArray ($expiresql)) {
if ($statuscode == STORY_ARCHIVE_ON_EXPIRE) {
if ($archivetid == ' ') {
// Retrieve the archive topic - currently only one supported
$archivetid = DB_getItem ($_TABLES['topics'], 'tid',
"archive_flag='1'");
}
if (!empty ($archivetid)) {
COM_errorLOG("Archive Story: $sid, Topic:$archivetid, Title: $title. Expired :$expire");
DB_query ("UPDATE {$_TABLES['stories']} SET tid = '$archivetid', frontpage = '0', featured = '0' WHERE sid='{$sid}'");
}
You can see the COM_errorLOG stmt at approx line 140 if it finds you have defined an archive topic id.
When I added this code, I forgot to also add the condition that once it actually archives the topic (moves it) which the code inside this IF block does - then skip this once it's moved.
So we need to add the additional test to see if the topic I am checking is now already archived. The only change in the code below should be to line 137 where the IF condition test now has the addition check.
Text Formatted Code
// Scan for any stories that have expired and should be archived or deleted
$expiresql = DB_query ("SELECT sid,tid,title,expire,statuscode FROM {$_TABLES['stories']} WHERE (expire <= NOW()) AND (statuscode = " . STORY_ARCHIVE_ON_EXPIRE . " OR statuscode = " . STORY_DELETE_ON_EXPIRE . ")");
while (list ($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetchArray ($expiresql)) {
if ($statuscode == STORY_ARCHIVE_ON_EXPIRE) {
if ($archivetid == ' ') {
// Retrieve the archive topic - currently only one supported
$archivetid = DB_getItem ($_TABLES['topics'], 'tid',
"archive_flag='1'");
}
if (!empty ($archivetid) AND $expiretopic != $archivetid) {
COM_errorLOG("Archive Story: $sid, Topic:$archivetid, Title: $title. Expired :$expire");
DB_query ("UPDATE {$_TABLES['stories']} SET tid = '$archivetid', frontpage = '0', featured = '0' WHERE sid='{$sid}'");
}
Let me know if that works.
Geeklog components by PortalParts -- www.portalparts.com