Ejemplo n.º 1
0
function mkdir($dir, $mode = 0777, $recursive = true)
{
    if (TextUtils::endsWith($dir, 'test/dir/mkdirfails')) {
        return false;
    }
    if (TextUtils::endsWith($dir, 'test/dir/mkdirpass')) {
        return true;
    }
    return \mkdir($dir, $mode, $recursive);
}
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function upload($file, $destination, array $options = array())
 {
     if (!is_file($file)) {
         throw new \RuntimeException('Unable to upload; File ' . $file . ' does not exists.');
     }
     $fileName = basename($file);
     if ($destination) {
         if (TextUtils::endsWith($destination, '/')) {
             $destination = $destination . $fileName;
         }
     } else {
         $destination = $fileName;
     }
     $savePath = $this->normalizePath($destination, true);
     $this->verifyPathExists(dirname($savePath), true);
     $this->chdir(dirname($savePath));
     $result = ftp_put($this->connection(), basename($savePath), $file, FTP_BINARY);
     $this->chdir($this->path);
     return $result === false ? false : $this->normalizePath($destination, false, false);
 }