cvs: pear /Net_FTP/Net FTP.php

From: Date: Fri, 19 Mar 2004 10:26:49 +0000
Subject: cvs: pear /Net_FTP/Net FTP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-17544@lists.php.net to get a copy of this message
toby Fri Mar 19 05:26:49 2004 EDT Modified files: /pear/Net_FTP/Net FTP.php Log: * Added rename() functionality. Thanks to the unnamed coder from "Webmestre ESGI" <wmaster_esgi@hotmail.com>. http://cvs.php.net/diff.php/pear/Net_FTP/Net/FTP.php?r1=1.15&r2=1.16&ty=u Index: pear/Net_FTP/Net/FTP.php diff -u pear/Net_FTP/Net/FTP.php:1.15 pear/Net_FTP/Net/FTP.php:1.16 --- pear/Net_FTP/Net/FTP.php:1.15 Tue Mar 16 16:18:10 2004 +++ pear/Net_FTP/Net/FTP.php Fri Mar 19 05:26:48 2004 @@ -14,7 +14,7 @@ // | Authors: Tobias Schlitt <toby@php.net> | // +----------------------------------------------------------------------+ // -// $Id: FTP.php,v 1.15 2004/03/16 21:18:10 toby Exp $ +// $Id: FTP.php,v 1.16 2004/03/19 10:26:48 toby Exp $ require_once 'PEAR.php'; @@ -484,6 +484,24 @@ } // end method chmodRecursive /** + * Rename or move a file or a directory from the ftp-server + * + * @access public + * @param string $remote_from The remote file or directory original to rename or move + * @param string $remote_to The remote file or directory final to rename or move + * @return bool $res True on success, otherwise PEAR::Error + */ + + function rename ( $remote_from, $remote_to ) + { + $res = @ftp_rename($this->_handle, $remote_from, $remote_to); + if(!$res) { + return $this->raiseError("Could not rename ".$remote_from." to ".$remote_to." !", 0); + } + return true; + } + + /** * This will return logical permissions mask for directory. * if directory have to be writeable it have also be executable * @@ -491,6 +509,7 @@ * @param string $permissions File permissions in digits for file (i.e. 666) * @return string File permissions in digits for directory (i.e. 777) */ + function makeDirPermissions($permissions){ $permissions = (string)$permissions; @@ -1538,4 +1557,4 @@ return $res; } } -?> \ No newline at end of file +?>

« previous php.pear.cvs (#17544) next »