summaryrefslogtreecommitdiff
path: root/includes/filetransfer
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-05 02:08:53 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-05 02:08:53 +0000
commitfd0e4caf2f6139d44b71d142fca7f07aac65a195 (patch)
treef37b8db34cc002c4ab3a45c8f633b19e1d6f33c5 /includes/filetransfer
parent8f43edf27ee1f78eaf4a7d615c5d0b50803b72e5 (diff)
downloadbrdo-fd0e4caf2f6139d44b71d142fca7f07aac65a195.tar.gz
brdo-fd0e4caf2f6139d44b71d142fca7f07aac65a195.tar.bz2
- Patch #612546 by dhthwy, jpmckinney, dww: remove the broken FileTransferFTPWrapper (file stream) class.
Diffstat (limited to 'includes/filetransfer')
-rw-r--r--includes/filetransfer/ftp.inc70
1 files changed, 1 insertions, 69 deletions
diff --git a/includes/filetransfer/ftp.inc b/includes/filetransfer/ftp.inc
index d370e09db..74a15a451 100644
--- a/includes/filetransfer/ftp.inc
+++ b/includes/filetransfer/ftp.inc
@@ -21,8 +21,7 @@ abstract class FileTransferFTP extends FileTransfer {
* @param array $settings
* @return FileTransferFTP
* The appropriate FileTransferFTP subclass based on the available
- * options. If the FTP PHP extension is available, use it. Otherwise, we
- * try to use the FTP file stream support.
+ * options. If the FTP PHP extension is available, use it.
*/
static function factory($jail, $settings) {
$settings['hostname'] = empty($settings['hostname']) ? 'localhost' : $settings['hostname'];
@@ -31,9 +30,6 @@ abstract class FileTransferFTP extends FileTransfer {
if (function_exists('ftp_connect')) {
$class = 'FileTransferFTPExtension';
}
- elseif (ini_get('allow_url_fopen')) {
- $class = 'FileTransferFTPWrapper';
- }
else {
throw new FileTransferException('No FTP backend available.');
}
@@ -42,70 +38,6 @@ abstract class FileTransferFTP extends FileTransfer {
}
}
-/**
- * Connection class using the FTP URL wrapper.
- */
-class FileTransferFTPWrapper extends FileTransferFTP {
-
- function connect() {
- $this->connection = 'ftp://' . urlencode($this->username) . ':' . urlencode($this->password) . '@' . $this->hostname . ':' . $this->port . '/';
- if (!is_dir($this->connection)) {
- throw new FileTransferException('FTP Connection failed.');
- }
- }
-
- function createDirectoryJailed($directory) {
- if (!@drupal_mkdir($this->connection . $directory)) {
- $exception = new FileTransferException('Cannot create directory @directory.', NULL, array('@directory' => $directory));
- throw $exception;
- }
- }
-
- function removeDirectoryJailed($directory) {
- if (is_dir($this->connection . $directory)) {
- $dh = opendir($this->connection . $directory);
- while (($resource = readdir($dh)) !== FALSE) {
- if ($resource == '.' || $resource == '..') {
- continue;
- }
- $full_path = $directory . DIRECTORY_SEPARATOR . $resource;
- if (is_file($this->connection . $full_path)) {
- $this->removeFile($full_path);
- }
- elseif (is_dir($this->connection . $full_path)) {
- $this->removeDirectory($full_path . '/');
- }
- }
- closedir($dh);
- if (!drupal_rmdir($this->connection . $directory)) {
- $exception = new FileTransferException('Cannot remove @directory.', NULL, array('@directory' => $directory));
- throw $exception;
- }
- }
- }
-
- function copyFileJailed($source, $destination) {
- if (!@copy($source, $this->connection . '/' . $destination)) {
- throw new FileTransferException('Cannot copy @source_file to @destination_file.', NULL, array('@source' => $source, '@destination' => $destination));
- }
- }
-
- function removeFileJailed($destination) {
- if (!@drupal_unlink($this->connection . '/' .$destination)) {
- throw new FileTransferException('Cannot remove @destination', NULL, array('@destination' => $destination));
- }
- }
-
- function isDirectory($path) {
- return is_dir($this->connection . '/' . $path);
- }
-
- public function isFile($path) {
- // This is stupid, but is_file and file_exists don't work! always return true.
- return @fopen($this->connection . '/' . $path,'r');
- }
-}
-
class FileTransferFTPExtension extends FileTransferFTP implements FileTransferChmodInterface {
public function connect() {