diff options
Diffstat (limited to 'vendor/thecodingmachine/safe/generated/ftp.php')
-rw-r--r-- | vendor/thecodingmachine/safe/generated/ftp.php | 251 |
1 files changed, 151 insertions, 100 deletions
diff --git a/vendor/thecodingmachine/safe/generated/ftp.php b/vendor/thecodingmachine/safe/generated/ftp.php index 174882657..23846bf1f 100644 --- a/vendor/thecodingmachine/safe/generated/ftp.php +++ b/vendor/thecodingmachine/safe/generated/ftp.php @@ -8,17 +8,17 @@ use Safe\Exceptions\FtpException; * Sends an ALLO command to the remote FTP server to * allocate space for a file to be uploaded. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param int $filesize The number of bytes to allocate. - * @param string $result A textual representation of the servers response will be returned by - * reference in result if a variable is provided. + * @param resource $ftp An FTP\Connection instance. + * @param int $size The number of bytes to allocate. + * @param string|null $response A textual representation of the servers response will be returned by + * reference in response if a variable is provided. * @throws FtpException * */ -function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void +function ftp_alloc($ftp, int $size, ?string &$response = null): void { error_clear_last(); - $result = \ftp_alloc($ftp_stream, $filesize, $result); + $result = \ftp_alloc($ftp, $size, $response); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -28,17 +28,17 @@ function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void /** * * - * @param resource $ftp - * @param string $remote_file - * @param string $local_file + * @param resource $ftp An FTP\Connection instance. + * @param string $remote_filename + * @param string $local_filename * @param int $mode * @throws FtpException * */ -function ftp_append($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY): void +function ftp_append($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): void { error_clear_last(); - $result = \ftp_append($ftp, $remote_file, $local_file, $mode); + $result = \ftp_append($ftp, $remote_filename, $local_filename, $mode); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -48,14 +48,14 @@ function ftp_append($ftp, string $remote_file, string $local_file, int $mode = F /** * Changes to the parent directory. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @throws FtpException * */ -function ftp_cdup($ftp_stream): void +function ftp_cdup($ftp): void { error_clear_last(); - $result = \ftp_cdup($ftp_stream); + $result = \ftp_cdup($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -65,15 +65,15 @@ function ftp_cdup($ftp_stream): void /** * Changes the current directory to the specified one. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $directory The target directory. * @throws FtpException * */ -function ftp_chdir($ftp_stream, string $directory): void +function ftp_chdir($ftp, string $directory): void { error_clear_last(); - $result = \ftp_chdir($ftp_stream, $directory); + $result = \ftp_chdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -82,19 +82,19 @@ function ftp_chdir($ftp_stream, string $directory): void /** * Sets the permissions on the specified remote file to - * mode. + * permissions. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param int $mode The new permissions, given as an octal value. + * @param resource $ftp An FTP\Connection instance. + * @param int $permissions The new permissions, given as an octal value. * @param string $filename The remote file. * @return int Returns the new file permissions on success. * @throws FtpException * */ -function ftp_chmod($ftp_stream, int $mode, string $filename): int +function ftp_chmod($ftp, int $permissions, string $filename): int { error_clear_last(); - $result = \ftp_chmod($ftp_stream, $mode, $filename); + $result = \ftp_chmod($ftp, $permissions, $filename); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -106,14 +106,14 @@ function ftp_chmod($ftp_stream, int $mode, string $filename): int * ftp_close closes the given link identifier * and releases the resource. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @throws FtpException * */ -function ftp_close($ftp_stream): void +function ftp_close($ftp): void { error_clear_last(); - $result = \ftp_close($ftp_stream); + $result = \ftp_close($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -122,9 +122,9 @@ function ftp_close($ftp_stream): void /** * ftp_connect opens an FTP connection to the - * specified host. + * specified hostname. * - * @param string $host The FTP server address. This parameter shouldn't have any trailing + * @param string $hostname The FTP server address. This parameter shouldn't have any trailing * slashes and shouldn't be prefixed with ftp://. * @param int $port This parameter specifies an alternate port to connect to. If it is * omitted or set to zero, then the default FTP port, 21, will be used. @@ -132,14 +132,14 @@ function ftp_close($ftp_stream): void * If omitted, the default value is 90 seconds. The timeout can be changed and * queried at any time with ftp_set_option and * ftp_get_option. - * @return resource Returns a FTP stream on success. + * @return resource Returns an FTP\Connection instance on success. * @throws FtpException * */ -function ftp_connect(string $host, int $port = 21, int $timeout = 90) +function ftp_connect(string $hostname, int $port = 21, int $timeout = 90) { error_clear_last(); - $result = \ftp_connect($host, $port, $timeout); + $result = \ftp_connect($hostname, $port, $timeout); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -149,17 +149,17 @@ function ftp_connect(string $host, int $port = 21, int $timeout = 90) /** * ftp_delete deletes the file specified by - * path from the FTP server. + * filename from the FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $path The file to delete. + * @param resource $ftp An FTP\Connection instance. + * @param string $filename The file to delete. * @throws FtpException * */ -function ftp_delete($ftp_stream, string $path): void +function ftp_delete($ftp, string $filename): void { error_clear_last(); - $result = \ftp_delete($ftp_stream, $path); + $result = \ftp_delete($ftp, $filename); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -167,22 +167,22 @@ function ftp_delete($ftp_stream, string $path): void /** - * ftp_fget retrieves remote_file + * ftp_fget retrieves remote_filename * from the FTP server, and writes it to the given file pointer. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param resource $handle An open file pointer in which we store the data. - * @param string $remote_file The remote file path. + * @param resource $ftp An FTP\Connection instance. + * @param resource $stream An open file pointer in which we store the data. + * @param string $remote_filename The remote file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $resumepos The position in the remote file to start downloading from. + * @param int $offset The position in the remote file to start downloading from. * @throws FtpException * */ -function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void +function ftp_fget($ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_fget($ftp_stream, $handle, $remote_file, $mode, $resumepos); + $result = \ftp_fget($ftp, $stream, $remote_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -193,19 +193,19 @@ function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = FTP_BIN * ftp_fput uploads the data from a file pointer * to a remote file on the FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $remote_file The remote file path. - * @param resource $handle An open file pointer on the local file. Reading stops at end of file. + * @param resource $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param resource $stream An open file pointer on the local file. Reading stops at end of file. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $startpos The position in the remote file to start uploading to. + * @param int $offset The position in the remote file to start uploading to. * @throws FtpException * */ -function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = FTP_BINARY, int $startpos = 0): void +function ftp_fput($ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_fput($ftp_stream, $remote_file, $handle, $mode, $startpos); + $result = \ftp_fput($ftp, $remote_filename, $stream, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -216,19 +216,19 @@ function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = FTP_BIN * ftp_get retrieves a remote file from the FTP server, * and saves it into a local file. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $local_file The local file path (will be overwritten if the file already exists). - * @param string $remote_file The remote file path. + * @param resource $ftp An FTP\Connection instance. + * @param string $local_filename The local file path (will be overwritten if the file already exists). + * @param string $remote_filename The remote file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $resumepos The position in the remote file to start downloading from. + * @param int $offset The position in the remote file to start downloading from. * @throws FtpException * */ -function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void +function ftp_get($ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos); + $result = \ftp_get($ftp, $local_filename, $remote_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -236,18 +236,18 @@ function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode /** - * Logs in to the given FTP stream. + * Logs in to the given FTP connection. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $username The username (USER). * @param string $password The password (PASS). * @throws FtpException * */ -function ftp_login($ftp_stream, string $username, string $password): void +function ftp_login($ftp, string $username, string $password): void { error_clear_last(); - $result = \ftp_login($ftp_stream, $username, $password); + $result = \ftp_login($ftp, $username, $password); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -257,16 +257,16 @@ function ftp_login($ftp_stream, string $username, string $password): void /** * Creates the specified directory on the FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $directory The name of the directory that will be created. * @return string Returns the newly created directory name on success. * @throws FtpException * */ -function ftp_mkdir($ftp_stream, string $directory): string +function ftp_mkdir($ftp, string $directory): string { error_clear_last(); - $result = \ftp_mkdir($ftp_stream, $directory); + $result = \ftp_mkdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -277,16 +277,16 @@ function ftp_mkdir($ftp_stream, string $directory): string /** * * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $directory The directory to be listed. * @return array Returns an array of arrays with file infos from the specified directory on success. * @throws FtpException * */ -function ftp_mlsd($ftp_stream, string $directory): array +function ftp_mlsd($ftp, string $directory): array { error_clear_last(); - $result = \ftp_mlsd($ftp_stream, $directory); + $result = \ftp_mlsd($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -295,21 +295,50 @@ function ftp_mlsd($ftp_stream, string $directory): array /** + * ftp_nb_put stores a local file on the FTP server. * + * The difference between this function and the ftp_put + * is that this function uploads the file asynchronously, so your program can + * perform other operations while the file is being uploaded. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param string $local_filename The local file path. + * @param int $mode The transfer mode. Must be either FTP_ASCII or + * FTP_BINARY. + * @param int $offset The position in the remote file to start uploading to. + * @return int Returns FTP_FAILED or FTP_FINISHED + * or FTP_MOREDATA to open the local file. + * @throws FtpException + * + */ +function ftp_nb_put($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int +{ + error_clear_last(); + $result = \ftp_nb_put($ftp, $remote_filename, $local_filename, $mode, $offset); + if ($result === false) { + throw FtpException::createFromPhpError(); + } + return $result; +} + + +/** + * + * + * @param resource $ftp An FTP\Connection instance. * @param string $directory The directory to be listed. This parameter can also include arguments, eg. - * ftp_nlist($conn_id, "-la /your/dir"); + * ftp_nlist($ftp, "-la /your/dir");. * Note that this parameter isn't escaped so there may be some issues with * filenames containing spaces and other characters. * @return array Returns an array of filenames from the specified directory on success. * @throws FtpException * */ -function ftp_nlist($ftp_stream, string $directory): array +function ftp_nlist($ftp, string $directory): array { error_clear_last(); - $result = \ftp_nlist($ftp_stream, $directory); + $result = \ftp_nlist($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -326,15 +355,15 @@ function ftp_nlist($ftp_stream, string $directory): array * Please note that ftp_pasv can only be called after a * successful login or otherwise it will fail. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param bool $pasv If TRUE, the passive mode is turned on, else it's turned off. + * @param resource $ftp An FTP\Connection instance. + * @param bool $enable If TRUE, the passive mode is turned on, else it's turned off. * @throws FtpException * */ -function ftp_pasv($ftp_stream, bool $pasv): void +function ftp_pasv($ftp, bool $enable): void { error_clear_last(); - $result = \ftp_pasv($ftp_stream, $pasv); + $result = \ftp_pasv($ftp, $enable); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -344,19 +373,19 @@ function ftp_pasv($ftp_stream, bool $pasv): void /** * ftp_put stores a local file on the FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $remote_file The remote file path. - * @param string $local_file The local file path. + * @param resource $ftp An FTP\Connection instance. + * @param string $remote_filename The remote file path. + * @param string $local_filename The local file path. * @param int $mode The transfer mode. Must be either FTP_ASCII or * FTP_BINARY. - * @param int $startpos The position in the remote file to start uploading to. + * @param int $offset The position in the remote file to start uploading to. * @throws FtpException * */ -function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): void +function ftp_put($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): void { error_clear_last(); - $result = \ftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos); + $result = \ftp_put($ftp, $remote_filename, $local_filename, $mode, $offset); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -366,15 +395,15 @@ function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode /** * * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @return string Returns the current directory name. * @throws FtpException * */ -function ftp_pwd($ftp_stream): string +function ftp_pwd($ftp): string { error_clear_last(); - $result = \ftp_pwd($ftp_stream); + $result = \ftp_pwd($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -383,19 +412,41 @@ function ftp_pwd($ftp_stream): string /** + * Sends an arbitrary command to the FTP server. + * + * @param resource $ftp An FTP\Connection instance. + * @param string $command The command to execute. + * @return array Returns the server's response as an array of strings. + * No parsing is performed on the response string, nor does + * ftp_raw determine if the command succeeded. + * @throws FtpException + * + */ +function ftp_raw($ftp, string $command): array +{ + error_clear_last(); + $result = \ftp_raw($ftp, $command); + if ($result === null) { + throw FtpException::createFromPhpError(); + } + return $result; +} + + +/** * ftp_rename renames a file or a directory on the FTP * server. * - * @param resource $ftp_stream The link identifier of the FTP connection. - * @param string $oldname The old file/directory name. - * @param string $newname The new name. + * @param resource $ftp An FTP\Connection instance. + * @param string $from The old file/directory name. + * @param string $to The new name. * @throws FtpException * */ -function ftp_rename($ftp_stream, string $oldname, string $newname): void +function ftp_rename($ftp, string $from, string $to): void { error_clear_last(); - $result = \ftp_rename($ftp_stream, $oldname, $newname); + $result = \ftp_rename($ftp, $from, $to); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -405,16 +456,16 @@ function ftp_rename($ftp_stream, string $oldname, string $newname): void /** * Removes the specified directory on the FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $directory The directory to delete. This must be either an absolute or relative * path to an empty directory. * @throws FtpException * */ -function ftp_rmdir($ftp_stream, string $directory): void +function ftp_rmdir($ftp, string $directory): void { error_clear_last(); - $result = \ftp_rmdir($ftp_stream, $directory); + $result = \ftp_rmdir($ftp, $directory); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -429,16 +480,16 @@ function ftp_rmdir($ftp_stream, string $directory): void * to server. They are useful for handling such things as file permissions and * group membership. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @param string $command The SITE command. Note that this parameter isn't escaped so there may * be some issues with filenames containing spaces and other characters. * @throws FtpException * */ -function ftp_site($ftp_stream, string $command): void +function ftp_site($ftp, string $command): void { error_clear_last(); - $result = \ftp_site($ftp_stream, $command); + $result = \ftp_site($ftp, $command); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -447,14 +498,14 @@ function ftp_site($ftp_stream, string $command): void /** * ftp_ssl_connect opens an explicit SSL-FTP connection to the - * specified host. That implies that + * specified hostname. That implies that * ftp_ssl_connect will succeed even if the server is not * configured for SSL-FTP, or its certificate is invalid. Only when * ftp_login is called, the client will send the * appropriate AUTH FTP command, so ftp_login will fail in * the mentioned cases. * - * @param string $host The FTP server address. This parameter shouldn't have any trailing + * @param string $hostname The FTP server address. This parameter shouldn't have any trailing * slashes and shouldn't be prefixed with ftp://. * @param int $port This parameter specifies an alternate port to connect to. If it is * omitted or set to zero, then the default FTP port, 21, will be used. @@ -462,14 +513,14 @@ function ftp_site($ftp_stream, string $command): void * If omitted, the default value is 90 seconds. The timeout can be changed and * queried at any time with ftp_set_option and * ftp_get_option. - * @return resource Returns a SSL-FTP stream on success. + * @return resource Returns an FTP\Connection instance on success. * @throws FtpException * */ -function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) +function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90) { error_clear_last(); - $result = \ftp_ssl_connect($host, $port, $timeout); + $result = \ftp_ssl_connect($hostname, $port, $timeout); if ($result === false) { throw FtpException::createFromPhpError(); } @@ -480,15 +531,15 @@ function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) /** * Returns the system type identifier of the remote FTP server. * - * @param resource $ftp_stream The link identifier of the FTP connection. + * @param resource $ftp An FTP\Connection instance. * @return string Returns the remote system type. * @throws FtpException * */ -function ftp_systype($ftp_stream): string +function ftp_systype($ftp): string { error_clear_last(); - $result = \ftp_systype($ftp_stream); + $result = \ftp_systype($ftp); if ($result === false) { throw FtpException::createFromPhpError(); } |