public function __construct($options) { parent::__construct($options); if ($this->workspace && !$this->srcPath) { $this->srcPath = $this->workspace . $this->getType(); } }
/** * Move the file to the workspace. * * @param string $srcPath The original file position * @param string $filename the filename * * @return mixed the new path if success, else false */ protected function handleFile($srcPath, $filename) { Billrun_Factory::log('Relocate receive handle file ' . $filename, Zend_Log::INFO); $srcPath = parent::handleFile($srcPath, $filename); Billrun_Factory::dispatcher()->trigger('beforeRelocateFileHandling', array($this, &$srcPath, $filename)); $newPath = $this->workspace . DIRECTORY_SEPARATOR . static::$type; if (!file_exists($newPath)) { mkdir($newPath, 0777, true); } $newPath .= DIRECTORY_SEPARATOR . $filename; $ret = $this->moveFiles ? copy($srcPath, $newPath) && unlink($srcPath) : copy($srcPath, $newPath); if ($this->preserve_timestamps) { $timestamp = filemtime($srcPath); Billrun_Util::setFileModificationTime($newPath, $timestamp); } Billrun_Factory::dispatcher()->trigger('afterRelocateFileHandling', array($this, &$srcPath, &$newPath, $filename, $ret)); return $ret ? $newPath : FALSE; }