/** * * * * @access * @param * @return */ function createRevision($userfile_name, $userfile_size, $userfile_type, $userfile_tmpname) { if (!$this->setFilename(urldecode($userfile_name))) { return -1; } if ($this->getId()) { $this->initWithId($this->getId()); } elseif (!$this->initFilesystemName()) { return -1; } if (!$this->exist()) { if (!$this->create()) { return -1; } } $att_rev = new PHPWikiAttachmentRevision($this->gid); $att_rev->setFilename($this->getFilesystemName()); $att_rev->setOwnerId(user_getid()); $att_rev->setAttachmentId($this->getId()); $att_rev->setMimeType($userfile_type); $att_rev->setDate(time()); if (!$att_rev->setSize($userfile_size)) { return -1; } if (!$att_rev->create($userfile_tmpname)) { return -1; } return $att_rev->getRevision(); }