function clean() { try { $this->taskCleanDir(['build'])->run(); } catch (\Exception $e) { Console::error("Cannot Clean Directory"); } return $this; }
public static function mkdir($config, $path = null) { Console::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 (!self::is_dir($conn_id, $mypath)) { $folders = explode("/", $mypath); $new_path = ""; foreach ($folders as $key => $folder) { $new_path = $new_path . $folder; if (!self::is_dir($conn_id, $new_path) && !ftp_mkdir($conn_id, $new_path)) { Console::println("Error: There might be problem while creating " . $new_path); } $new_path = $new_path . "/"; } } } catch (Exception $e) { Console::println("Error: There was a problem while creating " . $mypath); } // close the connection ftp_close($conn_id); }