summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/autoloader.php2
-rw-r--r--lib/base.php11
-rw-r--r--lib/l10n/bg_BG.js2
-rw-r--r--lib/l10n/bg_BG.json2
-rw-r--r--lib/l10n/cs_CZ.js2
-rw-r--r--lib/l10n/cs_CZ.json2
-rw-r--r--lib/l10n/da.js2
-rw-r--r--lib/l10n/da.json2
-rw-r--r--lib/l10n/de.js4
-rw-r--r--lib/l10n/de.json4
-rw-r--r--lib/l10n/de_DE.js4
-rw-r--r--lib/l10n/de_DE.json4
-rw-r--r--lib/l10n/el.js2
-rw-r--r--lib/l10n/el.json2
-rw-r--r--lib/l10n/en_GB.js1
-rw-r--r--lib/l10n/en_GB.json1
-rw-r--r--lib/l10n/eo.js1
-rw-r--r--lib/l10n/eo.json1
-rw-r--r--lib/l10n/es.js2
-rw-r--r--lib/l10n/es.json2
-rw-r--r--lib/l10n/eu.js1
-rw-r--r--lib/l10n/eu.json1
-rw-r--r--lib/l10n/fi_FI.js2
-rw-r--r--lib/l10n/fi_FI.json2
-rw-r--r--lib/l10n/fr.js9
-rw-r--r--lib/l10n/fr.json9
-rw-r--r--lib/l10n/gl.js2
-rw-r--r--lib/l10n/gl.json2
-rw-r--r--lib/l10n/hr.js1
-rw-r--r--lib/l10n/hr.json1
-rw-r--r--lib/l10n/id.js5
-rw-r--r--lib/l10n/id.json5
-rw-r--r--lib/l10n/it.js2
-rw-r--r--lib/l10n/it.json2
-rw-r--r--lib/l10n/ja.js1
-rw-r--r--lib/l10n/ja.json1
-rw-r--r--lib/l10n/ko.js1
-rw-r--r--lib/l10n/ko.json1
-rw-r--r--lib/l10n/lb.js12
-rw-r--r--lib/l10n/lb.json12
-rw-r--r--lib/l10n/nb_NO.js2
-rw-r--r--lib/l10n/nb_NO.json2
-rw-r--r--lib/l10n/nl.js2
-rw-r--r--lib/l10n/nl.json2
-rw-r--r--lib/l10n/pl.js1
-rw-r--r--lib/l10n/pl.json1
-rw-r--r--lib/l10n/pt_BR.js2
-rw-r--r--lib/l10n/pt_BR.json2
-rw-r--r--lib/l10n/pt_PT.js1
-rw-r--r--lib/l10n/pt_PT.json1
-rw-r--r--lib/l10n/ro.js2
-rw-r--r--lib/l10n/ro.json2
-rw-r--r--lib/l10n/ru.js2
-rw-r--r--lib/l10n/ru.json2
-rw-r--r--lib/l10n/sk_SK.js1
-rw-r--r--lib/l10n/sk_SK.json1
-rw-r--r--lib/l10n/sl.js1
-rw-r--r--lib/l10n/sl.json1
-rw-r--r--lib/l10n/sr.js1
-rw-r--r--lib/l10n/sr.json1
-rw-r--r--lib/l10n/sv.js1
-rw-r--r--lib/l10n/sv.json1
-rw-r--r--lib/l10n/th_TH.js2
-rw-r--r--lib/l10n/th_TH.json2
-rw-r--r--lib/l10n/tr.js4
-rw-r--r--lib/l10n/tr.json4
-rw-r--r--lib/l10n/uk.js1
-rw-r--r--lib/l10n/uk.json1
-rw-r--r--lib/private/app.php34
-rw-r--r--lib/private/app/codechecker/abstractcheck.php139
-rw-r--r--lib/private/app/codechecker/codechecker.php (renamed from lib/private/app/codechecker.php)42
-rw-r--r--lib/private/app/codechecker/deprecationcheck.php147
-rw-r--r--lib/private/app/codechecker/emptycheck.php67
-rw-r--r--lib/private/app/codechecker/icheck.php55
-rw-r--r--lib/private/app/codechecker/nodevisitor.php306
-rw-r--r--lib/private/app/codechecker/privatecheck.php86
-rw-r--r--lib/private/app/codechecker/strongcomparisoncheck.php80
-rw-r--r--lib/private/app/codecheckvisitor.php133
-rw-r--r--lib/private/appframework/http/request.php3
-rw-r--r--lib/private/appframework/middleware/security/corsmiddleware.php37
-rw-r--r--lib/private/appframework/middleware/security/securitymiddleware.php14
-rw-r--r--lib/private/cache/file.php2
-rw-r--r--lib/private/connector/sabre/file.php6
-rw-r--r--lib/private/connector/sabre/filesplugin.php18
-rw-r--r--lib/private/db.php4
-rw-r--r--lib/private/db/connection.php2
-rw-r--r--lib/private/db/statementwrapper.php2
-rw-r--r--lib/private/encryption/util.php29
-rw-r--r--lib/private/files.php4
-rw-r--r--lib/private/files/cache/cache.php2
-rw-r--r--lib/private/files/cache/scanner.php2
-rw-r--r--lib/private/files/mapper.php305
-rw-r--r--lib/private/files/mount/mountpoint.php4
-rw-r--r--lib/private/files/node/root.php29
-rw-r--r--lib/private/files/storage/dav.php50
-rw-r--r--lib/private/files/storage/flysystem.php243
-rw-r--r--lib/private/files/storage/local.php571
-rw-r--r--lib/private/files/storage/mappedlocal.php456
-rw-r--r--lib/private/files/storage/polyfill/copydirectory.php89
-rw-r--r--lib/private/files/storage/wrapper/encryption.php110
-rw-r--r--lib/private/files/type/detection.php2
-rw-r--r--lib/private/files/view.php2
-rw-r--r--lib/private/helper.php152
-rw-r--r--lib/private/hook.php4
-rw-r--r--lib/private/installer.php20
-rw-r--r--lib/private/legacy/appconfig.php131
-rw-r--r--lib/private/legacy/log.php69
-rw-r--r--lib/private/legacy/search.php70
-rw-r--r--lib/private/legacy/search/provider.php31
-rw-r--r--lib/private/legacy/search/provider/file.php29
-rw-r--r--lib/private/legacy/search/result.php41
-rw-r--r--lib/private/log.php22
-rw-r--r--lib/private/log/owncloud.php6
-rw-r--r--lib/private/log/rotate.php2
-rw-r--r--lib/private/log/syslog.php10
-rw-r--r--lib/private/memcache/factory.php49
-rw-r--r--lib/private/mimetypes.list.php200
-rw-r--r--lib/private/naturalsort.php2
-rw-r--r--lib/private/ocsclient.php2
-rw-r--r--lib/private/preview.php2
-rw-r--r--lib/private/preview/bitmap.php2
-rw-r--r--lib/private/preview/office.php2
-rw-r--r--lib/private/preview/svg.php2
-rw-r--r--lib/private/server.php33
-rw-r--r--lib/private/setup/mssql.php20
-rw-r--r--lib/private/setup/mysql.php2
-rw-r--r--lib/private/setup/oci.php22
-rw-r--r--lib/private/setup/postgresql.php10
-rw-r--r--lib/private/share/share.php118
-rw-r--r--lib/private/systemconfig.php8
-rw-r--r--lib/private/user.php10
-rw-r--r--lib/private/user/database.php4
-rw-r--r--lib/private/user/manager.php2
-rw-r--r--lib/private/util.php15
-rw-r--r--lib/public/appframework/http/jsonresponse.php11
-rw-r--r--lib/public/files/irootfolder.php8
-rw-r--r--lib/public/iservercontainer.php1
-rw-r--r--lib/public/util.php8
138 files changed, 2116 insertions, 2250 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 7031962fc49..23285f61e73 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -73,7 +73,7 @@ class Autoloader {
* Remove "apps/" from inclusion path for smooth migration to mutli app dir
*/
if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
- \OC_Log::write('core', 'include path for class "' . $class . '" starts with "apps/"', \OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
}
} elseif (strpos($class, 'OC_') === 0) {
diff --git a/lib/base.php b/lib/base.php
index bb6027370bf..32fcbac7c05 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -406,6 +406,8 @@ class OC {
OC_Util::addScript('search', 'search');
OC_Util::addScript("oc-requesttoken");
OC_Util::addScript("apps");
+ OC_Util::addScript('mimetype');
+ OC_Util::addScript('mimetypelist');
OC_Util::addVendorScript('snapjs/dist/latest/snap');
// avatars
@@ -572,7 +574,8 @@ class OC {
OC_Util::isSetLocaleWorking();
if (!defined('PHPUNIT_RUN')) {
- OC\Log\ErrorHandler::setLogger(OC_Log::$object);
+ $logger = \OC::$server->getLogger();
+ OC\Log\ErrorHandler::setLogger($logger);
if (defined('DEBUG') and DEBUG) {
OC\Log\ErrorHandler::register(true);
set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
@@ -1030,7 +1033,7 @@ class OC {
}
if (defined("DEBUG") && DEBUG) {
- OC_Log::write('core', 'Trying to login from cookie', OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'Trying to login from cookie', \OCP\Util::DEBUG);
}
if(OC_User::userExists($_COOKIE['oc_username'])) {
@@ -1042,8 +1045,8 @@ class OC {
OC_Util::redirectToDefaultPage();
// doesn't return
}
- OC_Log::write('core', 'Authentication cookie rejected for user ' .
- $_COOKIE['oc_username'], OC_Log::WARN);
+ \OCP\Util::writeLog('core', 'Authentication cookie rejected for user ' .
+ $_COOKIE['oc_username'], \OCP\Util::WARN);
// if you reach this point you have changed your password
// or you are an attacker
// we can not delete tokens here because users may reach
diff --git a/lib/l10n/bg_BG.js b/lib/l10n/bg_BG.js
index 986884d7310..fd78bc865c3 100644
--- a/lib/l10n/bg_BG.js
+++ b/lib/l10n/bg_BG.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Необходима е библиотеката %s с версия по-ниска от %s - налична версия %s. ",
"Following platforms are supported: %s" : "Поддържани са следните платформи: %s",
"ownCloud %s or higher is required." : "Необходим е ownCloud %s или по-висока версия.",
- "ownCloud with a version lower than %s is required." : "Необходим е ownCloud с по-ниска версия от %s.",
"Help" : "Помощ",
"Personal" : "Лични",
"Users" : "Потребители",
@@ -33,6 +32,7 @@ OC.L10N.register(
"_%n year ago_::_%n years ago_" : ["преди %n година","преди %n години"],
"seconds ago" : "преди секунди",
"web services under your control" : "уеб услуги под твой контрол",
+ "File name contains at least one invalid character" : "Името на файла съдържа поне един невалиден символ",
"App directory already exists" : "Папката на приложението вече съществува.",
"Can't create app folder. Please fix permissions. %s" : "Неуспешно създаване на папката за приложението. Моля, оправете разрешенията. %s",
"No source specified when installing app" : "Не е зададен източник при инсталацията на приложението.",
diff --git a/lib/l10n/bg_BG.json b/lib/l10n/bg_BG.json
index 6db0d8894e8..51b5d562bbd 100644
--- a/lib/l10n/bg_BG.json
+++ b/lib/l10n/bg_BG.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Необходима е библиотеката %s с версия по-ниска от %s - налична версия %s. ",
"Following platforms are supported: %s" : "Поддържани са следните платформи: %s",
"ownCloud %s or higher is required." : "Необходим е ownCloud %s или по-висока версия.",
- "ownCloud with a version lower than %s is required." : "Необходим е ownCloud с по-ниска версия от %s.",
"Help" : "Помощ",
"Personal" : "Лични",
"Users" : "Потребители",
@@ -31,6 +30,7 @@
"_%n year ago_::_%n years ago_" : ["преди %n година","преди %n години"],
"seconds ago" : "преди секунди",
"web services under your control" : "уеб услуги под твой контрол",
+ "File name contains at least one invalid character" : "Името на файла съдържа поне един невалиден символ",
"App directory already exists" : "Папката на приложението вече съществува.",
"Can't create app folder. Please fix permissions. %s" : "Неуспешно създаване на папката за приложението. Моля, оправете разрешенията. %s",
"No source specified when installing app" : "Не е зададен източник при инсталацията на приложението.",
diff --git a/lib/l10n/cs_CZ.js b/lib/l10n/cs_CZ.js
index fd30fc3463b..da6cb13a00e 100644
--- a/lib/l10n/cs_CZ.js
+++ b/lib/l10n/cs_CZ.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Je vyžadována knihovna %s ve verzi nižší než %s - dostupná verze %s.",
"Following platforms are supported: %s" : "Jsou podporovány následující systémy: %s",
"ownCloud %s or higher is required." : "Je vyžadován ownCloud %s nebo vyšší.",
- "ownCloud with a version lower than %s is required." : "Je vyžadován ownCloud ve verzi nižší než %s.",
+ "ownCloud %s or lower is required." : "Je vyžadován ownCloud %s nebo nižší.",
"Help" : "Nápověda",
"Personal" : "Osobní",
"Users" : "Uživatelé",
diff --git a/lib/l10n/cs_CZ.json b/lib/l10n/cs_CZ.json
index 3ee3cc16587..c493b357d35 100644
--- a/lib/l10n/cs_CZ.json
+++ b/lib/l10n/cs_CZ.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Je vyžadována knihovna %s ve verzi nižší než %s - dostupná verze %s.",
"Following platforms are supported: %s" : "Jsou podporovány následující systémy: %s",
"ownCloud %s or higher is required." : "Je vyžadován ownCloud %s nebo vyšší.",
- "ownCloud with a version lower than %s is required." : "Je vyžadován ownCloud ve verzi nižší než %s.",
+ "ownCloud %s or lower is required." : "Je vyžadován ownCloud %s nebo nižší.",
"Help" : "Nápověda",
"Personal" : "Osobní",
"Users" : "Uživatelé",
diff --git a/lib/l10n/da.js b/lib/l10n/da.js
index 147a2c40242..c086fd058ed 100644
--- a/lib/l10n/da.js
+++ b/lib/l10n/da.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Der kræves en version af biblioteket %s, der er lavere end %s - tilgængelig version er %s.",
"Following platforms are supported: %s" : "Følgende platforme understøttes: %s",
"ownCloud %s or higher is required." : "Der kræves ownCloud %s eller højere.",
- "ownCloud with a version lower than %s is required." : "Der kræves ownCloud i en version som er lavere end %s.",
+ "ownCloud %s or lower is required." : "ownCloud %s eller lavere er påkrævet.",
"Help" : "Hjælp",
"Personal" : "Personligt",
"Users" : "Brugere",
diff --git a/lib/l10n/da.json b/lib/l10n/da.json
index 14057dc10ec..15e48886c46 100644
--- a/lib/l10n/da.json
+++ b/lib/l10n/da.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Der kræves en version af biblioteket %s, der er lavere end %s - tilgængelig version er %s.",
"Following platforms are supported: %s" : "Følgende platforme understøttes: %s",
"ownCloud %s or higher is required." : "Der kræves ownCloud %s eller højere.",
- "ownCloud with a version lower than %s is required." : "Der kræves ownCloud i en version som er lavere end %s.",
+ "ownCloud %s or lower is required." : "ownCloud %s eller lavere er påkrævet.",
"Help" : "Hjælp",
"Personal" : "Personligt",
"Users" : "Brugere",
diff --git a/lib/l10n/de.js b/lib/l10n/de.js
index ceb61e470f0..c094d461ecd 100644
--- a/lib/l10n/de.js
+++ b/lib/l10n/de.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Die Bibliothek %s wird in einer früheren Version als %s benötigt - verfügbare Version ist %s.",
"Following platforms are supported: %s" : "Die folgenden Plattformen werden unterstützt: %s",
"ownCloud %s or higher is required." : "ownCloud %s oder höher wird benötigt.",
- "ownCloud with a version lower than %s is required." : "ownCloud wird in einer früheren Version als %s benötigt.",
+ "ownCloud %s or lower is required." : "ownCloud %s oder niedriger wird benötigt.",
"Help" : "Hilfe",
"Personal" : "Persönlich",
"Users" : "Benutzer",
@@ -45,6 +45,7 @@ OC.L10N.register(
"File name is a reserved word" : "Der Dateiname ist ein reserviertes Wort",
"File name contains at least one invalid character" : "Der Dateiname enthält mindestens ein ungültiges Zeichen",
"File name is too long" : "Dateiname ist zu lang",
+ "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuche es später noch einmal",
"Can't read file" : "Datei kann nicht gelesen werden",
"App directory already exists" : "Das Applikationsverzeichnis existiert bereits",
"Can't create app folder. Please fix permissions. %s" : "Es kann kein Applikationsordner erstellt werden. Bitte passe die Berechtigungen an. %s",
@@ -85,6 +86,7 @@ OC.L10N.register(
"Set an admin username." : "Einen Administrator-Benutzernamen setzen.",
"Set an admin password." : "Ein Administrator-Passwort setzen.",
"Can't create or write into the data directory %s" : "Das Datenverzeichnis %s kann nicht erstellt oder es kann darin nicht geschrieben werden.",
+ "Invalid Federated Cloud ID" : "Ungültige Federated-Cloud-ID",
"%s shared »%s« with you" : "%s hat „%s“ mit Dir geteilt",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Freigabe von %s fehlgeschlagen, da das Backend die Freigabe vom Typ %i nicht erlaubt.",
diff --git a/lib/l10n/de.json b/lib/l10n/de.json
index b2c380ff62b..f8097ba0bf9 100644
--- a/lib/l10n/de.json
+++ b/lib/l10n/de.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Die Bibliothek %s wird in einer früheren Version als %s benötigt - verfügbare Version ist %s.",
"Following platforms are supported: %s" : "Die folgenden Plattformen werden unterstützt: %s",
"ownCloud %s or higher is required." : "ownCloud %s oder höher wird benötigt.",
- "ownCloud with a version lower than %s is required." : "ownCloud wird in einer früheren Version als %s benötigt.",
+ "ownCloud %s or lower is required." : "ownCloud %s oder niedriger wird benötigt.",
"Help" : "Hilfe",
"Personal" : "Persönlich",
"Users" : "Benutzer",
@@ -43,6 +43,7 @@
"File name is a reserved word" : "Der Dateiname ist ein reserviertes Wort",
"File name contains at least one invalid character" : "Der Dateiname enthält mindestens ein ungültiges Zeichen",
"File name is too long" : "Dateiname ist zu lang",
+ "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuche es später noch einmal",
"Can't read file" : "Datei kann nicht gelesen werden",
"App directory already exists" : "Das Applikationsverzeichnis existiert bereits",
"Can't create app folder. Please fix permissions. %s" : "Es kann kein Applikationsordner erstellt werden. Bitte passe die Berechtigungen an. %s",
@@ -83,6 +84,7 @@
"Set an admin username." : "Einen Administrator-Benutzernamen setzen.",
"Set an admin password." : "Ein Administrator-Passwort setzen.",
"Can't create or write into the data directory %s" : "Das Datenverzeichnis %s kann nicht erstellt oder es kann darin nicht geschrieben werden.",
+ "Invalid Federated Cloud ID" : "Ungültige Federated-Cloud-ID",
"%s shared »%s« with you" : "%s hat „%s“ mit Dir geteilt",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Freigabe von %s fehlgeschlagen, da das Backend die Freigabe vom Typ %i nicht erlaubt.",
diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js
index 9eb8396eda9..ec4fd632552 100644
--- a/lib/l10n/de_DE.js
+++ b/lib/l10n/de_DE.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Die Bibliothek %s wird in einer früheren Version als %s benötigt - vorhanden ist Version %s.",
"Following platforms are supported: %s" : "Die folgenden Plattformen werden unterstützt: %s",
"ownCloud %s or higher is required." : "ownCloud %s oder höher wird benötigt.",
- "ownCloud with a version lower than %s is required." : "ownCloud wird in einer früheren Version als %s benötigt.",
+ "ownCloud %s or lower is required." : "ownCloud %s oder niedriger wird benötigt.",
"Help" : "Hilfe",
"Personal" : "Persönlich",
"Users" : "Benutzer",
@@ -45,6 +45,7 @@ OC.L10N.register(
"File name is a reserved word" : "Der Dateiname ist ein reserviertes Wort",
"File name contains at least one invalid character" : "Der Dateiname enthält mindestens ein ungültiges Zeichen",
"File name is too long" : "Dateiname ist zu lang",
+ "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuchen Sie es später noch einmal",
"Can't read file" : "Datei kann nicht gelesen werden",
"App directory already exists" : "Der Ordner für die App ist bereits vorhanden.",
"Can't create app folder. Please fix permissions. %s" : "Der Ordner für die App konnte nicht angelegt werden. Bitte überprüfen Sie die Ordner- und Dateirechte und passen Sie diese entsprechend an. %s",
@@ -85,6 +86,7 @@ OC.L10N.register(
"Set an admin username." : "Einen Administrator-Benutzernamen setzen.",
"Set an admin password." : "Setze Administrator Passwort",
"Can't create or write into the data directory %s" : "Das Datenverzeichnis %s kann nicht erstellt oder es kann darin nicht geschrieben werden.",
+ "Invalid Federated Cloud ID" : "Ungültige Federated-Cloud-ID",
"%s shared »%s« with you" : "%s hat „%s“ mit Ihnen geteilt",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Freigabe von %s fehlgeschlagen, da das Backend die Freigabe vom Typ %i nicht erlaubt.",
diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json
index fa965557457..44d5cab7ca3 100644
--- a/lib/l10n/de_DE.json
+++ b/lib/l10n/de_DE.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Die Bibliothek %s wird in einer früheren Version als %s benötigt - vorhanden ist Version %s.",
"Following platforms are supported: %s" : "Die folgenden Plattformen werden unterstützt: %s",
"ownCloud %s or higher is required." : "ownCloud %s oder höher wird benötigt.",
- "ownCloud with a version lower than %s is required." : "ownCloud wird in einer früheren Version als %s benötigt.",
+ "ownCloud %s or lower is required." : "ownCloud %s oder niedriger wird benötigt.",
"Help" : "Hilfe",
"Personal" : "Persönlich",
"Users" : "Benutzer",
@@ -43,6 +43,7 @@
"File name is a reserved word" : "Der Dateiname ist ein reserviertes Wort",
"File name contains at least one invalid character" : "Der Dateiname enthält mindestens ein ungültiges Zeichen",
"File name is too long" : "Dateiname ist zu lang",
+ "File is currently busy, please try again later" : "Die Datei ist zur Zeit in Benutzung, bitte versuchen Sie es später noch einmal",
"Can't read file" : "Datei kann nicht gelesen werden",
"App directory already exists" : "Der Ordner für die App ist bereits vorhanden.",
"Can't create app folder. Please fix permissions. %s" : "Der Ordner für die App konnte nicht angelegt werden. Bitte überprüfen Sie die Ordner- und Dateirechte und passen Sie diese entsprechend an. %s",
@@ -83,6 +84,7 @@
"Set an admin username." : "Einen Administrator-Benutzernamen setzen.",
"Set an admin password." : "Setze Administrator Passwort",
"Can't create or write into the data directory %s" : "Das Datenverzeichnis %s kann nicht erstellt oder es kann darin nicht geschrieben werden.",
+ "Invalid Federated Cloud ID" : "Ungültige Federated-Cloud-ID",
"%s shared »%s« with you" : "%s hat „%s“ mit Ihnen geteilt",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Freigabe von %s fehlgeschlagen, da das Backend die Freigabe vom Typ %i nicht erlaubt.",
diff --git a/lib/l10n/el.js b/lib/l10n/el.js
index 4ead3fb9254..d687c1eb851 100644
--- a/lib/l10n/el.js
+++ b/lib/l10n/el.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Απαιτείται βιβλιοθήκη %s παλαιότερη από την έκδοση %s - διαθέσιμη έκδοση %s ",
"Following platforms are supported: %s" : "Οι ακόλουθες πλατφόρμες υποστηρίζονται: %s",
"ownCloud %s or higher is required." : "Απαιτείται ownCloud %s ή νεότερο",
- "ownCloud with a version lower than %s is required." : "Απαιτείται έκδοση ownCloud παλαιότερη από την %s.",
+ "ownCloud %s or lower is required." : "Απαιτείται έκδοση του ownCloud παλαιότερη από την %s.",
"Help" : "Βοήθεια",
"Personal" : "Προσωπικά",
"Users" : "Χρήστες",
diff --git a/lib/l10n/el.json b/lib/l10n/el.json
index bb6df966a87..05ca5aa4a2f 100644
--- a/lib/l10n/el.json
+++ b/lib/l10n/el.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Απαιτείται βιβλιοθήκη %s παλαιότερη από την έκδοση %s - διαθέσιμη έκδοση %s ",
"Following platforms are supported: %s" : "Οι ακόλουθες πλατφόρμες υποστηρίζονται: %s",
"ownCloud %s or higher is required." : "Απαιτείται ownCloud %s ή νεότερο",
- "ownCloud with a version lower than %s is required." : "Απαιτείται έκδοση ownCloud παλαιότερη από την %s.",
+ "ownCloud %s or lower is required." : "Απαιτείται έκδοση του ownCloud παλαιότερη από την %s.",
"Help" : "Βοήθεια",
"Personal" : "Προσωπικά",
"Users" : "Χρήστες",
diff --git a/lib/l10n/en_GB.js b/lib/l10n/en_GB.js
index 89fac8a92fe..f14cbbfdfea 100644
--- a/lib/l10n/en_GB.js
+++ b/lib/l10n/en_GB.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Library %s with a version lower than %s is required - available version %s.",
"Following platforms are supported: %s" : "Following platforms are supported: %s",
"ownCloud %s or higher is required." : "ownCloud %s or higher is required.",
- "ownCloud with a version lower than %s is required." : "ownCloud with a version lower than %s is required.",
"Help" : "Help",
"Personal" : "Personal",
"Users" : "Users",
diff --git a/lib/l10n/en_GB.json b/lib/l10n/en_GB.json
index 73f4e3030fb..d50562272d0 100644
--- a/lib/l10n/en_GB.json
+++ b/lib/l10n/en_GB.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Library %s with a version lower than %s is required - available version %s.",
"Following platforms are supported: %s" : "Following platforms are supported: %s",
"ownCloud %s or higher is required." : "ownCloud %s or higher is required.",
- "ownCloud with a version lower than %s is required." : "ownCloud with a version lower than %s is required.",
"Help" : "Help",
"Personal" : "Personal",
"Users" : "Users",
diff --git a/lib/l10n/eo.js b/lib/l10n/eo.js
index ad565d590b7..b672c053740 100644
--- a/lib/l10n/eo.js
+++ b/lib/l10n/eo.js
@@ -9,7 +9,6 @@ OC.L10N.register(
"The command line tool %s could not be found" : "La komandolinia ilo %s ne troviĝis",
"The library %s is not available." : "La biblioteko %s ne haveblas.",
"ownCloud %s or higher is required." : "ownCloud %s aŭ pli alta necesas.",
- "ownCloud with a version lower than %s is required." : "Eldono de ownCloud pli malalta ol %s necesas.",
"Help" : "Helpo",
"Personal" : "Persona",
"Users" : "Uzantoj",
diff --git a/lib/l10n/eo.json b/lib/l10n/eo.json
index e7f8810e310..d3877595272 100644
--- a/lib/l10n/eo.json
+++ b/lib/l10n/eo.json
@@ -7,7 +7,6 @@
"The command line tool %s could not be found" : "La komandolinia ilo %s ne troviĝis",
"The library %s is not available." : "La biblioteko %s ne haveblas.",
"ownCloud %s or higher is required." : "ownCloud %s aŭ pli alta necesas.",
- "ownCloud with a version lower than %s is required." : "Eldono de ownCloud pli malalta ol %s necesas.",
"Help" : "Helpo",
"Personal" : "Persona",
"Users" : "Uzantoj",
diff --git a/lib/l10n/es.js b/lib/l10n/es.js
index 42ecd7e7bb1..71f3a8aa8bf 100644
--- a/lib/l10n/es.js
+++ b/lib/l10n/es.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Biblioteca %s con una versión inferior que %s la requerida - versión disponible %s.",
"Following platforms are supported: %s" : "Las siguientes plataformas están soportadas: %s",
"ownCloud %s or higher is required." : "Se requiere ownCloud %s o superior.",
- "ownCloud with a version lower than %s is required." : "ownCloud con una versión inferior que %s la requerida.",
+ "ownCloud %s or lower is required." : "Se requiere ownCloud %s o una versión inferior.",
"Help" : "Ayuda",
"Personal" : "Personal",
"Users" : "Usuarios",
diff --git a/lib/l10n/es.json b/lib/l10n/es.json
index 6f28071f04b..1259ff53b49 100644
--- a/lib/l10n/es.json
+++ b/lib/l10n/es.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Biblioteca %s con una versión inferior que %s la requerida - versión disponible %s.",
"Following platforms are supported: %s" : "Las siguientes plataformas están soportadas: %s",
"ownCloud %s or higher is required." : "Se requiere ownCloud %s o superior.",
- "ownCloud with a version lower than %s is required." : "ownCloud con una versión inferior que %s la requerida.",
+ "ownCloud %s or lower is required." : "Se requiere ownCloud %s o una versión inferior.",
"Help" : "Ayuda",
"Personal" : "Personal",
"Users" : "Usuarios",
diff --git a/lib/l10n/eu.js b/lib/l10n/eu.js
index ce77065574f..b9093d1bf41 100644
--- a/lib/l10n/eu.js
+++ b/lib/l10n/eu.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "%s liburutegiak %s baino bertsio txikiagoa izan behar du - dagoen bertsioa %s.",
"Following platforms are supported: %s" : "Hurrengo plataformak onartzen dira: %s",
"ownCloud %s or higher is required." : "ownCloud %s edo haundiagoa behar da.",
- "ownCloud with a version lower than %s is required." : "ownCloud %s baino bertsio txikiagoa behar da.",
"Help" : "Laguntza",
"Personal" : "Pertsonala",
"Users" : "Erabiltzaileak",
diff --git a/lib/l10n/eu.json b/lib/l10n/eu.json
index 6fa2fc55a16..b921d8dd28b 100644
--- a/lib/l10n/eu.json
+++ b/lib/l10n/eu.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "%s liburutegiak %s baino bertsio txikiagoa izan behar du - dagoen bertsioa %s.",
"Following platforms are supported: %s" : "Hurrengo plataformak onartzen dira: %s",
"ownCloud %s or higher is required." : "ownCloud %s edo haundiagoa behar da.",
- "ownCloud with a version lower than %s is required." : "ownCloud %s baino bertsio txikiagoa behar da.",
"Help" : "Laguntza",
"Personal" : "Pertsonala",
"Users" : "Erabiltzaileak",
diff --git a/lib/l10n/fi_FI.js b/lib/l10n/fi_FI.js
index c8b5fb5bdb4..5724595dbda 100644
--- a/lib/l10n/fi_FI.js
+++ b/lib/l10n/fi_FI.js
@@ -15,7 +15,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Kirjasto %s versiota alempi %s tarvitaan - käytettävissä oleva versio %s.",
"Following platforms are supported: %s" : "Seuraavat alustat ovat tuettuja: %s",
"ownCloud %s or higher is required." : "ownCloud %s tai uudempi vaaditaan.",
- "ownCloud with a version lower than %s is required." : "ownCloud versiota %s alempi vaaditaan.",
+ "ownCloud %s or lower is required." : "ownCloud %s tai aiempi vaaditaan.",
"Help" : "Ohje",
"Personal" : "Henkilökohtainen",
"Users" : "Käyttäjät",
diff --git a/lib/l10n/fi_FI.json b/lib/l10n/fi_FI.json
index 83171dd042c..223429b7f88 100644
--- a/lib/l10n/fi_FI.json
+++ b/lib/l10n/fi_FI.json
@@ -13,7 +13,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Kirjasto %s versiota alempi %s tarvitaan - käytettävissä oleva versio %s.",
"Following platforms are supported: %s" : "Seuraavat alustat ovat tuettuja: %s",
"ownCloud %s or higher is required." : "ownCloud %s tai uudempi vaaditaan.",
- "ownCloud with a version lower than %s is required." : "ownCloud versiota %s alempi vaaditaan.",
+ "ownCloud %s or lower is required." : "ownCloud %s tai aiempi vaaditaan.",
"Help" : "Ohje",
"Personal" : "Henkilökohtainen",
"Users" : "Käyttäjät",
diff --git a/lib/l10n/fr.js b/lib/l10n/fr.js
index dcb797478fd..5743b7ff283 100644
--- a/lib/l10n/fr.js
+++ b/lib/l10n/fr.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "La librairie %s doit avoir une version antérieure à %s. Version disponible : %s.",
"Following platforms are supported: %s" : "Les plateformes suivantes sont prises en charge : %s",
"ownCloud %s or higher is required." : "ownCloud %s ou supérieur est requis.",
- "ownCloud with a version lower than %s is required." : "Une version antérieure à %s d'ownCloud est requise.",
+ "ownCloud %s or lower is required." : "ownCloud %s ou inférieur est requis.",
"Help" : "Aide",
"Personal" : "Personnel",
"Users" : "Utilisateurs",
@@ -44,7 +44,7 @@ OC.L10N.register(
"File name is a reserved word" : "Ce nom de fichier est un mot réservé",
"File name contains at least one invalid character" : "Le nom de fichier contient un (des) caractère(s) non valide(s)",
"File name is too long" : "Nom de fichier trop long",
- "File is currently busy, please try again later" : "Le fichier est actuellement occupé, veuillez ré-essayer ultérieurement.",
+ "File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
"Can't read file" : "Impossible de lire le fichier",
"App directory already exists" : "Le dossier de l'application existe déjà",
"Can't create app folder. Please fix permissions. %s" : "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
@@ -85,6 +85,7 @@ OC.L10N.register(
"Set an admin username." : "Spécifiez un nom d'utilisateur pour l'administrateur.",
"Set an admin password." : "Spécifiez un mot de passe pour l'administrateur.",
"Can't create or write into the data directory %s" : "Impossible de créer, ou d'écrire dans, le répertoire des données %s",
+ "Invalid Federated Cloud ID" : "ID Federated Cloud incorrect",
"%s shared »%s« with you" : "%s a partagé «%s» avec vous",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Le partage de %s a échoué car l’infrastructure n'autorise pas les partages de type %i",
@@ -109,9 +110,9 @@ OC.L10N.register(
"Sharing backend %s not found" : "Service de partage %s non trouvé",
"Sharing backend for %s not found" : "Le service de partage pour %s est introuvable",
"Sharing %s failed, because the user %s is the original sharer" : "Le partage de %s a échoué car l'utilisateur %s est l'utilisateur à l'origine du partage.",
- "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Le partage de %s a échoué car les permissions dépassent les permissions accordées à %s",
+ "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Le partage de %s a échoué car les permissions dépassent celles accordées à %s",
"Sharing %s failed, because resharing is not allowed" : "Le partage de %s a échoué car le repartage n'est pas autorisé",
- "Sharing %s failed, because the sharing backend for %s could not find its source" : "Le partage de %s a échoué parce que la source n'a été trouvée pour le partage %s.",
+ "Sharing %s failed, because the sharing backend for %s could not find its source" : "Le partage de %s a échoué car la source n'a pas été trouvée pour le partage %s.",
"Sharing %s failed, because the file could not be found in the file cache" : "Le partage de %s a échoué car le fichier n'a pas été trouvé dans les fichiers mis en cache.",
"Could not find category \"%s\"" : "Impossible de trouver la catégorie \"%s\"",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Seuls les caractères suivants sont autorisés dans un nom d'utilisateur : \"a-z\", \"A-Z\", \"0-9\", et \"_.@-\"",
diff --git a/lib/l10n/fr.json b/lib/l10n/fr.json
index b5b1ce1a0da..fa2881ca6aa 100644
--- a/lib/l10n/fr.json
+++ b/lib/l10n/fr.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "La librairie %s doit avoir une version antérieure à %s. Version disponible : %s.",
"Following platforms are supported: %s" : "Les plateformes suivantes sont prises en charge : %s",
"ownCloud %s or higher is required." : "ownCloud %s ou supérieur est requis.",
- "ownCloud with a version lower than %s is required." : "Une version antérieure à %s d'ownCloud est requise.",
+ "ownCloud %s or lower is required." : "ownCloud %s ou inférieur est requis.",
"Help" : "Aide",
"Personal" : "Personnel",
"Users" : "Utilisateurs",
@@ -42,7 +42,7 @@
"File name is a reserved word" : "Ce nom de fichier est un mot réservé",
"File name contains at least one invalid character" : "Le nom de fichier contient un (des) caractère(s) non valide(s)",
"File name is too long" : "Nom de fichier trop long",
- "File is currently busy, please try again later" : "Le fichier est actuellement occupé, veuillez ré-essayer ultérieurement.",
+ "File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
"Can't read file" : "Impossible de lire le fichier",
"App directory already exists" : "Le dossier de l'application existe déjà",
"Can't create app folder. Please fix permissions. %s" : "Impossible de créer le dossier de l'application. Corrigez les droits d'accès. %s",
@@ -83,6 +83,7 @@
"Set an admin username." : "Spécifiez un nom d'utilisateur pour l'administrateur.",
"Set an admin password." : "Spécifiez un mot de passe pour l'administrateur.",
"Can't create or write into the data directory %s" : "Impossible de créer, ou d'écrire dans, le répertoire des données %s",
+ "Invalid Federated Cloud ID" : "ID Federated Cloud incorrect",
"%s shared »%s« with you" : "%s a partagé «%s» avec vous",
"%s via %s" : "%s via %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Le partage de %s a échoué car l’infrastructure n'autorise pas les partages de type %i",
@@ -107,9 +108,9 @@
"Sharing backend %s not found" : "Service de partage %s non trouvé",
"Sharing backend for %s not found" : "Le service de partage pour %s est introuvable",
"Sharing %s failed, because the user %s is the original sharer" : "Le partage de %s a échoué car l'utilisateur %s est l'utilisateur à l'origine du partage.",
- "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Le partage de %s a échoué car les permissions dépassent les permissions accordées à %s",
+ "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Le partage de %s a échoué car les permissions dépassent celles accordées à %s",
"Sharing %s failed, because resharing is not allowed" : "Le partage de %s a échoué car le repartage n'est pas autorisé",
- "Sharing %s failed, because the sharing backend for %s could not find its source" : "Le partage de %s a échoué parce que la source n'a été trouvée pour le partage %s.",
+ "Sharing %s failed, because the sharing backend for %s could not find its source" : "Le partage de %s a échoué car la source n'a pas été trouvée pour le partage %s.",
"Sharing %s failed, because the file could not be found in the file cache" : "Le partage de %s a échoué car le fichier n'a pas été trouvé dans les fichiers mis en cache.",
"Could not find category \"%s\"" : "Impossible de trouver la catégorie \"%s\"",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Seuls les caractères suivants sont autorisés dans un nom d'utilisateur : \"a-z\", \"A-Z\", \"0-9\", et \"_.@-\"",
diff --git a/lib/l10n/gl.js b/lib/l10n/gl.js
index 67356d1c673..7ba4fff42ff 100644
--- a/lib/l10n/gl.js
+++ b/lib/l10n/gl.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Requírese a biblioteca %s cunha versión inferior a %s - dispoñíbel a versión %s.",
"Following platforms are supported: %s" : "Admítense as seguintes plataformas: %s",
"ownCloud %s or higher is required." : "Requírese ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "Requírese ownCloud cunha versión inferior a %s.",
+ "ownCloud %s or lower is required." : "Requírese ownCloud %s ou inferior.",
"Help" : "Axuda",
"Personal" : "Persoal",
"Users" : "Usuarios",
diff --git a/lib/l10n/gl.json b/lib/l10n/gl.json
index 355ba0dec48..57c29347f33 100644
--- a/lib/l10n/gl.json
+++ b/lib/l10n/gl.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Requírese a biblioteca %s cunha versión inferior a %s - dispoñíbel a versión %s.",
"Following platforms are supported: %s" : "Admítense as seguintes plataformas: %s",
"ownCloud %s or higher is required." : "Requírese ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "Requírese ownCloud cunha versión inferior a %s.",
+ "ownCloud %s or lower is required." : "Requírese ownCloud %s ou inferior.",
"Help" : "Axuda",
"Personal" : "Persoal",
"Users" : "Usuarios",
diff --git a/lib/l10n/hr.js b/lib/l10n/hr.js
index a885d452d9c..c1fb29d4169 100644
--- a/lib/l10n/hr.js
+++ b/lib/l10n/hr.js
@@ -13,7 +13,6 @@ OC.L10N.register(
"The library %s is not available." : "Knjiznica %s nije dostupna.",
"Following platforms are supported: %s" : "Sljedece platforme su podrzane: %s",
"ownCloud %s or higher is required." : "ownCloud %s ili visi je potreban.",
- "ownCloud with a version lower than %s is required." : "ownCloud sa verzijom manjom od %s je potrebna.",
"Help" : "Pomoć",
"Personal" : "Osobno",
"Users" : "Korisnici",
diff --git a/lib/l10n/hr.json b/lib/l10n/hr.json
index 40ef41d0a38..4e22f203bf5 100644
--- a/lib/l10n/hr.json
+++ b/lib/l10n/hr.json
@@ -11,7 +11,6 @@
"The library %s is not available." : "Knjiznica %s nije dostupna.",
"Following platforms are supported: %s" : "Sljedece platforme su podrzane: %s",
"ownCloud %s or higher is required." : "ownCloud %s ili visi je potreban.",
- "ownCloud with a version lower than %s is required." : "ownCloud sa verzijom manjom od %s je potrebna.",
"Help" : "Pomoć",
"Personal" : "Osobno",
"Users" : "Korisnici",
diff --git a/lib/l10n/id.js b/lib/l10n/id.js
index afe6f97a182..14355271356 100644
--- a/lib/l10n/id.js
+++ b/lib/l10n/id.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Diperlukan pustaka %s dengan versi yang lebih rendah dari %s - versi yang tersedia %s.",
"Following platforms are supported: %s" : "Berikut adalah platform yang didukung: %s",
"ownCloud %s or higher is required." : "Diperlukan ownCloud %s atau yang lebih tinggi.",
- "ownCloud with a version lower than %s is required." : "Diperlukan ownCloud dengan versi yang lebih rendah dari %s.",
+ "ownCloud %s or lower is required." : "ownCloud %s atau yang lebih rendah diperlukan.",
"Help" : "Bantuan",
"Personal" : "Pribadi",
"Users" : "Pengguna",
@@ -38,12 +38,14 @@ OC.L10N.register(
"_%n minute ago_::_%n minutes ago_" : ["%n menit yang lalu"],
"seconds ago" : "beberapa detik yang lalu",
"web services under your control" : "layanan web dalam kendali anda",
+ "Module with id: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Modul dengan id: %s tidak ada. Mohon aktifkan modul tersebut di pengaturan aplikasi Anda atau hubungi administrator.",
"Empty filename is not allowed" : "Nama berkas kosong tidak diperbolehkan",
"Dot files are not allowed" : "Berkas titik tidak diperbolehkan",
"4-byte characters are not supported in file names" : "Karakter 4 byte tidak didukung dalam nama berkas",
"File name is a reserved word" : "Nama berkas merupakan kata yang disediakan",
"File name contains at least one invalid character" : "Nama berkas berisi setidaknya satu karakter yang tidak sah.",
"File name is too long" : "Nama berkas terlalu panjang",
+ "File is currently busy, please try again later" : "Berkas sedang sibuk, mohon coba lagi nanti",
"Can't read file" : "Tidak dapat membaca berkas",
"App directory already exists" : "Direktori Apl sudah ada",
"Can't create app folder. Please fix permissions. %s" : "Tidak dapat membuat folder apl. Silakan perbaiki perizinan. %s",
@@ -84,6 +86,7 @@ OC.L10N.register(
"Set an admin username." : "Tetapkan nama pengguna admin.",
"Set an admin password." : "Tetapkan sandi admin.",
"Can't create or write into the data directory %s" : "Tidak dapat membuat atau menulis kedalam direktori data %s",
+ "Invalid Federated Cloud ID" : "Federated Cloud ID tidak sah",
"%s shared »%s« with you" : "%s membagikan »%s« dengan anda",
"%s via %s" : "%s melalui %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Gagal berbagi %s, karena backend tidak mengizinkan berbagi dengan tipe %i",
diff --git a/lib/l10n/id.json b/lib/l10n/id.json
index e56619e28ca..ac6429bce9a 100644
--- a/lib/l10n/id.json
+++ b/lib/l10n/id.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Diperlukan pustaka %s dengan versi yang lebih rendah dari %s - versi yang tersedia %s.",
"Following platforms are supported: %s" : "Berikut adalah platform yang didukung: %s",
"ownCloud %s or higher is required." : "Diperlukan ownCloud %s atau yang lebih tinggi.",
- "ownCloud with a version lower than %s is required." : "Diperlukan ownCloud dengan versi yang lebih rendah dari %s.",
+ "ownCloud %s or lower is required." : "ownCloud %s atau yang lebih rendah diperlukan.",
"Help" : "Bantuan",
"Personal" : "Pribadi",
"Users" : "Pengguna",
@@ -36,12 +36,14 @@
"_%n minute ago_::_%n minutes ago_" : ["%n menit yang lalu"],
"seconds ago" : "beberapa detik yang lalu",
"web services under your control" : "layanan web dalam kendali anda",
+ "Module with id: %s does not exist. Please enable it in your apps settings or contact your administrator." : "Modul dengan id: %s tidak ada. Mohon aktifkan modul tersebut di pengaturan aplikasi Anda atau hubungi administrator.",
"Empty filename is not allowed" : "Nama berkas kosong tidak diperbolehkan",
"Dot files are not allowed" : "Berkas titik tidak diperbolehkan",
"4-byte characters are not supported in file names" : "Karakter 4 byte tidak didukung dalam nama berkas",
"File name is a reserved word" : "Nama berkas merupakan kata yang disediakan",
"File name contains at least one invalid character" : "Nama berkas berisi setidaknya satu karakter yang tidak sah.",
"File name is too long" : "Nama berkas terlalu panjang",
+ "File is currently busy, please try again later" : "Berkas sedang sibuk, mohon coba lagi nanti",
"Can't read file" : "Tidak dapat membaca berkas",
"App directory already exists" : "Direktori Apl sudah ada",
"Can't create app folder. Please fix permissions. %s" : "Tidak dapat membuat folder apl. Silakan perbaiki perizinan. %s",
@@ -82,6 +84,7 @@
"Set an admin username." : "Tetapkan nama pengguna admin.",
"Set an admin password." : "Tetapkan sandi admin.",
"Can't create or write into the data directory %s" : "Tidak dapat membuat atau menulis kedalam direktori data %s",
+ "Invalid Federated Cloud ID" : "Federated Cloud ID tidak sah",
"%s shared »%s« with you" : "%s membagikan »%s« dengan anda",
"%s via %s" : "%s melalui %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Gagal berbagi %s, karena backend tidak mengizinkan berbagi dengan tipe %i",
diff --git a/lib/l10n/it.js b/lib/l10n/it.js
index 1bdda442f01..7f7335a9341 100644
--- a/lib/l10n/it.js
+++ b/lib/l10n/it.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Richiesta una versione della libreria %s minore di %s - versione disponibile %s.",
"Following platforms are supported: %s" : "Sono supportate le seguenti piattaforme: %s",
"ownCloud %s or higher is required." : "Richiesto ownCloud %s o superiore.",
- "ownCloud with a version lower than %s is required." : "Richiesta una versione di ownCloud minore di %s.",
+ "ownCloud %s or lower is required." : "Richiesto ownCloud %s o inferiore.",
"Help" : "Aiuto",
"Personal" : "Personale",
"Users" : "Utenti",
diff --git a/lib/l10n/it.json b/lib/l10n/it.json
index f802e65993b..14b8b05d98c 100644
--- a/lib/l10n/it.json
+++ b/lib/l10n/it.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Richiesta una versione della libreria %s minore di %s - versione disponibile %s.",
"Following platforms are supported: %s" : "Sono supportate le seguenti piattaforme: %s",
"ownCloud %s or higher is required." : "Richiesto ownCloud %s o superiore.",
- "ownCloud with a version lower than %s is required." : "Richiesta una versione di ownCloud minore di %s.",
+ "ownCloud %s or lower is required." : "Richiesto ownCloud %s o inferiore.",
"Help" : "Aiuto",
"Personal" : "Personale",
"Users" : "Utenti",
diff --git a/lib/l10n/ja.js b/lib/l10n/ja.js
index 5808a219b27..ef5fa0356a1 100644
--- a/lib/l10n/ja.js
+++ b/lib/l10n/ja.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "%s ライブラリーは、%s よりも古いバージョンが必要です。利用可能なバージョンは、 %s です。",
"Following platforms are supported: %s" : "次のプラットフォームをサポートしています: %s",
"ownCloud %s or higher is required." : "ownCloud %s 以上が必要です。",
- "ownCloud with a version lower than %s is required." : "ownCloud %s 以下が必要です。",
"Help" : "ヘルプ",
"Personal" : "個人",
"Users" : "ユーザー",
diff --git a/lib/l10n/ja.json b/lib/l10n/ja.json
index 0252dd906bf..3555295f80c 100644
--- a/lib/l10n/ja.json
+++ b/lib/l10n/ja.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "%s ライブラリーは、%s よりも古いバージョンが必要です。利用可能なバージョンは、 %s です。",
"Following platforms are supported: %s" : "次のプラットフォームをサポートしています: %s",
"ownCloud %s or higher is required." : "ownCloud %s 以上が必要です。",
- "ownCloud with a version lower than %s is required." : "ownCloud %s 以下が必要です。",
"Help" : "ヘルプ",
"Personal" : "個人",
"Users" : "ユーザー",
diff --git a/lib/l10n/ko.js b/lib/l10n/ko.js
index a8b9f3def7b..e51702ab243 100644
--- a/lib/l10n/ko.js
+++ b/lib/l10n/ko.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "%s 라이브러리의 버전 %s 미만이 필요합니다. 사용 가능한 버전은 %s입니다.",
"Following platforms are supported: %s" : "다음 플랫폼을 지원합니다: %s",
"ownCloud %s or higher is required." : "ownCloud 버전 %s 이상이 필요합니다.",
- "ownCloud with a version lower than %s is required." : "ownCloud 버전 %s 미만이 필요합니다.",
"Help" : "도움말",
"Personal" : "개인",
"Users" : "사용자",
diff --git a/lib/l10n/ko.json b/lib/l10n/ko.json
index 9a86f7f71cc..a0b042a7f3a 100644
--- a/lib/l10n/ko.json
+++ b/lib/l10n/ko.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "%s 라이브러리의 버전 %s 미만이 필요합니다. 사용 가능한 버전은 %s입니다.",
"Following platforms are supported: %s" : "다음 플랫폼을 지원합니다: %s",
"ownCloud %s or higher is required." : "ownCloud 버전 %s 이상이 필요합니다.",
- "ownCloud with a version lower than %s is required." : "ownCloud 버전 %s 미만이 필요합니다.",
"Help" : "도움말",
"Personal" : "개인",
"Users" : "사용자",
diff --git a/lib/l10n/lb.js b/lib/l10n/lb.js
index ede516dbe67..0c884f98eea 100644
--- a/lib/l10n/lb.js
+++ b/lib/l10n/lb.js
@@ -1,6 +1,11 @@
OC.L10N.register(
"lib",
{
+ "See %s" : "%s kucken",
+ "Sample configuration detected" : "Beispill-Konfiguratioun erkannt",
+ "PHP %s or higher is required." : "PHP %s oder méi nei ass néideg.",
+ "PHP with a version lower than %s is required." : "PHP mat enger Versioun %s oder méi kleng ass néideg.",
+ "Following databases are supported: %s" : "Dës Datebanke ginn ënnerstëtzt: %s",
"Help" : "Hëllef",
"Personal" : "Perséinlech",
"Users" : "Benotzer",
@@ -9,11 +14,16 @@ OC.L10N.register(
"Invalid image" : "Ongülteg d'Bild",
"today" : "haut",
"yesterday" : "gëschter",
+ "_%n day ago_::_%n days ago_" : ["%n Dag hier","%n Deeg hier"],
"last month" : "Läschte Mount",
+ "_%n month ago_::_%n months ago_" : ["%n Mount hier","%n Méint hier"],
"last year" : "Läscht Joer",
+ "_%n year ago_::_%n years ago_" : ["%n Joer hier","%n Joer hier"],
+ "_%n hour ago_::_%n hours ago_" : ["%n Stonn hier","%n Stonnen hier"],
"seconds ago" : "Sekonnen hir",
"web services under your control" : "Web-Servicer ënnert denger Kontroll",
"Authentication error" : "Authentifikatioun's Fehler",
- "%s shared »%s« with you" : "Den/D' %s huet »%s« mat dir gedeelt"
+ "%s shared »%s« with you" : "Den/D' %s huet »%s« mat dir gedeelt",
+ "Data directory (%s) is invalid" : "Daten-Dossier (%s) ass ongëlteg"
},
"nplurals=2; plural=(n != 1);");
diff --git a/lib/l10n/lb.json b/lib/l10n/lb.json
index eb6067727bc..08057c7de24 100644
--- a/lib/l10n/lb.json
+++ b/lib/l10n/lb.json
@@ -1,4 +1,9 @@
{ "translations": {
+ "See %s" : "%s kucken",
+ "Sample configuration detected" : "Beispill-Konfiguratioun erkannt",
+ "PHP %s or higher is required." : "PHP %s oder méi nei ass néideg.",
+ "PHP with a version lower than %s is required." : "PHP mat enger Versioun %s oder méi kleng ass néideg.",
+ "Following databases are supported: %s" : "Dës Datebanke ginn ënnerstëtzt: %s",
"Help" : "Hëllef",
"Personal" : "Perséinlech",
"Users" : "Benotzer",
@@ -7,11 +12,16 @@
"Invalid image" : "Ongülteg d'Bild",
"today" : "haut",
"yesterday" : "gëschter",
+ "_%n day ago_::_%n days ago_" : ["%n Dag hier","%n Deeg hier"],
"last month" : "Läschte Mount",
+ "_%n month ago_::_%n months ago_" : ["%n Mount hier","%n Méint hier"],
"last year" : "Läscht Joer",
+ "_%n year ago_::_%n years ago_" : ["%n Joer hier","%n Joer hier"],
+ "_%n hour ago_::_%n hours ago_" : ["%n Stonn hier","%n Stonnen hier"],
"seconds ago" : "Sekonnen hir",
"web services under your control" : "Web-Servicer ënnert denger Kontroll",
"Authentication error" : "Authentifikatioun's Fehler",
- "%s shared »%s« with you" : "Den/D' %s huet »%s« mat dir gedeelt"
+ "%s shared »%s« with you" : "Den/D' %s huet »%s« mat dir gedeelt",
+ "Data directory (%s) is invalid" : "Daten-Dossier (%s) ass ongëlteg"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/lib/l10n/nb_NO.js b/lib/l10n/nb_NO.js
index e797430c102..168fe4ad25c 100644
--- a/lib/l10n/nb_NO.js
+++ b/lib/l10n/nb_NO.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Bibliotek %s med en versjon lavere nn %s kreves - tilgjengelig version %s.",
"Following platforms are supported: %s" : "Følgende plattformer støttes: %s",
"ownCloud %s or higher is required." : "ownCloud %s eller høyere kreves.",
- "ownCloud with a version lower than %s is required." : "ownCloud med en versjon lavere enn %s kreves.",
+ "ownCloud %s or lower is required." : "ownCloud %s eller lavere kreves.",
"Help" : "Hjelp",
"Personal" : "Personlig",
"Users" : "Brukere",
diff --git a/lib/l10n/nb_NO.json b/lib/l10n/nb_NO.json
index 081927ea686..b72d709a022 100644
--- a/lib/l10n/nb_NO.json
+++ b/lib/l10n/nb_NO.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Bibliotek %s med en versjon lavere nn %s kreves - tilgjengelig version %s.",
"Following platforms are supported: %s" : "Følgende plattformer støttes: %s",
"ownCloud %s or higher is required." : "ownCloud %s eller høyere kreves.",
- "ownCloud with a version lower than %s is required." : "ownCloud med en versjon lavere enn %s kreves.",
+ "ownCloud %s or lower is required." : "ownCloud %s eller lavere kreves.",
"Help" : "Hjelp",
"Personal" : "Personlig",
"Users" : "Brukere",
diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js
index 25e4f35241a..b62443f9117 100644
--- a/lib/l10n/nl.js
+++ b/lib/l10n/nl.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Library %s met een versienummer lager dan %s is vereist - beschikbare versie %s.",
"Following platforms are supported: %s" : "De volgende platformen worden ondersteund: %s",
"ownCloud %s or higher is required." : "ownCloud %s of hoger vereist.",
- "ownCloud with a version lower than %s is required." : "ownCloud met een versie lager dan %s is vereist.",
+ "ownCloud %s or lower is required." : "ownCloud %s of lager vereist.",
"Help" : "Help",
"Personal" : "Persoonlijk",
"Users" : "Gebruikers",
diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json
index d5b0dba3214..26dd33f54fc 100644
--- a/lib/l10n/nl.json
+++ b/lib/l10n/nl.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Library %s met een versienummer lager dan %s is vereist - beschikbare versie %s.",
"Following platforms are supported: %s" : "De volgende platformen worden ondersteund: %s",
"ownCloud %s or higher is required." : "ownCloud %s of hoger vereist.",
- "ownCloud with a version lower than %s is required." : "ownCloud met een versie lager dan %s is vereist.",
+ "ownCloud %s or lower is required." : "ownCloud %s of lager vereist.",
"Help" : "Help",
"Personal" : "Persoonlijk",
"Users" : "Gebruikers",
diff --git a/lib/l10n/pl.js b/lib/l10n/pl.js
index 4f460f08f0d..6d568685359 100644
--- a/lib/l10n/pl.js
+++ b/lib/l10n/pl.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Biblioteka w wersji %s jest niższa niż %s, która jest wymagana - dostępna wersja %s.",
"Following platforms are supported: %s" : "Obsługiwane są następujące platformy: %s",
"ownCloud %s or higher is required." : "ownCloud %s jest w wersji wyższej niż wymagana.",
- "ownCloud with a version lower than %s is required." : "ownCloud jest w wersji niższej niż wymagana wersja %s",
"Help" : "Pomoc",
"Personal" : "Osobiste",
"Users" : "Użytkownicy",
diff --git a/lib/l10n/pl.json b/lib/l10n/pl.json
index 55f589edf60..ec89fc3acbd 100644
--- a/lib/l10n/pl.json
+++ b/lib/l10n/pl.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Biblioteka w wersji %s jest niższa niż %s, która jest wymagana - dostępna wersja %s.",
"Following platforms are supported: %s" : "Obsługiwane są następujące platformy: %s",
"ownCloud %s or higher is required." : "ownCloud %s jest w wersji wyższej niż wymagana.",
- "ownCloud with a version lower than %s is required." : "ownCloud jest w wersji niższej niż wymagana wersja %s",
"Help" : "Pomoc",
"Personal" : "Osobiste",
"Users" : "Użytkownicy",
diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js
index 05abaa83ebb..e5940fb577e 100644
--- a/lib/l10n/pt_BR.js
+++ b/lib/l10n/pt_BR.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "É requerida uma biblioteca %s com uma versão menor que %s - versão disponível %s.",
"Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
"ownCloud %s or higher is required." : "É necessário um ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "É necessário um ownCloud com uma versão menor que %s.",
+ "ownCloud %s or lower is required." : "É necessário um ownCloud %s ou inferior.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Users" : "Usuários",
diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json
index 454e3f05b8a..ba29f32e22d 100644
--- a/lib/l10n/pt_BR.json
+++ b/lib/l10n/pt_BR.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "É requerida uma biblioteca %s com uma versão menor que %s - versão disponível %s.",
"Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
"ownCloud %s or higher is required." : "É necessário um ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "É necessário um ownCloud com uma versão menor que %s.",
+ "ownCloud %s or lower is required." : "É necessário um ownCloud %s ou inferior.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Users" : "Usuários",
diff --git a/lib/l10n/pt_PT.js b/lib/l10n/pt_PT.js
index c1f7310b6e5..5c9f84ee0df 100644
--- a/lib/l10n/pt_PT.js
+++ b/lib/l10n/pt_PT.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão inferior a %s - versão disponível: %s.",
"Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
"ownCloud %s or higher is required." : "É necessário ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "É necessário uma versão do ownCloud inferior a %s.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Users" : "Utilizadores",
diff --git a/lib/l10n/pt_PT.json b/lib/l10n/pt_PT.json
index defa0723ed7..cf78d6fa9ab 100644
--- a/lib/l10n/pt_PT.json
+++ b/lib/l10n/pt_PT.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão inferior a %s - versão disponível: %s.",
"Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
"ownCloud %s or higher is required." : "É necessário ownCloud %s ou superior.",
- "ownCloud with a version lower than %s is required." : "É necessário uma versão do ownCloud inferior a %s.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Users" : "Utilizadores",
diff --git a/lib/l10n/ro.js b/lib/l10n/ro.js
index 7b417ab5628..24a42ef68c0 100644
--- a/lib/l10n/ro.js
+++ b/lib/l10n/ro.js
@@ -8,7 +8,6 @@ OC.L10N.register(
"PHP with a version lower than %s is required." : "Este necesară o versiune PHP mai mică decât %s",
"Following platforms are supported: %s" : "Sunt suportate următoarele platforme: %s",
"ownCloud %s or higher is required." : "ownCloud %s sau mai mare este necesar.",
- "ownCloud with a version lower than %s is required." : "ownCloud cu o versiune mai mică decât %s este necesară.",
"Help" : "Ajutor",
"Personal" : "Personal",
"Users" : "Utilizatori",
@@ -26,6 +25,7 @@ OC.L10N.register(
"seconds ago" : "secunde în urmă",
"web services under your control" : "servicii web controlate de tine",
"Empty filename is not allowed" : "Nu este permis fișier fără nume",
+ "File name contains at least one invalid character" : "Numele fișierului conține măcar un caracter invalid",
"File name is too long" : "Numele fișierului este prea lung",
"Application is not enabled" : "Aplicația nu este activată",
"Authentication error" : "Eroare la autentificare",
diff --git a/lib/l10n/ro.json b/lib/l10n/ro.json
index 47ea0d5fbbd..23c946b93e3 100644
--- a/lib/l10n/ro.json
+++ b/lib/l10n/ro.json
@@ -6,7 +6,6 @@
"PHP with a version lower than %s is required." : "Este necesară o versiune PHP mai mică decât %s",
"Following platforms are supported: %s" : "Sunt suportate următoarele platforme: %s",
"ownCloud %s or higher is required." : "ownCloud %s sau mai mare este necesar.",
- "ownCloud with a version lower than %s is required." : "ownCloud cu o versiune mai mică decât %s este necesară.",
"Help" : "Ajutor",
"Personal" : "Personal",
"Users" : "Utilizatori",
@@ -24,6 +23,7 @@
"seconds ago" : "secunde în urmă",
"web services under your control" : "servicii web controlate de tine",
"Empty filename is not allowed" : "Nu este permis fișier fără nume",
+ "File name contains at least one invalid character" : "Numele fișierului conține măcar un caracter invalid",
"File name is too long" : "Numele fișierului este prea lung",
"Application is not enabled" : "Aplicația nu este activată",
"Authentication error" : "Eroare la autentificare",
diff --git a/lib/l10n/ru.js b/lib/l10n/ru.js
index 625d537add6..d245bec5b19 100644
--- a/lib/l10n/ru.js
+++ b/lib/l10n/ru.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Требуется библиотека %s версии не выше %s, установлена версия %s.",
"Following platforms are supported: %s" : "Поддерживаются следующие платформы: %s",
"ownCloud %s or higher is required." : "Требуется ownCloud %s или выше.",
- "ownCloud with a version lower than %s is required." : "Требуется версия ownCloud ниже %s.",
+ "ownCloud %s or lower is required." : "Требуется ownCloud версии %s или ниже.",
"Help" : "Помощь",
"Personal" : "Личное",
"Users" : "Пользователи",
diff --git a/lib/l10n/ru.json b/lib/l10n/ru.json
index 6d7497fafa8..511f43789f4 100644
--- a/lib/l10n/ru.json
+++ b/lib/l10n/ru.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "Требуется библиотека %s версии не выше %s, установлена версия %s.",
"Following platforms are supported: %s" : "Поддерживаются следующие платформы: %s",
"ownCloud %s or higher is required." : "Требуется ownCloud %s или выше.",
- "ownCloud with a version lower than %s is required." : "Требуется версия ownCloud ниже %s.",
+ "ownCloud %s or lower is required." : "Требуется ownCloud версии %s или ниже.",
"Help" : "Помощь",
"Personal" : "Личное",
"Users" : "Пользователи",
diff --git a/lib/l10n/sk_SK.js b/lib/l10n/sk_SK.js
index 7fb4d1f56ca..a8d53af8702 100644
--- a/lib/l10n/sk_SK.js
+++ b/lib/l10n/sk_SK.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Požadovaná je knižnica %s v nižšej verzii ako %s - dostupná verzia %s.",
"Following platforms are supported: %s" : "Podporované sú nasledovné systémy: %s",
"ownCloud %s or higher is required." : "Požadovaná verzia ownCloudu %s alebo vyššia.",
- "ownCloud with a version lower than %s is required." : "ownCloud je vyžadovaný v nižšej verzii ako %s.",
"Help" : "Pomoc",
"Personal" : "Osobné",
"Users" : "Používatelia",
diff --git a/lib/l10n/sk_SK.json b/lib/l10n/sk_SK.json
index e2f7731a445..d223183f974 100644
--- a/lib/l10n/sk_SK.json
+++ b/lib/l10n/sk_SK.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Požadovaná je knižnica %s v nižšej verzii ako %s - dostupná verzia %s.",
"Following platforms are supported: %s" : "Podporované sú nasledovné systémy: %s",
"ownCloud %s or higher is required." : "Požadovaná verzia ownCloudu %s alebo vyššia.",
- "ownCloud with a version lower than %s is required." : "ownCloud je vyžadovaný v nižšej verzii ako %s.",
"Help" : "Pomoc",
"Personal" : "Osobné",
"Users" : "Používatelia",
diff --git a/lib/l10n/sl.js b/lib/l10n/sl.js
index 769a7f7054f..4630fa87dee 100644
--- a/lib/l10n/sl.js
+++ b/lib/l10n/sl.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Zahtevana je knjižnica %s z različico, manjšo od %s – na voljo je različica %s.",
"Following platforms are supported: %s" : "Podprta so okolja: %s",
"ownCloud %s or higher is required." : "Zahtevana je različica ownCloud %s ali višja.",
- "ownCloud with a version lower than %s is required." : "Zahtevana je različica ownCloud %s ali nižja.",
"Help" : "Pomoč",
"Personal" : "Osebno",
"Users" : "Uporabniki",
diff --git a/lib/l10n/sl.json b/lib/l10n/sl.json
index ab717c21dc2..ca40bc3cb12 100644
--- a/lib/l10n/sl.json
+++ b/lib/l10n/sl.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Zahtevana je knjižnica %s z različico, manjšo od %s – na voljo je različica %s.",
"Following platforms are supported: %s" : "Podprta so okolja: %s",
"ownCloud %s or higher is required." : "Zahtevana je različica ownCloud %s ali višja.",
- "ownCloud with a version lower than %s is required." : "Zahtevana je različica ownCloud %s ali nižja.",
"Help" : "Pomoč",
"Personal" : "Osebno",
"Users" : "Uporabniki",
diff --git a/lib/l10n/sr.js b/lib/l10n/sr.js
index 7052d9f4f68..5e3e3858950 100644
--- a/lib/l10n/sr.js
+++ b/lib/l10n/sr.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Библиотека %s издања нижег од %s је потребна - доступно издање %s.",
"Following platforms are supported: %s" : "Следеће платформе су подржане: %s",
"ownCloud %s or higher is required." : "оунКлауд %s или новији је потребан.",
- "ownCloud with a version lower than %s is required." : "Потребна је оунКлауд верзија испод %s.",
"Help" : "Помоћ",
"Personal" : "Лично",
"Users" : "Корисници",
diff --git a/lib/l10n/sr.json b/lib/l10n/sr.json
index 66126565cf1..5efb7613a42 100644
--- a/lib/l10n/sr.json
+++ b/lib/l10n/sr.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Библиотека %s издања нижег од %s је потребна - доступно издање %s.",
"Following platforms are supported: %s" : "Следеће платформе су подржане: %s",
"ownCloud %s or higher is required." : "оунКлауд %s или новији је потребан.",
- "ownCloud with a version lower than %s is required." : "Потребна је оунКлауд верзија испод %s.",
"Help" : "Помоћ",
"Personal" : "Лично",
"Users" : "Корисници",
diff --git a/lib/l10n/sv.js b/lib/l10n/sv.js
index 16607aaf86b..59122082c7d 100644
--- a/lib/l10n/sv.js
+++ b/lib/l10n/sv.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Bibliotek %s med version lägre än %s krävs - tillgänglig version %s.",
"Following platforms are supported: %s" : "Följande plattformar stödjs: %s",
"ownCloud %s or higher is required." : "ownCloud %s eller högre krävs.",
- "ownCloud with a version lower than %s is required." : "ownCloud med version lägre än %s krävs.",
"Help" : "Hjälp",
"Personal" : "Personligt",
"Users" : "Användare",
diff --git a/lib/l10n/sv.json b/lib/l10n/sv.json
index a346bdcd026..fcf8eb9b858 100644
--- a/lib/l10n/sv.json
+++ b/lib/l10n/sv.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Bibliotek %s med version lägre än %s krävs - tillgänglig version %s.",
"Following platforms are supported: %s" : "Följande plattformar stödjs: %s",
"ownCloud %s or higher is required." : "ownCloud %s eller högre krävs.",
- "ownCloud with a version lower than %s is required." : "ownCloud med version lägre än %s krävs.",
"Help" : "Hjälp",
"Personal" : "Personligt",
"Users" : "Användare",
diff --git a/lib/l10n/th_TH.js b/lib/l10n/th_TH.js
index 70e700dc4d0..816af4506bb 100644
--- a/lib/l10n/th_TH.js
+++ b/lib/l10n/th_TH.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "จำเป็นต้องมีไลบรารีรุ่น %s หรือรุ่นที่ต่ำกว่า %s - รุ่นที่ใช้ได้คือ %s",
"Following platforms are supported: %s" : "แพลตฟอร์มต่อไปนี้ได้รับการสนับสนุน: %s",
"ownCloud %s or higher is required." : "จำเป็นต้องมี ownCloud รุ่น %s หรือรุ่นที่สูงกว่า",
- "ownCloud with a version lower than %s is required." : "จำเป็นต้องมี ownCloud รุ่นที่ต่ำกว่า %s",
+ "ownCloud %s or lower is required." : "ต้องการ ownCloud %s หรือรุ่นที่ต่ำกว่า",
"Help" : "ช่วยเหลือ",
"Personal" : "ส่วนตัว",
"Users" : "ผู้ใช้งาน",
diff --git a/lib/l10n/th_TH.json b/lib/l10n/th_TH.json
index 32e5d276c32..eca70c531a2 100644
--- a/lib/l10n/th_TH.json
+++ b/lib/l10n/th_TH.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "จำเป็นต้องมีไลบรารีรุ่น %s หรือรุ่นที่ต่ำกว่า %s - รุ่นที่ใช้ได้คือ %s",
"Following platforms are supported: %s" : "แพลตฟอร์มต่อไปนี้ได้รับการสนับสนุน: %s",
"ownCloud %s or higher is required." : "จำเป็นต้องมี ownCloud รุ่น %s หรือรุ่นที่สูงกว่า",
- "ownCloud with a version lower than %s is required." : "จำเป็นต้องมี ownCloud รุ่นที่ต่ำกว่า %s",
+ "ownCloud %s or lower is required." : "ต้องการ ownCloud %s หรือรุ่นที่ต่ำกว่า",
"Help" : "ช่วยเหลือ",
"Personal" : "ส่วนตัว",
"Users" : "ผู้ใช้งาน",
diff --git a/lib/l10n/tr.js b/lib/l10n/tr.js
index 106eab37b5e..7f3a5096b0a 100644
--- a/lib/l10n/tr.js
+++ b/lib/l10n/tr.js
@@ -16,7 +16,7 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha düşük sürümü gerekli - kullanılabilir sürüm %s.",
"Following platforms are supported: %s" : "Aşağıdaki platformlar destekleniyor: %s",
"ownCloud %s or higher is required." : "ownCloud %s veya daha üstü gerekli.",
- "ownCloud with a version lower than %s is required." : "ownCloud %s sürümünden daha öncesi gerekli.",
+ "ownCloud %s or lower is required." : "ownCloud %s veya daha düşük sürüm gerekli.",
"Help" : "Yardım",
"Personal" : "Kişisel",
"Users" : "Kullanıcılar",
@@ -45,6 +45,7 @@ OC.L10N.register(
"File name is a reserved word" : "Bu dosya adı özel bir kullanıma aittir",
"File name contains at least one invalid character" : "Dosya adı en az bir geçersiz karakter içeriyor",
"File name is too long" : "Dosya adı çok uzun",
+ "File is currently busy, please try again later" : "Dosya şu anda meşgul, lütfen daha sonra deneyin",
"Can't read file" : "Dosya okunamıyor",
"App directory already exists" : "Uygulama dizini zaten mevcut",
"Can't create app folder. Please fix permissions. %s" : "Uygulama dizini oluşturulamıyor. Lütfen izinleri düzeltin. %s",
@@ -85,6 +86,7 @@ OC.L10N.register(
"Set an admin username." : "Bir yönetici kullanıcı adı ayarlayın.",
"Set an admin password." : "Bir yönetici kullanıcı parolası ayarlayın.",
"Can't create or write into the data directory %s" : "Veri dizini %s oluşturulamıyor veya yazılamıyor",
+ "Invalid Federated Cloud ID" : "Geçersiz Birleşmiş Bulut Kimliği",
"%s shared »%s« with you" : "%s sizinle »%s« paylaşımında bulundu",
"%s via %s" : "%s, %s aracılığıyla",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Arka uç %i türündeki paylaşımlara izin vermediğinden %s paylaşımı başarısız",
diff --git a/lib/l10n/tr.json b/lib/l10n/tr.json
index 0d212457791..fe9556ffea5 100644
--- a/lib/l10n/tr.json
+++ b/lib/l10n/tr.json
@@ -14,7 +14,7 @@
"Library %s with a version lower than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha düşük sürümü gerekli - kullanılabilir sürüm %s.",
"Following platforms are supported: %s" : "Aşağıdaki platformlar destekleniyor: %s",
"ownCloud %s or higher is required." : "ownCloud %s veya daha üstü gerekli.",
- "ownCloud with a version lower than %s is required." : "ownCloud %s sürümünden daha öncesi gerekli.",
+ "ownCloud %s or lower is required." : "ownCloud %s veya daha düşük sürüm gerekli.",
"Help" : "Yardım",
"Personal" : "Kişisel",
"Users" : "Kullanıcılar",
@@ -43,6 +43,7 @@
"File name is a reserved word" : "Bu dosya adı özel bir kullanıma aittir",
"File name contains at least one invalid character" : "Dosya adı en az bir geçersiz karakter içeriyor",
"File name is too long" : "Dosya adı çok uzun",
+ "File is currently busy, please try again later" : "Dosya şu anda meşgul, lütfen daha sonra deneyin",
"Can't read file" : "Dosya okunamıyor",
"App directory already exists" : "Uygulama dizini zaten mevcut",
"Can't create app folder. Please fix permissions. %s" : "Uygulama dizini oluşturulamıyor. Lütfen izinleri düzeltin. %s",
@@ -83,6 +84,7 @@
"Set an admin username." : "Bir yönetici kullanıcı adı ayarlayın.",
"Set an admin password." : "Bir yönetici kullanıcı parolası ayarlayın.",
"Can't create or write into the data directory %s" : "Veri dizini %s oluşturulamıyor veya yazılamıyor",
+ "Invalid Federated Cloud ID" : "Geçersiz Birleşmiş Bulut Kimliği",
"%s shared »%s« with you" : "%s sizinle »%s« paylaşımında bulundu",
"%s via %s" : "%s, %s aracılığıyla",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Arka uç %i türündeki paylaşımlara izin vermediğinden %s paylaşımı başarısız",
diff --git a/lib/l10n/uk.js b/lib/l10n/uk.js
index 0c6324ff041..8ebc66be6dd 100644
--- a/lib/l10n/uk.js
+++ b/lib/l10n/uk.js
@@ -16,7 +16,6 @@ OC.L10N.register(
"Library %s with a version lower than %s is required - available version %s." : "Потрібна бібліотека %s версії менш ніж %s, встановлена версія %s.",
"Following platforms are supported: %s" : "Підтримуються наступні платформи: %s",
"ownCloud %s or higher is required." : "Потрібен ownCloud %s або вище.",
- "ownCloud with a version lower than %s is required." : "Потрібна версія ownCloud нижче %s.",
"Help" : "Допомога",
"Personal" : "Особисте",
"Users" : "Користувачі",
diff --git a/lib/l10n/uk.json b/lib/l10n/uk.json
index e4b6b053dbc..a9f29cbfce2 100644
--- a/lib/l10n/uk.json
+++ b/lib/l10n/uk.json
@@ -14,7 +14,6 @@
"Library %s with a version lower than %s is required - available version %s." : "Потрібна бібліотека %s версії менш ніж %s, встановлена версія %s.",
"Following platforms are supported: %s" : "Підтримуються наступні платформи: %s",
"ownCloud %s or higher is required." : "Потрібен ownCloud %s або вище.",
- "ownCloud with a version lower than %s is required." : "Потрібна версія ownCloud нижче %s.",
"Help" : "Допомога",
"Personal" : "Особисте",
"Users" : "Користувачі",
diff --git a/lib/private/app.php b/lib/private/app.php
index e45d9ac07ba..6c6f79dfa9d 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -168,7 +168,7 @@ class OC_App {
private static function getAppTypes($app) {
//load the cache
if (count(self::$appTypes) == 0) {
- self::$appTypes = OC_Appconfig::getValues(false, 'types');
+ self::$appTypes = \OC::$server->getAppConfig()->getValues(false, 'types');
}
if (isset(self::$appTypes[$app])) {
@@ -190,7 +190,7 @@ class OC_App {
$appTypes = '';
}
- OC_Appconfig::setValue($app, 'types', $appTypes);
+ \OC::$server->getAppConfig()->setValue($app, 'types', $appTypes);
}
/**
@@ -511,7 +511,7 @@ class OC_App {
}
}
- OC_Log::write('core', 'No application directories are marked as writable.', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'No application directories are marked as writable.', \OCP\Util::ERROR);
return null;
}
@@ -771,7 +771,7 @@ class OC_App {
foreach (OC::$APPSROOTS as $apps_dir) {
if (!is_readable($apps_dir['path'])) {
- OC_Log::write('core', 'unable to read app folder : ' . $apps_dir['path'], OC_Log::WARN);
+ \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN);
continue;
}
$dh = opendir($apps_dir['path']);
@@ -779,7 +779,7 @@ class OC_App {
if (is_resource($dh)) {
while (($file = readdir($dh)) !== false) {
- if ($file[0] != '.' and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
+ if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
$apps[] = $file;
@@ -817,11 +817,11 @@ class OC_App {
$info = OC_App::getAppInfo($app);
if (!isset($info['name'])) {
- OC_Log::write('core', 'App id "' . $app . '" has no name in appinfo', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR);
continue;
}
- $enabled = OC_Appconfig::getValue($app, 'enabled', 'no');
+ $enabled = \OC::$server->getAppConfig()->getValue($app, 'enabled', 'no');
$info['groups'] = null;
if ($enabled === 'yes') {
$active = true;
@@ -1162,9 +1162,7 @@ class OC_App {
OC_DB::updateDbFromStructure(self::getAppPath($appId) . '/appinfo/database.xml');
}
unset(self::$appVersion[$appId]);
- if (!self::isEnabled($appId)) {
- return false;
- }
+ // run upgrade code
if (file_exists(self::getAppPath($appId) . '/appinfo/update.php')) {
self::loadApp($appId, false);
include self::getAppPath($appId) . '/appinfo/update.php';
@@ -1173,21 +1171,21 @@ class OC_App {
//set remote/public handlers
$appData = self::getAppInfo($appId);
if (array_key_exists('ocsid', $appData)) {
- OC_Appconfig::setValue($appId, 'ocsid', $appData['ocsid']);
- } elseif(OC_Appconfig::getValue($appId, 'ocsid', null) !== null) {
- OC_Appconfig::deleteKey($appId, 'ocsid');
+ \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']);
+ } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
+ \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
}
foreach ($appData['remote'] as $name => $path) {
- OCP\CONFIG::setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
+ \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
}
foreach ($appData['public'] as $name => $path) {
- OCP\CONFIG::setAppValue('core', 'public_' . $name, $appId . '/' . $path);
+ \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
}
self::setAppTypes($appId);
$version = \OC_App::getAppVersion($appId);
- \OC_Appconfig::setValue($appId, 'installed_version', $version);
+ \OC::$server->getAppConfig()->setValue($appId, 'installed_version', $version);
return true;
}
@@ -1205,11 +1203,11 @@ class OC_App {
}
return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
} else {
- OC_Log::write('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR);
return false;
}
} else {
- OC_Log::write('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR);
return false;
}
}
diff --git a/lib/private/app/codechecker/abstractcheck.php b/lib/private/app/codechecker/abstractcheck.php
new file mode 100644
index 00000000000..c1c6524e42f
--- /dev/null
+++ b/lib/private/app/codechecker/abstractcheck.php
@@ -0,0 +1,139 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+abstract class AbstractCheck implements ICheck {
+ /** @var ICheck */
+ protected $check;
+
+ /**
+ * @param ICheck $check
+ */
+ public function __construct(ICheck $check) {
+ $this->check = $check;
+ }
+
+ /**
+ * @param int $errorCode
+ * @param string $errorObject
+ * @return string
+ */
+ public function getDescription($errorCode, $errorObject) {
+ switch ($errorCode) {
+ case CodeChecker::STATIC_CALL_NOT_ALLOWED:
+ $functions = $this->getLocalFunctions();
+ $functions = array_change_key_case($functions, CASE_LOWER);
+ if (isset($functions[$errorObject])) {
+ return $this->getLocalDescription();
+ }
+ // no break;
+ case CodeChecker::CLASS_EXTENDS_NOT_ALLOWED:
+ case CodeChecker::CLASS_IMPLEMENTS_NOT_ALLOWED:
+ case CodeChecker::CLASS_NEW_NOT_ALLOWED:
+ case CodeChecker::CLASS_USE_NOT_ALLOWED:
+ $classes = $this->getLocalClasses();
+ $classes = array_change_key_case($classes, CASE_LOWER);
+ if (isset($classes[$errorObject])) {
+ return $this->getLocalDescription();
+ }
+ break;
+
+ case CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED:
+ $constants = $this->getLocalConstants();
+ $constants = array_change_key_case($constants, CASE_LOWER);
+ if (isset($constants[$errorObject])) {
+ return $this->getLocalDescription();
+ }
+ break;
+
+ case CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED:
+ $methods = $this->getLocalMethods();
+ $methods = array_change_key_case($methods, CASE_LOWER);
+ if (isset($methods[$errorObject])) {
+ return $this->getLocalDescription();
+ }
+ break;
+ }
+
+ return $this->check->getDescription($errorCode, $errorObject);
+ }
+
+ /**
+ * @return string
+ */
+ abstract protected function getLocalDescription();
+
+ /**
+ * @return array
+ */
+ abstract protected function getLocalClasses();
+
+ /**
+ * @return array
+ */
+ abstract protected function getLocalConstants();
+
+ /**
+ * @return array
+ */
+ abstract protected function getLocalFunctions();
+
+ /**
+ * @return array
+ */
+ abstract protected function getLocalMethods();
+
+ /**
+ * @return array E.g.: `'ClassName' => 'oc version',`
+ */
+ public function getClasses() {
+ return array_merge($this->getLocalClasses(), $this->check->getClasses());
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::CONSTANT_NAME' => 'oc version',`
+ */
+ public function getConstants() {
+ return array_merge($this->getLocalConstants(), $this->check->getConstants());
+ }
+
+ /**
+ * @return array E.g.: `'functionName' => 'oc version',`
+ */
+ public function getFunctions() {
+ return array_merge($this->getLocalFunctions(), $this->check->getFunctions());
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::methodName' => 'oc version',`
+ */
+ public function getMethods() {
+ return array_merge($this->getLocalMethods(), $this->check->getMethods());
+ }
+
+ /**
+ * @return bool
+ */
+ public function checkStrongComparisons() {
+ return $this->check->checkStrongComparisons();
+ }
+}
diff --git a/lib/private/app/codechecker.php b/lib/private/app/codechecker/codechecker.php
index 3f6cd19d6b4..ef7dc7f3e4d 100644
--- a/lib/private/app/codechecker.php
+++ b/lib/private/app/codechecker/codechecker.php
@@ -21,14 +21,13 @@
*
*/
-namespace OC\App;
+namespace OC\App\CodeChecker;
use OC\Hooks\BasicEmitter;
use PhpParser\Lexer;
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\NodeTraverser;
-use PhpParser\NodeVisitorAbstract;
use PhpParser\Parser;
use RecursiveCallbackFilterIterator;
use RecursiveDirectoryIterator;
@@ -42,43 +41,20 @@ class CodeChecker extends BasicEmitter {
const CLASS_IMPLEMENTS_NOT_ALLOWED = 1001;
const STATIC_CALL_NOT_ALLOWED = 1002;
const CLASS_CONST_FETCH_NOT_ALLOWED = 1003;
- const CLASS_NEW_FETCH_NOT_ALLOWED = 1004;
+ const CLASS_NEW_NOT_ALLOWED = 1004;
const OP_OPERATOR_USAGE_DISCOURAGED = 1005;
+ const CLASS_USE_NOT_ALLOWED = 1006;
+ const CLASS_METHOD_CALL_NOT_ALLOWED = 1007;
/** @var Parser */
private $parser;
- /** @var string[] */
- private $blackListedClassNames;
+ /** @var ICheck */
+ protected $checkList;
- public function __construct() {
+ public function __construct(ICheck $checkList) {
+ $this->checkList = $checkList;
$this->parser = new Parser(new Lexer);
- $this->blackListedClassNames = [
- // classes replaced by the public api
- 'OC_API',
- 'OC_App',
- 'OC_AppConfig',
- 'OC_Avatar',
- 'OC_BackgroundJob',
- 'OC_Config',
- 'OC_DB',
- 'OC_Files',
- 'OC_Helper',
- 'OC_Hook',
- 'OC_Image',
- 'OC_JSON',
- 'OC_L10N',
- 'OC_Log',
- 'OC_Mail',
- 'OC_Preferences',
- 'OC_Search_Provider',
- 'OC_Search_Result',
- 'OC_Request',
- 'OC_Response',
- 'OC_Template',
- 'OC_User',
- 'OC_Util',
- ];
}
/**
@@ -138,7 +114,7 @@ class CodeChecker extends BasicEmitter {
$code = file_get_contents($file);
$statements = $this->parser->parse($code);
- $visitor = new CodeCheckVisitor($this->blackListedClassNames);
+ $visitor = new NodeVisitor($this->checkList);
$traverser = new NodeTraverser;
$traverser->addVisitor($visitor);
diff --git a/lib/private/app/codechecker/deprecationcheck.php b/lib/private/app/codechecker/deprecationcheck.php
new file mode 100644
index 00000000000..3b6dc968bb5
--- /dev/null
+++ b/lib/private/app/codechecker/deprecationcheck.php
@@ -0,0 +1,147 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+class DeprecationCheck extends AbstractCheck implements ICheck {
+ /**
+ * @return string
+ */
+ protected function getLocalDescription() {
+ return 'deprecated';
+ }
+
+ /**
+ * @return array E.g.: `'ClassName' => 'oc version',`
+ */
+ protected function getLocalClasses() {
+ return [
+ 'OCP\Config' => '8.0.0',
+ 'OCP\Contacts' => '8.1.0',
+ 'OCP\DB' => '8.1.0',
+ 'OCP\IHelper' => '8.1.0',
+ 'OCP\JSON' => '8.1.0',
+ 'OCP\Response' => '8.1.0',
+ 'OCP\AppFramework\IApi' => '8.0.0',
+ ];
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::CONSTANT_NAME' => 'oc version',`
+ */
+ protected function getLocalConstants() {
+ return [
+ 'OCP::PERMISSION_CREATE' => '8.0.0',
+ 'OCP::PERMISSION_READ' => '8.0.0',
+ 'OCP::PERMISSION_UPDATE' => '8.0.0',
+ 'OCP::PERMISSION_DELETE' => '8.0.0',
+ 'OCP::PERMISSION_SHARE' => '8.0.0',
+ 'OCP::PERMISSION_ALL' => '8.0.0',
+ 'OCP::FILENAME_INVALID_CHARS' => '8.0.0',
+ ];
+ }
+
+ /**
+ * @return array E.g.: `'functionName' => 'oc version',`
+ */
+ protected function getLocalFunctions() {
+ return [
+ 'OCP::image_path' => '8.0.0',
+ 'OCP::mimetype_icon' => '8.0.0',
+ 'OCP::preview_icon' => '8.0.0',
+ 'OCP::publicPreview_icon' => '8.0.0',
+ 'OCP::human_file_size' => '8.0.0',
+ 'OCP::relative_modified_date' => '8.0.0',
+ 'OCP::simple_file_size' => '8.0.0',
+ 'OCP::html_select_options' => '8.0.0',
+ ];
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::methodName' => 'oc version',`
+ */
+ protected function getLocalMethods() {
+ return [
+ 'OCP\App::register' => '8.1.0',
+ 'OCP\App::addNavigationEntry' => '8.1.0',
+ 'OCP\App::setActiveNavigationEntry' => '8.1.0',
+
+ 'OCP\AppFramework\Controller::params' => '7.0.0',
+ 'OCP\AppFramework\Controller::getParams' => '7.0.0',
+ 'OCP\AppFramework\Controller::method' => '7.0.0',
+ 'OCP\AppFramework\Controller::getUploadedFile' => '7.0.0',
+ 'OCP\AppFramework\Controller::env' => '7.0.0',
+ 'OCP\AppFramework\Controller::cookie' => '7.0.0',
+ 'OCP\AppFramework\Controller::render' => '7.0.0',
+
+ 'OCP\AppFramework\IAppContainer::getCoreApi' => '8.0.0',
+ 'OCP\AppFramework\IAppContainer::isLoggedIn' => '8.0.0',
+ 'OCP\AppFramework\IAppContainer::isAdminUser' => '8.0.0',
+ 'OCP\AppFramework\IAppContainer::log' => '8.0.0',
+
+ 'OCP\BackgroundJob::addQueuedTask' => '6.0.0',
+ 'OCP\BackgroundJob::addRegularTask' => '6.0.0',
+ 'OCP\BackgroundJob::allQueuedTasks' => '6.0.0',
+ 'OCP\BackgroundJob::allRegularTasks' => '6.0.0',
+ 'OCP\BackgroundJob::deleteQueuedTask' => '6.0.0',
+ 'OCP\BackgroundJob::findQueuedTask' => '6.0.0',
+ 'OCP\BackgroundJob::queuedTaskWhereAppIs' => '6.0.0',
+ 'OCP\BackgroundJob::registerJob' => '8.1.0',
+
+ 'OCP\Files::tmpFile' => '8.1.0',
+ 'OCP\Files::tmpFolder' => '8.1.0',
+
+ 'OCP\IAppConfig::getValue' => '8.0.0',
+ 'OCP\IAppConfig::deleteKey' => '8.0.0',
+ 'OCP\IAppConfig::getKeys' => '8.0.0',
+ 'OCP\IAppConfig::setValue' => '8.0.0',
+ 'OCP\IAppConfig::deleteApp' => '8.0.0',
+
+ 'OCP\ISearch::search' => '8.0.0',
+
+ 'OCP\IServerContainer::getDb' => '8.1.0',
+ 'OCP\IServerContainer::getHTTPHelper' => '8.1.0',
+
+ 'OCP\User::getUser' => '8.0.0',
+ 'OCP\User::getUsers' => '8.1.0',
+ 'OCP\User::getDisplayName' => '8.1.0',
+ 'OCP\User::getDisplayNames' => '8.1.0',
+ 'OCP\User::userExists' => '8.1.0',
+ 'OCP\User::logout' => '8.1.0',
+ 'OCP\User::checkPassword' => '8.1.0',
+
+ 'OCP\Util::sendMail' => '8.1.0',
+ 'OCP\Util::formatDate' => '8.0.0',
+ 'OCP\Util::encryptedFiles' => '8.1.0',
+ 'OCP\Util::linkToRoute' => '8.1.0',
+ 'OCP\Util::linkTo' => '8.1.0',
+ 'OCP\Util::getServerHost' => '8.1.0',
+ 'OCP\Util::getServerProtocol' => '8.1.0',
+ 'OCP\Util::getRequestUri' => '8.1.0',
+ 'OCP\Util::getScriptName' => '8.1.0',
+ 'OCP\Util::imagePath' => '8.1.0',
+ 'OCP\Util::isValidFileName' => '8.1.0',
+ 'OCP\Util::generateRandomBytes' => '8.1.0',
+ 'OCP\Util::mb_str_replace' => '8.2.0',
+ 'OCP\Util::mb_substr_replace' => '8.2.0',
+ ];
+ }
+}
diff --git a/lib/private/app/codechecker/emptycheck.php b/lib/private/app/codechecker/emptycheck.php
new file mode 100644
index 00000000000..0e5df55d090
--- /dev/null
+++ b/lib/private/app/codechecker/emptycheck.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+namespace OC\App\CodeChecker;
+
+class EmptyCheck implements ICheck {
+ /**
+ * @param int $errorCode
+ * @param string $errorObject
+ * @return string
+ */
+ public function getDescription($errorCode, $errorObject) {
+ return '';
+ }
+
+ /**
+ * @return array E.g.: `'ClassName' => 'oc version',`
+ */
+ public function getClasses() {
+ return [];
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::CONSTANT_NAME' => 'oc version',`
+ */
+ public function getConstants() {
+ return [];
+ }
+
+ /**
+ * @return array E.g.: `'functionName' => 'oc version',`
+ */
+ public function getFunctions() {
+ return [];
+ }
+
+ /**
+ * @return array E.g.: `'ClassName::methodName' => 'oc version',`
+ */
+ public function getMethods() {
+ return [];
+ }
+
+ /**
+ * @return bool
+ */
+ public function checkStrongComparisons() {
+ return false;
+ }
+}
diff --git a/lib/private/app/codechecker/icheck.php b/lib/private/app/codechecker/icheck.php
new file mode 100644
index 00000000000..a00e0d8fa13
--- /dev/null
+++ b/lib/private/app/codechecker/icheck.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+namespace OC\App\CodeChecker;
+
+interface ICheck {
+ /**
+ * @param int $errorCode
+ * @param string $errorObject
+ * @return string
+ */
+ public function getDescription($errorCode, $errorObject);
+
+ /**
+ * @return array E.g.: `'ClassName' => 'oc version',`
+ */
+ public function getClasses();
+
+ /**
+ * @return array E.g.: `'ClassName::CONSTANT_NAME' => 'oc version',`
+ */
+ public function getConstants();
+
+ /**
+ * @return array E.g.: `'functionName' => 'oc version',`
+ */
+ public function getFunctions();
+
+ /**
+ * @return array E.g.: `'ClassName::methodName' => 'oc version',`
+ */
+ public function getMethods();
+
+ /**
+ * @return bool
+ */
+ public function checkStrongComparisons();
+}
diff --git a/lib/private/app/codechecker/nodevisitor.php b/lib/private/app/codechecker/nodevisitor.php
new file mode 100644
index 00000000000..a22f852f36a
--- /dev/null
+++ b/lib/private/app/codechecker/nodevisitor.php
@@ -0,0 +1,306 @@
+<?php
+/**
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+use PhpParser\Node;
+use PhpParser\Node\Name;
+use PhpParser\NodeVisitorAbstract;
+
+class NodeVisitor extends NodeVisitorAbstract {
+ /** @var ICheck */
+ protected $list;
+
+ /** @var string */
+ protected $blackListDescription;
+ /** @var string[] */
+ protected $blackListedClassNames;
+ /** @var string[] */
+ protected $blackListedConstants;
+ /** @var string[] */
+ protected $blackListedFunctions;
+ /** @var string[] */
+ protected $blackListedMethods;
+ /** @var bool */
+ protected $checkEqualOperatorUsage;
+ /** @var string[] */
+ protected $errorMessages;
+
+ /**
+ * @param ICheck $list
+ */
+ public function __construct(ICheck $list) {
+ $this->list = $list;
+
+ $this->blackListedClassNames = [];
+ foreach ($list->getClasses() as $class => $blackListInfo) {
+ if (is_numeric($class) && is_string($blackListInfo)) {
+ $class = $blackListInfo;
+ $blackListInfo = null;
+ }
+
+ $class = strtolower($class);
+ $this->blackListedClassNames[$class] = $class;
+ }
+
+ $this->blackListedConstants = [];
+ foreach ($list->getConstants() as $constantName => $blackListInfo) {
+ $constantName = strtolower($constantName);
+ $this->blackListedConstants[$constantName] = $constantName;
+ }
+
+ $this->blackListedFunctions = [];
+ foreach ($list->getFunctions() as $functionName => $blackListInfo) {
+ $functionName = strtolower($functionName);
+ $this->blackListedFunctions[$functionName] = $functionName;
+ }
+
+ $this->blackListedMethods = [];
+ foreach ($list->getMethods() as $functionName => $blackListInfo) {
+ $functionName = strtolower($functionName);
+ $this->blackListedMethods[$functionName] = $functionName;
+ }
+
+ $this->checkEqualOperatorUsage = $list->checkStrongComparisons();
+
+ $this->errorMessages = [
+ CodeChecker::CLASS_EXTENDS_NOT_ALLOWED => "%s class must not be extended",
+ CodeChecker::CLASS_IMPLEMENTS_NOT_ALLOWED => "%s interface must not be implemented",
+ CodeChecker::STATIC_CALL_NOT_ALLOWED => "Static method of %s class must not be called",
+ CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED => "Constant of %s class must not not be fetched",
+ CodeChecker::CLASS_NEW_NOT_ALLOWED => "%s class must not be instantiated",
+ CodeChecker::CLASS_USE_NOT_ALLOWED => "%s class must not be imported with a use statement",
+ CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED => "Method of %s class must not be called",
+
+ CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED => "is discouraged",
+ ];
+ }
+
+ /** @var array */
+ public $errors = [];
+
+ public function enterNode(Node $node) {
+ if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) {
+ $this->errors[]= [
+ 'disallowedToken' => '==',
+ 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason('==', CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED)
+ ];
+ }
+ if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\NotEqual) {
+ $this->errors[]= [
+ 'disallowedToken' => '!=',
+ 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason('!=', CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED)
+ ];
+ }
+ if ($node instanceof Node\Stmt\Class_) {
+ if (!is_null($node->extends)) {
+ $this->checkBlackList($node->extends->toString(), CodeChecker::CLASS_EXTENDS_NOT_ALLOWED, $node);
+ }
+ foreach ($node->implements as $implements) {
+ $this->checkBlackList($implements->toString(), CodeChecker::CLASS_IMPLEMENTS_NOT_ALLOWED, $node);
+ }
+ }
+ if ($node instanceof Node\Expr\StaticCall) {
+ if (!is_null($node->class)) {
+ if ($node->class instanceof Name) {
+ $this->checkBlackList($node->class->toString(), CodeChecker::STATIC_CALL_NOT_ALLOWED, $node);
+
+ $this->checkBlackListFunction($node->class->toString(), $node->name, $node);
+ $this->checkBlackListMethod($node->class->toString(), $node->name, $node);
+ }
+
+ if ($node->class instanceof Node\Expr\Variable) {
+ /**
+ * TODO: find a way to detect something like this:
+ * $c = "OC_API";
+ * $n = $c::call();
+ */
+ // $this->checkBlackListMethod($node->class->..., $node->name, $node);
+ }
+ }
+ }
+ if ($node instanceof Node\Expr\MethodCall) {
+ if (!is_null($node->var)) {
+ if ($node->var instanceof Node\Expr\Variable) {
+ /**
+ * TODO: find a way to detect something like this:
+ * $c = new OC_API();
+ * $n = $c::call();
+ * $n = $c->call();
+ */
+ // $this->checkBlackListMethod($node->var->..., $node->name, $node);
+ }
+ }
+ }
+ if ($node instanceof Node\Expr\ClassConstFetch) {
+ if (!is_null($node->class)) {
+ if ($node->class instanceof Name) {
+ $this->checkBlackList($node->class->toString(), CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED, $node);
+ }
+ if ($node->class instanceof Node\Expr\Variable) {
+ /**
+ * TODO: find a way to detect something like this:
+ * $c = "OC_API";
+ * $n = $i::ADMIN_AUTH;
+ */
+ }
+
+ $this->checkBlackListConstant($node->class->toString(), $node->name, $node);
+ }
+ }
+ if ($node instanceof Node\Expr\New_) {
+ if (!is_null($node->class)) {
+ if ($node->class instanceof Name) {
+ $this->checkBlackList($node->class->toString(), CodeChecker::CLASS_NEW_NOT_ALLOWED, $node);
+ }
+ if ($node->class instanceof Node\Expr\Variable) {
+ /**
+ * TODO: find a way to detect something like this:
+ * $c = "OC_API";
+ * $n = new $i;
+ */
+ }
+ }
+ }
+ if ($node instanceof Node\Stmt\UseUse) {
+ $this->checkBlackList($node->name->toString(), CodeChecker::CLASS_USE_NOT_ALLOWED, $node);
+ if ($node->alias) {
+ $this->addUseNameToBlackList($node->name->toString(), $node->alias);
+ } else {
+ $this->addUseNameToBlackList($node->name->toString(), $node->name->getLast());
+ }
+ }
+ }
+
+ /**
+ * Check whether an alias was introduced for a namespace of a blacklisted class
+ *
+ * Example:
+ * - Blacklist entry: OCP\AppFramework\IApi
+ * - Name: OCP\AppFramework
+ * - Alias: OAF
+ * => new blacklist entry: OAF\IApi
+ *
+ * @param string $name
+ * @param string $alias
+ */
+ private function addUseNameToBlackList($name, $alias) {
+ $name = strtolower($name);
+ $alias = strtolower($alias);
+
+ foreach ($this->blackListedClassNames as $blackListedAlias => $blackListedClassName) {
+ if (strpos($blackListedClassName, $name . '\\') === 0) {
+ $aliasedClassName = str_replace($name, $alias, $blackListedClassName);
+ $this->blackListedClassNames[$aliasedClassName] = $blackListedClassName;
+ }
+ }
+
+ foreach ($this->blackListedConstants as $blackListedAlias => $blackListedConstant) {
+ if (strpos($blackListedConstant, $name . '\\') === 0 || strpos($blackListedConstant, $name . '::') === 0) {
+ $aliasedConstantName = str_replace($name, $alias, $blackListedConstant);
+ $this->blackListedConstants[$aliasedConstantName] = $blackListedConstant;
+ }
+ }
+
+ foreach ($this->blackListedFunctions as $blackListedAlias => $blackListedFunction) {
+ if (strpos($blackListedFunction, $name . '\\') === 0 || strpos($blackListedFunction, $name . '::') === 0) {
+ $aliasedFunctionName = str_replace($name, $alias, $blackListedFunction);
+ $this->blackListedFunctions[$aliasedFunctionName] = $blackListedFunction;
+ }
+ }
+
+ foreach ($this->blackListedMethods as $blackListedAlias => $blackListedMethod) {
+ if (strpos($blackListedMethod, $name . '\\') === 0 || strpos($blackListedMethod, $name . '::') === 0) {
+ $aliasedMethodName = str_replace($name, $alias, $blackListedMethod);
+ $this->blackListedMethods[$aliasedMethodName] = $blackListedMethod;
+ }
+ }
+ }
+
+ private function checkBlackList($name, $errorCode, Node $node) {
+ $lowerName = strtolower($name);
+
+ if (isset($this->blackListedClassNames[$lowerName])) {
+ $this->errors[]= [
+ 'disallowedToken' => $name,
+ 'errorCode' => $errorCode,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason($this->blackListedClassNames[$lowerName], $errorCode)
+ ];
+ }
+ }
+
+ private function checkBlackListConstant($class, $constantName, Node $node) {
+ $name = $class . '::' . $constantName;
+ $lowerName = strtolower($name);
+
+ if (isset($this->blackListedConstants[$lowerName])) {
+ $this->errors[]= [
+ 'disallowedToken' => $name,
+ 'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason($this->blackListedConstants[$lowerName], CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED)
+ ];
+ }
+ }
+
+ private function checkBlackListFunction($class, $functionName, Node $node) {
+ $name = $class . '::' . $functionName;
+ $lowerName = strtolower($name);
+
+ if (isset($this->blackListedFunctions[$lowerName])) {
+ $this->errors[]= [
+ 'disallowedToken' => $name,
+ 'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason($this->blackListedFunctions[$lowerName], CodeChecker::STATIC_CALL_NOT_ALLOWED)
+ ];
+ }
+ }
+
+ private function checkBlackListMethod($class, $functionName, Node $node) {
+ $name = $class . '::' . $functionName;
+ $lowerName = strtolower($name);
+
+ if (isset($this->blackListedMethods[$lowerName])) {
+ $this->errors[]= [
+ 'disallowedToken' => $name,
+ 'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED,
+ 'line' => $node->getLine(),
+ 'reason' => $this->buildReason($this->blackListedMethods[$lowerName], CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED)
+ ];
+ }
+ }
+
+ private function buildReason($name, $errorCode) {
+ if (isset($this->errorMessages[$errorCode])) {
+ $desc = $this->list->getDescription($errorCode, $name);
+ return sprintf($this->errorMessages[$errorCode], $desc);
+ }
+
+ return "$name usage not allowed - error: $errorCode";
+ }
+}
diff --git a/lib/private/app/codechecker/privatecheck.php b/lib/private/app/codechecker/privatecheck.php
new file mode 100644
index 00000000000..d6f4eb06981
--- /dev/null
+++ b/lib/private/app/codechecker/privatecheck.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+class PrivateCheck extends AbstractCheck implements ICheck {
+ /**
+ * @return string
+ */
+ protected function getLocalDescription() {
+ return 'private';
+ }
+
+ /**
+ * @return array
+ */
+ public function getLocalClasses() {
+ return [
+ // classes replaced by the public api
+ 'OC_API' => '6.0.0',
+ 'OC_App' => '6.0.0',
+ 'OC_AppConfig' => '6.0.0',
+ 'OC_Avatar' => '6.0.0',
+ 'OC_BackgroundJob' => '6.0.0',
+ 'OC_Config' => '6.0.0',
+ 'OC_DB' => '6.0.0',
+ 'OC_Files' => '6.0.0',
+ 'OC_Helper' => '6.0.0',
+ 'OC_Hook' => '6.0.0',
+ 'OC_Image' => '6.0.0',
+ 'OC_JSON' => '6.0.0',
+ 'OC_L10N' => '6.0.0',
+ 'OC_Log' => '6.0.0',
+ 'OC_Mail' => '6.0.0',
+ 'OC_Preferences' => '6.0.0',
+ 'OC_Search_Provider' => '6.0.0',
+ 'OC_Search_Result' => '6.0.0',
+ 'OC_Request' => '6.0.0',
+ 'OC_Response' => '6.0.0',
+ 'OC_Template' => '6.0.0',
+ 'OC_User' => '6.0.0',
+ 'OC_Util' => '6.0.0',
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ public function getLocalConstants() {
+ return [];
+ }
+
+ /**
+ * @return array
+ */
+ public function getLocalFunctions() {
+ return [];
+ }
+
+ /**
+ * @return array
+ */
+ public function getLocalMethods() {
+ return [];
+ }
+}
diff --git a/lib/private/app/codechecker/strongcomparisoncheck.php b/lib/private/app/codechecker/strongcomparisoncheck.php
new file mode 100644
index 00000000000..7de0fe3e5c3
--- /dev/null
+++ b/lib/private/app/codechecker/strongcomparisoncheck.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\App\CodeChecker;
+
+class StrongComparisonCheck implements ICheck {
+ /** @var ICheck */
+ protected $check;
+
+ /**
+ * @param ICheck $check
+ */
+ public function __construct(ICheck $check) {
+ $this->check = $check;
+ }
+
+ /**
+ * @param int $errorCode
+ * @param string $errorObject
+ * @return string
+ */
+ public function getDescription($errorCode, $errorObject) {
+ return $this->check->getDescription($errorCode, $errorObject);
+ }
+
+ /**
+ * @return array
+ */
+ public function getClasses() {
+ return $this->check->getClasses();
+ }
+
+ /**
+ * @return array
+ */
+ public function getConstants() {
+ return $this->check->getConstants();
+ }
+
+ /**
+ * @return array
+ */
+ public function getFunctions() {
+ return $this->check->getFunctions();
+ }
+
+ /**
+ * @return array
+ */
+ public function getMethods() {
+ return $this->check->getMethods();
+ }
+
+ /**
+ * @return bool
+ */
+ public function checkStrongComparisons() {
+ return true;
+ }
+}
diff --git a/lib/private/app/codecheckvisitor.php b/lib/private/app/codecheckvisitor.php
deleted file mode 100644
index e983bd8630b..00000000000
--- a/lib/private/app/codecheckvisitor.php
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace OC\App;
-
-use PhpParser\Node;
-use PhpParser\Node\Name;
-use PhpParser\NodeVisitorAbstract;
-
-class CodeCheckVisitor extends NodeVisitorAbstract {
-
- public function __construct($blackListedClassNames) {
- $this->blackListedClassNames = array_map('strtolower', $blackListedClassNames);
- }
-
- public $errors = [];
-
- public function enterNode(Node $node) {
- if ($node instanceof Node\Expr\BinaryOp\Equal) {
- $this->errors[]= [
- 'disallowedToken' => '==',
- 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
- 'line' => $node->getLine(),
- 'reason' => $this->buildReason('==', CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED)
- ];
- }
- if ($node instanceof Node\Expr\BinaryOp\NotEqual) {
- $this->errors[]= [
- 'disallowedToken' => '!=',
- 'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
- 'line' => $node->getLine(),
- 'reason' => $this->buildReason('!=', CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED)
- ];
- }
- if ($node instanceof Node\Stmt\Class_) {
- if (!is_null($node->extends)) {
- $this->checkBlackList($node->extends->toString(), CodeChecker::CLASS_EXTENDS_NOT_ALLOWED, $node);
- }
- foreach ($node->implements as $implements) {
- $this->checkBlackList($implements->toString(), CodeChecker::CLASS_IMPLEMENTS_NOT_ALLOWED, $node);
- }
- }
- if ($node instanceof Node\Expr\StaticCall) {
- if (!is_null($node->class)) {
- if ($node->class instanceof Name) {
- $this->checkBlackList($node->class->toString(), CodeChecker::STATIC_CALL_NOT_ALLOWED, $node);
- }
- if ($node->class instanceof Node\Expr\Variable) {
- /**
- * TODO: find a way to detect something like this:
- * $c = "OC_API";
- * $n = $i::call();
- */
- }
- }
- }
- if ($node instanceof Node\Expr\ClassConstFetch) {
- if (!is_null($node->class)) {
- if ($node->class instanceof Name) {
- $this->checkBlackList($node->class->toString(), CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED, $node);
- }
- if ($node->class instanceof Node\Expr\Variable) {
- /**
- * TODO: find a way to detect something like this:
- * $c = "OC_API";
- * $n = $i::ADMIN_AUTH;
- */
- }
- }
- }
- if ($node instanceof Node\Expr\New_) {
- if (!is_null($node->class)) {
- if ($node->class instanceof Name) {
- $this->checkBlackList($node->class->toString(), CodeChecker::CLASS_NEW_FETCH_NOT_ALLOWED, $node);
- }
- if ($node->class instanceof Node\Expr\Variable) {
- /**
- * TODO: find a way to detect something like this:
- * $c = "OC_API";
- * $n = new $i;
- */
- }
- }
- }
- }
-
- private function checkBlackList($name, $errorCode, Node $node) {
- if (in_array(strtolower($name), $this->blackListedClassNames)) {
- $this->errors[]= [
- 'disallowedToken' => $name,
- 'errorCode' => $errorCode,
- 'line' => $node->getLine(),
- 'reason' => $this->buildReason($name, $errorCode)
- ];
- }
- }
-
- private function buildReason($name, $errorCode) {
- static $errorMessages= [
- CodeChecker::CLASS_EXTENDS_NOT_ALLOWED => "used as base class",
- CodeChecker::CLASS_IMPLEMENTS_NOT_ALLOWED => "used as interface",
- CodeChecker::STATIC_CALL_NOT_ALLOWED => "static method call on private class",
- CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED => "used to fetch a const from",
- CodeChecker::CLASS_NEW_FETCH_NOT_ALLOWED => "is instanciated",
- CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED => "is discouraged"
- ];
-
- if (isset($errorMessages[$errorCode])) {
- return $errorMessages[$errorCode];
- }
-
- return "$name usage not allowed - error: $errorCode";
- }
-}
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index f826ef45bb5..baf2f0c4745 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -478,7 +478,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
*/
private function isOverwriteCondition($type = '') {
$regex = '/' . $this->config->getSystemValue('overwritecondaddr', '') . '/';
- return $regex === '//' || preg_match($regex, $this->server['REMOTE_ADDR']) === 1
+ $remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
+ return $regex === '//' || preg_match($regex, $remoteAddr) === 1
|| $type !== 'protocol';
}
diff --git a/lib/private/appframework/middleware/security/corsmiddleware.php b/lib/private/appframework/middleware/security/corsmiddleware.php
index 600eb2318cf..d7c42cd9b13 100644
--- a/lib/private/appframework/middleware/security/corsmiddleware.php
+++ b/lib/private/appframework/middleware/security/corsmiddleware.php
@@ -2,6 +2,7 @@
/**
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @author Morris Jobke <hey@morrisjobke.de>
+ * @author Lukas Reschke <lukas@owncloud.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
@@ -23,6 +24,9 @@
namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Utility\ControllerMethodReflector;
+use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\AppFramework\Http\Response;
@@ -57,8 +61,8 @@ class CORSMiddleware extends Middleware {
* @param IUserSession $session
*/
public function __construct(IRequest $request,
- ControllerMethodReflector $reflector,
- IUserSession $session) {
+ ControllerMethodReflector $reflector,
+ IUserSession $session) {
$this->request = $request;
$this->reflector = $reflector;
$this->session = $session;
@@ -71,6 +75,7 @@ class CORSMiddleware extends Middleware {
* @param Controller $controller the controller that is being called
* @param string $methodName the name of the method that will be called on
* the controller
+ * @throws SecurityException
* @since 6.0.0
*/
public function beforeController($controller, $methodName){
@@ -83,7 +88,7 @@ class CORSMiddleware extends Middleware {
$this->session->logout();
if(!$this->session->login($user, $pass)) {
- throw new SecurityException('CORS requires basic auth');
+ throw new SecurityException('CORS requires basic auth', Http::STATUS_UNAUTHORIZED);
}
}
}
@@ -97,6 +102,7 @@ class CORSMiddleware extends Middleware {
* the controller
* @param Response $response the generated response from the controller
* @return Response a Response object
+ * @throws SecurityException
*/
public function afterController($controller, $methodName, Response $response){
// only react if its a CORS request and if the request sends origin and
@@ -106,7 +112,7 @@ class CORSMiddleware extends Middleware {
// allow credentials headers must not be true or CSRF is possible
// otherwise
- foreach($response->getHeaders() as $header => $value ) {
+ foreach($response->getHeaders() as $header => $value) {
if(strtolower($header) === 'access-control-allow-credentials' &&
strtolower(trim($value)) === 'true') {
$msg = 'Access-Control-Allow-Credentials must not be '.
@@ -121,5 +127,28 @@ class CORSMiddleware extends Middleware {
return $response;
}
+ /**
+ * If an SecurityException is being caught return a JSON error response
+ *
+ * @param Controller $controller the controller that is being called
+ * @param string $methodName the name of the method that will be called on
+ * the controller
+ * @param \Exception $exception the thrown exception
+ * @throws \Exception the passed in exception if it cant handle it
+ * @return Response a Response object or null in case that the exception could not be handled
+ */
+ public function afterException($controller, $methodName, \Exception $exception){
+ if($exception instanceof SecurityException){
+ $response = new JSONResponse(['message' => $exception->getMessage()]);
+ if($exception->getCode() !== 0) {
+ $response->setStatus($exception->getCode());
+ } else {
+ $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR);
+ }
+ return $response;
+ }
+
+ throw $exception;
+ }
}
diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php
index 715fb2457d2..34c626ce8be 100644
--- a/lib/private/appframework/middleware/security/securitymiddleware.php
+++ b/lib/private/appframework/middleware/security/securitymiddleware.php
@@ -69,13 +69,13 @@ class SecurityMiddleware extends Middleware {
* @param bool $isAdminUser
*/
public function __construct(IRequest $request,
- ControllerMethodReflector $reflector,
- INavigationManager $navigationManager,
- IURLGenerator $urlGenerator,
- ILogger $logger,
- $appName,
- $isLoggedIn,
- $isAdminUser){
+ ControllerMethodReflector $reflector,
+ INavigationManager $navigationManager,
+ IURLGenerator $urlGenerator,
+ ILogger $logger,
+ $appName,
+ $isLoggedIn,
+ $isAdminUser){
$this->navigationManager = $navigationManager;
$this->request = $request;
$this->reflector = $reflector;
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 69008c7fab5..a433b84d7bf 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -54,7 +54,7 @@ class File implements ICache {
$this->storage = new View('/' . $user->getUID() . '/cache');
return $this->storage;
} else {
- \OC_Log::write('core', 'Can\'t get cache storage, user not logged in', \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', \OCP\Util::ERROR);
throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in');
}
}
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index e4f53a219d2..18bd3b8d91d 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -128,7 +128,7 @@ class File extends Node implements IFile {
try {
$target = $partStorage->fopen($internalPartPath, 'wb');
if ($target === false) {
- \OC_Log::write('webdav', '\OC\Files\Filesystem::fopen() failed', \OC_Log::ERROR);
+ \OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::fopen() failed', \OCP\Util::ERROR);
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Exception('Could not write file contents');
}
@@ -192,7 +192,7 @@ class File extends Node implements IFile {
$fileExists = $storage->file_exists($internalPath);
}
if (!$run || $renameOkay === false || $fileExists === false) {
- \OC_Log::write('webdav', 'renaming part file to final file failed', \OC_Log::ERROR);
+ \OCP\Util::writeLog('webdav', 'renaming part file to final file failed', \OCP\Util::ERROR);
throw new Exception('Could not rename part file to final file');
}
} catch (\Exception $e) {
@@ -366,7 +366,7 @@ class File extends Node implements IFile {
$renameOkay = $this->fileView->rename($partFile, $targetPath);
$fileExists = $this->fileView->file_exists($targetPath);
if ($renameOkay === false || $fileExists === false) {
- \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
+ \OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::rename() failed', \OCP\Util::ERROR);
// only delete if an error occurred and the target file was already created
if ($fileExists) {
// set to null to avoid double-deletion when handling exception
diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php
index 608e8cd9017..84620f454aa 100644
--- a/lib/private/connector/sabre/filesplugin.php
+++ b/lib/private/connector/sabre/filesplugin.php
@@ -56,10 +56,19 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin {
private $tree;
/**
+ * Whether this is public webdav.
+ * If true, some returned information will be stripped off.
+ *
+ * @var bool
+ */
+ private $isPublic;
+
+ /**
* @param \Sabre\DAV\Tree $tree
*/
- public function __construct(\Sabre\DAV\Tree $tree) {
+ public function __construct(\Sabre\DAV\Tree $tree, $isPublic = false) {
$this->tree = $tree;
+ $this->isPublic = $isPublic;
}
/**
@@ -129,7 +138,12 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin {
});
$propFind->handle(self::PERMISSIONS_PROPERTYNAME, function() use ($node) {
- return $node->getDavPermissions();
+ $perms = $node->getDavPermissions();
+ if ($this->isPublic) {
+ // remove mount information
+ $perms = str_replace(['S', 'M'], '', $perms);
+ }
+ return $perms;
});
$propFind->handle(self::GETETAG_PROPERTYNAME, function() use ($node) {
diff --git a/lib/private/db.php b/lib/private/db.php
index 98df1c73714..1e93eb1892e 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -230,7 +230,7 @@ class OC_DB {
try {
$result = $schemaManager->updateDbFromStructure($file);
} catch (Exception $e) {
- OC_Log::write('core', 'Failed to update database structure ('.$e.')', OC_Log::FATAL);
+ \OCP\Util::writeLog('core', 'Failed to update database structure ('.$e.')', \OCP\Util::FATAL);
throw $e;
}
return $result;
@@ -247,7 +247,7 @@ class OC_DB {
try {
$result = $schemaManager->simulateUpdateDbFromStructure($file);
} catch (Exception $e) {
- OC_Log::write('core', 'Simulated database structure update failed ('.$e.')', OC_Log::FATAL);
+ \OCP\Util::writeLog('core', 'Simulated database structure update failed ('.$e.')', \OCP\Util::FATAL);
throw $e;
}
return $result;
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php
index 2d8ab550a70..a36bd2649df 100644
--- a/lib/private/db/connection.php
+++ b/lib/private/db/connection.php
@@ -103,7 +103,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
$statement = $this->adapter->fixupStatement($statement);
if(\OC_Config::getValue( 'log_query', false)) {
- \OC_Log::write('core', 'DB prepare : '.$statement, \OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'DB prepare : '.$statement, \OCP\Util::DEBUG);
}
return parent::prepare($statement);
}
diff --git a/lib/private/db/statementwrapper.php b/lib/private/db/statementwrapper.php
index a8fd168d157..4bdaf01f071 100644
--- a/lib/private/db/statementwrapper.php
+++ b/lib/private/db/statementwrapper.php
@@ -66,7 +66,7 @@ class OC_DB_StatementWrapper {
public function execute($input=array()) {
if(OC_Config::getValue( "log_query", false)) {
$params_str = str_replace("\n", " ", var_export($input, true));
- OC_Log::write('core', 'DB execute with arguments : '.$params_str, OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'DB execute with arguments : '.$params_str, \OCP\Util::DEBUG);
}
$this->lastArguments = $input;
if (count($input) > 0) {
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php
index 8bff65428d3..d0733941a35 100644
--- a/lib/private/encryption/util.php
+++ b/lib/private/encryption/util.php
@@ -128,35 +128,6 @@ class Util {
}
/**
- * read header into array
- *
- * @param string $header
- * @return array
- */
- public function readHeader($header) {
-
- $result = array();
-
- if (substr($header, 0, strlen(self::HEADER_START)) === self::HEADER_START) {
- $endAt = strpos($header, self::HEADER_END);
- if ($endAt !== false) {
- $header = substr($header, 0, $endAt + strlen(self::HEADER_END));
-
- // +1 to not start with an ':' which would result in empty element at the beginning
- $exploded = explode(':', substr($header, strlen(self::HEADER_START)+1));
-
- $element = array_shift($exploded);
- while ($element !== self::HEADER_END) {
- $result[$element] = array_shift($exploded);
- $element = array_shift($exploded);
- }
- }
- }
-
- return $result;
- }
-
- /**
* create header for encrypted file
*
* @param array $headerData
diff --git a/lib/private/files.php b/lib/private/files.php
index 17e2e5a398f..b61d09d8a0c 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -317,9 +317,9 @@ class OC_Files {
file_put_contents(OC::$SERVERROOT . '/.htaccess', $htaccess);
return OC_Helper::computerFileSize($size);
} else {
- OC_Log::write('files',
+ \OCP\Util::writeLog('files',
'Can\'t write upload limit to ' . OC::$SERVERROOT . '/.htaccess. Please check the file permissions',
- OC_Log::WARN);
+ \OCP\Util::WARN);
}
return false;
}
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 680398e383f..8cf097421d4 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -120,7 +120,7 @@ class Cache {
]);
$this->loadMimetypes();
} catch (\Doctrine\DBAL\DBALException $e) {
- \OC_Log::write('core', 'Exception during mimetype insertion: ' . $e->getmessage(), \OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'Exception during mimetype insertion: ' . $e->getmessage(), \OCP\Util::DEBUG);
return -1;
}
}
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index 50609e1e20e..7c65c721352 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -355,7 +355,7 @@ class Scanner extends BasicEmitter {
// might happen if inserting duplicate while a scanning
// process is running in parallel
// log and ignore
- \OC_Log::write('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OCP\Util::DEBUG);
$exceptionOccurred = true;
} catch (\OCP\Lock\LockedException $e) {
if ($this->useTransactions) {
diff --git a/lib/private/files/mapper.php b/lib/private/files/mapper.php
deleted file mode 100644
index 2c8760ba40e..00000000000
--- a/lib/private/files/mapper.php
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-/**
- * @author infoneo <infoneo@yahoo.pl>
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-namespace OC\Files;
-
-/**
- * class Mapper is responsible to translate logical paths to physical paths and reverse
- */
-class Mapper
-{
- private $unchangedPhysicalRoot;
-
- public function __construct($rootDir) {
- $this->unchangedPhysicalRoot = $rootDir;
- }
-
- /**
- * @param string $logicPath
- * @param bool $create indicates if the generated physical name shall be stored in the database or not
- * @return string the physical path
- */
- public function logicToPhysical($logicPath, $create) {
- $physicalPath = $this->resolveLogicPath($logicPath);
- if ($physicalPath !== null) {
- return $physicalPath;
- }
-
- return $this->create($logicPath, $create);
- }
-
- /**
- * @param string $physicalPath
- * @return string
- */
- public function physicalToLogic($physicalPath) {
- $logicPath = $this->resolvePhysicalPath($physicalPath);
- if ($logicPath !== null) {
- return $logicPath;
- }
-
- $this->insert($physicalPath, $physicalPath);
- return $physicalPath;
- }
-
- /**
- * @param string $path
- * @param bool $isLogicPath indicates if $path is logical or physical
- * @param boolean $recursive
- * @return void
- */
- public function removePath($path, $isLogicPath, $recursive) {
- if ($recursive) {
- $path=$path.'%';
- }
-
- if ($isLogicPath) {
- \OC_DB::executeAudited('DELETE FROM `*PREFIX*file_map` WHERE `logic_path` LIKE ?', array($path));
- } else {
- \OC_DB::executeAudited('DELETE FROM `*PREFIX*file_map` WHERE `physic_path` LIKE ?', array($path));
- }
- }
-
- /**
- * @param string $path1
- * @param string $path2
- * @throws \Exception
- */
- public function copy($path1, $path2)
- {
- $path1 = $this->resolveRelativePath($path1);
- $path2 = $this->resolveRelativePath($path2);
- $physicPath1 = $this->logicToPhysical($path1, true);
- $physicPath2 = $this->logicToPhysical($path2, true);
-
- $sql = 'SELECT * FROM `*PREFIX*file_map` WHERE `logic_path` LIKE ?';
- $result = \OC_DB::executeAudited($sql, array($path1.'%'));
- $updateQuery = \OC_DB::prepare('UPDATE `*PREFIX*file_map`'
- .' SET `logic_path` = ?'
- .' , `logic_path_hash` = ?'
- .' , `physic_path` = ?'
- .' , `physic_path_hash` = ?'
- .' WHERE `logic_path` = ?');
- while( $row = $result->fetchRow()) {
- $currentLogic = $row['logic_path'];
- $currentPhysic = $row['physic_path'];
- $newLogic = $path2.$this->stripRootFolder($currentLogic, $path1);
- $newPhysic = $physicPath2.$this->stripRootFolder($currentPhysic, $physicPath1);
- if ($path1 !== $currentLogic) {
- try {
- \OC_DB::executeAudited($updateQuery, array($newLogic, md5($newLogic), $newPhysic, md5($newPhysic),
- $currentLogic));
- } catch (\Exception $e) {
- error_log('Mapper::Copy failed '.$currentLogic.' -> '.$newLogic.'\n'.$e);
- throw $e;
- }
- }
- }
- }
-
- /**
- * @param string $path
- * @param string $root
- * @return false|string
- */
- public function stripRootFolder($path, $root) {
- if (strpos($path, $root) !== 0) {
- // throw exception ???
- return false;
- }
- if (strlen($path) > strlen($root)) {
- return substr($path, strlen($root));
- }
-
- return '';
- }
-
- /**
- * @param string $logicPath
- * @return null
- * @throws \OC\DatabaseException
- */
- private function resolveLogicPath($logicPath) {
- $logicPath = $this->resolveRelativePath($logicPath);
- $sql = 'SELECT * FROM `*PREFIX*file_map` WHERE `logic_path_hash` = ?';
- $result = \OC_DB::executeAudited($sql, array(md5($logicPath)));
- $result = $result->fetchRow();
- if ($result === false) {
- return null;
- }
-
- return $result['physic_path'];
- }
-
- private function resolvePhysicalPath($physicalPath) {
- $physicalPath = $this->resolveRelativePath($physicalPath);
- $sql = \OC_DB::prepare('SELECT * FROM `*PREFIX*file_map` WHERE `physic_path_hash` = ?');
- $result = \OC_DB::executeAudited($sql, array(md5($physicalPath)));
- $result = $result->fetchRow();
-
- return $result['logic_path'];
- }
-
- private function resolveRelativePath($path) {
- $explodedPath = explode('/', $path);
- $pathArray = array();
- foreach ($explodedPath as $pathElement) {
- if (empty($pathElement) || ($pathElement == '.')) {
- continue;
- } elseif ($pathElement == '..') {
- if (count($pathArray) == 0) {
- return false;
- }
- array_pop($pathArray);
- } else {
- array_push($pathArray, $pathElement);
- }
- }
- if (substr($path, 0, 1) == '/') {
- $path = '/';
- } else {
- $path = '';
- }
- return $path.implode('/', $pathArray);
- }
-
- /**
- * @param string $logicPath
- * @param bool $store
- * @return string
- */
- private function create($logicPath, $store) {
- $logicPath = $this->resolveRelativePath($logicPath);
- $index = 0;
-
- // create the slugified path
- $physicalPath = $this->slugifyPath($logicPath);
-
- // detect duplicates
- while ($this->resolvePhysicalPath($physicalPath) !== null) {
- $physicalPath = $this->slugifyPath($logicPath, $index++);
- }
-
- // insert the new path mapping if requested
- if ($store) {
- $this->insert($logicPath, $physicalPath);
- }
-
- return $physicalPath;
- }
-
- private function insert($logicPath, $physicalPath) {
- $sql = 'INSERT INTO `*PREFIX*file_map` (`logic_path`, `physic_path`, `logic_path_hash`, `physic_path_hash`)
- VALUES (?, ?, ?, ?)';
- \OC_DB::executeAudited($sql, array($logicPath, $physicalPath, md5($logicPath), md5($physicalPath)));
- }
-
- /**
- * @param string $path
- * @param int $index
- * @return string
- */
- public function slugifyPath($path, $index = null) {
- $path = $this->stripRootFolder($path, $this->unchangedPhysicalRoot);
-
- $pathElements = explode('/', $path);
- $sluggedElements = array();
-
- foreach ($pathElements as $pathElement) {
- // remove empty elements
- if (empty($pathElement)) {
- continue;
- }
-
- $sluggedElements[] = $this->slugify($pathElement);
- }
-
- // apply index to file name
- if ($index !== null) {
- $last = array_pop($sluggedElements);
-
- // if filename contains periods - add index number before last period
- if (preg_match('~\.[^\.]+$~i', $last, $extension)) {
- array_push($sluggedElements, substr($last, 0, -(strlen($extension[0]))) . '-' . $index . $extension[0]);
- } else {
- // if filename doesn't contain periods add index ofter the last char
- array_push($sluggedElements, $last . '-' . $index);
- }
- }
-
- $sluggedPath = $this->unchangedPhysicalRoot.implode('/', $sluggedElements);
- return $this->resolveRelativePath($sluggedPath);
- }
-
- /**
- * Modifies a string to remove all non ASCII characters and spaces.
- *
- * @param string $text
- * @return string
- */
- private function slugify($text) {
- $originalText = $text;
- // replace non letter or digits or dots by -
- $text = preg_replace('~[^\\pL\d\.]+~u', '-', $text);
-
- // trim
- $text = trim($text, '-');
-
- // transliterate
- if (function_exists('iconv')) {
- $text = iconv('utf-8', 'us-ascii//TRANSLIT//IGNORE', $text);
- }
-
- // lowercase
- $text = strtolower($text);
-
- // remove unwanted characters
- $text = preg_replace('~[^-\w\.]+~', '', $text);
-
- // trim ending dots (for security reasons and win compatibility)
- $text = preg_replace('~\.+$~', '', $text);
-
- if (empty($text) || \OC\Files\Filesystem::isFileBlacklisted($text)) {
- /**
- * Item slug would be empty. Previously we used uniqid() here.
- * However this means that the behaviour is not reproducible, so
- * when uploading files into a "empty" folder, the folders name is
- * different.
- *
- * The other case is, that the slugified name would be a blacklisted
- * filename. In this case we just use the same workaround by
- * returning the secure md5 hash of the original name.
- *
- *
- * If there would be a md5() hash collision, the deduplicate check
- * will spot this and append an index later, so this should not be
- * a problem.
- */
- return md5($originalText);
- }
-
- return $text;
- }
-}
diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php
index f1e492c8603..2871bbd9083 100644
--- a/lib/private/files/mount/mountpoint.php
+++ b/lib/private/files/mount/mountpoint.php
@@ -140,12 +140,12 @@ class MountPoint implements IMountPoint {
// the root storage could not be initialized, show the user!
throw new \Exception('The root storage could not be initialized. Please contact your local administrator.', $exception->getCode(), $exception);
} else {
- \OC_Log::write('core', $exception->getMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', $exception->getMessage(), \OCP\Util::ERROR);
}
return null;
}
} else {
- \OC_Log::write('core', 'storage backend ' . $this->class . ' not found', \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
$this->invalidStorage = true;
return null;
}
diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php
index 7ffb3674a8f..4df926748de 100644
--- a/lib/private/files/node/root.php
+++ b/lib/private/files/node/root.php
@@ -323,4 +323,33 @@ class Root extends Folder implements IRootFolder {
public function getName() {
return '';
}
+
+ /**
+ * Returns a view to user's files folder
+ *
+ * @param String $userId user ID
+ * @return \OCP\Files\Folder
+ */
+ public function getUserFolder($userId) {
+ \OC\Files\Filesystem::initMountPoints($userId);
+ $dir = '/' . $userId;
+ $folder = null;
+
+ if (!$this->nodeExists($dir)) {
+ $folder = $this->newFolder($dir);
+ } else {
+ $folder = $this->get($dir);
+ }
+
+ $dir = '/files';
+ if (!$folder->nodeExists($dir)) {
+ $folder = $folder->newFolder($dir);
+ \OC_Util::copySkeleton($userId, $folder);
+ } else {
+ $folder = $folder->get($dir);
+ }
+
+ return $folder;
+
+ }
}
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index d67e6b9f97e..24cf3c29209 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -219,9 +219,9 @@ class DAV extends Common {
$this->statCache->set($path, false);
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return false;
}
@@ -286,9 +286,9 @@ class DAV extends Common {
if ($e->getHttpStatus() === 404) {
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return false;
}
@@ -311,9 +311,9 @@ class DAV extends Common {
if ($e->getHttpStatus() === 404) {
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return false;
}
@@ -363,6 +363,9 @@ class DAV extends Common {
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode !== 200) {
Util::writeLog("webdav client", 'curl GET ' . curl_getinfo($curl, CURLINFO_EFFECTIVE_URL) . ' returned status code ' . $statusCode, Util::ERROR);
+ if ($statusCode === 423) {
+ throw new \OCP\Lock\LockedException($path);
+ }
}
curl_close($curl);
rewind($fp);
@@ -446,10 +449,10 @@ class DAV extends Common {
if ($e->getHttpStatus() === 501) {
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
return false;
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
return false;
}
} else {
@@ -502,6 +505,9 @@ class DAV extends Common {
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode !== 200) {
Util::writeLog("webdav client", 'curl GET ' . curl_getinfo($curl, CURLINFO_EFFECTIVE_URL) . ' returned status code ' . $statusCode, Util::ERROR);
+ if ($statusCode === 423) {
+ throw new \OCP\Lock\LockedException($path);
+ }
}
curl_close($curl);
fclose($source);
@@ -564,9 +570,9 @@ class DAV extends Common {
if ($e->getHttpStatus() === 404) {
return array();
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return array();
}
@@ -591,9 +597,9 @@ class DAV extends Common {
if ($e->getHttpStatus() === 404) {
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return false;
}
@@ -643,9 +649,9 @@ class DAV extends Common {
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
}
return false;
}
@@ -760,13 +766,17 @@ class DAV extends Common {
return $remoteMtime > $time;
}
} catch (ClientHttpException $e) {
- if ($e->getHttpStatus() === 404) {
+ if ($e->getHttpStatus() === 404 || $e->getHttpStatus() === 405) {
+ if ($path === '') {
+ // if root is gone it means the storage is not available
+ throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage());
+ }
return false;
}
- $this->convertException($e);
+ $this->convertException($e, $path);
return false;
} catch (\Exception $e) {
- $this->convertException($e);
+ $this->convertException($e, $path);
return false;
}
}
@@ -778,15 +788,19 @@ class DAV extends Common {
* or do nothing.
*
* @param Exception $e sabre exception
+ * @param string $path optional path from the operation
*
* @throws StorageInvalidException if the storage is invalid, for example
* when the authentication expired or is invalid
* @throws StorageNotAvailableException if the storage is not available,
* which might be temporary
*/
- private function convertException(Exception $e) {
+ private function convertException(Exception $e, $path = '') {
Util::writeLog('files_external', $e->getMessage(), Util::ERROR);
if ($e instanceof ClientHttpException) {
+ if ($e->getHttpStatus() === 423) {
+ throw new \OCP\Lock\LockedException($path);
+ }
if ($e->getHttpStatus() === 401) {
// either password was changed or was invalid all along
throw new StorageInvalidException(get_class($e).': '.$e->getMessage());
diff --git a/lib/private/files/storage/flysystem.php b/lib/private/files/storage/flysystem.php
new file mode 100644
index 00000000000..6d8dee10622
--- /dev/null
+++ b/lib/private/files/storage/flysystem.php
@@ -0,0 +1,243 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage;
+
+use Icewind\Streams\CallbackWrapper;
+use Icewind\Streams\IteratorDirectory;
+use League\Flysystem\AdapterInterface;
+use League\Flysystem\FileNotFoundException;
+use League\Flysystem\Filesystem;
+use League\Flysystem\Plugin\GetWithMetadata;
+
+/**
+ * Generic adapter between flysystem adapters and owncloud's storage system
+ *
+ * To use: subclass and call $this->buildFlysystem with the flysystem adapter of choice
+ */
+abstract class Flysystem extends Common {
+ /**
+ * @var Filesystem
+ */
+ protected $flysystem;
+
+ /**
+ * @var string
+ */
+ protected $root = '';
+
+ /**
+ * Initialize the storage backend with a flyssytem adapter
+ *
+ * @param \League\Flysystem\AdapterInterface $adapter
+ */
+ protected function buildFlySystem(AdapterInterface $adapter) {
+ $this->flysystem = new Filesystem($adapter);
+ $this->flysystem->addPlugin(new GetWithMetadata());
+ }
+
+ protected function buildPath($path) {
+ $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path);
+ return ltrim($fullPath, '/');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function file_get_contents($path) {
+ return $this->flysystem->read($this->buildPath($path));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function file_put_contents($path, $data) {
+ return $this->flysystem->put($this->buildPath($path), $data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function file_exists($path) {
+ return $this->flysystem->has($this->buildPath($path));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function unlink($path) {
+ if ($this->is_dir($path)) {
+ return $this->rmdir($path);
+ }
+ try {
+ return $this->flysystem->delete($this->buildPath($path));
+ } catch (FileNotFoundException $e) {
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rename($source, $target) {
+ if ($this->file_exists($target)) {
+ $this->unlink($target);
+ }
+ return $this->flysystem->rename($this->buildPath($source), $this->buildPath($target));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function copy($source, $target) {
+ if ($this->file_exists($target)) {
+ $this->unlink($target);
+ }
+ return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function filesize($path) {
+ if ($this->is_dir($path)) {
+ return 0;
+ } else {
+ return $this->flysystem->getSize($this->buildPath($path));
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function mkdir($path) {
+ if ($this->file_exists($path)) {
+ return false;
+ }
+ return $this->flysystem->createDir($this->buildPath($path));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function filemtime($path) {
+ return $this->flysystem->getTimestamp($this->buildPath($path));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rmdir($path) {
+ try {
+ return @$this->flysystem->deleteDir($this->buildPath($path));
+ } catch (FileNotFoundException $e) {
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function opendir($path) {
+ try {
+ $content = $this->flysystem->listContents($this->buildPath($path));
+ } catch (FileNotFoundException $e) {
+ return false;
+ }
+ $names = array_map(function ($object) {
+ return $object['basename'];
+ }, $content);
+ return IteratorDirectory::wrap($names);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function fopen($path, $mode) {
+ $fullPath = $this->buildPath($path);
+ $useExisting = true;
+ switch ($mode) {
+ case 'r':
+ case 'rb':
+ try {
+ return $this->flysystem->readStream($fullPath);
+ } catch (FileNotFoundException $e) {
+ return false;
+ }
+ case 'w':
+ case 'w+':
+ case 'wb':
+ case 'wb+':
+ $useExisting = false;
+ case 'a':
+ case 'ab':
+ case 'r+':
+ case 'a+':
+ case 'x':
+ case 'x+':
+ case 'c':
+ case 'c+':
+ //emulate these
+ if ($useExisting and $this->file_exists($path)) {
+ if (!$this->isUpdatable($path)) {
+ return false;
+ }
+ $tmpFile = $this->getCachedFile($path);
+ } else {
+ if (!$this->isCreatable(dirname($path))) {
+ return false;
+ }
+ $tmpFile = \OCP\Files::tmpFile();
+ }
+ $source = fopen($tmpFile, $mode);
+ return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) {
+ $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r'));
+ unlink($tmpFile);
+ });
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function touch($path, $mtime = null) {
+ if ($this->file_exists($path)) {
+ return false;
+ } else {
+ $this->file_put_contents($path, '');
+ return true;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function stat($path) {
+ $info = $this->flysystem->getWithMetadata($this->buildPath($path), ['timestamp', 'size']);
+ return [
+ 'mtime' => $info['timestamp'],
+ 'size' => $info['size']
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function filetype($path) {
+ if ($path === '' or $path === '/' or $path === '.') {
+ return 'dir';
+ }
+ try {
+ $info = $this->flysystem->getMetadata($this->buildPath($path));
+ } catch (FileNotFoundException $e) {
+ return false;
+ }
+ return $info['type'];
+ }
+}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 53465f8585e..b7272b7d1f0 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -36,361 +36,354 @@
namespace OC\Files\Storage;
-if (\OC_Util::runningOnWindows()) {
- class Local extends MappedLocal {
-
- }
-} else {
-
- /**
- * for local filestore, we only have to map the paths
- */
- class Local extends \OC\Files\Storage\Common {
- protected $datadir;
+/**
+ * for local filestore, we only have to map the paths
+ */
+class Local extends \OC\Files\Storage\Common {
+ protected $datadir;
- public function __construct($arguments) {
- $this->datadir = $arguments['datadir'];
- if (substr($this->datadir, -1) !== '/') {
- $this->datadir .= '/';
- }
+ public function __construct($arguments) {
+ $this->datadir = $arguments['datadir'];
+ if (substr($this->datadir, -1) !== '/') {
+ $this->datadir .= '/';
}
+ }
- public function __destruct() {
- }
+ public function __destruct() {
+ }
- public function getId() {
- return 'local::' . $this->datadir;
- }
+ public function getId() {
+ return 'local::' . $this->datadir;
+ }
- public function mkdir($path) {
- return @mkdir($this->getSourcePath($path), 0777, true);
- }
+ public function mkdir($path) {
+ return @mkdir($this->getSourcePath($path), 0777, true);
+ }
- public function rmdir($path) {
- if (!$this->isDeletable($path)) {
- return false;
- }
- try {
- $it = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($this->getSourcePath($path)),
- \RecursiveIteratorIterator::CHILD_FIRST
- );
+ public function rmdir($path) {
+ if (!$this->isDeletable($path)) {
+ return false;
+ }
+ try {
+ $it = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($this->getSourcePath($path)),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
+ /**
+ * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
+ * This bug is fixed in PHP 5.5.9 or before
+ * See #8376
+ */
+ $it->rewind();
+ while ($it->valid()) {
/**
- * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
- * This bug is fixed in PHP 5.5.9 or before
- * See #8376
+ * @var \SplFileInfo $file
*/
- $it->rewind();
- while ($it->valid()) {
- /**
- * @var \SplFileInfo $file
- */
- $file = $it->current();
- if (in_array($file->getBasename(), array('.', '..'))) {
- $it->next();
- continue;
- } elseif ($file->isDir()) {
- rmdir($file->getPathname());
- } elseif ($file->isFile() || $file->isLink()) {
- unlink($file->getPathname());
- }
+ $file = $it->current();
+ if (in_array($file->getBasename(), array('.', '..'))) {
$it->next();
+ continue;
+ } elseif ($file->isDir()) {
+ rmdir($file->getPathname());
+ } elseif ($file->isFile() || $file->isLink()) {
+ unlink($file->getPathname());
}
- return rmdir($this->getSourcePath($path));
- } catch (\UnexpectedValueException $e) {
- return false;
+ $it->next();
}
+ return rmdir($this->getSourcePath($path));
+ } catch (\UnexpectedValueException $e) {
+ return false;
}
+ }
- public function opendir($path) {
- return opendir($this->getSourcePath($path));
- }
-
- public function is_dir($path) {
- if (substr($path, -1) == '/') {
- $path = substr($path, 0, -1);
- }
- return is_dir($this->getSourcePath($path));
- }
+ public function opendir($path) {
+ return opendir($this->getSourcePath($path));
+ }
- public function is_file($path) {
- return is_file($this->getSourcePath($path));
+ public function is_dir($path) {
+ if (substr($path, -1) == '/') {
+ $path = substr($path, 0, -1);
}
+ return is_dir($this->getSourcePath($path));
+ }
- public function stat($path) {
- clearstatcache();
- $fullPath = $this->getSourcePath($path);
- $statResult = stat($fullPath);
- if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
- $filesize = $this->filesize($path);
- $statResult['size'] = $filesize;
- $statResult[7] = $filesize;
- }
- return $statResult;
- }
+ public function is_file($path) {
+ return is_file($this->getSourcePath($path));
+ }
- public function filetype($path) {
- $filetype = filetype($this->getSourcePath($path));
- if ($filetype == 'link') {
- $filetype = filetype(realpath($this->getSourcePath($path)));
- }
- return $filetype;
+ public function stat($path) {
+ clearstatcache();
+ $fullPath = $this->getSourcePath($path);
+ $statResult = stat($fullPath);
+ if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
+ $filesize = $this->filesize($path);
+ $statResult['size'] = $filesize;
+ $statResult[7] = $filesize;
}
+ return $statResult;
+ }
- public function filesize($path) {
- if ($this->is_dir($path)) {
- return 0;
- }
- $fullPath = $this->getSourcePath($path);
- if (PHP_INT_SIZE === 4) {
- $helper = new \OC\LargeFileHelper;
- return $helper->getFilesize($fullPath);
- }
- return filesize($fullPath);
+ public function filetype($path) {
+ $filetype = filetype($this->getSourcePath($path));
+ if ($filetype == 'link') {
+ $filetype = filetype(realpath($this->getSourcePath($path)));
}
+ return $filetype;
+ }
- public function isReadable($path) {
- return is_readable($this->getSourcePath($path));
+ public function filesize($path) {
+ if ($this->is_dir($path)) {
+ return 0;
}
-
- public function isUpdatable($path) {
- return is_writable($this->getSourcePath($path));
+ $fullPath = $this->getSourcePath($path);
+ if (PHP_INT_SIZE === 4) {
+ $helper = new \OC\LargeFileHelper;
+ return $helper->getFilesize($fullPath);
}
+ return filesize($fullPath);
+ }
- public function file_exists($path) {
- return file_exists($this->getSourcePath($path));
- }
+ public function isReadable($path) {
+ return is_readable($this->getSourcePath($path));
+ }
- public function filemtime($path) {
- clearstatcache($this->getSourcePath($path));
- return filemtime($this->getSourcePath($path));
- }
+ public function isUpdatable($path) {
+ return is_writable($this->getSourcePath($path));
+ }
- public function touch($path, $mtime = null) {
- // sets the modification time of the file to the given value.
- // If mtime is nil the current time is set.
- // note that the access time of the file always changes to the current time.
- if ($this->file_exists($path) and !$this->isUpdatable($path)) {
- return false;
- }
- if (!is_null($mtime)) {
- $result = touch($this->getSourcePath($path), $mtime);
- } else {
- $result = touch($this->getSourcePath($path));
- }
- if ($result) {
- clearstatcache(true, $this->getSourcePath($path));
- }
+ public function file_exists($path) {
+ return file_exists($this->getSourcePath($path));
+ }
- return $result;
- }
+ public function filemtime($path) {
+ clearstatcache($this->getSourcePath($path));
+ return filemtime($this->getSourcePath($path));
+ }
- public function file_get_contents($path) {
- return file_get_contents($this->getSourcePath($path));
+ public function touch($path, $mtime = null) {
+ // sets the modification time of the file to the given value.
+ // If mtime is nil the current time is set.
+ // note that the access time of the file always changes to the current time.
+ if ($this->file_exists($path) and !$this->isUpdatable($path)) {
+ return false;
}
-
- public function file_put_contents($path, $data) {
- return file_put_contents($this->getSourcePath($path), $data);
+ if (!is_null($mtime)) {
+ $result = touch($this->getSourcePath($path), $mtime);
+ } else {
+ $result = touch($this->getSourcePath($path));
}
-
- public function unlink($path) {
- if ($this->is_dir($path)) {
- return $this->rmdir($path);
- } else if ($this->is_file($path)) {
- return unlink($this->getSourcePath($path));
- } else {
- return false;
- }
-
+ if ($result) {
+ clearstatcache(true, $this->getSourcePath($path));
}
- public function rename($path1, $path2) {
- $srcParent = dirname($path1);
- $dstParent = dirname($path2);
+ return $result;
+ }
- if (!$this->isUpdatable($srcParent)) {
- \OC_Log::write('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OC_Log::ERROR);
- return false;
- }
+ public function file_get_contents($path) {
+ return file_get_contents($this->getSourcePath($path));
+ }
- if (!$this->isUpdatable($dstParent)) {
- \OC_Log::write('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OC_Log::ERROR);
- return false;
- }
+ public function file_put_contents($path, $data) {
+ return file_put_contents($this->getSourcePath($path), $data);
+ }
- if (!$this->file_exists($path1)) {
- \OC_Log::write('core', 'unable to rename, file does not exists : ' . $path1, \OC_Log::ERROR);
- return false;
- }
+ public function unlink($path) {
+ if ($this->is_dir($path)) {
+ return $this->rmdir($path);
+ } else if ($this->is_file($path)) {
+ return unlink($this->getSourcePath($path));
+ } else {
+ return false;
+ }
- if ($this->is_dir($path2)) {
- $this->rmdir($path2);
- } else if ($this->is_file($path2)) {
- $this->unlink($path2);
- }
+ }
- if ($this->is_dir($path1)) {
- // we cant move folders across devices, use copy instead
- $stat1 = stat(dirname($this->getSourcePath($path1)));
- $stat2 = stat(dirname($this->getSourcePath($path2)));
- if ($stat1['dev'] !== $stat2['dev']) {
- $result = $this->copy($path1, $path2);
- if ($result) {
- $result &= $this->rmdir($path1);
- }
- return $result;
- }
- }
+ public function rename($path1, $path2) {
+ $srcParent = dirname($path1);
+ $dstParent = dirname($path2);
- return rename($this->getSourcePath($path1), $this->getSourcePath($path2));
+ if (!$this->isUpdatable($srcParent)) {
+ \OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OCP\Util::ERROR);
+ return false;
}
- public function copy($path1, $path2) {
- if ($this->is_dir($path1)) {
- return parent::copy($path1, $path2);
- } else {
- return copy($this->getSourcePath($path1), $this->getSourcePath($path2));
- }
+ if (!$this->isUpdatable($dstParent)) {
+ \OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OCP\Util::ERROR);
+ return false;
}
- public function fopen($path, $mode) {
- return fopen($this->getSourcePath($path), $mode);
+ if (!$this->file_exists($path1)) {
+ \OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, \OCP\Util::ERROR);
+ return false;
}
- public function hash($type, $path, $raw = false) {
- return hash_file($type, $this->getSourcePath($path), $raw);
+ if ($this->is_dir($path2)) {
+ $this->rmdir($path2);
+ } else if ($this->is_file($path2)) {
+ $this->unlink($path2);
}
- public function free_space($path) {
- $space = @disk_free_space($this->getSourcePath($path));
- if ($space === false || is_null($space)) {
- return \OCP\Files\FileInfo::SPACE_UNKNOWN;
+ if ($this->is_dir($path1)) {
+ // we cant move folders across devices, use copy instead
+ $stat1 = stat(dirname($this->getSourcePath($path1)));
+ $stat2 = stat(dirname($this->getSourcePath($path2)));
+ if ($stat1['dev'] !== $stat2['dev']) {
+ $result = $this->copy($path1, $path2);
+ if ($result) {
+ $result &= $this->rmdir($path1);
+ }
+ return $result;
}
- return $space;
}
- public function search($query) {
- return $this->searchInDir($query);
- }
+ return rename($this->getSourcePath($path1), $this->getSourcePath($path2));
+ }
- public function getLocalFile($path) {
- return $this->getSourcePath($path);
+ public function copy($path1, $path2) {
+ if ($this->is_dir($path1)) {
+ return parent::copy($path1, $path2);
+ } else {
+ return copy($this->getSourcePath($path1), $this->getSourcePath($path2));
}
+ }
- public function getLocalFolder($path) {
- return $this->getSourcePath($path);
- }
+ public function fopen($path, $mode) {
+ return fopen($this->getSourcePath($path), $mode);
+ }
- /**
- * @param string $query
- * @param string $dir
- * @return array
- */
- protected function searchInDir($query, $dir = '') {
- $files = array();
- $physicalDir = $this->getSourcePath($dir);
- foreach (scandir($physicalDir) as $item) {
- if ($item == '.' || $item == '..')
- continue;
- $physicalItem = $physicalDir . '/' . $item;
+ public function hash($type, $path, $raw = false) {
+ return hash_file($type, $this->getSourcePath($path), $raw);
+ }
- if (strstr(strtolower($item), strtolower($query)) !== false) {
- $files[] = $dir . '/' . $item;
- }
- if (is_dir($physicalItem)) {
- $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
- }
- }
- return $files;
+ public function free_space($path) {
+ $space = @disk_free_space($this->getSourcePath($path));
+ if ($space === false || is_null($space)) {
+ return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
+ return $space;
+ }
- /**
- * check if a file or folder has been updated since $time
- *
- * @param string $path
- * @param int $time
- * @return bool
- */
- public function hasUpdated($path, $time) {
- if ($this->file_exists($path)) {
- return $this->filemtime($path) > $time;
- } else {
- return true;
- }
- }
+ public function search($query) {
+ return $this->searchInDir($query);
+ }
+
+ public function getLocalFile($path) {
+ return $this->getSourcePath($path);
+ }
+
+ public function getLocalFolder($path) {
+ return $this->getSourcePath($path);
+ }
- /**
- * Get the source path (on disk) of a given path
- *
- * @param string $path
- * @return string
- */
- public function getSourcePath($path) {
- $fullPath = $this->datadir . $path;
- return $fullPath;
+ /**
+ * @param string $query
+ * @param string $dir
+ * @return array
+ */
+ protected function searchInDir($query, $dir = '') {
+ $files = array();
+ $physicalDir = $this->getSourcePath($dir);
+ foreach (scandir($physicalDir) as $item) {
+ if ($item == '.' || $item == '..')
+ continue;
+ $physicalItem = $physicalDir . '/' . $item;
+
+ if (strstr(strtolower($item), strtolower($query)) !== false) {
+ $files[] = $dir . '/' . $item;
+ }
+ if (is_dir($physicalItem)) {
+ $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
+ }
}
+ return $files;
+ }
- /**
- * {@inheritdoc}
- */
- public function isLocal() {
+ /**
+ * check if a file or folder has been updated since $time
+ *
+ * @param string $path
+ * @param int $time
+ * @return bool
+ */
+ public function hasUpdated($path, $time) {
+ if ($this->file_exists($path)) {
+ return $this->filemtime($path) > $time;
+ } else {
return true;
}
+ }
- /**
- * get the ETag for a file or folder
- *
- * @param string $path
- * @return string
- */
- public function getETag($path) {
- if ($this->is_file($path)) {
- $stat = $this->stat($path);
- return md5(
- $stat['mtime'] .
- $stat['ino'] .
- $stat['dev'] .
- $stat['size']
- );
- } else {
- return parent::getETag($path);
- }
+ /**
+ * Get the source path (on disk) of a given path
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getSourcePath($path) {
+ $fullPath = $this->datadir . $path;
+ return $fullPath;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isLocal() {
+ return true;
+ }
+
+ /**
+ * get the ETag for a file or folder
+ *
+ * @param string $path
+ * @return string
+ */
+ public function getETag($path) {
+ if ($this->is_file($path)) {
+ $stat = $this->stat($path);
+ return md5(
+ $stat['mtime'] .
+ $stat['ino'] .
+ $stat['dev'] .
+ $stat['size']
+ );
+ } else {
+ return parent::getETag($path);
}
+ }
- /**
- * @param \OCP\Files\Storage $sourceStorage
- * @param string $sourceInternalPath
- * @param string $targetInternalPath
- * @return bool
- */
- public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
- if($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')){
- /**
- * @var \OC\Files\Storage\Local $sourceStorage
- */
- $rootStorage = new Local(['datadir' => '/']);
- return $rootStorage->copy($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath));
- } else {
- return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
- }
+ /**
+ * @param \OCP\Files\Storage $sourceStorage
+ * @param string $sourceInternalPath
+ * @param string $targetInternalPath
+ * @return bool
+ */
+ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ if($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')){
+ /**
+ * @var \OC\Files\Storage\Local $sourceStorage
+ */
+ $rootStorage = new Local(['datadir' => '/']);
+ return $rootStorage->copy($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath));
+ } else {
+ return parent::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
+ }
- /**
- * @param \OCP\Files\Storage $sourceStorage
- * @param string $sourceInternalPath
- * @param string $targetInternalPath
- * @return bool
- */
- public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
- if ($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')) {
- /**
- * @var \OC\Files\Storage\Local $sourceStorage
- */
- $rootStorage = new Local(['datadir' => '/']);
- return $rootStorage->rename($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath));
- } else {
- return parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
- }
+ /**
+ * @param \OCP\Files\Storage $sourceStorage
+ * @param string $sourceInternalPath
+ * @param string $targetInternalPath
+ * @return bool
+ */
+ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ if ($sourceStorage->instanceOfStorage('\OC\Files\Storage\Local')) {
+ /**
+ * @var \OC\Files\Storage\Local $sourceStorage
+ */
+ $rootStorage = new Local(['datadir' => '/']);
+ return $rootStorage->rename($sourceStorage->getSourcePath($sourceInternalPath), $this->getSourcePath($targetInternalPath));
+ } else {
+ return parent::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
}
}
}
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
deleted file mode 100644
index 932320267e4..00000000000
--- a/lib/private/files/storage/mappedlocal.php
+++ /dev/null
@@ -1,456 +0,0 @@
-<?php
-/**
- * @author Andreas Fischer <bantu@owncloud.com>
- * @author Arthur Schiwon <blizzz@owncloud.com>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Clark Tomlinson <fallen013@gmail.com>
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
- * @author Sjors van der Pluijm <sjors@desjors.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-namespace OC\Files\Storage;
-
-/**
- * for local filestore, we only have to map the paths
- */
-class MappedLocal extends \OC\Files\Storage\Common {
- protected $datadir;
- private $mapper;
-
- public function __construct($arguments) {
- $this->datadir = $arguments['datadir'];
- if (substr($this->datadir, -1) !== '/') {
- $this->datadir .= '/';
- }
-
- $this->mapper = new \OC\Files\Mapper($this->datadir);
- }
-
- public function __destruct() {
- }
-
- public function getId() {
- return 'local::' . $this->datadir;
- }
-
- public function mkdir($path) {
- return @mkdir($this->getSourcePath($path), 0777, true);
- }
-
- public function rmdir($path) {
- if (!$this->isDeletable($path)) {
- return false;
- }
- try {
- $it = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($this->getSourcePath($path)),
- \RecursiveIteratorIterator::CHILD_FIRST
- );
- /**
- * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
- * This bug is fixed in PHP 5.5.9 or before
- * See #8376
- */
- $it->rewind();
- while ($it->valid()) {
- /**
- * @var \SplFileInfo $file
- */
- $file = $it->current();
- if (in_array($file->getBasename(), array('.', '..'))) {
- $it->next();
- continue;
- } elseif ($file->isDir()) {
- rmdir($file->getPathname());
- } elseif ($file->isFile() || $file->isLink()) {
- unlink($file->getPathname());
- }
- $it->next();
- }
- if ($result = @rmdir($this->getSourcePath($path))) {
- $this->cleanMapper($path);
- }
- return $result;
- } catch (\UnexpectedValueException $e) {
- return false;
- }
- }
-
- public function opendir($path) {
- $files = array('.', '..');
- $physicalPath = $this->getSourcePath($path);
-
- $logicalPath = $this->mapper->physicalToLogic($physicalPath);
- $dh = opendir($physicalPath);
- if (is_resource($dh)) {
- while (($file = readdir($dh)) !== false) {
- if ($file === '.' or $file === '..') {
- continue;
- }
-
- $logicalFilePath = $this->mapper->physicalToLogic($physicalPath . '/' . $file);
-
- $file = $this->mapper->stripRootFolder($logicalFilePath, $logicalPath);
- $file = $this->stripLeading($file);
- $files[] = $file;
- }
- }
-
- \OC\Files\Stream\Dir::register('local-win32' . $path, $files);
- return opendir('fakedir://local-win32' . $path);
- }
-
- public function is_dir($path) {
- if (substr($path, -1) == '/') {
- $path = substr($path, 0, -1);
- }
- return is_dir($this->getSourcePath($path));
- }
-
- public function is_file($path) {
- return is_file($this->getSourcePath($path));
- }
-
- public function stat($path) {
- clearstatcache();
- $fullPath = $this->getSourcePath($path);
- $statResult = stat($fullPath);
- if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
- $filesize = $this->filesize($path);
- $statResult['size'] = $filesize;
- $statResult[7] = $filesize;
- }
- return $statResult;
- }
-
- public function filetype($path) {
- $filetype = filetype($this->getSourcePath($path));
- if ($filetype == 'link') {
- $filetype = filetype(realpath($this->getSourcePath($path)));
- }
- return $filetype;
- }
-
- public function filesize($path) {
- if ($this->is_dir($path)) {
- return 0;
- }
- $fullPath = $this->getSourcePath($path);
- if (PHP_INT_SIZE === 4) {
- $helper = new \OC\LargeFileHelper;
- return $helper->getFilesize($fullPath);
- }
- return filesize($fullPath);
- }
-
- public function isReadable($path) {
- return is_readable($this->getSourcePath($path));
- }
-
- public function isUpdatable($path) {
- return is_writable($this->getSourcePath($path));
- }
-
- public function file_exists($path) {
- return file_exists($this->getSourcePath($path));
- }
-
- public function filemtime($path) {
- clearstatcache($this->getSourcePath($path));
- return filemtime($this->getSourcePath($path));
- }
-
- public function touch($path, $mtime = null) {
- // sets the modification time of the file to the given value.
- // If mtime is nil the current time is set.
- // note that the access time of the file always changes to the current time.
- if ($this->file_exists($path) and !$this->isUpdatable($path)) {
- return false;
- }
- if (!is_null($mtime)) {
- $result = touch($this->getSourcePath($path), $mtime);
- } else {
- $result = touch($this->getSourcePath($path));
- }
- if ($result) {
- clearstatcache(true, $this->getSourcePath($path));
- }
-
- return $result;
- }
-
- public function file_get_contents($path) {
- return file_get_contents($this->getSourcePath($path));
- }
-
- public function file_put_contents($path, $data) {
- return file_put_contents($this->getSourcePath($path), $data);
- }
-
- public function unlink($path) {
- return $this->delTree($path);
- }
-
- public function rename($path1, $path2) {
- $srcParent = $this->dirname($path1);
- $dstParent = $this->dirname($path2);
-
- if (!$this->isUpdatable($srcParent)) {
- \OC_Log::write('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OC_Log::ERROR);
- return false;
- }
-
- if (!$this->isUpdatable($dstParent)) {
- \OC_Log::write('core', 'unable to rename, destination directory is not writable : ' . $dstParent, \OC_Log::ERROR);
- return false;
- }
-
- if (!$this->file_exists($path1)) {
- \OC_Log::write('core', 'unable to rename, file does not exists : ' . $path1, \OC_Log::ERROR);
- return false;
- }
-
- if ($this->is_dir($path2)) {
- $this->rmdir($path2);
- } else if ($this->is_file($path2)) {
- $this->unlink($path2);
- }
-
- $physicPath1 = $this->getSourcePath($path1);
- $physicPath2 = $this->getSourcePath($path2);
- if ($return = rename($physicPath1, $physicPath2)) {
- // mapper needs to create copies or all children
- $this->copyMapping($path1, $path2);
- $this->cleanMapper($physicPath1, false, true);
- }
- return $return;
- }
-
- public function copy($path1, $path2) {
- if ($this->is_dir($path1)) {
- if ($this->is_dir($path2)) {
- $this->rmdir($path2);
- } else if ($this->is_file($path2)) {
- $this->unlink($path2);
- }
- $dir = $this->opendir($path1);
- $this->mkdir($path2);
- while ($file = readdir($dir)) {
- if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
- if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) {
- return false;
- }
- }
- }
- closedir($dir);
- return true;
- } else {
- if ($return = copy($this->getSourcePath($path1), $this->getSourcePath($path2))) {
- $this->copyMapping($path1, $path2);
- }
- return $return;
- }
- }
-
- public function fopen($path, $mode) {
- return fopen($this->getSourcePath($path), $mode);
- }
-
- /**
- * @param string $dir
- * @param bool $isLogicPath
- * @return bool
- */
- private function delTree($dir, $isLogicPath = true) {
- $dirRelative = $dir;
- if ($isLogicPath) {
- $dir = $this->getSourcePath($dir);
- }
- if (!file_exists($dir)) {
- return true;
- }
- if (!is_dir($dir) || is_link($dir)) {
- if ($return = unlink($dir)) {
- $this->cleanMapper($dir, false);
- return $return;
- }
- }
- foreach (scandir($dir) as $item) {
- if ($item == '.' || $item == '..') {
- continue;
- }
- if (is_file($dir . '/' . $item)) {
- if (unlink($dir . '/' . $item)) {
- $this->cleanMapper($dir . '/' . $item, false);
- }
- } elseif (is_dir($dir . '/' . $item)) {
- if (!$this->delTree($dir . "/" . $item, false)) {
- return false;
- };
- }
- }
- if ($return = rmdir($dir)) {
- $this->cleanMapper($dir, false);
- }
- return $return;
- }
-
- public function hash($type, $path, $raw = false) {
- return hash_file($type, $this->getSourcePath($path), $raw);
- }
-
- public function free_space($path) {
- $space = @disk_free_space($this->getSourcePath($path));
- if ($space === false || is_null($space)) {
- return \OCP\Files\FileInfo::SPACE_UNKNOWN;
- }
- return $space;
- }
-
- public function search($query) {
- return $this->searchInDir($query);
- }
-
- public function getLocalFile($path) {
- return $this->getSourcePath($path);
- }
-
- public function getLocalFolder($path) {
- return $this->getSourcePath($path);
- }
-
- /**
- * @param string $query
- * @param string $dir
- * @return array
- */
- protected function searchInDir($query, $dir = '') {
- $files = array();
- $physicalDir = $this->getSourcePath($dir);
- foreach (scandir($physicalDir) as $item) {
- if ($item == '.' || $item == '..')
- continue;
- $physicalItem = $this->mapper->physicalToLogic($physicalDir . '/' . $item);
- $item = substr($physicalItem, strlen($physicalDir) + 1);
-
- if (strstr(strtolower($item), strtolower($query)) !== false) {
- $files[] = $dir . '/' . $item;
- }
- if (is_dir($physicalItem)) {
- $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
- }
- }
- return $files;
- }
-
- /**
- * check if a file or folder has been updated since $time
- *
- * @param string $path
- * @param int $time
- * @return bool
- */
- public function hasUpdated($path, $time) {
- if ($this->file_exists($path)) {
- return $this->filemtime($path) > $time;
- } else {
- return true;
- }
- }
-
- /**
- * Get the source path (on disk) of a given path
- *
- * @param string $path
- * @return string
- */
- protected function getSourcePath($path) {
- $path = $this->stripLeading($path);
- $fullPath = $this->datadir . $path;
- return $this->mapper->logicToPhysical($fullPath, true);
- }
-
- /**
- * {@inheritdoc}
- */
- public function isLocal() {
- return true;
- }
-
- /**
- * @param string $path
- * @return string
- */
- private function dirName($path) {
- $path = dirname($path);
- if ($path === '.') {
- return '';
- } else {
- return $path;
- }
- }
-
- /**
- * @param string $path
- */
- private function cleanMapper($path, $isLogicPath = true, $recursive = true) {
- $fullPath = $path;
- if ($isLogicPath) {
- $fullPath = $this->datadir . $path;
- }
- $this->mapper->removePath($fullPath, $isLogicPath, $recursive);
- }
-
- /**
- * @param string $path1
- * @param string $path2
- */
- private function copyMapping($path1, $path2) {
- $path1 = $this->stripLeading($path1);
- $path2 = $this->stripLeading($path2);
-
- $fullPath1 = $this->datadir . $path1;
- $fullPath2 = $this->datadir . $path2;
-
- $this->mapper->copy($fullPath1, $fullPath2);
- }
-
- /**
- * @param string $path
- */
- private function stripLeading($path) {
- if (strpos($path, '/') === 0) {
- $path = substr($path, 1);
- }
- if (strpos($path, '\\') === 0) {
- $path = substr($path, 1);
- }
- if ($path === false) {
- return '';
- }
-
- return $path;
- }
-}
diff --git a/lib/private/files/storage/polyfill/copydirectory.php b/lib/private/files/storage/polyfill/copydirectory.php
new file mode 100644
index 00000000000..1b4873a3a76
--- /dev/null
+++ b/lib/private/files/storage/polyfill/copydirectory.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Storage\PolyFill;
+
+trait CopyDirectory {
+ /**
+ * Check if a path is a directory
+ *
+ * @param string $path
+ * @return bool
+ */
+ abstract public function is_dir($path);
+
+ /**
+ * Check if a file or folder exists
+ *
+ * @param string $path
+ * @return bool
+ */
+ abstract public function file_exists($path);
+
+ /**
+ * Delete a file or folder
+ *
+ * @param string $path
+ * @return bool
+ */
+ abstract public function unlink($path);
+
+ /**
+ * Open a directory handle for a folder
+ *
+ * @param string $path
+ * @return resource | bool
+ */
+ abstract public function opendir($path);
+
+ /**
+ * Create a new folder
+ *
+ * @param string $path
+ * @return bool
+ */
+ abstract public function mkdir($path);
+
+ public function copy($source, $target) {
+ if ($this->is_dir($source)) {
+ if ($this->file_exists($target)) {
+ $this->unlink($target);
+ }
+ $this->mkdir($target);
+ return $this->copyRecursive($source, $target);
+ } else {
+ return parent::copy($source, $target);
+ }
+ }
+
+ /**
+ * For adapters that dont support copying folders natively
+ *
+ * @param $source
+ * @param $target
+ * @return bool
+ */
+ protected function copyRecursive($source, $target) {
+ $dh = $this->opendir($source);
+ $result = true;
+ while ($file = readdir($dh)) {
+ if ($file !== '.' and $file !== '..') {
+ if ($this->is_dir($source . '/' . $file)) {
+ $this->mkdir($target . '/' . $file);
+ $result = $this->copyRecursive($source . '/' . $file, $target . '/' . $file);
+ } else {
+ $result = parent::copy($source . '/' . $file, $target . '/' . $file);
+ }
+ if (!$result) {
+ break;
+ }
+ }
+ }
+ return $result;
+ }
+}
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 8818b822fa7..61290791faa 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -31,6 +31,7 @@ use OC\Encryption\Util;
use OC\Files\Filesystem;
use OC\Files\Mount\Manager;
use OC\Files\Storage\LocalTempFileTrait;
+use OCP\Encryption\Exceptions\GenericEncryptionException;
use OCP\Encryption\IFile;
use OCP\Encryption\IManager;
use OCP\Encryption\Keys\IStorage;
@@ -174,9 +175,8 @@ class Encryption extends Wrapper {
public function file_get_contents($path) {
$encryptionModule = $this->getEncryptionModule($path);
- $info = $this->getCache()->get($path);
- if ($encryptionModule || $info['encrypted'] === true) {
+ if ($encryptionModule) {
$handle = $this->fopen($path, "r");
if (!$handle) {
return false;
@@ -338,14 +338,15 @@ class Encryption extends Wrapper {
* @param string $path
* @param string $mode
* @return resource
+ * @throws GenericEncryptionException
+ * @throws ModuleDoesNotExistsException
*/
public function fopen($path, $mode) {
$encryptionEnabled = $this->encryptionManager->isEnabled();
$shouldEncrypt = false;
$encryptionModule = null;
- $rawHeader = $this->getHeader($path);
- $header = $this->util->readHeader($rawHeader);
+ $header = $this->getHeader($path);
$fullPath = $this->getFullPath($path);
$encryptionModuleId = $this->util->getEncryptionModuleId($header);
@@ -380,6 +381,10 @@ class Encryption extends Wrapper {
|| $mode === 'wb'
|| $mode === 'wb+'
) {
+ // don't overwrite encrypted files if encyption is not enabled
+ if ($targetIsEncrypted && $encryptionEnabled === false) {
+ throw new GenericEncryptionException('Tried to access encrypted file but encryption is not enabled');
+ }
if ($encryptionEnabled) {
// if $encryptionModuleId is empty, the default module will be used
$encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId);
@@ -398,6 +403,7 @@ class Encryption extends Wrapper {
// OC_DEFAULT_MODULE to read the file
$encryptionModule = $this->encryptionManager->getEncryptionModule('OC_DEFAULT_MODULE');
$shouldEncrypt = true;
+ $targetIsEncrypted = true;
}
}
} catch (ModuleDoesNotExistsException $e) {
@@ -416,7 +422,7 @@ class Encryption extends Wrapper {
$source = $this->storage->fopen($path, $mode);
$handle = \OC\Files\Stream\Encryption::wrap($source, $path, $fullPath, $header,
$this->uid, $encryptionModule, $this->storage, $this, $this->util, $this->fileHelper, $mode,
- $size, $unencryptedSize, strlen($rawHeader));
+ $size, $unencryptedSize, $this->getHeaderSize($path));
return $handle;
}
@@ -606,27 +612,101 @@ class Encryption extends Wrapper {
}
/**
+ * read first block of encrypted file, typically this will contain the
+ * encryption header
+ *
+ * @param string $path
+ * @return string
+ */
+ protected function readFirstBlock($path) {
+ $firstBlock = '';
+ if ($this->storage->file_exists($path)) {
+ $handle = $this->storage->fopen($path, 'r');
+ $firstBlock = fread($handle, $this->util->getHeaderSize());
+ fclose($handle);
+ }
+ return $firstBlock;
+ }
+
+ /**
+ * return header size of given file
+ *
+ * @param string $path
+ * @return int
+ */
+ protected function getHeaderSize($path) {
+ $headerSize = 0;
+ $realFile = $this->util->stripPartialFileExtension($path);
+ if ($this->storage->file_exists($realFile)) {
+ $path = $realFile;
+ }
+ $firstBlock = $this->readFirstBlock($path);
+
+ if (substr($firstBlock, 0, strlen(Util::HEADER_START)) === Util::HEADER_START) {
+ $headerSize = strlen($firstBlock);
+ }
+
+ return $headerSize;
+ }
+
+ /**
+ * parse raw header to array
+ *
+ * @param string $rawHeader
+ * @return array
+ */
+ protected function parseRawHeader($rawHeader) {
+ $result = array();
+ if (substr($rawHeader, 0, strlen(Util::HEADER_START)) === Util::HEADER_START) {
+ $header = $rawHeader;
+ $endAt = strpos($header, Util::HEADER_END);
+ if ($endAt !== false) {
+ $header = substr($header, 0, $endAt + strlen(Util::HEADER_END));
+
+ // +1 to not start with an ':' which would result in empty element at the beginning
+ $exploded = explode(':', substr($header, strlen(Util::HEADER_START)+1));
+
+ $element = array_shift($exploded);
+ while ($element !== Util::HEADER_END) {
+ $result[$element] = array_shift($exploded);
+ $element = array_shift($exploded);
+ }
+ }
+ }
+
+ return $result;
+ }
+
+ /**
* read header from file
*
* @param string $path
* @return array
*/
protected function getHeader($path) {
- $header = '';
$realFile = $this->util->stripPartialFileExtension($path);
if ($this->storage->file_exists($realFile)) {
$path = $realFile;
}
- if ($this->storage->file_exists($path)) {
- $handle = $this->storage->fopen($path, 'r');
- $firstBlock = fread($handle, $this->util->getHeaderSize());
- fclose($handle);
- if (substr($firstBlock, 0, strlen(Util::HEADER_START)) === Util::HEADER_START) {
- $header = $firstBlock;
+ $firstBlock = $this->readFirstBlock($path);
+ $result = $this->parseRawHeader($firstBlock);
+
+ // if the header doesn't contain a encryption module we check if it is a
+ // legacy file. If true, we add the default encryption module
+ if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY])) {
+ if (!empty($result)) {
+ $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE';
+ } else {
+ // if the header was empty we have to check first if it is a encrypted file at all
+ $info = $this->getCache()->get($path);
+ if (isset($info['encrypted']) && $info['encrypted'] === true) {
+ $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE';
+ }
}
}
- return $header;
+
+ return $result;
}
/**
@@ -639,8 +719,7 @@ class Encryption extends Wrapper {
*/
protected function getEncryptionModule($path) {
$encryptionModule = null;
- $rawHeader = $this->getHeader($path);
- $header = $this->util->readHeader($rawHeader);
+ $header = $this->getHeader($path);
$encryptionModuleId = $this->util->getEncryptionModuleId($header);
if (!empty($encryptionModuleId)) {
try {
@@ -675,4 +754,5 @@ class Encryption extends Wrapper {
return false;
}
+
}
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php
index 61ca32a5ed1..3287375bc79 100644
--- a/lib/private/files/type/detection.php
+++ b/lib/private/files/type/detection.php
@@ -66,7 +66,7 @@ class Detection {
// Update the alternative mimetypes to avoid having to look them up each time.
foreach ($this->mimetypes as $mimeType) {
- $this->secureMimeTypes[$mimeType[0]] = $mimeType[1] ?: $mimeType[0];
+ $this->secureMimeTypes[$mimeType[0]] = isset($mimeType[1]) ? $mimeType[1]: $mimeType[0];
}
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 1706818f03e..cb3c05d2bca 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -848,7 +848,7 @@ class View {
$hooks[] = 'write';
break;
default:
- \OC_Log::write('core', 'invalid mode (' . $mode . ') for ' . $path, \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR);
}
return $this->basicOperation('fopen', $path, $hooks, $mode);
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 4c2f1f509c8..ed954f87630 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -54,77 +54,7 @@ class OC_Helper {
private static $mimetypeDetector;
private static $templateManager;
/** @var string[] */
- private static $mimeTypeAlias = array(
- 'application/octet-stream' => 'file', // use file icon as fallback
-
- 'application/illustrator' => 'image/vector',
- 'application/postscript' => 'image/vector',
- 'image/svg+xml' => 'image/vector',
-
- 'application/coreldraw' => 'image',
- 'application/x-gimp' => 'image',
- 'application/x-photoshop' => 'image',
- 'application/x-dcraw' => 'image',
-
- 'application/font-sfnt' => 'font',
- 'application/x-font' => 'font',
- 'application/font-woff' => 'font',
- 'application/vnd.ms-fontobject' => 'font',
-
- 'application/json' => 'text/code',
- 'application/x-perl' => 'text/code',
- 'application/x-php' => 'text/code',
- 'text/x-shellscript' => 'text/code',
- 'application/yaml' => 'text/code',
- 'application/xml' => 'text/html',
- 'text/css' => 'text/code',
- 'application/x-tex' => 'text',
-
- 'application/x-compressed' => 'package/x-generic',
- 'application/x-7z-compressed' => 'package/x-generic',
- 'application/x-deb' => 'package/x-generic',
- 'application/x-gzip' => 'package/x-generic',
- 'application/x-rar-compressed' => 'package/x-generic',
- 'application/x-tar' => 'package/x-generic',
- 'application/vnd.android.package-archive' => 'package/x-generic',
- 'application/zip' => 'package/x-generic',
-
- 'application/msword' => 'x-office/document',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document',
- 'application/vnd.ms-word.document.macroEnabled.12' => 'x-office/document',
- 'application/vnd.ms-word.template.macroEnabled.12' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-template' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-web' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-master' => 'x-office/document',
-
- 'application/mspowerpoint' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.template.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation',
-
- 'application/msexcel' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.template.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.addin.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet',
- 'text/csv' => 'x-office/spreadsheet',
-
- 'application/msaccess' => 'database',
- );
+ private static $mimeTypeAlias = [];
/**
* Creates an url using a defined route
@@ -256,45 +186,61 @@ class OC_Helper {
*/
public static function mimetypeIcon($mimetype) {
+ // On first access load the list of mimetype aliases
+ if (empty(self::$mimeTypeAlias)) {
+ $file = file_get_contents(OC::$SERVERROOT . '/config/mimetypealiases.dist.json');
+ self::$mimeTypeAlias = get_object_vars(json_decode($file));
+
+ if (file_exists(\OC::$SERVERROOT . '/config/mimetypealiases.json')) {
+ $custom = get_object_vars(json_decode(file_get_contents(\OC::$SERVERROOT . '/config/mimetypealiases.json')));
+ self::$mimeTypeAlias = array_merge(self::$mimeTypeAlias, $custom);
+ }
+ }
+
if (isset(self::$mimeTypeAlias[$mimetype])) {
$mimetype = self::$mimeTypeAlias[$mimetype];
}
if (isset(self::$mimetypeIcons[$mimetype])) {
return self::$mimetypeIcons[$mimetype];
}
+
// Replace slash and backslash with a minus
$icon = str_replace('/', '-', $mimetype);
$icon = str_replace('\\', '-', $icon);
// Is it a dir?
if ($mimetype === 'dir') {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder.png';
- return OC::$WEBROOT . '/core/img/filetypes/folder.png';
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/folder.png');
+ return self::$mimetypeIcons[$mimetype];
}
if ($mimetype === 'dir-shared') {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder-shared.png';
- return OC::$WEBROOT . '/core/img/filetypes/folder-shared.png';
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/folder-shared.png');
+ return self::$mimetypeIcons[$mimetype];
}
if ($mimetype === 'dir-external') {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/folder-external.png';
- return OC::$WEBROOT . '/core/img/filetypes/folder-external.png';
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/folder-external.png');
+ return self::$mimetypeIcons[$mimetype];
}
// Icon exists?
- if (file_exists(OC::$SERVERROOT . '/core/img/filetypes/' . $icon . '.png')) {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/' . $icon . '.png';
- return OC::$WEBROOT . '/core/img/filetypes/' . $icon . '.png';
+ try {
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/' . $icon . '.png');
+ return self::$mimetypeIcons[$mimetype];
+ } catch (\RuntimeException $e) {
+ // Specified image not found
}
// Try only the first part of the filetype
$mimePart = substr($icon, 0, strpos($icon, '-'));
- if (file_exists(OC::$SERVERROOT . '/core/img/filetypes/' . $mimePart . '.png')) {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/' . $mimePart . '.png';
- return OC::$WEBROOT . '/core/img/filetypes/' . $mimePart . '.png';
- } else {
- self::$mimetypeIcons[$mimetype] = OC::$WEBROOT . '/core/img/filetypes/file.png';
- return OC::$WEBROOT . '/core/img/filetypes/file.png';
+ try {
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/' . $mimePart . '.png');
+ return self::$mimetypeIcons[$mimetype];
+ } catch (\RuntimeException $e) {
+ // Image for the first part of the mimetype not found
}
+
+ self::$mimetypeIcons[$mimetype] = \OC::$server->getURLGenerator()->imagePath('core', 'filetypes/file.png');
+ return self::$mimetypeIcons[$mimetype];
}
/**
@@ -488,8 +434,18 @@ class OC_Helper {
*/
static public function getMimetypeDetector() {
if (!self::$mimetypeDetector) {
+ $dist = file_get_contents(OC::$configDir . '/mimetypemapping.dist.json');
+ $mimetypemapping = get_object_vars(json_decode($dist));
+
+ //Check if need to load custom mappings
+ if (file_exists(OC::$configDir . '/mimetypemapping.json')) {
+ $custom = file_get_contents(OC::$configDir . '/mimetypemapping.json');
+ $custom_mapping = get_object_vars(json_decode($custom));
+ $mimetypemapping = array_merge($mimetypemapping, $custom_mapping);
+ }
+
self::$mimetypeDetector = new \OC\Files\Type\Detection();
- self::$mimetypeDetector->registerTypeArray(include 'mimetypes.list.php');
+ self::$mimetypeDetector->registerTypeArray($mimetypemapping);
}
return self::$mimetypeDetector;
}
@@ -770,17 +726,11 @@ class OC_Helper {
* @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
* @param int $length Length of the part to be replaced
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
- * @internal param string $input The input string. .Opposite to the PHP build-in function does not accept an array.
* @return string
+ * @deprecated 8.2.0 Use substr_replace() instead.
*/
- public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
- $start = intval($start);
- $length = intval($length);
- $string = mb_substr($string, 0, $start, $encoding) .
- $replacement .
- mb_substr($string, $start + $length, mb_strlen($string, 'UTF-8') - $start, $encoding);
-
- return $string;
+ public static function mb_substr_replace($string, $replacement, $start, $length = 0, $encoding = 'UTF-8') {
+ return substr_replace($string, $replacement, $start, $length);
}
/**
@@ -792,17 +742,11 @@ class OC_Helper {
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param int $count If passed, this will be set to the number of replacements performed.
* @return string
+ * @deprecated 8.2.0 Use str_replace() instead.
*
*/
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
- $offset = -1;
- $length = mb_strlen($search, $encoding);
- while (($i = mb_strrpos($subject, $search, $offset, $encoding)) !== false) {
- $subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);
- $offset = $i - mb_strlen($subject, $encoding);
- $count++;
- }
- return $subject;
+ return str_replace($search, $replace, $subject, $count);
}
/**
diff --git a/lib/private/hook.php b/lib/private/hook.php
index 188c3d65acb..faf5495b646 100644
--- a/lib/private/hook.php
+++ b/lib/private/hook.php
@@ -111,9 +111,9 @@ class OC_Hook{
if (empty($message)) {
$message = get_class($e);
}
- OC_Log::write('hook',
+ \OCP\Util::writeLog('hook',
'error while running hook (' . $class . '::' . $i["name"] . '): ' . $message,
- OC_Log::ERROR);
+ \OCP\Util::ERROR);
if($e instanceof \OC\ServerNotAvailableException) {
throw $e;
}
diff --git a/lib/private/installer.php b/lib/private/installer.php
index bd214be5667..37af8d0edcb 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -114,7 +114,7 @@ class OC_Installer{
//install the database
if(is_file($basedir.'/appinfo/database.xml')) {
- if (OC_Appconfig::getValue($info['id'], 'installed_version') === null) {
+ if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) {
OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml');
} else {
OC_DB::updateDbFromStructure($basedir.'/appinfo/database.xml');
@@ -127,8 +127,8 @@ class OC_Installer{
}
//set the installed version
- OC_Appconfig::setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
- OC_Appconfig::setValue($info['id'], 'enabled', 'no');
+ \OC::$server->getAppConfig()->setValue($info['id'], 'installed_version', OC_App::getAppVersion($info['id']));
+ \OC::$server->getAppConfig()->setValue($info['id'], 'enabled', 'no');
//set remote/public handelers
foreach($info['remote'] as $name=>$path) {
@@ -151,7 +151,7 @@ class OC_Installer{
* Checks whether or not an app is installed, i.e. registered in apps table.
*/
public static function isInstalled( $app ) {
- return (OC_Appconfig::getValue($app, "installed_version") !== null);
+ return (\OC::$server->getAppConfig()->getValue($app, "installed_version") !== null);
}
/**
@@ -184,7 +184,7 @@ class OC_Installer{
* -# setting the installed version
*
* upgrade.php can determine the current installed version of the app using
- * "OC_Appconfig::getValue($appid, 'installed_version')"
+ * "\OC::$server->getAppConfig()->getValue($appid, 'installed_version')"
*/
public static function updateApp( $info=array(), $isShipped=false) {
list($extractDir, $path) = self::downloadApp($info);
@@ -387,7 +387,7 @@ class OC_Installer{
return false;
}
- $ocsid=OC_Appconfig::getValue( $app, 'ocsid', '');
+ $ocsid=\OC::$server->getAppConfig()->getValue( $app, 'ocsid', '');
if($ocsid<>'') {
$ocsClient = new OCSClient(
@@ -480,7 +480,7 @@ class OC_Installer{
return true;
}else{
- OC_Log::write('core', 'can\'t remove app '.$name.'. It is not installed.', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'can\'t remove app '.$name.'. It is not installed.', \OCP\Util::ERROR);
return false;
}
@@ -503,7 +503,7 @@ class OC_Installer{
$enabled = isset($info['default_enable']);
if( $enabled ) {
OC_Installer::installShippedApp($filename);
- OC_Appconfig::setValue($filename, 'enabled', 'yes');
+ \OC::$server->getAppConfig()->setValue($filename, 'enabled', 'yes');
}
}
}
@@ -533,9 +533,9 @@ class OC_Installer{
if (is_null($info)) {
return false;
}
- OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
+ \OC::$server->getAppConfig()->setValue($app, 'installed_version', OC_App::getAppVersion($app));
if (array_key_exists('ocsid', $info)) {
- OC_Appconfig::setValue($app, 'ocsid', $info['ocsid']);
+ \OC::$server->getAppConfig()->setValue($app, 'ocsid', $info['ocsid']);
}
//set remote/public handlers
diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php
deleted file mode 100644
index 54e568d9ff6..00000000000
--- a/lib/private/legacy/appconfig.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
- * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
- * @author Vincent Petry <pvince81@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * This class provides an easy way for apps to store config values in the
- * database.
- *
- * @deprecated use \OC::$server->getAppConfig() to get an \OCP\IAppConfig instance
- */
-class OC_Appconfig {
- /**
- * @return \OCP\IAppConfig
- */
- private static function getAppConfig() {
- return \OC::$server->getAppConfig();
- }
-
- /**
- * Get all apps using the config
- * @return array an array of app ids
- *
- * This function returns a list of all apps that have at least one
- * entry in the appconfig table.
- */
- public static function getApps() {
- return self::getAppConfig()->getApps();
- }
-
- /**
- * Get the available keys for an app
- * @param string $app the app we are looking for
- * @return array an array of key names
- *
- * This function gets all keys of an app. Please note that the values are
- * not returned.
- */
- public static function getKeys($app) {
- return self::getAppConfig()->getKeys($app);
- }
-
- /**
- * Gets the config value
- * @param string $app app
- * @param string $key key
- * @param string $default = null, default value if the key does not exist
- * @return string the value or $default
- *
- * This function gets a value from the appconfig table. If the key does
- * not exist the default value will be returned
- */
- public static function getValue($app, $key, $default = null) {
- return self::getAppConfig()->getValue($app, $key, $default);
- }
-
- /**
- * check if a key is set in the appconfig
- * @param string $app
- * @param string $key
- * @return bool
- */
- public static function hasKey($app, $key) {
- return self::getAppConfig()->hasKey($app, $key);
- }
-
- /**
- * sets a value in the appconfig
- * @param string $app app
- * @param string $key key
- * @param string $value value
- *
- * Sets a value. If the key did not exist before it will be created.
- */
- public static function setValue($app, $key, $value) {
- self::getAppConfig()->setValue($app, $key, $value);
- }
-
- /**
- * Deletes a key
- * @param string $app app
- * @param string $key key
- *
- * Deletes a key.
- */
- public static function deleteKey($app, $key) {
- self::getAppConfig()->deleteKey($app, $key);
- }
-
- /**
- * Remove app from appconfig
- * @param string $app app
- *
- * Removes all keys in appconfig belonging to the app.
- */
- public static function deleteApp($app) {
- self::getAppConfig()->deleteApp($app);
- }
-
- /**
- * get multiply values, either the app or key can be used as wildcard by setting it to false
- *
- * @param string|false $app
- * @param string|false $key
- * @return array
- */
- public static function getValues($app, $key) {
- return self::getAppConfig()->getValues($app, $key);
- }
-}
diff --git a/lib/private/legacy/log.php b/lib/private/legacy/log.php
deleted file mode 100644
index f9a2044da77..00000000000
--- a/lib/private/legacy/log.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * logging utilities
- *
- * Log is saved by default at data/owncloud.log using OC_Log_Owncloud.
- * Selecting other backend is done with a config option 'log_type'.
- */
-
-OC_Log::$object = new \OC\Log();
-/**
- * @deprecated use \OC::$server->getLogger() to get an \OCP\ILogger instance
- */
-class OC_Log {
- public static $object;
-
- const DEBUG=0;
- const INFO=1;
- const WARN=2;
- const ERROR=3;
- const FATAL=4;
-
- static private $level_funcs = array(
- self::DEBUG => 'debug',
- self::INFO => 'info',
- self::WARN => 'warning',
- self::ERROR => 'error',
- self::FATAL => 'emergency',
- );
-
- static public $enabled = true;
- static protected $class = null;
-
- /**
- * write a message in the log
- * @param string $app
- * @param string $message
- * @param int $level
- */
- public static function write($app, $message, $level) {
- if (self::$enabled) {
- $context = array('app' => $app);
- $func = array(self::$object, self::$level_funcs[$level]);
- call_user_func($func, $message, $context);
- }
- }
-}
diff --git a/lib/private/legacy/search.php b/lib/private/legacy/search.php
deleted file mode 100644
index d113412dc4a..00000000000
--- a/lib/private/legacy/search.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * provides an interface to all search providers
- *
- * @deprecated use \OCP\ISearch / \OC\Search instead
- */
-class OC_Search {
- /**
- * @return \OCP\ISearch
- */
- private static function getSearch() {
- return \OC::$server->getSearch();
- }
-
- /**
- * Search all providers for $query
- * @param string $query
- * @return array An array of OCP\Search\Result's
- */
- public static function search($query) {
- return self::getSearch()->search($query);
- }
-
- /**
- * Register a new search provider to search with
- * @param string $class class name of a OCP\Search\Provider
- * @param array $options optional
- */
- public static function registerProvider($class, $options = array()) {
- return self::getSearch()->registerProvider($class, $options);
- }
-
- /**
- * Remove one existing search provider
- * @param string $provider class name of a OCP\Search\Provider
- */
- public static function removeProvider($provider) {
- return self::getSearch()->removeProvider($provider);
- }
-
- /**
- * Remove all registered search providers
- */
- public static function clearProviders() {
- return self::getSearch()->clearProviders();
- }
-
-}
diff --git a/lib/private/legacy/search/provider.php b/lib/private/legacy/search/provider.php
deleted file mode 100644
index e411673fe0e..00000000000
--- a/lib/private/legacy/search/provider.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * Class OC_Search_Provider
- *
- * @deprecated use \OCP\Search\Provider instead
- */
-abstract class OC_Search_Provider extends \OCP\Search\Provider {
-
-}
diff --git a/lib/private/legacy/search/provider/file.php b/lib/private/legacy/search/provider/file.php
deleted file mode 100644
index f895ce8e07e..00000000000
--- a/lib/private/legacy/search/provider/file.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * @deprecated use \OC\Search\Provider\File instead
- */
-class OC_Search_Provider_File extends \OC\Search\Provider\File {
-
-}
diff --git a/lib/private/legacy/search/result.php b/lib/private/legacy/search/result.php
deleted file mode 100644
index 73ee91f089d..00000000000
--- a/lib/private/legacy/search/result.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * @author Andrew Brown <andrew@casabrown.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * @deprecated use \OCP\Search\Result instead
- */
-class OC_Search_Result extends \OCP\Search\Result {
- /**
- * Create a new search result
- * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]'
- * @param string $name displayed text of result
- * @param string $link URL to the result within its app
- * @param string $type @deprecated because it is now set in \OC\Search\Result descendants
- */
- public function __construct($id = null, $name = null, $link = null, $type = null) {
- $this->id = $id;
- $this->name = $name;
- $this->link = $link;
- $this->type = $type;
- }
-}
diff --git a/lib/private/log.php b/lib/private/log.php
index dd5cb6efbb9..3c0e7b45d1b 100644
--- a/lib/private/log.php
+++ b/lib/private/log.php
@@ -79,7 +79,7 @@ class Log implements ILogger {
* @param array $context
*/
public function emergency($message, array $context = array()) {
- $this->log(\OC_Log::FATAL, $message, $context);
+ $this->log(\OCP\Util::FATAL, $message, $context);
}
/**
@@ -92,7 +92,7 @@ class Log implements ILogger {
* @param array $context
*/
public function alert($message, array $context = array()) {
- $this->log(\OC_Log::ERROR, $message, $context);
+ $this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@@ -104,7 +104,7 @@ class Log implements ILogger {
* @param array $context
*/
public function critical($message, array $context = array()) {
- $this->log(\OC_Log::ERROR, $message, $context);
+ $this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@@ -115,7 +115,7 @@ class Log implements ILogger {
* @param array $context
*/
public function error($message, array $context = array()) {
- $this->log(\OC_Log::ERROR, $message, $context);
+ $this->log(\OCP\Util::ERROR, $message, $context);
}
/**
@@ -128,7 +128,7 @@ class Log implements ILogger {
* @param array $context
*/
public function warning($message, array $context = array()) {
- $this->log(\OC_Log::WARN, $message, $context);
+ $this->log(\OCP\Util::WARN, $message, $context);
}
/**
@@ -138,7 +138,7 @@ class Log implements ILogger {
* @param array $context
*/
public function notice($message, array $context = array()) {
- $this->log(\OC_Log::INFO, $message, $context);
+ $this->log(\OCP\Util::INFO, $message, $context);
}
/**
@@ -150,7 +150,7 @@ class Log implements ILogger {
* @param array $context
*/
public function info($message, array $context = array()) {
- $this->log(\OC_Log::INFO, $message, $context);
+ $this->log(\OCP\Util::INFO, $message, $context);
}
/**
@@ -160,7 +160,7 @@ class Log implements ILogger {
* @param array $context
*/
public function debug($message, array $context = array()) {
- $this->log(\OC_Log::DEBUG, $message, $context);
+ $this->log(\OCP\Util::DEBUG, $message, $context);
}
@@ -172,7 +172,7 @@ class Log implements ILogger {
* @param array $context
*/
public function log($level, $message, array $context = array()) {
- $minLevel = min($this->config->getValue('loglevel', \OC_Log::WARN), \OC_Log::ERROR);
+ $minLevel = min($this->config->getValue('loglevel', \OCP\Util::WARN), \OCP\Util::ERROR);
$logCondition = $this->config->getValue('log.condition', []);
if (isset($context['app'])) {
@@ -185,7 +185,7 @@ class Log implements ILogger {
if(!empty($logCondition)
&& isset($logCondition['apps'])
&& in_array($app, $logCondition['apps'], true)) {
- $minLevel = \OC_Log::DEBUG;
+ $minLevel = \OCP\Util::DEBUG;
}
} else {
@@ -233,7 +233,7 @@ class Log implements ILogger {
// if log condition is satisfied change the required log level to DEBUG
if($this->logConditionSatisfied) {
- $minLevel = \OC_Log::DEBUG;
+ $minLevel = \OCP\Util::DEBUG;
}
if ($level >= $minLevel) {
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index 01112ef7f9d..c98f21208bb 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -78,8 +78,8 @@ class OC_Log_Owncloud {
$remoteAddr = $request->getRemoteAddress();
// remove username/passwords from URLs before writing the to the log file
$time = $time->format($format);
- $minLevel=min($config->getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
- if($minLevel == OC_Log::DEBUG) {
+ $minLevel=min($config->getValue( "loglevel", \OCP\Util::WARN ), \OCP\Util::ERROR);
+ if($minLevel == \OCP\Util::DEBUG) {
$url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '--';
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '--';
$entry = compact('reqId', 'remoteAddr', 'app', 'message', 'level', 'time', 'method', 'url');
@@ -107,7 +107,7 @@ class OC_Log_Owncloud {
*/
public static function getEntries($limit=50, $offset=0) {
self::init();
- $minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN );
+ $minLevel=OC_Config::getValue( "loglevel", \OCP\Util::WARN );
$entries = array();
$handle = @fopen(self::$logFile, 'rb');
if ($handle) {
diff --git a/lib/private/log/rotate.php b/lib/private/log/rotate.php
index a8882e0e2f1..4572a9904d2 100644
--- a/lib/private/log/rotate.php
+++ b/lib/private/log/rotate.php
@@ -44,6 +44,6 @@ class Rotate extends \OC\BackgroundJob\Job {
$rotatedLogfile = $logfile.'.1';
rename($logfile, $rotatedLogfile);
$msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"';
- \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN);
+ \OCP\Util::writeLog('OC\Log\Rotate', $msg, \OCP\Util::WARN);
}
}
diff --git a/lib/private/log/syslog.php b/lib/private/log/syslog.php
index 863d1d6c201..cb42c1dc011 100644
--- a/lib/private/log/syslog.php
+++ b/lib/private/log/syslog.php
@@ -23,11 +23,11 @@
class OC_Log_Syslog {
static protected $levels = array(
- OC_Log::DEBUG => LOG_DEBUG,
- OC_Log::INFO => LOG_INFO,
- OC_Log::WARN => LOG_WARNING,
- OC_Log::ERROR => LOG_ERR,
- OC_Log::FATAL => LOG_CRIT,
+ \OCP\Util::DEBUG => LOG_DEBUG,
+ \OCP\Util::INFO => LOG_INFO,
+ \OCP\Util::WARN => LOG_WARNING,
+ \OCP\Util::ERROR => LOG_ERR,
+ \OCP\Util::FATAL => LOG_CRIT,
);
/**
diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php
index 5bb7e42c808..fe82558e731 100644
--- a/lib/private/memcache/factory.php
+++ b/lib/private/memcache/factory.php
@@ -29,6 +29,7 @@
namespace OC\Memcache;
use \OCP\ICacheFactory;
+use \OCP\ILogger;
class Factory implements ICacheFactory {
const NULL_CACHE = '\\OC\\Memcache\\NullCache';
@@ -39,6 +40,11 @@ class Factory implements ICacheFactory {
private $globalPrefix;
/**
+ * @var ILogger $logger
+ */
+ private $logger;
+
+ /**
* @var string $localCacheClass
*/
private $localCacheClass;
@@ -55,13 +61,15 @@ class Factory implements ICacheFactory {
/**
* @param string $globalPrefix
+ * @param ILogger $logger
* @param string|null $localCacheClass
* @param string|null $distributedCacheClass
* @param string|null $lockingCacheClass
*/
- public function __construct($globalPrefix,
+ public function __construct($globalPrefix, ILogger $logger,
$localCacheClass = null, $distributedCacheClass = null, $lockingCacheClass = null)
{
+ $this->logger = $logger;
$this->globalPrefix = $globalPrefix;
if (!$localCacheClass) {
@@ -71,22 +79,43 @@ class Factory implements ICacheFactory {
$distributedCacheClass = $localCacheClass;
}
+ $missingCacheMessage = 'Memcache {class} not available for {use} cache';
+ $missingCacheHint = 'Is the matching PHP module installed and enabled?';
if (!$localCacheClass::isAvailable()) {
- throw new \OC\HintException(
- 'Missing memcache class ' . $localCacheClass . ' for local cache',
- 'Is the matching PHP module installed and enabled ?'
- );
+ if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
+ // CLI should not hard-fail on broken memcache
+ $this->logger->info($missingCacheMessage, [
+ 'class' => $localCacheClass,
+ 'use' => 'local',
+ 'app' => 'cli'
+ ]);
+ $localCacheClass = self::NULL_CACHE;
+ } else {
+ throw new \OC\HintException(strtr($missingCacheMessage, [
+ '{class}' => $localCacheClass, '{use}' => 'local'
+ ]), $missingCacheHint);
+ }
}
if (!$distributedCacheClass::isAvailable()) {
- throw new \OC\HintException(
- 'Missing memcache class ' . $distributedCacheClass . ' for distributed cache',
- 'Is the matching PHP module installed and enabled ?'
- );
+ if (\OC::$CLI && !defined('PHPUNIT_RUN')) {
+ // CLI should not hard-fail on broken memcache
+ $this->logger->info($missingCacheMessage, [
+ 'class' => $distributedCacheClass,
+ 'use' => 'distributed',
+ 'app' => 'cli'
+ ]);
+ $distributedCacheClass = self::NULL_CACHE;
+ } else {
+ throw new \OC\HintException(strtr($missingCacheMessage, [
+ '{class}' => $distributedCacheClass, '{use}' => 'distributed'
+ ]), $missingCacheHint);
+ }
}
if (!($lockingCacheClass && $lockingCacheClass::isAvailable())) {
// dont fallback since the fallback might not be suitable for storing lock
- $lockingCacheClass = '\OC\Memcache\NullCache';
+ $lockingCacheClass = self::NULL_CACHE;
}
+
$this->localCacheClass = $localCacheClass;
$this->distributedCacheClass = $distributedCacheClass;
$this->lockingCacheClass = $lockingCacheClass;
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
deleted file mode 100644
index efb8089420e..00000000000
--- a/lib/private/mimetypes.list.php
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/**
- * @author Aidan Amavi <github@aidanamavi.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Normal Ra <normalraw@gmail.com>
- * @author Olivier Paroz <github@oparoz.com>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- * @author tiezdne <oswald.84@t-online.de>
- * @author Victor Dubiniuk <dubiniuk@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-/**
- * Array mapping file extensions to mimetypes (in alphabetical order).
- *
- * The first index in the mime type array is the assumed correct mimetype
- * and the second is either a secure alternative or null if the correct
- * is considered secure.
- */
-return array(
- '3gp' => array('video/3gpp', null),
- '7z' => array('application/x-7z-compressed', null),
- 'accdb' => array('application/msaccess', null),
- 'ai' => array('application/illustrator', null),
- 'apk' => array('application/vnd.android.package-archive', null),
- 'arw' => array('image/x-dcraw', null),
- 'avi' => array('video/x-msvideo', null),
- 'bash' => array('text/x-shellscript', null),
- 'blend' => array('application/x-blender', null),
- 'bin' => array('application/x-bin', null),
- 'bmp' => array('image/bmp', null),
- 'bpg' => array('image/bpg', null),
- 'cb7' => array('application/x-cbr', null),
- 'cba' => array('application/x-cbr', null),
- 'cbr' => array('application/x-cbr', null),
- 'cbt' => array('application/x-cbr', null),
- 'cbtc' => array('application/x-cbr', null),
- 'cbz' => array('application/x-cbr', null),
- 'cc' => array('text/x-c', null),
- 'cdr' => array('application/coreldraw', null),
- 'cnf' => array('text/plain', null),
- 'conf' => array('text/plain', null),
- 'cpp' => array('text/x-c++src', null),
- 'cr2' => array('image/x-dcraw', null),
- 'css' => array('text/css', null),
- 'csv' => array('text/csv', null),
- 'cvbdl' => array('application/x-cbr', null),
- 'c' => array('text/x-c', null),
- 'c++' => array('text/x-c++src', null),
- 'dcr' => array('image/x-dcraw', null),
- 'deb' => array('application/x-deb', null),
- 'dng' => array('image/x-dcraw', null),
- 'doc' => array('application/msword', null),
- 'docm' => array('application/vnd.ms-word.document.macroEnabled.12', null),
- 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', null),
- 'dot' => array('application/msword', null),
- 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.template', null),
- 'dv' => array('video/dv', null),
- 'eot' => array('application/vnd.ms-fontobject', null),
- 'epub' => array('application/epub+zip', null),
- 'eps' => array('application/postscript', null),
- 'erf' => array('image/x-dcraw', null),
- 'exe' => array('application/x-ms-dos-executable', null),
- 'flac' => array('audio/flac', null),
- 'flv' => array('video/x-flv', null),
- 'gif' => array('image/gif', null),
- 'gz' => array('application/x-gzip', null),
- 'gzip' => array('application/x-gzip', null),
- 'h' => array('text/x-h', null),
- 'hh' => array('text/x-h', null),
- 'html' => array('text/html', 'text/plain'),
- 'htm' => array('text/html', 'text/plain'),
- 'ical' => array('text/calendar', null),
- 'ics' => array('text/calendar', null),
- 'iiq' => array('image/x-dcraw', null),
- 'impress' => array('text/impress', null),
- 'jpeg' => array('image/jpeg', null),
- 'jpg' => array('image/jpeg', null),
- 'jps' => array('image/jpeg', null),
- 'js' => array('application/javascript', 'text/plain'),
- 'json' => array('application/json', 'text/plain'),
- 'k25' => array('image/x-dcraw', null),
- 'kdc' => array('image/x-dcraw', null),
- 'key' => array('application/x-iwork-keynote-sffkey', null),
- 'keynote' => array('application/x-iwork-keynote-sffkey', null),
- 'kra' => array('application/x-krita', null),
- 'm2t' => array('video/mp2t', null),
- 'm4v' => array('video/mp4', null),
- 'markdown' => array('text/markdown', null),
- 'mdown' => array('text/markdown', null),
- 'md' => array('text/markdown', null),
- 'mdb' => array('application/msaccess', null),
- 'mdwn' => array('text/markdown', null),
- 'mkd' => array('text/markdown', null),
- 'mef' => array('image/x-dcraw', null),
- 'mkv' => array('video/x-matroska', null),
- 'mobi' => array('application/x-mobipocket-ebook', null),
- 'mov' => array('video/quicktime', null),
- 'mp3' => array('audio/mpeg', null),
- 'mp4' => array('video/mp4', null),
- 'mpeg' => array('video/mpeg', null),
- 'mpg' => array('video/mpeg', null),
- 'mpo' => array('image/jpeg', null),
- 'msi' => array('application/x-msi', null),
- 'mts' => ['video/MP2T', null],
- 'mt2s' => ['video/MP2T', null],
- 'nef' => array('image/x-dcraw', null),
- 'numbers' => array('application/x-iwork-numbers-sffnumbers', null),
- 'odf' => array('application/vnd.oasis.opendocument.formula', null),
- 'odg' => array('application/vnd.oasis.opendocument.graphics', null),
- 'odp' => array('application/vnd.oasis.opendocument.presentation', null),
- 'ods' => array('application/vnd.oasis.opendocument.spreadsheet', null),
- 'odt' => array('application/vnd.oasis.opendocument.text', null),
- 'oga' => array('audio/ogg', null),
- 'ogg' => array('audio/ogg', null),
- 'ogv' => array('video/ogg', null),
- 'opus' => array('audio/ogg', null),
- 'orf' => array('image/x-dcraw', null),
- 'otf' => array('application/font-sfnt', null),
- 'pages' => array('application/x-iwork-pages-sffpages', null),
- 'pdf' => array('application/pdf', null),
- 'pfb' => array('application/x-font', null),
- 'pef' => array('image/x-dcraw', null),
- 'php' => array('application/x-php', null),
- 'pl' => array('application/x-perl', null),
- 'png' => array('image/png', null),
- 'pot' => array('application/vnd.ms-powerpoint', null),
- 'potm' => array('application/vnd.ms-powerpoint.template.macroEnabled.12', null),
- 'potx' => array('application/vnd.openxmlformats-officedocument.presentationml.template', null),
- 'ppa' => array('application/vnd.ms-powerpoint', null),
- 'ppam' => array('application/vnd.ms-powerpoint.addin.macroEnabled.12', null),
- 'pps' => array('application/vnd.ms-powerpoint', null),
- 'ppsm' => array('application/vnd.ms-powerpoint.slideshow.macroEnabled.12', null),
- 'ppsx' => array('application/vnd.openxmlformats-officedocument.presentationml.slideshow', null),
- 'ppt' => array('application/vnd.ms-powerpoint', null),
- 'pptm' => array('application/vnd.ms-powerpoint.presentation.macroEnabled.12', null),
- 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', null),
- 'ps' => array('application/postscript', null),
- 'psd' => array('application/x-photoshop', null),
- 'py' => array('text/x-python', null),
- 'raf' => array('image/x-dcraw', null),
- 'rar' => array('application/x-rar-compressed', null),
- 'reveal' => array('text/reveal', null),
- 'rw2' => array('image/x-dcraw', null),
- 'sgf' => array('application/sgf', null),
- 'sh-lib' => array('text/x-shellscript', null),
- 'sh' => array('text/x-shellscript', null),
- 'srf' => array('image/x-dcraw', null),
- 'sr2' => array('image/x-dcraw', null),
- 'svg' => array('image/svg+xml', 'text/plain'),
- 'swf' => array('application/x-shockwave-flash', 'application/octet-stream'),
- 'tar' => array('application/x-tar', null),
- 'tar.gz' => array('application/x-compressed', null),
- 'tex' => array('application/x-tex', null),
- 'tgz' => array('application/x-compressed', null),
- 'tiff' => array('image/tiff', null),
- 'tif' => array('image/tiff', null),
- 'ttf' => array('application/font-sfnt', null),
- 'txt' => array('text/plain', null),
- 'vcard' => array('text/vcard', null),
- 'vcf' => array('text/vcard', null),
- 'vob' => array('video/dvd', null),
- 'wav' => array('audio/wav', null),
- 'webm' => array('video/webm', null),
- 'woff' => array('application/font-woff', null),
- 'wmv' => array('video/x-ms-wmv', null),
- 'xcf' => array('application/x-gimp', null),
- 'xla' => array('application/vnd.ms-excel', null),
- 'xlam' => array('application/vnd.ms-excel.addin.macroEnabled.12', null),
- 'xls' => array('application/vnd.ms-excel', null),
- 'xlsb' => array('application/vnd.ms-excel.sheet.binary.macroEnabled.12', null),
- 'xlsm' => array('application/vnd.ms-excel.sheet.macroEnabled.12', null),
- 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', null),
- 'xlt' => array('application/vnd.ms-excel', null),
- 'xltm' => array('application/vnd.ms-excel.template.macroEnabled.12', null),
- 'xltx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.template', null),
- 'xml' => array('application/xml', 'text/plain'),
- 'xrf' => array('image/x-dcraw', null),
- 'yaml' => array('application/yaml', 'text/plain'),
- 'yml' => array('application/yaml', 'text/plain'),
- 'zip' => array('application/zip', null),
-);
diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php
index 310a029b6de..26b9cec6cf1 100644
--- a/lib/private/naturalsort.php
+++ b/lib/private/naturalsort.php
@@ -39,7 +39,7 @@ class NaturalSort {
// or inject an instance of \OC\NaturalSort_DefaultCollator to force using Owncloud's default collator
if (isset($injectedCollator)) {
$this->collator = $injectedCollator;
- \OC_Log::write('core', 'forced use of '.get_class($injectedCollator), \OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'forced use of '.get_class($injectedCollator), \OCP\Util::DEBUG);
}
}
diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index 18ba4cea003..d6593e5089a 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -272,7 +272,7 @@ class OCSClient {
$tmp = $data->data->content;
if (is_null($tmp)) {
- \OC_Log::write('core', 'No update found at the ownCloud appstore for app ' . $id, \OC_Log::INFO);
+ \OCP\Util::writeLog('core', 'No update found at the ownCloud appstore for app ' . $id, \OCP\Util::INFO);
return null;
}
diff --git a/lib/private/preview.php b/lib/private/preview.php
index cc954bc3653..5dcab476a4f 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -135,7 +135,7 @@ class Preview {
&& \OC::$server->getConfig()
->getSystemValue('enable_previews', true)
) {
- \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'No preview providers exist', \OCP\Util::ERROR);
throw new \Exception('No preview providers');
}
}
diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php
index 12ad4f020eb..065425c9a1d 100644
--- a/lib/private/preview/bitmap.php
+++ b/lib/private/preview/bitmap.php
@@ -46,7 +46,7 @@ abstract class Bitmap extends Provider {
try {
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
} catch (\Exception $e) {
- \OC_Log::write('core', 'ImageMagick says: ' . $e->getmessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index f72c5def35f..30398147aa6 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -56,7 +56,7 @@ abstract class Office extends Provider {
} catch (\Exception $e) {
unlink($absPath);
unlink($pdfPreview);
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php
index 4e3cba576fb..f8318e9a69a 100644
--- a/lib/private/preview/svg.php
+++ b/lib/private/preview/svg.php
@@ -52,7 +52,7 @@ class SVG extends Provider {
$svg->readImageBlob($content);
$svg->setImageFormat('png32');
} catch (\Exception $e) {
- \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::ERROR);
return false;
}
diff --git a/lib/private/server.php b/lib/private/server.php
index af137ce36aa..53949b53df7 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -50,7 +50,6 @@ use OC\Http\Client\ClientService;
use OC\Lock\MemcacheLockingProvider;
use OC\Lock\NoopLockingProvider;
use OC\Mail\Mailer;
-use OC\Memcache\ArrayCache;
use OC\Memcache\NullCache;
use OC\Security\CertificateManager;
use OC\Security\Crypto;
@@ -234,17 +233,17 @@ class Server extends SimpleContainer implements IServerContainer {
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
$prefix = md5($instanceId.'-'.$version.'-'.$path);
- return new \OC\Memcache\Factory($prefix,
+ return new \OC\Memcache\Factory($prefix, $c->getLogger(),
$config->getSystemValue('memcache.local', null),
$config->getSystemValue('memcache.distributed', null),
$config->getSystemValue('memcache.locking', null)
);
}
- return new \OC\Memcache\Factory('',
- new ArrayCache(),
- new ArrayCache(),
- new ArrayCache()
+ return new \OC\Memcache\Factory('', $c->getLogger(),
+ '\\OC\\Memcache\\ArrayCache',
+ '\\OC\\Memcache\\ArrayCache',
+ '\\OC\\Memcache\\ArrayCache'
);
});
$this->registerService('ActivityManager', function (Server $c) {
@@ -535,29 +534,9 @@ class Server extends SimpleContainer implements IServerContainer {
return null;
}
$userId = $user->getUID();
- } else {
- $user = $this->getUserManager()->get($userId);
}
- \OC\Files\Filesystem::initMountPoints($userId);
- $dir = '/' . $userId;
$root = $this->getRootFolder();
- $folder = null;
-
- if (!$root->nodeExists($dir)) {
- $folder = $root->newFolder($dir);
- } else {
- $folder = $root->get($dir);
- }
-
- $dir = '/files';
- if (!$folder->nodeExists($dir)) {
- $folder = $folder->newFolder($dir);
- \OC_Util::copySkeleton($user, $folder);
- } else {
- $folder = $folder->get($dir);
- }
-
- return $folder;
+ return $root->getUserFolder($userId);
}
/**
diff --git a/lib/private/setup/mssql.php b/lib/private/setup/mssql.php
index f8815259af4..0ae02d6cbcc 100644
--- a/lib/private/setup/mssql.php
+++ b/lib/private/setup/mssql.php
@@ -66,7 +66,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@@ -77,7 +77,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
$query = "CREATE LOGIN [".$this->dbuser."] WITH PASSWORD = '".$this->dbpassword."';";
@@ -89,7 +89,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
}
@@ -106,7 +106,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@@ -117,7 +117,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
$query = "USE [".$this->dbname."]; CREATE USER [".$this->dbuser."] FOR LOGIN [".$this->dbuser."];";
@@ -129,7 +129,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
@@ -142,7 +142,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
}
@@ -158,7 +158,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
}
@@ -179,7 +179,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
$row = sqlsrv_fetch_array($result);
@@ -190,7 +190,7 @@ class MSSQL extends AbstractDatabase {
$entry = '';
}
$entry.='Offending command was: '.$query.'<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
} else {
if ($row == null) {
\OC_DB::createDbFromStructure($this->dbDefinitionFile);
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index b9246a915a6..c01ff724b80 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -103,7 +103,7 @@ class MySQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(mysql_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.mssql', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.mssql', $entry, \OCP\Util::WARN);
}
$query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'";
diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php
index 791dc7232f5..d46d5529da0 100644
--- a/lib/private/setup/oci.php
+++ b/lib/private/setup/oci.php
@@ -66,7 +66,7 @@ class OCI extends AbstractDatabase {
} else {
$easy_connect_string = '//'.$e_host.'/'.$e_dbname;
}
- \OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
+ \OCP\Util::writeLog('setup oracle', 'connect string: ' . $easy_connect_string, \OCP\Util::DEBUG);
$connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string);
if(!$connection) {
$errorMessage = $this->getLastError();
@@ -93,7 +93,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
if($result) {
@@ -155,7 +155,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
@@ -178,14 +178,14 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
if(! oci_fetch_row($stmt)) {
@@ -196,7 +196,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
//oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
@@ -204,7 +204,7 @@ class OCI extends AbstractDatabase {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
} else { // change password of the existing role
$query = "ALTER USER :un IDENTIFIED BY :pw";
@@ -212,7 +212,7 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
oci_bind_by_name($stmt, ':un', $name);
oci_bind_by_name($stmt, ':pw', $password);
@@ -220,7 +220,7 @@ class OCI extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
}
// grant necessary roles
@@ -229,14 +229,14 @@ class OCI extends AbstractDatabase {
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
- \OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.oci', $entry, \OCP\Util::WARN);
}
}
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 597e38f43a6..c8fd3b98fe4 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -118,7 +118,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
if(! pg_fetch_row($result)) {
//The database does not exists... let's create it
@@ -127,7 +127,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
else {
$query = "REVOKE ALL PRIVILEGES ON DATABASE \"$e_name\" FROM PUBLIC";
@@ -144,7 +144,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
if(! pg_fetch_row($result)) {
@@ -154,7 +154,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
}
else { // change password of the existing role
@@ -163,7 +163,7 @@ class PostgreSQL extends AbstractDatabase {
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(pg_last_error($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
- \OC_Log::write('setup.pg', $entry, \OC_Log::WARN);
+ \OCP\Util::writeLog('setup.pg', $entry, \OCP\Util::WARN);
}
}
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index af7f78b9ff5..7fcbb695c68 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -87,10 +87,10 @@ class Share extends Constants {
}
return true;
}
- \OC_Log::write('OCP\Share',
+ \OCP\Util::writeLog('OCP\Share',
'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class']
.' is already registered for '.$itemType,
- \OC_Log::WARN);
+ \OCP\Util::WARN);
}
return false;
}
@@ -102,7 +102,7 @@ class Share extends Constants {
* The Share API is enabled by default if not configured
*/
public static function isEnabled() {
- if (\OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes') == 'yes') {
return true;
}
return false;
@@ -142,18 +142,28 @@ class Share extends Constants {
while ($source !== -1) {
// Fetch all shares with another user
- $query = \OC_DB::prepare(
- 'SELECT `share_with`, `file_source`, `file_target`
+ if (!$returnUserPaths) {
+ $query = \OC_DB::prepare(
+ 'SELECT `share_with`, `file_source`, `file_target`
+ FROM
+ `*PREFIX*share`
+ WHERE
+ `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')'
+ );
+ $result = $query->execute(array($source, self::SHARE_TYPE_USER));
+ } else {
+ $query = \OC_DB::prepare(
+ 'SELECT `share_with`, `file_source`, `file_target`
FROM
`*PREFIX*share`
WHERE
- `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')'
- );
-
- $result = $query->execute(array($source, self::SHARE_TYPE_USER));
+ `item_source` = ? AND `share_type` IN (?, ?) AND `item_type` IN (\'file\', \'folder\')'
+ );
+ $result = $query->execute(array($source, self::SHARE_TYPE_USER, self::$shareTypeGroupUserUnique));
+ }
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$shares[] = $row['share_with'];
@@ -175,14 +185,19 @@ class Share extends Constants {
$result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$usersInGroup = \OC_Group::usersInGroup($row['share_with']);
$shares = array_merge($shares, $usersInGroup);
if ($returnUserPaths) {
foreach ($usersInGroup as $user) {
- $fileTargets[(int) $row['file_source']][$user] = $row;
+ if (!isset($fileTargets[(int) $row['file_source']][$user])) {
+ // When the user already has an entry for this file source
+ // the file is either shared directly with him as well, or
+ // he has an exception entry (because of naming conflict).
+ $fileTargets[(int) $row['file_source']][$user] = $row;
+ }
}
}
}
@@ -238,9 +253,6 @@ class Share extends Constants {
// Include owner in list of users, if requested
if ($includeOwner) {
$shares[] = $ownerUser;
- if ($returnUserPaths) {
- $sharePaths[$ownerUser] = $path;
- }
}
if ($returnUserPaths) {
@@ -256,7 +268,7 @@ class Share extends Constants {
$result = $query->execute();
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
@@ -268,6 +280,12 @@ class Share extends Constants {
}
}
+ if ($includeOwner) {
+ $sharePaths[$ownerUser] = $path;
+ } else {
+ unset($sharePaths[$ownerUser]);
+ }
+
return $sharePaths;
}
@@ -464,7 +482,7 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
$result = $query->execute(array($token));
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
}
$row = $result->fetchRow();
if ($row === false) {
@@ -581,7 +599,7 @@ class Share extends Constants {
if ($backend->isShareTypeAllowed($shareType) === false) {
$message = 'Sharing %s failed, because the backend does not allow shares from type %i';
$message_t = $l->t('Sharing %s failed, because the backend does not allow shares from type %i', array($itemSourceName, $shareType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -599,14 +617,14 @@ class Share extends Constants {
if (!$path) {
$message = 'Sharing %s failed, because the file does not exist';
$message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// verify that the user has share permission
if (!\OC\Files\Filesystem::isSharable($path)) {
$message = 'You are not allowed to share %s';
$message_t = $l->t('You are not allowed to share %s', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -619,7 +637,7 @@ class Share extends Constants {
foreach ($mounts as $mount) {
if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message);
}
@@ -636,13 +654,13 @@ class Share extends Constants {
if ($shareWith == $uidOwner) {
$message = 'Sharing %s failed, because the user %s is the item owner';
$message_t = $l->t('Sharing %s failed, because the user %s is the item owner', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if (!\OC_User::userExists($shareWith)) {
$message = 'Sharing %s failed, because the user %s does not exist';
$message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly) {
@@ -651,7 +669,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user '
.'%s is not a member of any groups that %s is a member of';
$message_t = $l->t('Sharing %s failed, because the user %s is not a member of any groups that %s is a member of', array($itemSourceName, $shareWith, $uidOwner));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -664,7 +682,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -672,14 +690,14 @@ class Share extends Constants {
if (!\OC_Group::groupExists($shareWith)) {
$message = 'Sharing %s failed, because the group %s does not exist';
$message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly && !\OC_Group::inGroup($uidOwner, $shareWith)) {
$message = 'Sharing %s failed, because '
.'%s is not a member of the group %s';
$message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// Check if the item source is already shared with the group, either from the same owner or a different user
@@ -692,7 +710,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -703,7 +721,7 @@ class Share extends Constants {
$shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner));
} else if ($shareType === self::SHARE_TYPE_LINK) {
$updateExistingShare = false;
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
// when updating a link share
// FIXME Don't delete link if we update it
@@ -731,7 +749,7 @@ class Share extends Constants {
if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
$message = 'You need to provide a password to create a public link, only protected links are allowed';
$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -760,7 +778,7 @@ class Share extends Constants {
}
$message = 'Sharing %s failed, because sharing with links is not allowed';
$message_t = $l->t('Sharing %s failed, because sharing with links is not allowed', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else if ($shareType === self::SHARE_TYPE_REMOTE) {
$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
@@ -787,7 +805,7 @@ class Share extends Constants {
// Future share types need to include their own conditions
$message = 'Share type %s is not valid for %s';
$message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $shareType, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -988,7 +1006,7 @@ class Share extends Constants {
$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
if($result === false) {
- \OC_Log::write('OCP\Share', 'Couldn\'t set send mail status', \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', \OCP\Util::ERROR);
}
}
@@ -1015,7 +1033,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed,'
.' because the permissions exceed permissions granted to %s';
$message_t = $l->t('Setting permissions for %s failed, because the permissions exceed permissions granted to %s', array($itemSource, \OC_User::getUser()));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -1078,7 +1096,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed, because the item was not found';
$message_t = $l->t('Setting permissions for %s failed, because the item was not found', array($itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -1340,20 +1358,20 @@ class Share extends Constants {
if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) {
$message = 'Sharing backend %s must implement the interface OCP\Share_Backend';
$message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', array($class));
- \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
return self::$backends[$itemType];
} else {
$message = 'Sharing backend %s not found';
$message_t = $l->t('Sharing backend %s not found', array($class));
- \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
$message = 'Sharing backend for %s not found';
$message_t = $l->t('Sharing backend for %s not found', array($itemType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -1365,7 +1383,7 @@ class Share extends Constants {
*/
public static function isResharingAllowed() {
if (!isset(self::$isResharingAllowed)) {
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {
self::$isResharingAllowed = true;
} else {
self::$isResharingAllowed = false;
@@ -1509,7 +1527,7 @@ class Share extends Constants {
$queryArgs = array($itemType);
}
}
- if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
$where .= ' AND `share_type` != ?';
$queryArgs[] = self::SHARE_TYPE_LINK;
}
@@ -1617,9 +1635,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
$result = $query->execute($queryArgs);
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share',
+ \OCP\Util::writeLog('OCP\Share',
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
- \OC_Log::ERROR);
+ \OCP\Util::ERROR);
}
$items = array();
$targets = array();
@@ -1681,9 +1699,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
$parentResult = $query->execute(array($row['parent']));
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
+ \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
- \OC_Log::ERROR);
+ \OCP\Util::ERROR);
} else {
$parentRow = $parentResult->fetchRow();
$tmpPath = $parentRow['file_target'];
@@ -2124,7 +2142,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user %s is the original sharer';
$message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -2136,7 +2154,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else {
// TODO Don't check if inside folder
@@ -2162,7 +2180,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because resharing is not allowed';
$message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {
@@ -2175,7 +2193,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the sharing backend for '
.'%s could not find its source';
$message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
@@ -2190,7 +2208,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the file could not be found in the file cache';
$message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {
@@ -2504,7 +2522,7 @@ class Share extends Constants {
* @return bool
*/
public static function shareWithGroupMembersOnly() {
- $value = \OC_Appconfig::getValue('core', 'shareapi_only_share_with_group_members', 'no');
+ $value = \OC::$server->getAppConfig()->getValue('core', 'shareapi_only_share_with_group_members', 'no');
return ($value === 'yes') ? true : false;
}
diff --git a/lib/private/systemconfig.php b/lib/private/systemconfig.php
index 451ccd85e2f..13b0959768a 100644
--- a/lib/private/systemconfig.php
+++ b/lib/private/systemconfig.php
@@ -29,6 +29,14 @@ namespace OC;
*/
class SystemConfig {
/**
+ * Lists all available config keys
+ * @return array an array of key names
+ */
+ public function getKeys() {
+ return \OC_Config::getKeys();
+ }
+
+ /**
* Sets a new system wide value
*
* @param string $key the key of the value, under which will be saved
diff --git a/lib/private/user.php b/lib/private/user.php
index 7c3cb528a9a..92807246144 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -142,12 +142,12 @@ class OC_User {
case 'database':
case 'mysql':
case 'sqlite':
- OC_Log::write('core', 'Adding user backend ' . $backend . '.', OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'Adding user backend ' . $backend . '.', \OCP\Util::DEBUG);
self::$_usedBackends[$backend] = new OC_User_Database();
self::getManager()->registerBackend(self::$_usedBackends[$backend]);
break;
default:
- OC_Log::write('core', 'Adding default user backend ' . $backend . '.', OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'Adding default user backend ' . $backend . '.', \OCP\Util::DEBUG);
$className = 'OC_USER_' . strToUpper($backend);
self::$_usedBackends[$backend] = new $className();
self::getManager()->registerBackend(self::$_usedBackends[$backend]);
@@ -184,10 +184,10 @@ class OC_User {
self::useBackend($backend);
self::$_setupedBackends[] = $i;
} else {
- OC_Log::write('core', 'User backend ' . $class . ' already initialized.', OC_Log::DEBUG);
+ \OCP\Util::writeLog('core', 'User backend ' . $class . ' already initialized.', \OCP\Util::DEBUG);
}
} else {
- OC_Log::write('core', 'User backend ' . $class . ' not found.', OC_Log::ERROR);
+ \OCP\Util::writeLog('core', 'User backend ' . $class . ' not found.', \OCP\Util::ERROR);
}
}
}
@@ -405,7 +405,7 @@ class OC_User {
return $backend->getLogoutAttribute();
}
- return 'href="' . link_to('', 'index.php') . '?logout=true&requesttoken=' . urlencode(OC_Util::callRegister()) . '"';
+ return 'href="' . link_to('', 'index.php') . '?logout=true&amp;requesttoken=' . urlencode(OC_Util::callRegister()) . '"';
}
/**
diff --git a/lib/private/user/database.php b/lib/private/user/database.php
index 3cf73f939e5..081066398c0 100644
--- a/lib/private/user/database.php
+++ b/lib/private/user/database.php
@@ -211,7 +211,7 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
$result = $query->execute(array($uid));
if (OC_DB::isError($result)) {
- OC_Log::write('core', OC_DB::getErrorMessage(), OC_Log::ERROR);
+ \OCP\Util::writeLog('core', OC_DB::getErrorMessage(), \OCP\Util::ERROR);
return false;
}
@@ -288,7 +288,7 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
$query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`');
$result = $query->execute();
if (OC_DB::isError($result)) {
- OC_Log::write('core', OC_DB::getErrorMessage(), OC_Log::ERROR);
+ \OCP\Util::writeLog('core', OC_DB::getErrorMessage(), \OCP\Util::ERROR);
return false;
}
return $result->fetchOne();
diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php
index 09400d8365c..6a57aa3f7ae 100644
--- a/lib/private/user/manager.php
+++ b/lib/private/user/manager.php
@@ -182,7 +182,7 @@ class Manager extends PublicEmitter implements IUserManager {
}
}
- \OC::$server->getLogger()->warning('Login failed: \''. $loginname .'\' (Remote IP: \''. \OC::$server->getRequest()->getRemoteAddress(). ')', ['app' => 'core']);
+ \OC::$server->getLogger()->warning('Login failed: \''. $loginname .'\' (Remote IP: \''. \OC::$server->getRequest()->getRemoteAddress(). '\')', ['app' => 'core']);
return false;
}
diff --git a/lib/private/util.php b/lib/private/util.php
index 9c78ad3ad1c..39d64952dc6 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -212,9 +212,9 @@ class OC_Util {
* @return boolean
*/
public static function isSharingDisabledForUser() {
- if (\OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
+ if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes') {
$user = \OCP\User::getUser();
- $groupsList = \OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
+ $groupsList = \OC::$server->getAppConfig()->getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroups = explode(',', $groupsList);
$usersGroups = \OC_Group::getUserGroups($user);
if (!empty($usersGroups)) {
@@ -267,17 +267,17 @@ class OC_Util {
/**
* copies the skeleton to the users /files
*
- * @param \OC\User\User $user
+ * @param String $userId
* @param \OCP\Files\Folder $userDirectory
*/
- public static function copySkeleton(\OC\User\User $user, \OCP\Files\Folder $userDirectory) {
+ public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) {
$skeletonDirectory = \OCP\Config::getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
if (!empty($skeletonDirectory)) {
\OCP\Util::writeLog(
'files_skeleton',
- 'copying skeleton for '.$user->getUID().' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'),
+ 'copying skeleton for '.$userId.' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'),
\OCP\Util::DEBUG
);
self::copyr($skeletonDirectory, $userDirectory);
@@ -999,7 +999,7 @@ class OC_Util {
if (isset($_REQUEST['redirect_url']) && strpos($_REQUEST['redirect_url'], '@') === false) {
$location = $urlGenerator->getAbsoluteURL(urldecode($_REQUEST['redirect_url']));
} else {
- $defaultPage = OC_Appconfig::getValue('core', 'defaultpage');
+ $defaultPage = \OC::$server->getAppConfig()->getValue('core', 'defaultpage');
if ($defaultPage) {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
@@ -1245,6 +1245,7 @@ class OC_Util {
* @return string of the response or false on error
* This function get the content of a page via curl, if curl is enabled.
* If not, file_get_contents is used.
+ * @deprecated Use \OCP\Http\Client\IClientService
*/
public static function getUrlContent($url) {
try {
@@ -1344,7 +1345,7 @@ class OC_Util {
// XCache
if (function_exists('xcache_clear_cache')) {
if (ini_get('xcache.admin.enable_auth')) {
- OC_Log::write('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OC_Log::WARN);
+ \OCP\Util::writeLog('core', 'XCache opcode cache will not be cleared because "xcache.admin.enable_auth" is enabled.', \OCP\Util::WARN);
} else {
@xcache_clear_cache(XC_TYPE_PHP, 0);
}
diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index 1a770109d45..456a5616d4d 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -61,9 +61,16 @@ class JSONResponse extends Response {
* Returns the rendered json
* @return string the rendered json
* @since 6.0.0
+ * @throws \Exception If data could not get encoded
*/
- public function render(){
- return json_encode($this->data);
+ public function render() {
+ $response = json_encode($this->data);
+ if($response === false) {
+ throw new \Exception(sprintf('Could not json_encode due to invalid ' .
+ 'non UTF-8 characters in the array: %s', var_export($this->data, true)));
+ }
+
+ return $response;
}
/**
diff --git a/lib/public/files/irootfolder.php b/lib/public/files/irootfolder.php
index 19192cd9cc9..97dc5a31e74 100644
--- a/lib/public/files/irootfolder.php
+++ b/lib/public/files/irootfolder.php
@@ -33,5 +33,13 @@ use OC\Hooks\Emitter;
*/
interface IRootFolder extends Folder, Emitter {
+ /**
+ * Returns a view to user's files folder
+ *
+ * @param String $userId user ID
+ * @return \OCP\Files\Folder
+ * @since 8.2.0
+ */
+ public function getUserFolder($userId);
}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index ef6c6044951..95ee853d84c 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -99,6 +99,7 @@ interface IServerContainer {
* @param string $userId user ID
* @return \OCP\Files\Folder
* @since 6.0.0 - parameter $userId was added in 8.0.0
+ * @see getUserFolder in \OCP\Files\IRootFolder
*/
public function getUserFolder($userId = null);
diff --git a/lib/public/util.php b/lib/public/util.php
index 087bb639618..c32668b14a8 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -78,7 +78,7 @@ class Util {
public static function setChannel($channel) {
//Flush timestamp to reload version.php
\OC::$server->getSession()->set('OC_Version_Timestamp', 0);
- return \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
+ \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
}
/**
@@ -148,8 +148,8 @@ class Util {
* @since 4.0.0
*/
public static function writeLog( $app, $message, $level ) {
- // call the internal log class
- \OC_LOG::write( $app, $message, $level );
+ $context = ['app' => $app];
+ \OC::$server->getLogger()->log($level, $message, $context);
}
/**
@@ -542,6 +542,7 @@ class Util {
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return string
* @since 4.5.0
+ * @deprecated 8.2.0 Use substr_replace() instead.
*/
public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
return(\OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding));
@@ -557,6 +558,7 @@ class Util {
* @param int $count If passed, this will be set to the number of replacements performed.
* @return string
* @since 4.5.0
+ * @deprecated 8.2.0 Use str_replace() instead.
*/
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));