diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/l10n/nl.js | 1 | ||||
-rw-r--r-- | lib/l10n/nl.json | 1 | ||||
-rw-r--r-- | lib/l10n/pt_BR.js | 2 | ||||
-rw-r--r-- | lib/l10n/pt_BR.json | 2 | ||||
-rw-r--r-- | lib/l10n/sr.js | 40 | ||||
-rw-r--r-- | lib/l10n/sr.json | 40 | ||||
-rw-r--r-- | lib/private/cache/fileglobalgc.php | 10 | ||||
-rw-r--r-- | lib/private/connector/sabre/custompropertiesbackend.php | 16 | ||||
-rw-r--r-- | lib/private/db/connection.php | 2 | ||||
-rw-r--r-- | lib/private/fileproxy/fileoperations.php | 37 | ||||
-rw-r--r-- | lib/private/files/cache/cache.php | 3 | ||||
-rw-r--r-- | lib/private/files/cache/watcher.php | 7 | ||||
-rw-r--r-- | lib/private/files/mount/mountpoint.php | 17 | ||||
-rw-r--r-- | lib/private/files/storage/common.php | 21 | ||||
-rw-r--r-- | lib/private/files/storage/storagefactory.php | 11 | ||||
-rw-r--r-- | lib/private/server.php | 29 | ||||
-rw-r--r-- | lib/private/share/share.php | 10 | ||||
-rw-r--r-- | lib/private/template.php | 1 | ||||
-rw-r--r-- | lib/private/util.php | 11 | ||||
-rw-r--r-- | lib/public/appframework/db/mapper.php | 73 | ||||
-rw-r--r-- | lib/public/files/mount/imountpoint.php | 7 | ||||
-rw-r--r-- | lib/public/files/storage/istoragefactory.php | 5 | ||||
-rw-r--r-- | lib/repair/repairmimetypes.php | 2 |
23 files changed, 246 insertions, 102 deletions
diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js index 67dea9f0f83..237fa0093e6 100644 --- a/lib/l10n/nl.js +++ b/lib/l10n/nl.js @@ -43,6 +43,7 @@ OC.L10N.register( "4-byte characters are not supported in file names" : "4-byte tekens in bestandsnamen worden niet ondersteund", "File name is a reserved word" : "Bestandsnaam is een gereserveerd woord", "File name contains at least one invalid character" : "De bestandsnaam bevat ten minste één verboden teken", + "File name is too long" : "De bestandsnaam is te lang", "App directory already exists" : "App directory bestaat al", "Can't create app folder. Please fix permissions. %s" : "Kan de app map niet aanmaken, Herstel de permissies. %s", "No source specified when installing app" : "Geen bron opgegeven bij installatie van de app", diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json index 35961c075d3..5d87dc5b9c0 100644 --- a/lib/l10n/nl.json +++ b/lib/l10n/nl.json @@ -41,6 +41,7 @@ "4-byte characters are not supported in file names" : "4-byte tekens in bestandsnamen worden niet ondersteund", "File name is a reserved word" : "Bestandsnaam is een gereserveerd woord", "File name contains at least one invalid character" : "De bestandsnaam bevat ten minste één verboden teken", + "File name is too long" : "De bestandsnaam is te lang", "App directory already exists" : "App directory bestaat al", "Can't create app folder. Please fix permissions. %s" : "Kan de app map niet aanmaken, Herstel de permissies. %s", "No source specified when installing app" : "Geen bron opgegeven bij installatie van de app", diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js index 456189f3cc6..07d1eb39fbf 100644 --- a/lib/l10n/pt_BR.js +++ b/lib/l10n/pt_BR.js @@ -42,6 +42,8 @@ OC.L10N.register( "Dot files are not allowed" : "Dot arquivos não são permitidos", "4-byte characters are not supported in file names" : "Caracteres de 4-bytes não são suportados em nomes de arquivos", "File name is a reserved word" : "O nome do arquivo é uma palavra reservada", + "File name contains at least one invalid character" : "O nome do arquivo contém pelo menos um caractere inválido", + "File name is too long" : "O nome do arquivo é muito longo", "App directory already exists" : "Diretório App já existe", "Can't create app folder. Please fix permissions. %s" : "Não é possível criar pasta app. Corrija as permissões. %s", "No source specified when installing app" : "Nenhuma fonte foi especificada enquanto instalava o aplicativo", diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json index 7915a8f715a..8b356bd88fc 100644 --- a/lib/l10n/pt_BR.json +++ b/lib/l10n/pt_BR.json @@ -40,6 +40,8 @@ "Dot files are not allowed" : "Dot arquivos não são permitidos", "4-byte characters are not supported in file names" : "Caracteres de 4-bytes não são suportados em nomes de arquivos", "File name is a reserved word" : "O nome do arquivo é uma palavra reservada", + "File name contains at least one invalid character" : "O nome do arquivo contém pelo menos um caractere inválido", + "File name is too long" : "O nome do arquivo é muito longo", "App directory already exists" : "Diretório App já existe", "Can't create app folder. Please fix permissions. %s" : "Não é possível criar pasta app. Corrija as permissões. %s", "No source specified when installing app" : "Nenhuma fonte foi especificada enquanto instalava o aplicativo", diff --git a/lib/l10n/sr.js b/lib/l10n/sr.js index f46c88770ac..dd987fe7438 100644 --- a/lib/l10n/sr.js +++ b/lib/l10n/sr.js @@ -1,11 +1,21 @@ OC.L10N.register( "lib", { + "See %s" : "Погледајте %s", + "PHP %s or higher is required." : "Потребан је ПХП %s или новији.", + "PHP with a version lower than %s is required." : "Потребан је ПХП старији од %s.", + "Following databases are supported: %s" : "Следеће базе података су подржане: %s", + "The library %s is not available." : "Библиотека %s није доступна.", + "Following platforms are supported: %s" : "Следеће платформе су подржане: %s", + "ownCloud %s or higher is required." : "Оунклауд %s или новији је потребан.", "Help" : "Помоћ", "Personal" : "Лично", "Users" : "Корисници", "Admin" : "Администратор", "Recommended" : "Препоручено", + "App \"%s\" cannot be installed because it is not compatible with this version of ownCloud." : "Апликација „%s“ не може бити инсталирана јер није компатибилна са овим издањем Оунклауда.", + "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "Апликација „%s“ не може бити инсталирана јер следеће зависности нису испуњене: %s", + "No app name specified" : "Није наведен назив апликације", "Unknown filetype" : "Непознат тип фајла", "Invalid image" : "Неисправна слика", "today" : "данас", @@ -14,20 +24,42 @@ OC.L10N.register( "last month" : "прошлог месеца", "_%n month ago_::_%n months ago_" : ["пре %n месец","пре %n месеца","пре %n месеци"], "last year" : "прошле године", - "_%n year ago_::_%n years ago_" : ["","",""], - "_%n hour ago_::_%n hours ago_" : ["","",""], - "_%n minute ago_::_%n minutes ago_" : ["","",""], + "_%n year ago_::_%n years ago_" : ["пре %n годину","пре %n године","пре %n година"], + "_%n hour ago_::_%n hours ago_" : ["пре %n сат","пре %n сата","пре %n сати"], + "_%n minute ago_::_%n minutes ago_" : ["пре %n минут","пре %n минута","пре %n минута"], "seconds ago" : "пре неколико секунди", "web services under your control" : "веб сервиси под вашом контролом", + "Empty filename is not allowed" : "Празан назив није дозвољен", + "Dot files are not allowed" : "Фајлови са почетном тачком у називу нису дозвољени", + "4-byte characters are not supported in file names" : "4-битни знакови нису подржани у називу фајлова", + "File name is a reserved word" : "Назив фајла је резервисана реч", + "File name contains at least one invalid character" : "Назив фајла садржи бар један недозвољен знак", + "File name is too long" : "Назив фајла је предугачак", + "App directory already exists" : "Директоријум апликација већ постоји", + "Archives of type %s are not supported" : "%s архиве нису подржане", "Application is not enabled" : "Апликација није укључена", "Authentication error" : "Грешка аутентификације", "Token expired. Please reload page." : "Жетон је истекао. Поново учитајте страницу.", + "Unknown user" : "Непознат корисник", "Mac OS X is not supported and %s will not work properly on this platform. Use it at your own risk! " : "Мек ОС Икс није подржан и %s неће радити исправно на овој платформи. Користите га на сопствени ризик!", "For the best results, please consider using a GNU/Linux server instead." : "За најбоље резултате, размотрите употребу ГНУ/Линукс сервера.", "It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. This will lead to problems with files over 4 GB and is highly discouraged." : "Изгледа да %s ради у 32-битном ПХП окружењу а open_basedir је подешен у php.ini фајлу. То може довести до проблема са фајловима већим од 4 GB те стога није препоручљиво.", "Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP." : "Уклоните open_basedir поставку из php.ini фајла или пређите на 64-битни ПХП.", + "Set an admin username." : "Поставите име за администратора.", + "Set an admin password." : "Поставите лозинку за администратора.", + "%s shared »%s« with you" : "%s подели „%s“ са вама", + "You are not allowed to share %s" : "Није вам дозвољено да делите %s", "Could not find category \"%s\"" : "Не могу да пронађем категорију „%s“.", + "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Само су следећи знакови дозвољени за корисничко име: „a-z“, „A-Z“, „0-9“ и „_.@-“", "A valid username must be provided" : "Морате унети исправно корисничко име", - "A valid password must be provided" : "Морате унети исправну лозинку" + "A valid password must be provided" : "Морате унети исправну лозинку", + "The username is already being used" : "Корисничко име се већ користи", + "No database drivers (sqlite, mysql, or postgresql) installed." : "Нема драјвера базе података (скулајт, мајскул или постгрескул).", + "Setting locale to %s failed" : "Постављање локалитета на %s није успело", + "Please install one of these locales on your system and restart your webserver." : "Инсталирајте неки од ових локалитета на ваш систем и поново покрените веб сервер.", + "Please ask your server administrator to install the module." : "Замолите администратора вашег сервера да инсталира тај модул.", + "PHP module %s not installed." : "ПХП модул %s није инсталиран.", + "PHP setting \"%s\" is not set to \"%s\"." : "ПХП поставка „%s“ није постављена на „%s“.", + "PostgreSQL >= 9 required" : "Захтеван је ПостгреСкул >= 9" }, "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"); diff --git a/lib/l10n/sr.json b/lib/l10n/sr.json index fcae89b69fd..6b7eef1fa51 100644 --- a/lib/l10n/sr.json +++ b/lib/l10n/sr.json @@ -1,9 +1,19 @@ { "translations": { + "See %s" : "Погледајте %s", + "PHP %s or higher is required." : "Потребан је ПХП %s или новији.", + "PHP with a version lower than %s is required." : "Потребан је ПХП старији од %s.", + "Following databases are supported: %s" : "Следеће базе података су подржане: %s", + "The library %s is not available." : "Библиотека %s није доступна.", + "Following platforms are supported: %s" : "Следеће платформе су подржане: %s", + "ownCloud %s or higher is required." : "Оунклауд %s или новији је потребан.", "Help" : "Помоћ", "Personal" : "Лично", "Users" : "Корисници", "Admin" : "Администратор", "Recommended" : "Препоручено", + "App \"%s\" cannot be installed because it is not compatible with this version of ownCloud." : "Апликација „%s“ не може бити инсталирана јер није компатибилна са овим издањем Оунклауда.", + "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "Апликација „%s“ не може бити инсталирана јер следеће зависности нису испуњене: %s", + "No app name specified" : "Није наведен назив апликације", "Unknown filetype" : "Непознат тип фајла", "Invalid image" : "Неисправна слика", "today" : "данас", @@ -12,20 +22,42 @@ "last month" : "прошлог месеца", "_%n month ago_::_%n months ago_" : ["пре %n месец","пре %n месеца","пре %n месеци"], "last year" : "прошле године", - "_%n year ago_::_%n years ago_" : ["","",""], - "_%n hour ago_::_%n hours ago_" : ["","",""], - "_%n minute ago_::_%n minutes ago_" : ["","",""], + "_%n year ago_::_%n years ago_" : ["пре %n годину","пре %n године","пре %n година"], + "_%n hour ago_::_%n hours ago_" : ["пре %n сат","пре %n сата","пре %n сати"], + "_%n minute ago_::_%n minutes ago_" : ["пре %n минут","пре %n минута","пре %n минута"], "seconds ago" : "пре неколико секунди", "web services under your control" : "веб сервиси под вашом контролом", + "Empty filename is not allowed" : "Празан назив није дозвољен", + "Dot files are not allowed" : "Фајлови са почетном тачком у називу нису дозвољени", + "4-byte characters are not supported in file names" : "4-битни знакови нису подржани у називу фајлова", + "File name is a reserved word" : "Назив фајла је резервисана реч", + "File name contains at least one invalid character" : "Назив фајла садржи бар један недозвољен знак", + "File name is too long" : "Назив фајла је предугачак", + "App directory already exists" : "Директоријум апликација већ постоји", + "Archives of type %s are not supported" : "%s архиве нису подржане", "Application is not enabled" : "Апликација није укључена", "Authentication error" : "Грешка аутентификације", "Token expired. Please reload page." : "Жетон је истекао. Поново учитајте страницу.", + "Unknown user" : "Непознат корисник", "Mac OS X is not supported and %s will not work properly on this platform. Use it at your own risk! " : "Мек ОС Икс није подржан и %s неће радити исправно на овој платформи. Користите га на сопствени ризик!", "For the best results, please consider using a GNU/Linux server instead." : "За најбоље резултате, размотрите употребу ГНУ/Линукс сервера.", "It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. This will lead to problems with files over 4 GB and is highly discouraged." : "Изгледа да %s ради у 32-битном ПХП окружењу а open_basedir је подешен у php.ini фајлу. То може довести до проблема са фајловима већим од 4 GB те стога није препоручљиво.", "Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP." : "Уклоните open_basedir поставку из php.ini фајла или пређите на 64-битни ПХП.", + "Set an admin username." : "Поставите име за администратора.", + "Set an admin password." : "Поставите лозинку за администратора.", + "%s shared »%s« with you" : "%s подели „%s“ са вама", + "You are not allowed to share %s" : "Није вам дозвољено да делите %s", "Could not find category \"%s\"" : "Не могу да пронађем категорију „%s“.", + "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Само су следећи знакови дозвољени за корисничко име: „a-z“, „A-Z“, „0-9“ и „_.@-“", "A valid username must be provided" : "Морате унети исправно корисничко име", - "A valid password must be provided" : "Морате унети исправну лозинку" + "A valid password must be provided" : "Морате унети исправну лозинку", + "The username is already being used" : "Корисничко име се већ користи", + "No database drivers (sqlite, mysql, or postgresql) installed." : "Нема драјвера базе података (скулајт, мајскул или постгрескул).", + "Setting locale to %s failed" : "Постављање локалитета на %s није успело", + "Please install one of these locales on your system and restart your webserver." : "Инсталирајте неки од ових локалитета на ваш систем и поново покрените веб сервер.", + "Please ask your server administrator to install the module." : "Замолите администратора вашег сервера да инсталира тај модул.", + "PHP module %s not installed." : "ПХП модул %s није инсталиран.", + "PHP setting \"%s\" is not set to \"%s\"." : "ПХП поставка „%s“ није постављена на „%s“.", + "PostgreSQL >= 9 required" : "Захтеван је ПостгреСкул >= 9" },"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" }
\ No newline at end of file diff --git a/lib/private/cache/fileglobalgc.php b/lib/private/cache/fileglobalgc.php index 039992718ab..b07e886f652 100644 --- a/lib/private/cache/fileglobalgc.php +++ b/lib/private/cache/fileglobalgc.php @@ -6,6 +6,9 @@ use OC\BackgroundJob\Job; use OCP\IConfig; class FileGlobalGC extends Job { + // only do cleanup every 5 minutes + const CLEANUP_TTL_SEC = 300; + public function run($argument) { $this->gc(\OC::$server->getConfig(), $this->getCacheDir()); } @@ -39,8 +42,7 @@ class FileGlobalGC extends Job { public function gc(IConfig $config, $cacheDir) { $lastRun = $config->getAppValue('core', 'global_cache_gc_lastrun', 0); $now = time(); - if (($now - $lastRun) < 300) { - // only do cleanup every 5 minutes + if (($now - $lastRun) < self::CLEANUP_TTL_SEC) { return; } $config->setAppValue('core', 'global_cache_gc_lastrun', $now); @@ -48,6 +50,8 @@ class FileGlobalGC extends Job { return; } $paths = $this->getExpiredPaths($cacheDir, $now); - array_walk($paths, 'unlink'); + array_walk($paths, function($file) { + unlink($file); + }); } } diff --git a/lib/private/connector/sabre/custompropertiesbackend.php b/lib/private/connector/sabre/custompropertiesbackend.php index 76ac8b84ef9..6827cb9ae0d 100644 --- a/lib/private/connector/sabre/custompropertiesbackend.php +++ b/lib/private/connector/sabre/custompropertiesbackend.php @@ -29,6 +29,7 @@ use Sabre\DAV\PropertyStorage\Backend\BackendInterface; use Sabre\DAV\PropFind; use Sabre\DAV\PropPatch; use Sabre\DAV\Tree; +use Sabre\DAV\Exception\NotFound; class CustomPropertiesBackend implements BackendInterface { @@ -94,8 +95,19 @@ class CustomPropertiesBackend implements BackendInterface { * @return void */ public function propFind($path, PropFind $propFind) { - $node = $this->tree->getNodeForPath($path); - if (!($node instanceof Node)) { + try { + $node = $this->tree->getNodeForPath($path); + if (!($node instanceof Node)) { + return; + } + } catch (NotFound $e) { + // in some rare (buggy) cases the node might not be found, + // we catch the exception to prevent breaking the whole list with a 404 + // (soft fail) + \OC::$server->getLogger()->warning( + 'Could not get node for path: \"' . $path . '\" : ' . $e->getMessage(), + array('app' => 'files') + ); return; } diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php index 8748f66b369..dd1a9da6747 100644 --- a/lib/private/db/connection.php +++ b/lib/private/db/connection.php @@ -30,7 +30,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { return parent::connect(); } catch (DBALException $e) { // throw a new exception to prevent leaking info from the stacktrace - throw new DBALException($e->getMessage(), $e->getCode()); + throw new DBALException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); } } diff --git a/lib/private/fileproxy/fileoperations.php b/lib/private/fileproxy/fileoperations.php deleted file mode 100644 index b2ff2e7e5e9..00000000000 --- a/lib/private/fileproxy/fileoperations.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * ownCloud - * - * @author Bjoern Schiessle - * @copyright 2012 Bjoern Schiessle <schiessle@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/>. - * - */ - -/** - * check if standard file operations - */ - -class OC_FileProxy_FileOperations extends OC_FileProxy{ - static $rootView; - - public function premkdir($path) { - if(!self::$rootView) { - self::$rootView = new \OC\Files\View(''); - } - return !self::$rootView->file_exists($path); - } - -} diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index 64661ca1157..670ac2ec524 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -245,9 +245,6 @@ class Cache { $queryParts[] = '`storage`'; $params[] = $this->getNumericStorageId(); - $params = array_map(function($item) { - return trim($item, "`"); - }, $params); $queryParts = array_map(function($item) { return trim($item, "`"); }, $queryParts); diff --git a/lib/private/files/cache/watcher.php b/lib/private/files/cache/watcher.php index f4572895b09..22c3fb202c3 100644 --- a/lib/private/files/cache/watcher.php +++ b/lib/private/files/cache/watcher.php @@ -52,6 +52,13 @@ class Watcher { } /** + * @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS + */ + public function getPolicy() { + return $this->watchPolicy; + } + + /** * check $path for updates * * @param string $path diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php index 85edb7cb570..a187f4db109 100644 --- a/lib/private/files/mount/mountpoint.php +++ b/lib/private/files/mount/mountpoint.php @@ -71,9 +71,10 @@ class MountPoint implements IMountPoint { } $mountpoint = $this->formatPath($mountpoint); + $this->mountPoint = $mountpoint; if ($storage instanceof Storage) { $this->class = get_class($storage); - $this->storage = $this->loader->wrap($mountpoint, $storage); + $this->storage = $this->loader->wrap($this, $storage); } else { // Update old classes to new namespace if (strpos($storage, 'OC_Filestorage_') !== false) { @@ -82,7 +83,6 @@ class MountPoint implements IMountPoint { $this->class = $storage; $this->arguments = $arguments; } - $this->mountPoint = $mountpoint; } /** @@ -113,7 +113,7 @@ class MountPoint implements IMountPoint { if (class_exists($this->class)) { try { - return $this->loader->getInstance($this->mountPoint, $this->class, $this->arguments); + return $this->loader->getInstance($this, $this->class, $this->arguments); } catch (\Exception $exception) { $this->invalidStorage = true; if ($this->mountPoint === '/') { @@ -195,7 +195,7 @@ class MountPoint implements IMountPoint { $storage = $this->getStorage(); // storage can be null if it couldn't be initialized if ($storage != null) { - $this->storage = $wrapper($this->mountPoint, $storage); + $this->storage = $wrapper($this->mountPoint, $storage, $this); } } @@ -209,4 +209,13 @@ class MountPoint implements IMountPoint { public function getOption($name, $default) { return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default; } + + /** + * Get all options for the mount + * + * @return array + */ + public function getOptions() { + return $this->mountOptions; + } } diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 5de243e177a..11cf3405fd9 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -35,6 +35,8 @@ abstract class Common implements \OC\Files\Storage\Storage { protected $watcher; protected $storageCache; + protected $mountOptions = []; + /** * @var string[] */ @@ -330,7 +332,8 @@ abstract class Common implements \OC\Files\Storage\Storage { } if (!isset($this->watcher)) { $this->watcher = new Watcher($storage); - $this->watcher->setPolicy(\OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_ONCE)); + $globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_ONCE); + $this->watcher->setPolicy($this->getMountOption('filesystem_check_changes', $globalPolicy)); } return $this->watcher; } @@ -517,4 +520,20 @@ abstract class Common implements \OC\Files\Storage\Storage { throw new InvalidCharacterInPathException(); } } + + /** + * @param array $options + */ + public function setMountOptions(array $options) { + $this->mountOptions = $options; + } + + /** + * @param string $name + * @param mixed $default + * @return mixed + */ + public function getMountOption($name, $default = null) { + return isset($this->mountOptions[$name]) ? $this->mountOptions[$name] : $default; + } } diff --git a/lib/private/files/storage/storagefactory.php b/lib/private/files/storage/storagefactory.php index fa6dea2537c..51972791290 100644 --- a/lib/private/files/storage/storagefactory.php +++ b/lib/private/files/storage/storagefactory.php @@ -8,6 +8,7 @@ namespace OC\Files\Storage; +use OCP\Files\Mount\IMountPoint; use OCP\Files\Storage\IStorageFactory; class StorageFactory implements IStorageFactory { @@ -55,23 +56,23 @@ class StorageFactory implements IStorageFactory { /** * Create an instance of a storage and apply the registered storage wrappers * - * @param string|boolean $mountPoint + * @param \OCP\Files\Mount\IMountPoint $mountPoint * @param string $class * @param array $arguments * @return \OCP\Files\Storage */ - public function getInstance($mountPoint, $class, $arguments) { + public function getInstance(IMountPoint $mountPoint, $class, $arguments) { return $this->wrap($mountPoint, new $class($arguments)); } /** - * @param string|boolean $mountPoint + * @param \OCP\Files\Mount\IMountPoint $mountPoint * @param \OCP\Files\Storage $storage * @return \OCP\Files\Storage */ - public function wrap($mountPoint, $storage) { + public function wrap(IMountPoint $mountPoint, $storage) { foreach ($this->storageWrappers as $wrapper) { - $storage = $wrapper($mountPoint, $storage); + $storage = $wrapper($mountPoint->getMountPoint(), $storage, $mountPoint); } return $storage; } diff --git a/lib/private/server.php b/lib/private/server.php index c55817bb6b3..4264c70905c 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -12,6 +12,7 @@ use OC\Diagnostics\NullQueryLogger; use OC\Diagnostics\EventLogger; use OC\Diagnostics\QueryLogger; use OC\Mail\Mailer; +use OC\Memcache\ArrayCache; use OC\Security\CertificateManager; use OC\Files\Node\Root; use OC\Files\View; @@ -159,17 +160,25 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('UserCache', function ($c) { return new UserCache(); }); - $this->registerService('MemCacheFactory', function ($c) { + $this->registerService('MemCacheFactory', function (Server $c) { $config = $c->getConfig(); - $v = \OC_App::getAppVersions(); - $v['core'] = implode('.', \OC_Util::getVersion()); - $version = implode(',', $v); - $instanceId = \OC_Util::getInstanceId(); - $path = \OC::$SERVERROOT; - $prefix = md5($instanceId.'-'.$version.'-'.$path); - return new \OC\Memcache\Factory($prefix, - $config->getSystemValue('memcache.local', null), - $config->getSystemValue('memcache.distributed', null) + + if($config->getSystemValue('installed', false)) { + $v = \OC_App::getAppVersions(); + $v['core'] = implode('.', \OC_Util::getVersion()); + $version = implode(',', $v); + $instanceId = \OC_Util::getInstanceId(); + $path = \OC::$SERVERROOT; + $prefix = md5($instanceId.'-'.$version.'-'.$path); + return new \OC\Memcache\Factory($prefix, + $config->getSystemValue('memcache.local', null), + $config->getSystemValue('memcache.distributed', null) + ); + } + + return new \OC\Memcache\Factory('', + new ArrayCache(), + new ArrayCache() ); }); $this->registerService('ActivityManager', function ($c) { diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 974ebf41f93..dff3af56f40 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1097,9 +1097,17 @@ class Share extends \OC\Share\Constants { */ public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) { $user = \OC_User::getUser(); + $l = \OC::$server->getL10N('lib'); if ($date == '') { - $date = null; + if (\OCP\Util::isDefaultExpireDateEnforced()) { + $warning = 'Cannot clear expiration date. Shares are required to have an expiration date.'; + $warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.'); + \OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN); + throw new \Exception($warning_t); + } else { + $date = null; + } } else { $date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource); } diff --git a/lib/private/template.php b/lib/private/template.php index b0d212c6f53..e6b76cc664e 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -217,6 +217,7 @@ class OC_Template extends \OC\Template\Base { public static function printExceptionErrorPage(Exception $exception) { $request = \OC::$server->getRequest(); $content = new \OC_Template('', 'exception', 'error', false); + $content->assign('errorClass', get_class($exception)); $content->assign('errorMsg', $exception->getMessage()); $content->assign('errorCode', $exception->getCode()); $content->assign('file', $exception->getFile()); diff --git a/lib/private/util.php b/lib/private/util.php index 11366d450a9..a048996da6e 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -98,6 +98,14 @@ class OC_Util { return false; } + \OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) { + if($storage->instanceOfStorage('\OC\Files\Storage\Common')) { + /** @var \OC\Files\Storage\Common $storage */ + $storage->setMountOptions($mount->getOptions()); + } + return $storage; + }); + //if we aren't logged in, there is no use to set up the filesystem if ($user != "") { \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { @@ -127,9 +135,6 @@ class OC_Util { //jail the user into his "home" directory \OC\Files\Filesystem::init($user, $userDir); - $fileOperationProxy = new OC_FileProxy_FileOperations(); - OC_FileProxy::register($fileOperationProxy); - //trigger creation of user home and /files folder \OC::$server->getUserFolder($user); diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php index 5143547c8e8..9a5d6e819b9 100644 --- a/lib/public/appframework/db/mapper.php +++ b/lib/public/appframework/db/mapper.php @@ -26,7 +26,8 @@ namespace OCP\AppFramework\Db; -use \OCP\IDBConnection; +use OCP\IDBConnection; +use OCP\IDb; /** @@ -183,6 +184,31 @@ abstract class Mapper { return $entity; } + /** + * Checks if an array is associative + * @param array $array + * @return bool true if associative + */ + private function isAssocArray(array $array) { + return array_values($array) !== $array; + } + + /** + * Returns the correct PDO constant based on the value type + * @param $value + * @return PDO constant + */ + private function getPDOType($value) { + switch (gettype($value)) { + case 'integer': + return \PDO::PARAM_INT; + case 'boolean': + return \PDO::PARAM_BOOL; + default: + return \PDO::PARAM_STR; + } + } + /** * Runs an sql query @@ -193,32 +219,37 @@ abstract class Mapper { * @return \PDOStatement the database query result */ protected function execute($sql, array $params=[], $limit=null, $offset=null){ - $query = $this->db->prepare($sql, $limit, $offset); - - $index = 1; // bindParam is 1 indexed - foreach($params as $param) { - - switch (gettype($param)) { - case 'integer': - $pdoConstant = \PDO::PARAM_INT; - break; - - case 'boolean': - $pdoConstant = \PDO::PARAM_BOOL; - break; + if ($this->db instanceof IDb) { + $query = $this->db->prepareQuery($sql, $limit, $offset); + } else { + $query = $this->db->prepare($sql, $limit, $offset); + } - default: - $pdoConstant = \PDO::PARAM_STR; - break; + if ($this->isAssocArray($params)) { + foreach ($params as $key => $param) { + $pdoConstant = $this->getPDOType($param); + $query->bindValue($key, $param, $pdoConstant); } + } else { + $index = 1; // bindParam is 1 indexed + foreach ($params as $param) { + $pdoConstant = $this->getPDOType($param); + $query->bindValue($index, $param, $pdoConstant); + $index++; + } + } - $query->bindValue($index, $param, $pdoConstant); + $result = $query->execute(); - $index++; + // this is only for backwards compatibility reasons and can be removed + // in owncloud 10. IDb returns a StatementWrapper from execute, PDO, + // Doctrine and IDbConnection don't so this needs to be done in order + // to stay backwards compatible for the things that rely on the + // StatementWrapper being returned + if ($result instanceof \OC_DB_StatementWrapper) { + return $result; } - $query->execute(); - return $query; } diff --git a/lib/public/files/mount/imountpoint.php b/lib/public/files/mount/imountpoint.php index af7819ae160..2ec0cca1dce 100644 --- a/lib/public/files/mount/imountpoint.php +++ b/lib/public/files/mount/imountpoint.php @@ -64,4 +64,11 @@ interface IMountPoint { * @return mixed */ public function getOption($name, $default); + + /** + * Get all options for the mount + * + * @return array + */ + public function getOptions(); } diff --git a/lib/public/files/storage/istoragefactory.php b/lib/public/files/storage/istoragefactory.php index 50c844af2e6..7d4fa55e418 100644 --- a/lib/public/files/storage/istoragefactory.php +++ b/lib/public/files/storage/istoragefactory.php @@ -7,6 +7,7 @@ */ namespace OCP\Files\Storage; +use OCP\Files\Mount\IMountPoint; /** * Creates storage instances and manages and applies storage wrappers @@ -25,10 +26,10 @@ interface IStorageFactory { public function addStorageWrapper($wrapperName, $callback); /** - * @param string|boolean $mountPoint + * @param \OCP\Files\Mount\IMountPoint $mountPoint * @param string $class * @param array $arguments * @return \OCP\Files\Storage */ - public function getInstance($mountPoint, $class, $arguments); + public function getInstance(IMountPoint $mountPoint, $class, $arguments); } diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index ad55c63c21a..721464f923d 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -66,7 +66,7 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ? - ) WHERE `name` LIKE ? + ) WHERE `name` ILIKE ? '); } |