[geeklog-cvs] geeklog-1.3/public_html index.php,1.70,1.71
blaine at iowaoutdoors.org
blaine at iowaoutdoors.org
Sat Apr 2 19:50:11 EST 2005
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv16800/public_html
Modified Files:
index.php
Log Message:
Update to code that handles the auto archive/delete of stories. Changed SQL select to be more efficient and not return already archived stories.
Index: index.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/index.php,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** index.php 25 Mar 2005 22:57:01 -0000 1.70
--- index.php 3 Apr 2005 00:50:08 -0000 1.71
***************
*** 124,139 ****
COM_featuredCheck();
! $archivetid = ' '; // this would be invalid as a topic id
// 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}'");
--- 124,138 ----
COM_featuredCheck();
! // Retrieve the archive topic - currently only one supported
! $archivetid = DB_getItem ($_TABLES['topics'], 'tid', "archive_flag='1'");
// Scan for any stories that have expired and should be archived or deleted
! $asql = "SELECT sid,tid,title,expire,statuscode FROM {$_TABLES['stories']} ";
! $asql .= "WHERE (expire <= NOW()) AND (statuscode = " . STORY_ARCHIVE_ON_EXPIRE;
! $asql .= " OR statuscode = " . STORY_DELETE_ON_EXPIRE . ") AND tid != '$archivetid'";
! $expiresql = DB_query ($asql);
while (list ($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetchArray ($expiresql)) {
if ($statuscode == STORY_ARCHIVE_ON_EXPIRE) {
! 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}'");
More information about the geeklog-cvs
mailing list