コード例 #1
0
ファイル: github2ftp.php プロジェクト: KasaiDot/github2ftp
function ftp_mk_dir($ftp_stream, $dir)
{
    if (ftp_is_dir($ftp_stream, $dir) || @ftp_mkdir($ftp_stream, $dir)) {
        return true;
    }
    if (!ftp_mk_dir($ftp_stream, dirname($dir))) {
        return false;
    }
    return ftp_mkdir($ftp_stream, $dir);
}
コード例 #2
0
ファイル: deploy.php プロジェクト: Whargal/PTM
 function make_directory($ftp_stream, $dir)
 {
     if (ftp_is_dir($ftp_stream, $dir) || @ftp_mkdir($ftp_stream, $dir)) {
         return true;
     }
     if (!make_directory($ftp_stream, dirname($dir))) {
         return false;
     }
     return ftp_mkdir($ftp_stream, $dir);
 }
コード例 #3
0
ファイル: App.php プロジェクト: rudraks/application
 function create_remote($config, $path = null)
 {
     self::println("Creating Remote : " . $config['path']);
     // set up basic connection
     $conn_id = ftp_connect($config['host']);
     // login with username and password
     $login_result = ftp_login($conn_id, $config['user'], $config['pass']);
     $mypath = $path != null ? $path : $config['path'];
     // try to create the directory $dir
     try {
         if (!ftp_is_dir($conn_id, $mypath)) {
             $folders = explode("/", $mypath);
             $new_path = "";
             foreach ($folders as $key => $folder) {
                 $new_path = $new_path . $folder;
                 if (!ftp_is_dir($conn_id, $new_path) && !ftp_mkdir($conn_id, $new_path)) {
                     self::println("Error: There might be problem while creating " . $new_path);
                 }
                 $new_path = $new_path . "/";
             }
         }
     } catch (Exception $e) {
         self::println("Error: There was a problem while creating " . $mypath);
     }
     // close the connection
     ftp_close($conn_id);
 }
コード例 #4
0
ファイル: FtpProxy.php プロジェクト: ufosky-server/Gvirila
 function remove($path)
 {
     $this->sessionSuspend();
     try {
         $ftp = $this->getConnection();
         $splitPaths = Path::split($path);
         $name = array_pop($splitPaths);
         $this->chdir($ftp, $splitPaths);
         if (ftp_is_dir($ftp, $name)) {
             include_once __DIR__ . '/../fns/ftp_rrmdir.php';
             $ok = ftp_rrmdir($ftp, $name);
             if (!$ok) {
                 throw new ReadWriteException($path);
             }
         } elseif (ftp_is_file($ftp, $name)) {
             $ok = @ftp_delete($ftp, $name);
             if (!$ok) {
                 throw new ReadWriteException($path);
             }
         } else {
             throw new FileNotFoundException($path);
         }
     } catch (Exception $e) {
         $this->sessionResume();
         throw $e;
     }
     $this->sessionResume();
 }