Temporary fix for sharing files

This commit is contained in:
Michael Gapczynski 2012-02-17 21:56:20 -05:00
parent 1fa05894d5
commit 6f1ed85f0b
2 changed files with 64 additions and 6 deletions

View 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));
}
}
}

View File

@ -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){}
}