Posted on: 02/02/05 10:27am
By: scubasteve
Since enabling the autoarchive feature I have been seeing massive entries in error.log. Here is small chunk of what I have been seeing. It appears that it is repeatidly going through EVERY archived message and, well, I don't know exactly what it is doing. When I originally enabled the archive feature by creating a archive topic, I went into the mysql database and basically changed the field that tells geeklog what topic each story belongs to. In all, I moved about 100 stories from one topic to another.
Here is the log. This goes on and on repeating the story IDs over and over. Error.log is already up to 2mb.
Help!
Tue Feb 1 16:32:29 2005 - Archive Story: 20050119192227792, Topic:archive, Title: "story title" Expired :2005-01-19 19:29:27
Tue Feb 1 16:32:29 2005 - Archive Story: 20050119193145610, Topic:archive, Title: "story title" Expired :2005-01-19 19:35:18
Tue Feb 1 16:32:29 2005 - Archive Story: 20050124082640593, Topic:archive, Title: "story title" Expired :2005-01-24 11:21:05
Tue Feb 1 16:32:29 2005 - Archive Story: 20050124095450162, Topic:archive, Title: "story title". Expired :2005-01-28 09:54:50
Tue Feb 1 16:32:29 2005 - Archive Story: 2005012513155975, Topic:archive, Title: "story title" Expired :2005-01-27 17:00:59
Tue Feb 1 16:32:29 2005 - Archive Story: 20050128110617837, Topic:archive, Title: "story title" Expired :2005-01-28 11:46:17
Tue Feb 1 16:32:29 2005 - Archive Story: 20050128190443468, Topic:archive, Title: "story title" Expired :2005-01-30 19:20:40
Tue Feb 1 16:33:03 2005 - Archive Story: 20040819080447925, Topic:archive, Title: "story title" Expired :2005-01-29 18:22:07
Tue Feb 1 16:33:03 2005 - Archive Story: 20040923111307421, Topic:archive, Title: "story title" Expired :2005-01-19 17:46:11
Tue Feb 1 16:33:03 2005 - Archive Story: 20041208170647888, Topic:archive, Title: "story title" Expired :2004-12-22 13:40:35
Tue Feb 1 16:33:03 2005 - Archive Story: 20041213135719147, Topic:archive, Title: "story title" Expired :2004-12-17 21:34:26
Tue Feb 1 16:33:03 2005 - Archive Story: 20041215131849491, Topic:archive, Title: "story title" Expired :2004-12-25 12:00:47
Tue Feb 1 16:33:03 2005 - Archive Story: 20041220142428384, Topic:archive, Title: "story title" Expired :2004-12-22 11:35:58
Tue Feb 1 16:33:03 2005 - Archive Story: 20041228104626551, Topic:archive, Title: "story title" Expired :2005-01-29 18:24:19
Tue Feb 1 16:33:03 2005 - Archive Story: 2004123009202753, Topic:archive, Title: "story title" Expired :2005-01-07 11:58:11
Tue Feb 1 16:33:03 2005 - Archive Story: 20050103142804863, Topic:archive, Title: "story title" Expired :2005-01-03 14:36:35
Tue Feb 1 16:33:03 2005 - Archive Story: 20050110124521653, Topic:archive, Title: "story title" Expired :2005-01-25 18:21:24
Autoarchive issues
Posted on: 02/02/05 11:27am
By: Blaine
Are error log entries still be recorded once the stories have been archvived ?
Autoarchive issues
Posted on: 02/02/05 11:30am
By: scubasteve
Yes. It has multiple entries for EVERY archived story several times each day.
Autoarchive issues
Posted on: 02/02/05 11:38am
By: Blaine
Are you comfortable with making a change to the code?
I think I see the issue and wanted you to test it.
Autoarchive issues
Posted on: 02/02/05 11:41am
By: scubasteve
Actually, it has a log entry for every archived story about about 4 times an hour.
Autoarchive issues
Posted on: 02/02/05 11:42am
By: scubasteve
I think I see the issue and wanted you to test it.
Why the hell not.
Autoarchive issues
Posted on: 02/02/05 11:50am
By: Blaine
Ok ..
In the main site index.php, find this block of code at approx line 128
// 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.
// 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.
Autoarchive issues
Posted on: 02/02/05 12:04pm
By: scubasteve
"AND $expiretopic != $archivetid)"
I added the above code. I will give you an update in an hour or so.
Autoarchive issues
Posted on: 02/02/05 12:54pm
By: scubasteve
Well, so far so good. No additional entries in error.log. I will update again later.
Thanks for the quick help!
Autoarchive issues
Posted on: 02/02/05 01:44pm
By: Dirk
[QUOTE BY= Blaine] 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.[/QUOTE]
Another option would be to set the status back to 0 in that UPDATE request ...
bye, Dirk
Autoarchive issues
Posted on: 02/02/05 05:19pm
By: scubasteve
Still no entries in error.log. Looks like everything is fixed. I will update this thread again if it re-appears but I doubt it will. Once again, thanks for the help.
Autoarchive issues
Posted on: 03/11/05 06:16pm
By: Robin
[QUOTE BY= Dirk] Another option would be to set the status back to 0 in that UPDATE request ...[/QUOTE]
Could you please elaborate a little bit on this one. I'm having a similar problem now. It's amazing how big the error.log can get