Automatic creation of 'Shared' directory, bug fixes for an empty 'Shared' directory
This commit is contained in:
parent
1ec75330ec
commit
5fbed936bf
3 changed files with 27 additions and 21 deletions
|
@ -59,7 +59,7 @@ class OC_Share {
|
|||
throw new Exception("This item is already shared with ".$uid);
|
||||
}
|
||||
// Check if the target already exists for the user, if it does append a number to the name
|
||||
$target = "/".$uid."/files/Share/".basename($source);
|
||||
$target = "/".$uid."/files/Shared/".basename($source);
|
||||
if (self::getSource($target)) {
|
||||
if ($pos = strrpos($target, ".")) {
|
||||
$name = substr($target, 0, $pos);
|
||||
|
|
|
@ -32,6 +32,9 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
|
||||
public function __construct($arguments) {
|
||||
$this->datadir = $arguments['datadir'];
|
||||
if (!OC_Filesystem::is_dir($this->datadir)) {
|
||||
OC_Filesystem::mkdir($this->datadir);
|
||||
}
|
||||
}
|
||||
|
||||
public function getInternalPath($path) {
|
||||
|
@ -309,14 +312,15 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
public function filectime($path) {
|
||||
if ($path == "" || $path == "/") {
|
||||
$ctime = 0;
|
||||
$dir = $this->opendir($path);
|
||||
while (($filename = readdir($dir)) != false) {
|
||||
$tempctime = $this->filectime($filename);
|
||||
if ($tempctime < $ctime) {
|
||||
$ctime = $tempctime;
|
||||
if ($dh = $this->opendir($path)) {
|
||||
while (($filename = readdir($dh)) !== false) {
|
||||
$tempctime = $this->filectime($filename);
|
||||
if ($tempctime < $ctime) {
|
||||
$ctime = $tempctime;
|
||||
}
|
||||
}
|
||||
return $ctime;
|
||||
}
|
||||
return $ctime;
|
||||
} else {
|
||||
$source = $this->getSource($path);
|
||||
if ($source) {
|
||||
|
@ -329,14 +333,15 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
public function filemtime($path) {
|
||||
if ($path == "" || $path == "/") {
|
||||
$mtime = 0;
|
||||
$dir = $this->opendir($path);
|
||||
while (($filename = readdir($dir)) != false) {
|
||||
$tempmtime = $this->filemtime($filename);
|
||||
if ($tempmtime > $mtime) {
|
||||
$mtime = $tempmtime;
|
||||
if ($dh = $this->opendir($path)) {
|
||||
while (($filename = readdir($dh)) !== false) {
|
||||
$tempmtime = $this->filemtime($filename);
|
||||
if ($tempmtime > $mtime) {
|
||||
$mtime = $tempmtime;
|
||||
}
|
||||
}
|
||||
return $mtime;
|
||||
}
|
||||
return $mtime;
|
||||
} else {
|
||||
$source = $this->getSource($path);
|
||||
if ($source) {
|
||||
|
@ -349,14 +354,15 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
|||
public function fileatime($path) {
|
||||
if ($path == "" || $path == "/") {
|
||||
$atime = 0;
|
||||
$dir = $this->opendir($path);
|
||||
while (($filename = readdir($dir)) != false) {
|
||||
$tempatime = $this->fileatime($filename);
|
||||
if ($tempatime > $atime) {
|
||||
$atime = $tempatime;
|
||||
if ($dh = $this->opendir($path)) {
|
||||
while (($filename = readdir($dh)) !== false) {
|
||||
$tempatime = $this->fileatime($filename);
|
||||
if ($tempatime > $atime) {
|
||||
$atime = $tempatime;
|
||||
}
|
||||
}
|
||||
return $atime;
|
||||
}
|
||||
return $atime;
|
||||
} else {
|
||||
$source = $this->getSource($path);
|
||||
if ($source) {
|
||||
|
|
|
@ -54,8 +54,8 @@ class OC_Util {
|
|||
OC_Filesystem::mount($rootStorage,'/');
|
||||
|
||||
// TODO add this storage provider in a proper way
|
||||
$sharedStorage = OC_Filesystem::createStorage('shared',array('datadir'=>'/'.OC_User::getUser().'/files/Share/'));
|
||||
OC_Filesystem::mount($sharedStorage,'/'.OC_User::getUser().'/files/Share/');
|
||||
$sharedStorage = OC_Filesystem::createStorage('shared',array('datadir'=>'/'.OC_User::getUser().'/files/Shared/'));
|
||||
OC_Filesystem::mount($sharedStorage,'/'.OC_User::getUser().'/files/Shared/');
|
||||
|
||||
$CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root";
|
||||
if( !is_dir( $CONFIG_DATADIRECTORY )){
|
||||
|
|
Loading…
Reference in a new issue