[PHP-DEV] New FTP extension functionality

2002-07-27 Thread Stefan Esser

Hi,

yesterday I did several commits to the FTP extension. Due to the fact that
I do not know how I can document the stuff myself and right now am lacking
the time here is a brief instruction:

Stefan Esser

---
5 new constants
---

FTP_AUTOSEEK new option for get/set_option: when enabled (which is default)
 get/put requests with a resumepos/startpos will first seek
 to the wanted position within the stream
 
FTP_AUTORESUME   automaticly determine resumepos/startpos for get/put request
 (does only work if AUTOSEEK is enabled)

FTP_FAILED   asynchronous transfer has failed
FTP_FINISHED asynchronous transfer has finished
FTP_MOREDATA asynchronous transfer is still active

New optional 5th parameter
--

Added optional startpos to ftp_put/ftp_fput (works like in the async examples)
Added optional resumepos to ftp_get/ftp_fget (works like in the async examples)

New asynchronous FTP functions
--

int ftp_async_get(resource ftp_stream, string local_file, string remote_file, int 
mode[, int resumepos])
int ftp_async_fget(resource ftp_stream, resource fp, string remote_file, int mode[, 
int resumepos])
int ftp_async_put(resource ftp_stream, string remote_file, string local_file, int 
mode[, int startpos])
int ftp_async_fput(resource ftp_stream, string remote_file, resource fp, int mode[, 
int startpos])
int ftp_async_continue(resource ftp_stream)


Example (Downloading a file):
-

...
// Initate the Download
$ret = ftp_async_get ($my_connection, test, README, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error downloading the file...;
   exit(1);
}
...

Example (Uploading a file):
-

...
// Initiate the Upload
$ret = ftp_async_put ($my_connection, test.remote, test.local, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue uploading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error uploading the file...;
   exit(1);
}
...


Example (Resume downloading a file):


...
// Initate 
$ret = ftp_async_get ($my_connection, test, README, FTP_BINARY, 
  filesize(test));
// OR: $ret = ftp_async_get ($my_connection, test, README, 
//   FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error downloading the file...;
   exit(1);
}
...

Example (Resume uploading a file):
--

...
// Initiate
$ret = ftp_async_put ($my_connection, test.remote, test.local, 
  FTP_BINARY, ftp_size(test.remote));
// OR: $ret = ftp_async_put ($my_connection, test.remote, test.local, 
//   FTP_BINARY, FTP_AUTORESUME);

while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo .;

   // Continue uploading...
   $ret = ftp_async_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo There was an error uploading the file...;
   exit(1);
}
...

Example (Resume downloading at position 100 to a new file):
---
...
// Disable Autoseek
ftp_set_option ($my_connection, FTP_AUTOSEEK, FALSE);

// Initiate
$ret = ftp_async_get ($my_connection, newfile, README, FTP_BINARY, 100);
while ($ret == FTP_MOREDATA) {

   ...
   
   // Continue downloading...
   $ret = ftp_async_continue ($my_connection);
}
...

newfile is now 100 bytes smaller than README on the ftp because
we started reading at offset 100. If we have not have disabled
AUTOSEEK the first 100 bytes of newfile will be '\0'...



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread Yasuo Ohgaki

Zeev Suraski wrote:
 At 01:16 26/07/2002, [EMAIL PROTECTED] wrote:
 
 On Thu, 25 Jul 2002, Stig S. Bakken wrote:

  Okay, I'm modifying brancing on sunday to branching when 4.2.3 is 
 out,
  so we don't have two QA processes at the same time.  Sorry Derick.

 Disregard that folks, 4.2.3 is declared dead now.
 
 
 Can you (or somebody else) elaborate on that?
 
 Zeev
 

I'm +1 for Stig's opinion.

4.2.3's QA should take much shorter time then 4.3.0.
I suppose 4.2.3 is more stable and suitable for
production use compare to 4.3.0. Most system admins
will not use version end with 0 also. So it would be
useful longer term than it seems.

Just my .02

--
Yasuo Ohgaki


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread derick

On Sat, 27 Jul 2002, Yasuo Ohgaki wrote:

 I'm +1 for Stig's opinion.

Declaring 4.2.3 a no-no was both Stig's and mine suggestion.

Derick

---
 Did I help you?   http://www.derickrethans.nl/link.php?url=giftlist
 Frequent ranting: http://www.derickrethans.nl/
---
 PHP: Scripting the Web - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread derick

On Fri, 26 Jul 2002, Zeev Suraski wrote:

 At 01:16 26/07/2002, [EMAIL PROTECTED] wrote:
 On Thu, 25 Jul 2002, Stig S. Bakken wrote:
 
   Okay, I'm modifying brancing on sunday to branching when 4.2.3 is out,
   so we don't have two QA processes at the same time.  Sorry Derick.
 
 Disregard that folks, 4.2.3 is declared dead now.
 
 Can you (or somebody else) elaborate on that?

Releasing 4.2.3 would take 4-5 weeks, and this would delay 4.3.0 another 
month. Doing two release processes at the same time is not going to 
work, there are too little people for this and we also think that 4.3.0 
should not be delayed another 4 to 5 weeks.

Derick

---
 Did I help you?   http://www.derickrethans.nl/link.php?url=giftlist
 Frequent ranting: http://www.derickrethans.nl/
