/** * Description... * * @return void **/ public function total() { if (!$this->_total) { $this->_total = $this->_mapper->storage('total')->loadObjectById($this->total_id); } return $this->_total; }
public function _updateAccessInfo() { if (!$this->_existsInDb()) { return; } M('Db')->exec("UPDATE " . $this->_mapper->table() . " SET access_id = ?, access_inherit = ? WHERE id = ?", $this->_accessId(), $this->_accessInherit(), $this->id()); $this->_mapper->storage()->cacheClear($this); }
/** * Description... * * @return void **/ public function sweeper() { $begin = microtime(true); $images = $reports = 0; $this->_mapper->_usePermissions(FALSE); M('ObjectFs')->srvUsePermissions(0); foreach ($this->_mapper->storage('total')->getObjectList() as $object) { $result = $object->sweeper(); if ($result > 0) { $images += $result; } else { $reports -= $result; } } $end = microtime(true); M('Trace')->trace('total_report_sweeper', "Report sweeper execution time: " . round($end - $begin, 2) . " sec. Deleted: reports - {$reports}, images - {$images}"); // так как sweeper запускается ночью, то отправим емейл с уведомлением (в логах трудно отследить, запускался sweeper ночью или нет). M("MailSend")->sendAdminMail(array("subject" => "Report sweeper", "body" => "Deleted: reports - {$reports}, images - {$images}\n" . 'execution time: ' . round($end - $begin, 2) . ' sec')) or die("Cannot send mail!"); }
/** * Description... * * @return void **/ public function valueSelected($value) { return !isNull(iterFirst($this->_mapper->storage('param')->getObjectList()->filter('total_id=? and varname=?', $this->id(), $value))); }