[geeklog-cvs] geeklog-1.3/public_html index.php,1.64,1.65

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Thu Sep 23 10:21:03 EDT 2004


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

Modified Files:
	index.php 
Log Message:
Only do the SQL request to get the archive topic when we actually need it.


Index: index.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/index.php,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** index.php	25 Aug 2004 21:25:46 -0000	1.64
--- index.php	23 Sep 2004 14:20:59 -0000	1.65
***************
*** 126,140 ****
  COM_featuredCheck();
  
! // 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");
          STORY_deleteImages ($sid);
--- 126,145 ----
  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)) {
!             COM_errorLOG("Archive Story: $sid, Topic:$archivetid, Title: $title. Expired :$expire");
!             DB_query ("UPDATE {$_TABLES['stories']} SET tid = '$archivetid' WHERE sid='{$sid}'");
!         }
!     } else if ($statuscode == STORY_DELETE_ON_EXPIRE) {
          COM_errorLOG("Delete Story and comments: $sid, Topic:$expiretopic, Title: $title. Expired :$expire");
          STORY_deleteImages ($sid);
***************
*** 143,146 ****
--- 148,152 ----
      }
  }
+ 
  $sql = " (date <= NOW()) AND (draft_flag = 0)";
  




More information about the geeklog-cvs mailing list