---
 PHP: Scripting the Web - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread Yasuo Ohgaki

[EMAIL PROTECTED] wrote:
I'm +1 for Stig's opinion.
 
 Declaring 4.2.3 a no-no was both Stig's and mine suggestion.
 

Then no 4.2.3 and we will have 4.3.0 branch on Sunday.
(Bad news for some users, good news for us ;)

--
Yasuo Ohgaki


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] win32 dir patches [cont.]

2002-07-27 Thread Steph

dir.c change tested on 98, xp and rh7.3, this is the one-liner I tried
to send the list earlier in the week, fixes #14657

readdir.c changes tested on 98 and xp (not used by *nix), fixes #11214

Please cd someone commit these before 4.3.0 (or give me the karma to do
so :) ?


--- old_readdir.h   2000-07-02 23:46:52.0 +
+++ readdir.h   2002-07-25 21:06:10.0 +
 -38,7 +38,7 
 struct dirent *readdir(DIR *);
 int readdir_r(DIR *, struct dirent *, struct dirent **);
 int closedir(DIR *);
-void rewinddir(DIR *);
+int rewinddir(DIR *);
 
 
 #endif /* READDIR_H */


--- old_readdir.c   2002-07-23 19:38:26.0 +
+++ readdir.c   2002-07-26 23:20:18.0 +
 -113,29 +113,31 
return 0;
 }
 
-void rewinddir(DIR *dir_Info)
+int rewinddir(DIR *dp)
 {
/* Re-set to the beginning */
char *filespec;
long handle;
int index;
 
-   dir_Info-handle = 0;
-   dir_Info-offset = 0;
-   dir_Info-finished = 0;
+   _findclose(dp-handle);
 
-   filespec = malloc(strlen(dir_Info-dir) + 2 + 1);
-   strcpy(filespec, dir_Info-dir);
+   dp-offset = 0;
+   dp-finished = 0;
+
+   filespec = malloc(strlen(dp-dir) + 2 + 1);
+   strcpy(filespec, dp-dir);
index = strlen(filespec) - 1;
if (index = 0  (filespec[index] == '/' || filespec[index] == '\\'))
filespec[index] = '\0';
strcat(filespec, /*);
 
-   if ((handle = _findfirst(filespec, (dir_Info-fileinfo)))  0) {
-   if (errno == ENOENT) {
-   dir_Info-finished = 1;
+   if ((handle = _findfirst(filespec, (dp-fileinfo)))  0) {
+   if (errno == ENOENT)
+   dp-finished = 1;
}
-   }
-   dir_Info-handle = handle;
+   dp-handle = handle;
free(filespec);
+
+return 0;
 }


--- old_dir.c   2002-07-08 12:52:22.0 +
+++ dir.c   2002-07-25 19:14:10.0 +
 -158,7 +158,6 
object_init_ex(return_value, dir_class_entry_ptr);
add_property_stringl(return_value, path, Z_STRVAL_PP(arg), 
Z_STRLEN_PP(arg), 1);
add_property_resource(return_value, handle, dirp-rsrc_id);
-   zend_list_addref(dirp-rsrc_id); /* might not be needed */
php_stream_auto_cleanup(dirp); /* so we don't get warnings under debug 
*/
} else {
php_stream_to_zval(dirp, return_value);



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] CVS Account Request: elmaystro

2002-07-27 Thread Mostafa Mohamed Mostafa Foda

Translating the documentation To Arabic.

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] PHP version of the Javascript Function escape()

2002-07-27 Thread Chad Gilmer

Hi there,

I am looking to convert a string into it's ASCII equivalent.
I can do this using Javascript's escape() function, but I have searched the
PHP Manual and cannot find a similar function in PHP.

Any help would be appreciated.

Thanks

Chad



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread Zeev Suraski

FWIW, I don't see why releasing it should take 5 weeks.  I think releasing 
it can take pretty much as long as we decide it should take.  I think we 
just got used to have slow-moving, lingering release processes.

At 15:06 27/07/2002, Yasuo Ohgaki wrote:
[EMAIL PROTECTED] wrote:
I'm +1 for Stig's opinion.
Declaring 4.2.3 a no-no was both Stig's and mine suggestion.

Then no 4.2.3 and we will have 4.3.0 branch on Sunday.
(Bad news for some users, good news for us ;)

--
Yasuo Ohgaki


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] 4.3 release call to arms

2002-07-27 Thread Jani Taskinen


+1, I don't think we need to do more than one RC for it..
As only bug fixes have been merged to that branch anyway.

--Jani


-- 

On Sat, 27 Jul 2002, Zeev Suraski wrote:

FWIW, I don't see why releasing it should take 5 weeks.  I think releasing 
it can take pretty much as long as we decide it should take.  I think we 
just got used to have slow-moving, lingering release processes.

At 15:06 27/07/2002, Yasuo Ohgaki wrote:
[EMAIL PROTECTED] wrote:
I'm +1 for Stig's opinion.
Declaring 4.2.3 a no-no was both Stig's and mine suggestion.

Then no 4.2.3 and we will have 4.3.0 branch on Sunday.
(Bad news for some users, good news for us ;)

--
Yasuo Ohgaki





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php