Lines 128-134
if ($zebraqueue_days) {
Link Here
|
128 |
} |
128 |
} |
129 |
$sth = $dbh->prepare( |
129 |
$sth = $dbh->prepare( |
130 |
"SELECT id,biblio_auth_number,server,time FROM zebraqueue |
130 |
"SELECT id,biblio_auth_number,server,time FROM zebraqueue |
131 |
WHERE done=1 and time < date_sub(curdate(), interval ? day)" |
131 |
WHERE done=1 and time < date_sub(CAST(now() AS date), interval ? day)" |
132 |
); |
132 |
); |
133 |
$sth->execute($zebraqueue_days) or die $dbh->errstr; |
133 |
$sth->execute($zebraqueue_days) or die $dbh->errstr; |
134 |
$sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?"); |
134 |
$sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?"); |
Lines 144-150
if ($zebraqueue_days) {
Link Here
|
144 |
if ($mail) { |
144 |
if ($mail) { |
145 |
print "Mail queue purge triggered for $mail days.\n" if ($verbose); |
145 |
print "Mail queue purge triggered for $mail days.\n" if ($verbose); |
146 |
|
146 |
|
147 |
$sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(curdate(), interval ? day)"); |
147 |
$sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(CAST(now() AS date), interval ? day)"); |
148 |
$sth->execute($mail) or die $dbh->errstr; |
148 |
$sth->execute($mail) or die $dbh->errstr; |
149 |
my $count = $sth->rows; |
149 |
my $count = $sth->rows; |
150 |
$sth->finish; |
150 |
$sth->finish; |
Lines 167-173
if($pImport) {
Link Here
|
167 |
|
167 |
|
168 |
if($pLogs) { |
168 |
if($pLogs) { |
169 |
print "Purging records from action_logs.\n" if $verbose; |
169 |
print "Purging records from action_logs.\n" if $verbose; |
170 |
$sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(curdate(), interval ? DAY)"); |
170 |
$sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
171 |
$sth->execute($pLogs) or die $dbh->errstr; |
171 |
$sth->execute($pLogs) or die $dbh->errstr; |
172 |
print "Done with purging action_logs.\n" if $verbose; |
172 |
print "Done with purging action_logs.\n" if $verbose; |
173 |
} |
173 |
} |
Lines 204-210
sub RemoveOldSessions {
Link Here
|
204 |
sub PurgeImportTables { |
204 |
sub PurgeImportTables { |
205 |
#First purge import_records |
205 |
#First purge import_records |
206 |
#Delete cascades to import_biblios, import_items and import_record_matches |
206 |
#Delete cascades to import_biblios, import_items and import_record_matches |
207 |
$sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(curdate(), interval ? DAY)"); |
207 |
$sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
208 |
$sth->execute($pImport) or die $dbh->errstr; |
208 |
$sth->execute($pImport) or die $dbh->errstr; |
209 |
|
209 |
|
210 |
# Now purge import_batches |
210 |
# Now purge import_batches |
Lines 216-221
sub PurgeImportTables {
Link Here
|
216 |
FROM import_batches ba |
216 |
FROM import_batches ba |
217 |
LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id |
217 |
LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id |
218 |
WHERE re.import_record_id IS NULL AND |
218 |
WHERE re.import_record_id IS NULL AND |
219 |
ba.upload_timestamp < date_sub(curdate(), interval ? DAY)"); |
219 |
ba.upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)"); |
220 |
$sth->execute($pImport) or die $dbh->errstr; |
220 |
$sth->execute($pImport) or die $dbh->errstr; |
221 |
} |
221 |
} |
222 |
- |
|
|