Ejemplo n.º 1
0
 /**
  * Instantiate
  *
  * @param string $dir The full path
  * @param Centurion_Ftp $ftp The FTP connection
  */
 public function __construct($dir, $ftp)
 {
     $this->_dir = $dir;
     $this->_filter = $filter;
     $this->_ftp = $ftp;
     $lines = @ftp_rawlist($this->_ftp->getConnection(), $dir);
     foreach ($lines as $line) {
         preg_match('/^([\\-dl])([rwx\\-]+)\\s+(\\d+)\\s+(\\w+)\\s+(\\w+)\\s+(\\d+)\\s+(\\w+\\s+\\d+\\s+[\\d\\:]+)\\s+(.*)$/', $line, $matches);
         list($trash, $type, $permissions, $unknown, $owner, $group, $bytes, $date, $name) = $matches;
         if ($type != 'l') {
             $this->_data[] = array('type' => $type, 'permissions' => $permissions, 'bytes' => $bytes, 'name' => $name);
         }
     }
     $this->_count = count($this->_data);
 }
Ejemplo n.º 2
0
 /**
  * @return Centurion_Ftp
  */
 protected function _getConnection()
 {
     if (null === $this->_connection) {
         $this->_connection = Centurion_Ftp::connect($this->getOption('server'), $this->getOption('username'), $this->getOption('password'));
     }
     return $this->_connection;
 }
Ejemplo n.º 3
0
 /**
  * Create the directory
  *
  * @return Centurion_Ftp_Directory
  */
 public function create($permissions = null)
 {
     $makedir = @ftp_mkdir($this->_ftp->getConnection(), $this->_path);
     if ($makedir === false) {
         //throw new Centurion_Ftp_Directory_Exception('Unable to create directory "' . $dir . '"');
     }
     if ($permissions !== null) {
         $chmod = $this->_ftp->chmod($this->_path, $permissions);
         if ($chmod === false) {
             //throw new Centurion_Ftp_Directory_Exception('Unable to chmod directory "' . $dir . '"');
         }
     }
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * Change the file permissions
  *
  * @param int|string $mode
  * @return Centurion_Ftp_File
  */
 public function chmod($mode)
 {
     $this->_ftp->chmod($this->_path, $mode);
     return $this;
 }