[PHP-CVS] cvs: php-src /ext/spl/examples findfile.inc

2008-01-02 Thread Ilia Alshanetsky
iliaa   Wed Jan  2 19:19:45 2008 UTC

  Modified files:  
/php-src/ext/spl/examples   findfile.inc 
  Log:
  
  MFB: Fixed bug #43647 (Make FindFile use PATH_SEPARATOR instead of ;)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/examples/findfile.inc?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/spl/examples/findfile.inc
diff -u php-src/ext/spl/examples/findfile.inc:1.8 
php-src/ext/spl/examples/findfile.inc:1.9
--- php-src/ext/spl/examples/findfile.inc:1.8   Tue Feb 21 23:21:53 2006
+++ php-src/ext/spl/examples/findfile.inc   Wed Jan  2 19:19:45 2008
@@ -33,7 +33,7 @@
function __construct($path, $file)
{
$this-file = $file;
-   $list = split(';', $path);
+   $list = split(PATH_SEPARATOR, $path);
if (count($list) = 1) {
parent::__construct(new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator($path)));
} else {

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



[PHP-CVS] cvs: php-src /ext/spl/examples findfile.inc findfile.php findregex.php

2004-01-25 Thread Marcus Boerger
helly   Sun Jan 25 08:03:26 2004 EDT

  Added files: 
/php-src/ext/spl/examples   findfile.inc findregex.php 

  Modified files:  
/php-src/ext/spl/examples   findfile.php 
  Log:
  Update examples
  
http://cvs.php.net/diff.php/php-src/ext/spl/examples/findfile.php?r1=1.4r2=1.5ty=u
Index: php-src/ext/spl/examples/findfile.php
diff -u php-src/ext/spl/examples/findfile.php:1.4 
php-src/ext/spl/examples/findfile.php:1.5
--- php-src/ext/spl/examples/findfile.php:1.4   Fri Jan 23 17:33:45 2004
+++ php-src/ext/spl/examples/findfile.php   Sun Jan 25 08:03:24 2004
@@ -24,18 +24,5 @@
exit(1);
 }
 
-class FindFile extends FilterIterator
-{
-   protected $file;
-
-   function __construct($path, $file) {
-   $this-file = $file;
-   parent::__construct(new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator($path)));
-   }
-   function accept() {
-   return !strcmp($this-current(), $this-file);
-   }
-}
-
-foreach(new FindFile($argv[1], $argv[2]) as $pathname = $file) echo 
$file-getPathname().\n;
+foreach(new FindFile($argv[1], $argv[2]) as $file) echo $file-getPathname().\n;
 ?
\ No newline at end of file

http://cvs.php.net/co.php/php-src/ext/spl/examples/findfile.inc?r=1.1p=1
Index: php-src/ext/spl/examples/findfile.inc
+++ php-src/ext/spl/examples/findfile.inc
?php

/**
 * @brief   Base class to find files
 * @author  Marcus Boerger
 * @version 1.0
 *
 */
class FindFile extends FilterIterator
{
protected $file;

function __construct($path, $file)
{
$this-file = $file;
parent::__construct(new RecursiveIteratorIterator(new 
RecursiveDirectoryIterator($path)));
}

function accept()
{
return !strcmp($this-current(), $this-file);
}
}

?
http://cvs.php.net/co.php/php-src/ext/spl/examples/findregex.php?r=1.1p=1
Index: php-src/ext/spl/examples/findregex.php
+++ php-src/ext/spl/examples/findregex.php
?php

/** Find a specific file by name.
 *
 * Usage: php findregex.php path name
 *
 * path  Path to search in.
 * name  Filename to look for.
 *
 * (c) Marcus Boerger, Adam Trachtenberg, 2004
 */

if ($argc  3) {
echo EOF
Usage: php findregex.php file name

Find a specific file by name.

path  Path to search in.
name  Regex for filenames to look for.


EOF;
exit(1);
}

class RegexFindFile extends FindFile
{
function accept()
{
return preg_match($this-file, $this-current());
}
}

foreach(new RegexFindFile($argv[1], $argv[2]) as $file) {
echo $file-getPathname().\n;
}

?  

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