[geeklog-cvs] geeklog-1.3/public_html index.php,1.61,1.62

blaine at iowaoutdoors.org blaine at iowaoutdoors.org
Sun Aug 15 15:57:51 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv5510/public_html

Modified Files:
	index.php 
Log Message:
Added support for new DEFINES in config.php to be used for the Story Status field to indicate ArchiveStoryOnExpiry or DeleteStoryOnExpiry. Also corrected logic in index.php to find and handle expired stories.

Index: index.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/index.php,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** index.php	1 Aug 2004 21:37:50 -0000	1.61
--- index.php	15 Aug 2004 19:57:49 -0000	1.62
***************
*** 126,142 ****
  
  // Scan for any stories that have expired and should be deleted
  $expiresql = DB_query("SELECT sid,tid,title,expire,statuscode FROM {$_TABLES['stories']}"
!                             . " WHERE tid != '{$_CONF['archivetopic']}'"
!                             . " AND (expire <= NOW()) AND (statuscode >= 10)");
  while (list ($sid,$expiretopic,$title,$expire,$statuscode) = DB_fetchArray($expiresql)) {
!     if ($statuscode == 10) {
!         if (DB_COUNT($_TABLES['topics'],'archive_flag', '1') == 1) {
!             $archivetid = DB_getItem($_TABLES['topics'],'tid',"archive_flag='1'");
!             COM_errorLOG("Archive Story: $sid, Topic:$archivetid, Title: $title. Expired :$expire");
!             DB_query("UPDATE {$_TABLES['stories']} SET tid = '$archivetid' WHERE sid='{$sid}'");
!         } else {
!             COM_errorLOG("ERROR: Archive Topic does not exist. Attempt to archive Story: $sid");
!         }
!     } else {
          COM_errorLOG("Delete Story and comments: $sid, Topic:$expiretopic, Title: $title. Expired :$expire");
          DB_query("DELETE FROM {$_TABLES['stories']} WHERE sid='{$sid}'");
--- 126,139 ----
  
  // Scan for any stories that have expired and should be deleted
+ // Retrieve the archive topic - currently only one supported
+ $archivetid = DB_getItem($_TABLES['topics'],'tid',"archive_flag='1'");
  $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 ( $archivetid != '' AND $statuscode == STORY_ARCHIVE_ON_EXPIRE ) {
!         COM_errorLOG("Archive Story: $sid, Topic:$archivetid, Title: $title. Expired :$expire");
!         DB_query("UPDATE {$_TABLES['stories']} SET tid = '$archivetid' WHERE sid='{$sid}'");
!     } elseif ($statuscode == STORY_DELETE_ON_EXPIRE) {
          COM_errorLOG("Delete Story and comments: $sid, Topic:$expiretopic, Title: $title. Expired :$expire");
          DB_query("DELETE FROM {$_TABLES['stories']} WHERE sid='{$sid}'");




More information about the geeklog-cvs mailing list