]> source.dussan.org Git - nextcloud-server.git/commitdiff
check if directory already exist before executing mkdir
authorBjörn Schießle <schiessle@owncloud.com>
Fri, 12 Oct 2012 14:29:35 +0000 (16:29 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Fri, 12 Oct 2012 14:31:03 +0000 (16:31 +0200)
lib/fileproxy/fileoperations.php [new file with mode: 0644]
lib/util.php

diff --git a/lib/fileproxy/fileoperations.php b/lib/fileproxy/fileoperations.php
new file mode 100644 (file)
index 0000000..f2a5324
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**\r
+ * ownCloud\r
+ *\r
+ * @author Bjoern Schiessle\r
+ * @copyright 2012 Bjoern Schiessle <schiessle@owncloud.com>\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE\r
+ * License as published by the Free Software Foundation; either\r
+ * version 3 of the License, or any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.\r
+ *\r
+ * You should have received a copy of the GNU Affero General Public\r
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.\r
+ *\r
+ */\r
+\r
+/**\r
+ * check if standard file operations\r
+ */
+class OC_FileProxy_FileOperations extends OC_FileProxy{\r
+       static $rootView;\r
+       private $userQuota=-1;
+
+       public function premkdir($path) {\r
+               if(!self::$rootView){\r
+                       self::$rootView = new OC_FilesystemView('');\r
+               }
+               return !self::$rootView->file_exists($path);\r
+       }
+       
+}
\ No newline at end of file
index d01a1aa405ca818022ff468f7df6d330037782ad..afbea9a00cbc7f710e6f3712581af3d5a89e383e 100755 (executable)
@@ -49,7 +49,9 @@ class OC_Util {
                        OC_Filesystem::mount('OC_Filestorage_Local', array('datadir' => $user_root), $user);
                        OC_Filesystem::init($user_dir);
                        $quotaProxy=new OC_FileProxy_Quota();
+                       $fileOperationProxy = new OC_FileProxy_FileOperations();
                        OC_FileProxy::register($quotaProxy);
+                       OC_FileProxy::register($fileOperationProxy);
                        // Load personal mount config
                        if (is_file($user_root.'/mount.php')) {
                                $mountConfig = include($user_root.'/mount.php');