/** * Instantiate * * @param string $dir The full path * @param Zend_Ftp $ftp The FTP connection */ public function __construct($dir, $ftp) { $this->_dir = $dir; $this->_ftp = $ftp; $lines = @ftp_rawlist($this->_ftp->getConnection(), $this->_dir->path); if (!is_array($lines)) { return false; } $this->processDirectoryData($lines); }
/** * * @return int the last modified time as a Unix timestamp */ public function getModificationTime() { $timestamp = @ftp_mdtm($this->_ftp->getConnection(), $this->_path); if ($timestamp == -1) { // try to get the timestamp by the file extra data if (isset($this->extraData['date']) && $this->extraData['date'] != -1) { $timestamp = $this->extraData['date']; } else { return false; } } return $timestamp; }
/** * Create the directory * * @return Zend_Ftp_Directory */ public function create($permissions = null) { $makedir = @ftp_mkdir($this->_ftp->getConnection(), $this->_path); if ($makedir === false) { //throw new Zend_Ftp_Directory_Exception('Unable to create directory "' . $dir . '"'); } if ($permissions !== null) { $chmod = $this->_ftp->chmod($this->_path, $permissions); if ($chmod === false) { //throw new Zend_Ftp_Directory_Exception('Unable to chmod directory "' . $dir . '"'); } } return $this; }