| @@ 899-920 (lines=22) @@ | ||
| 896 | * @param string $ftp_file The file to delete |
|
| 897 | * @return boolean Whether or not the operation was successful |
|
| 898 | */ |
|
| 899 | public function unlink($ftp_file) |
|
| 900 | { |
|
| 901 | // We are actually connected, right? |
|
| 902 | if (!is_resource($this->connection)) |
|
| 903 | return false; |
|
| 904 | ||
| 905 | // Delete file X. |
|
| 906 | fwrite($this->connection, 'DELE ' . $ftp_file . "\r\n"); |
|
| 907 | if (!$this->check_response(250)) |
|
| 908 | { |
|
| 909 | fwrite($this->connection, 'RMD ' . $ftp_file . "\r\n"); |
|
| 910 | ||
| 911 | // Still no love? |
|
| 912 | if (!$this->check_response(250)) |
|
| 913 | { |
|
| 914 | $this->error = 'bad_file'; |
|
| 915 | return false; |
|
| 916 | } |
|
| 917 | } |
|
| 918 | ||
| 919 | return true; |
|
| 920 | } |
|
| 921 | ||
| 922 | /** |
|
| 923 | * Reads the response to the command from the server |
|
| @@ 314-335 (lines=22) @@ | ||
| 311 | return true; |
|
| 312 | } |
|
| 313 | ||
| 314 | function unlink($ftp_file) |
|
| 315 | { |
|
| 316 | // We are actually connected, right? |
|
| 317 | if (!is_resource($this->connection)) |
|
| 318 | return false; |
|
| 319 | ||
| 320 | // Delete file X. |
|
| 321 | fwrite($this->connection, 'DELE ' . $ftp_file . "\r\n"); |
|
| 322 | if (!$this->check_response(250)) |
|
| 323 | { |
|
| 324 | fwrite($this->connection, 'RMD ' . $ftp_file . "\r\n"); |
|
| 325 | ||
| 326 | // Still no love? |
|
| 327 | if (!$this->check_response(250)) |
|
| 328 | { |
|
| 329 | $this->error = 'bad_file'; |
|
| 330 | return false; |
|
| 331 | } |
|
| 332 | } |
|
| 333 | ||
| 334 | return true; |
|
| 335 | } |
|
| 336 | ||
| 337 | function check_response($desired) |
|
| 338 | { |
|
| @@ 1751-1772 (lines=22) @@ | ||
| 1748 | return true; |
|
| 1749 | } |
|
| 1750 | ||
| 1751 | function unlink($ftp_file) |
|
| 1752 | { |
|
| 1753 | // We are actually connected, right? |
|
| 1754 | if (!is_resource($this->connection)) |
|
| 1755 | return false; |
|
| 1756 | ||
| 1757 | // Delete file X. |
|
| 1758 | fwrite($this->connection, 'DELE ' . $ftp_file . "\r\n"); |
|
| 1759 | if (!$this->check_response(250)) |
|
| 1760 | { |
|
| 1761 | fwrite($this->connection, 'RMD ' . $ftp_file . "\r\n"); |
|
| 1762 | ||
| 1763 | // Still no love? |
|
| 1764 | if (!$this->check_response(250)) |
|
| 1765 | { |
|
| 1766 | $this->error = 'bad_file'; |
|
| 1767 | return false; |
|
| 1768 | } |
|
| 1769 | } |
|
| 1770 | ||
| 1771 | return true; |
|
| 1772 | } |
|
| 1773 | ||
| 1774 | function check_response($desired) |
|
| 1775 | { |
|