syntax errors

This commit is contained in:
Matthew Exon 2022-03-02 22:05:28 +01:00
parent 7f3679e225
commit 7871f7bbf7

View file

@ -206,8 +206,8 @@ function phototrack_search_table($a, $table) {
} }
} }
$r = DBA::p("SELECT COUNT(*) FROM `$table` LEFT OUTER JOIN phototrack_row_check ON ( phototrack_row_check.`table` = '$table' AND phototrack_row_check.`row-id` = `$table`.id ) WHERE ( ( phototrack_row_check.checked IS NULL ) OR ( phototrack_row_check.checked < DATE_SUB(NOW(), INTERVAL 1 MONTH) ) )"); $r = DBA::p("SELECT COUNT(*) FROM `$table` LEFT OUTER JOIN phototrack_row_check ON ( phototrack_row_check.`table` = '$table' AND phototrack_row_check.`row-id` = `$table`.id ) WHERE ( ( phototrack_row_check.checked IS NULL ) OR ( phototrack_row_check.checked < DATE_SUB(NOW(), INTERVAL 1 MONTH) ) )");
$remaining = DBA::fetch($r)['count(*)']; $remaining = DBA::fetch($r)['count'];
Logger::info('phototrack: searched ' . count($rows) . ' rows in table ' . $table . ', ' . $remaining . ' still remaining to search'); Logger::info('phototrack: searched ' . DBA::numRows($rows) . ' rows in table ' . $table . ', ' . $remaining . ' still remaining to search');
return $remaining; return $remaining;
} }
@ -262,12 +262,12 @@ function phototrack_tidy() {
Logger::debug('phototrack: remove photo ' . $row['resource-id']); Logger::debug('phototrack: remove photo ' . $row['resource-id']);
DBA::e('DELETE FROM photo WHERE `resource-id` = "' . $row['resource-id'] . '"'); DBA::e('DELETE FROM photo WHERE `resource-id` = "' . $row['resource-id'] . '"');
} }
Logger::info('phototrack_tidy: deleted ' . count($rows) . ' photos'); Logger::info('phototrack_tidy: deleted ' . DBA::numRows($rows) . ' photos');
} }
DBA::e('DROP TABLE `phototrack-temp`'); DBA::e('DROP TABLE `phototrack-temp`');
$rows = DBA::p('SELECT id FROM phototrack_photo_use WHERE checked < DATE_SUB(NOW(), INTERVAL 14 DAY)'); $rows = DBA::p('SELECT id FROM phototrack_photo_use WHERE checked < DATE_SUB(NOW(), INTERVAL 14 DAY)');
foreach ($rows as $row) { foreach ($rows as $row) {
DBA::e( 'DELETE FROM phototrack_photo_use WHERE id = ' . $row['id']); DBA::e( 'DELETE FROM phototrack_photo_use WHERE id = ' . $row['id']);
} }
Logger::info('phototrack_tidy: deleted ' . count($rows) . ' phototrack_photo_use rows'); Logger::info('phototrack_tidy: deleted ' . DBA::numRows($rows) . ' phototrack_photo_use rows');
} }