/** * Save serialized message map in directory. Parameter are getHeader() parameter plus raw_headers, body and * attachments. * * @param string $dir * @param int $msg_num */ public function save($dir, $msg_num) { require_once __DIR__ . '/File.class.php'; $this->selectMsg($msg_num); $h = $this->getHeader(); $save_as = $dir . '/mail_' . date('YmdHis', $h['udate']) . '_' . $h['mid'] . '.ser'; if (File::exists($save_as)) { return; } $h['raw_headers'] = imap_fetchheader($this->con, $this->id, $this->id_as_uid | FT_PREFETCHTEXT); $h['body'] = imap_body($this->con, $this->id, $this->id_as_uid); $h['attachments'] = $this->getAttachments(); File::serialize($save_as, $h); }
/** * Tokenize file content according to $rx ({[a-zA-Z0-9_]*:.*}). * * @param string $txt */ public function load($file) { $this->setText(File::load($file)); $this->file = $file; }
/** * */ public function loadDump($file) { File::exists($file, true); $dsn = $this->getDSN(true); lib\execute("mysql -h " . $dsn['host'] . " -u '" . $dsn['login'] . "' -p'" . $dsn['password'] . "' '" . $dsn['name'] . "' < '" . $file . "'"); }