Lines 135-141
if ($zebraqueue_days) {
Link Here
|
135 |
} |
135 |
} |
136 |
$sth = $dbh->prepare( |
136 |
$sth = $dbh->prepare( |
137 |
"SELECT id,biblio_auth_number,server,time FROM zebraqueue |
137 |
"SELECT id,biblio_auth_number,server,time FROM zebraqueue |
138 |
WHERE done=1 and time < date_sub(curdate(), interval ? day)" |
138 |
WHERE done=1 and time < date_sub(CAST(now() AS date), interval ? day)" |
139 |
); |
139 |
); |
140 |
$sth->execute($zebraqueue_days) or die $dbh->errstr; |
140 |
$sth->execute($zebraqueue_days) or die $dbh->errstr; |
141 |
$sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?"); |
141 |
$sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?"); |
Lines 151-157
if ($zebraqueue_days) {
Link Here
|
151 |
if ($mail) { |
151 |
if ($mail) { |
152 |
print "Mail queue purge triggered for $mail days.\n" if ($verbose); |
152 |
print "Mail queue purge triggered for $mail days.\n" if ($verbose); |
153 |
|
153 |
|
154 |
$sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(curdate(), interval ? day)"); |
154 |
$sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(CAST(now() AS date), interval ? day)"); |
155 |
$sth->execute($mail) or die $dbh->errstr; |
155 |
$sth->execute($mail) or die $dbh->errstr; |
156 |
my $count = $sth->rows; |
156 |
my $count = $sth->rows; |
157 |
$sth->finish; |
157 |
$sth->finish; |
Lines 174-180
if($pImport) {
Link Here
|
174 |
|
174 |
|
175 |
if($pLogs) { |
175 |
if($pLogs) { |
176 |
print "Purging records from action_logs.\n" if $verbose; |
176 |
print "Purging records from action_logs.\n" if $verbose; |
177 |
$sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(curdate(), interval ? DAY)"); |
177 |
$sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
178 |
$sth->execute($pLogs) or die $dbh->errstr; |
178 |
$sth->execute($pLogs) or die $dbh->errstr; |
179 |
print "Done with purging action_logs.\n" if $verbose; |
179 |
print "Done with purging action_logs.\n" if $verbose; |
180 |
} |
180 |
} |
Lines 217-223
sub RemoveOldSessions {
Link Here
|
217 |
sub PurgeImportTables { |
217 |
sub PurgeImportTables { |
218 |
#First purge import_records |
218 |
#First purge import_records |
219 |
#Delete cascades to import_biblios, import_items and import_record_matches |
219 |
#Delete cascades to import_biblios, import_items and import_record_matches |
220 |
$sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(curdate(), interval ? DAY)"); |
220 |
$sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
221 |
$sth->execute($pImport) or die $dbh->errstr; |
221 |
$sth->execute($pImport) or die $dbh->errstr; |
222 |
|
222 |
|
223 |
# Now purge import_batches |
223 |
# Now purge import_batches |
Lines 229-234
sub PurgeImportTables {
Link Here
|
229 |
FROM import_batches ba |
229 |
FROM import_batches ba |
230 |
LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id |
230 |
LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id |
231 |
WHERE re.import_record_id IS NULL AND |
231 |
WHERE re.import_record_id IS NULL AND |
232 |
ba.upload_timestamp < date_sub(curdate(), interval ? DAY)"); |
232 |
ba.upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
233 |
$sth->execute($pImport) or die $dbh->errstr; |
233 |
$sth->execute($pImport) or die $dbh->errstr; |
234 |
} |
234 |
} |
235 |
- |
|
|