svn: /web/doc-editor/trunk/php/ ExtJsController.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Mon, 15 Mar 2010 00:51:34 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=296227

Log:
When we create a patch from a file witch is into a no-existing folder, we create it before saving the patch - spotted by Yago

Changed paths:
    U   web/doc-editor/trunk/php/ExtJsController.php

Modified: web/doc-editor/trunk/php/ExtJsController.php
===================================================================
--- web/doc-editor/trunk/php/ExtJsController.php	2010-03-15 00:46:40 UTC (rev 296226)
+++ web/doc-editor/trunk/php/ExtJsController.php	2010-03-15 00:51:34 UTC (rev 296227)
@@ -747,17 +747,24 @@
             }
         } else {

-            $uniqID = RepositoryManager::getInstance()->addPendingPatch(
-                $file, $emailAlert
-            );
+            // We must ensure that this folder exist localy
+            if( $file->folderExist() ) {

-            $file->save($fileContent, true, $uniqID);
+                $uniqID = RepositoryManager::getInstance()->addPendingPatch(
+                    $file, $emailAlert
+                );

-            return JsonResponseBuilder::success(
-                array(
-                    'uniqId' => $uniqID
-                )
-            );
+                $file->save($fileContent, true, $uniqID);
+
+                return JsonResponseBuilder::success(
+                    array(
+                        'uniqId' => $uniqID
+                    )
+                );
+
+            } else {
+              return JsonResponseBuilder::failure();
+            }
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.