/** * author thuan.nguyenhuy@gmail.com * set records of logfiles collection (Upload:1 /Donwload:2 /Rename:3 /Move:4 /Copy:5 /Clone:6) * @param int $ownerId * @param array $log include log information: action, content, descr, ip * @return array */ public static function historyAction($action, $linkCode, $allowdelete = 0) { $info = UserFile::getRecordInfoByLinkcode($linkCode, $allowdelete); $log = array('action' => Yii::t('logfile', $action), 'files' => $info, 'owner_id' => Yii::app()->user->id, 'descr' => $action, 'ip' => Yii::app()->request->userHostAddress); $isert = new LogFiles(); $isert->_id = User::exportRandomPass(22); $isert->action = new MongoInt32($log["action"]); $isert->files = $log["files"]; $isert->owner_id = new MongoInt32(Yii::app()->user->id); $isert->descr = $log["descr"]; $isert->ip = $log["ip"]; $isert->save(); }