Author: ts
Date: Tue Sep 25 12:12:14 2007
New Revision: 6264

Log:
- Fixed memory backend.

Modified:
    trunk/Webdav/src/backend/memory.php
    trunk/Webdav/src/backend/simple.php
    trunk/Webdav/tests/backend_memory_test.php

Modified: trunk/Webdav/src/backend/memory.php
==============================================================================
--- trunk/Webdav/src/backend/memory.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backend/memory.php [iso-8859-1] Tue Sep 25 12:12:14 2007
@@ -431,7 +431,7 @@
         {
             // Copy a resource, or a collection, but the depth header told not
             // to recurse into collections
-            if ( $causeErrors && preg_match( $this->options->failForRegexp, 
$fromPath ) )
+            if ( $causeErrors && preg_match( $this->options->failForRegexp, 
$fromPath ) > 0 )
             {
                 // Completely abort with error
                 return array( ezcWebdavErrorResponse(
@@ -439,7 +439,7 @@
                     $fromPath
                 ) );
             }
-            if ( $causeErrors && preg_match( $this->options->failForRegexp, 
$toPath ) )
+            if ( $causeErrors && preg_match( $this->options->failForRegexp, 
$toPath ) > 0 )
             {
                 // Completely abort with error
                 return array( ezcWebdavErrorResponse(
@@ -602,8 +602,14 @@
                 else
                 {
                     unset( $this->content[$name] );
-                }
-            }
+                    unset( $this->props[$name] );
+                }
+            }
+        }
+
+        if ( count( $errors ) > 0 ) 
+        {
+            return $errors;
         }
 
         // Remove parent node assignement to removed node
@@ -612,15 +618,6 @@
         {
             unset( $this->content[$parent][$id] );
             $this->content[$parent] = array_values( $this->content[$parent] );
-        }
-
-        // Also remove all properties for removed content nodes
-        foreach ( $this->props as $name => $properties )
-        {
-            if ( strpos( $name, $path ) === 0 )
-            {
-                unset( $this->props[$name] );
-            }
         }
 
         return $errors;

Modified: trunk/Webdav/src/backend/simple.php
==============================================================================
--- trunk/Webdav/src/backend/simple.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backend/simple.php [iso-8859-1] Tue Sep 25 12:12:14 2007
@@ -736,12 +736,6 @@
 
         // Delete
         $deletion = $this->performDelete( $source );
-
-        // If deletion failed, this has again been caused by the automatic
-        // error causing facilities of the backend. Send 423 by choice.
-        //
-        // @TODO: The error generated here should depend on the actual backend
-        // implementation and  not be generated guessing what may fit.
         if ( count( $deletion ) > 0 )
         {
             return new ezcWebdavMultistatusResponse(
@@ -910,11 +904,10 @@
              $this->nodeExists( $dest ) )
         {
             $replaced = true;
-            if ( $this->performDelete( $dest ) === false )
+            if ( count ( $delteErrors = $this->performDelete( $dest ) ) > 0 )
             {
-                return new ezcWebdavErrorResponse(
-                    ezcWebdavResponse::STATUS_423,
-                    $dest
+                return new ezcWebdavMultistatusResponse(
+                    $delteErrors
                 );
             }
         }
@@ -948,11 +941,10 @@
         //
         // @TODO: The error generated here should depend on the actual backend
         // implementation and  not be generated guessing what may fit.
-        if ( $deletion !== true )
-        {
-            return new ezcWebdavErrorResponse(
-                ezcWebdavResponse::STATUS_423,
-                $source
+        if ( count( $deletion ) > 0 )
+        {
+            return new ezcWebdavMultistatusResponse(
+                $deletion
             );
         }
 

Modified: trunk/Webdav/tests/backend_memory_test.php
==============================================================================
--- trunk/Webdav/tests/backend_memory_test.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/backend_memory_test.php [iso-8859-1] Tue Sep 25 12:12:14 
2007
@@ -1309,9 +1309,13 @@
         $response = $backend->delete( $request );
 
         $this->assertEquals(
-            new ezcWebdavErrorResponse(
-                ezcWebdavResponse::STATUS_423,
-                '/foo'
+            new ezcWebdavMultistatusResponse(
+                array(
+                    new ezcWebdavErrorResponse(
+                        ezcWebdavResponse::STATUS_423,
+                        '/foo'
+                    ),
+                )
             ),
             $response,
             'Expected response does not match real response.',


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to