mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:40:12 +01:00
updated google model
This commit is contained in:
parent
1be641087e
commit
4e6946feca
@ -46,12 +46,13 @@ class ModelGoogleGoogle extends Model {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save all Messages from selected folder
|
||||
|
||||
private function saveMessages($email) {
|
||||
$last_msg_id = -1;
|
||||
$from = 1;
|
||||
$downloaded = 0;
|
||||
$count = 0;
|
||||
$storage = $this->storage;
|
||||
|
||||
$from = $this->get_last_message_id_by_unique_id($email, $storage) + 1;
|
||||
@ -86,7 +87,7 @@ class ModelGoogleGoogle extends Model {
|
||||
|
||||
rename(DIR_TMP . "/" . $tmpname, DIR_IMAP . "/" . $tmpname);
|
||||
|
||||
$downloaded++;
|
||||
$count++;
|
||||
}
|
||||
//print "k: $k\n";
|
||||
}
|
||||
@ -97,13 +98,14 @@ class ModelGoogleGoogle extends Model {
|
||||
}
|
||||
|
||||
|
||||
syslog(LOG_INFO, "downloaded $downloaded messages for $email");
|
||||
syslog(LOG_INFO, "downloaded $count messages for $email");
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
public function download_users_emails($email, $accessToken) {
|
||||
|
||||
$count = 0;
|
||||
|
||||
if(!$email || !$accessToken) { return 0; }
|
||||
|
||||
@ -121,12 +123,13 @@ class ModelGoogleGoogle extends Model {
|
||||
|
||||
if($folder->isSelectable()) {
|
||||
$this->storage->selectFolder($folder);
|
||||
$this->saveMessages($email);
|
||||
$count += $this->saveMessages($email);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user