[limb-svn] r5518 - in 3.x/limb/util: src/system tests/cases/system

svn at limb-project.com svn at limb-project.com
Tue Apr 3 15:32:04 MSD 2007


Author: pachanga
Date: 2007-04-03 15:32:03 +0400 (Tue, 03 Apr 2007)
New Revision: 5518
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5518

Modified:
   3.x/limb/util/src/system/lmbFs.class.php
   3.x/limb/util/tests/cases/system/lmbFsTest.class.php
Log:
-- new lmbFs :: cp(..) signature:
lmbFs :: cp($src, $dest, $exclude_regex = '', $include_regex = '', $as_child = false, $include_hidden = true)
(shouldn't be any BC issues since this method was not used anywhere)

Modified: 3.x/limb/util/src/system/lmbFs.class.php
===================================================================
--- 3.x/limb/util/src/system/lmbFs.class.php	2007-04-03 10:20:44 UTC (rev 5517)
+++ 3.x/limb/util/src/system/lmbFs.class.php	2007-04-03 11:32:03 UTC (rev 5518)
@@ -219,7 +219,7 @@
       throw new lmbIOException('failed to remove directory', array('dir' => $item));
   }
 
-  static function cp($src, $dest, $as_child = false, $include_regex = '', $exclude_regex = '', $include_hidden = false)
+  static function cp($src, $dest, $exclude_regex = '', $include_regex = '', $as_child = false, $include_hidden = true)
   {
     if(!is_dir($src))
     {
@@ -237,7 +237,7 @@
     if($as_child)
     {
       $separator_regex = preg_quote($separator);
-     if(preg_match( "#^.+{$separator_regex}([^{$separator_regex}]+)$#", $src, $matches))
+      if(preg_match( "#^.+{$separator_regex}([^{$separator_regex}]+)$#", $src, $matches))
       {
         self :: _doMkdir($dest . $separator . $matches[1], 0777);
         $dest .= $separator . $matches[1];
@@ -248,16 +248,16 @@
     $items = self :: find($src, 'df', $include_regex, $exclude_regex, false, $include_hidden);
 
     $total_items = $items;
-    while (count($items) > 0)
+    while(count($items) > 0)
     {
       $current_items = $items;
       $items = array();
-      foreach ($current_items as $item)
+      foreach($current_items as $item)
       {
         $full_path = $src . $separator . $item;
-       if(is_file( $full_path))
+        if(is_file( $full_path))
           copy($full_path, $dest . $separator . $item);
-        elseif (is_dir( $full_path))
+        elseif(is_dir( $full_path))
         {
           self :: _doMkdir($dest . $separator . $item, 0777);
 

Modified: 3.x/limb/util/tests/cases/system/lmbFsTest.class.php
===================================================================
--- 3.x/limb/util/tests/cases/system/lmbFsTest.class.php	2007-04-03 10:20:44 UTC (rev 5517)
+++ 3.x/limb/util/tests/cases/system/lmbFsTest.class.php	2007-04-03 11:32:03 UTC (rev 5518)
@@ -1,13 +1,13 @@
 <?php
-/**
- * Limb Web Application Framework
- *
- * @link http://limb-project.com
- *
- * @copyright  Copyright &copy; 2004-2007 BIT
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html
- * @version    $Id$
- * @package    util
+/**
+ * Limb Web Application Framework
+ *
+ * @link http://limb-project.com
+ *
+ * @copyright  Copyright &copy; 2004-2007 BIT
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
+ * @version    $Id$
+ * @package    util
  */
 lmb_require('limb/util/src/system/lmbSys.class.php');
 lmb_require('limb/util/src/system/lmbFs.class.php');
@@ -334,11 +334,11 @@
     $this->_removeFileSystem();
   }
 
-  function testCpAsShild()
+  function testCpAsChild()
   {
     $this->_createFileSystem();
 
-    lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', true);
+    lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', null, null, true);
 
     $this->assertEqual(
       lmbFs :: ls(TEST_DIR_ABSOLUTE_PATH . '/tmp/cp/wow/'),
@@ -355,7 +355,7 @@
   {
     $this->_createFileSystem();
 
-    $res = lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', false, null, '/hey/');
+    $res = lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', '/hey/');
     sort($res);
 
     $this->assertEqual(
@@ -377,7 +377,7 @@
   {
     $this->_createFileSystem();
 
-    $res = lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', false, '/test2/');
+    $res = lmbFs :: cp(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow', TEST_DIR_ABSOLUTE_PATH . '/tmp/cp', null, '/test2/');
 
     $this->assertEqual(
       $res,



More information about the limb-svn mailing list