]> source.dussan.org Git - nextcloud-server.git/commitdiff
Temporary fix for sharing files
authorMichael Gapczynski <GapczynskiM@gmail.com>
Sat, 18 Feb 2012 02:56:20 +0000 (21:56 -0500)
committerMichael Gapczynski <GapczynskiM@gmail.com>
Sat, 18 Feb 2012 02:56:20 +0000 (21:56 -0500)
apps/files_sharing/lib_share.php
lib/filestorage/google.php [new file with mode: 0644]

index 049a74278b35e8c32f2e98c0a6e2f75a61e9fdda..42739bdfba94f628d364173b306147611d4379dd 100644 (file)
@@ -88,12 +88,15 @@ class OC_Share {
                                        $uid = $uid."@".$gid;
                                }
                                $query->execute(array($uid_owner, $uid, $source, $target, $permissions));
-                               // Clear the folder size cache for the 'Shared' folder
-//                             $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?");
-//                             $clearFolderSize->execute(array($sharedFolder));
-                               // Emit post_create and post_write hooks to notify of a new file in the user's filesystem
-                               OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target));
-                               OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
+                               // Add file to filesystem cache
+                               $userDirectory = "/".OC_User::getUser()."/files";
+                               $data = OC_Filecache::get(substr($source, strlen($userDirectory)));
+                               $parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
+                               $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
+                               $parent = $parentResult['id'];
+                               $is_writeable = $permissions & OC_Share::WRITE;
+                               $cacheQuery = OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)');
+                               $cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable));
                        }
                }
        }
diff --git a/lib/filestorage/google.php b/lib/filestorage/google.php
new file mode 100644 (file)
index 0000000..fc271f4
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Michael Gapczynski
+* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class OC_Filestorage_Google extends OC_Filestorage_Common {
+       
+       private $auth;
+
+       public function __construct($parameters) {
+               
+       }
+       
+       private function connect() {
+         
+       }
+       public function mkdir($path){}
+       public function rmdir($path){}
+       public function opendir($path){}
+       public function is_dir($path){}
+       public function is_file($path){}
+       public function stat($path){}
+       public function filetype($path){}
+       public function is_readable($path){}
+       public function is_writable($path){}
+       public function file_exists($path){}
+       public function unlink($path){}
+       public function rename($path1,$path2){}
+       public function fopen($path,$mode){}
+       public function toTmpFile($path){}
+       public function fromTmpFile($tmpPath,$path){}
+       public function fromUploadedFile($tmpPath,$path){}
+       public function getMimeType($path){}
+       public function hash($type,$path,$raw){}
+       public function free_space($path){}
+       public function search($query){}
+       public function getLocalFile($path){}
+}
\ No newline at end of file