display proper oldest record based on the sent date

This commit is contained in:
SJ 2013-10-19 10:39:10 +02:00
parent 6aad513879
commit 447ea6c47f
3 changed files with 6 additions and 2 deletions

View File

@ -56,6 +56,7 @@ create index metadata_idx5 on metadata(`deleted`);
create index metadata_idx6 on metadata(`arrived`); create index metadata_idx6 on metadata(`arrived`);
create index metadata_idx7 on metadata(`retained`); create index metadata_idx7 on metadata(`retained`);
create index metadata_idx8 on metadata(`fromdomain`); create index metadata_idx8 on metadata(`fromdomain`);
create index metadata_idx9 on metadata(`sent`);
create table if not exists `rcpt` ( create table if not exists `rcpt` (

View File

@ -2,3 +2,6 @@
alter table `user_settings` add column `ga_enabled` int default 0; alter table `user_settings` add column `ga_enabled` int default 0;
alter table `user_settings` add column `ga_secret` varchar(255) default null; alter table `user_settings` add column `ga_secret` varchar(255) default null;
create index metadata_idx9 on metadata(`sent`);

View File

@ -169,7 +169,7 @@ class ModelHealthHealth extends Model {
public function get_oldest_record_ts() { public function get_oldest_record_ts() {
$data = array(); $data = array();
$query = $this->db->query("SELECT `sent` AS `oldest_record_ts` FROM " . TABLE_META . " WHERE deleted=0 ORDER BY `arrived` ASC LIMIT 1"); $query = $this->db->query("SELECT `sent` AS `oldest_record_ts` FROM " . TABLE_META . " WHERE `deleted`=0 and `sent` > 837381600 ORDER BY `sent` ASC LIMIT 1");
if(isset($query->rows)) { if(isset($query->rows)) {
$data = array_pop($query->rows); $data = array_pop($query->rows);