summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php25
-rw-r--r--lib/l10n/ca.php6
-rw-r--r--lib/l10n/cs_CZ.php6
-rw-r--r--lib/l10n/el.php4
-rw-r--r--lib/l10n/fr.php6
-rw-r--r--lib/l10n/gl.php6
-rw-r--r--lib/l10n/ja.php71
-rw-r--r--lib/l10n/pl.php6
-rw-r--r--lib/l10n/pt_PT.php1
-rw-r--r--lib/l10n/sl.php6
-rw-r--r--lib/l10n/tr.php6
-rw-r--r--lib/private/api.php4
-rw-r--r--lib/private/appframework/routing/routeconfig.php7
-rw-r--r--lib/private/connector/sabre/auth.php16
-rw-r--r--lib/private/files/cache/legacy.php139
-rw-r--r--lib/private/files/cache/upgrade.php235
-rw-r--r--lib/private/helper.php33
-rw-r--r--lib/private/image.php152
-rw-r--r--lib/private/mimetypes.list.php1
-rwxr-xr-xlib/private/preview.php67
-rw-r--r--lib/private/route/route.php (renamed from lib/private/route.php)12
-rw-r--r--lib/private/route/router.php (renamed from lib/private/router.php)105
-rw-r--r--lib/private/server.php15
-rw-r--r--lib/private/session/internal.php14
-rw-r--r--lib/private/session/memory.php20
-rw-r--r--lib/private/session/session.php12
-rw-r--r--lib/private/setup/postgresql.php20
-rw-r--r--lib/private/updater.php45
-rw-r--r--lib/private/urlgenerator.php2
-rwxr-xr-xlib/private/util.php2
-rw-r--r--lib/public/appframework/app.php2
-rw-r--r--lib/public/iservercontainer.php6
-rw-r--r--lib/public/isession.php5
-rw-r--r--lib/public/route/iroute.php79
-rw-r--r--lib/public/route/irouter.php71
-rw-r--r--lib/public/share.php6
-rw-r--r--lib/public/util.php7
37 files changed, 631 insertions, 589 deletions
diff --git a/lib/base.php b/lib/base.php
index 5f15189b118..cc710fc7207 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -74,11 +74,6 @@ class OC {
public static $CLI = false;
/**
- * @var OC_Router
- */
- protected static $router = null;
-
- /**
* @var \OC\Session\Session
*/
public static $session = null;
@@ -387,19 +382,6 @@ class OC {
return OC_Config::getValue('session_lifetime', 60 * 60 * 24);
}
- /**
- * @return OC_Router
- */
- public static function getRouter() {
- if (!isset(OC::$router)) {
- OC::$router = new OC_Router();
- OC::$router->loadRoutes();
- }
-
- return OC::$router;
- }
-
-
public static function loadAppClassPaths() {
foreach (OC_APP::getEnabledApps() as $app) {
$file = OC_App::getAppPath($app) . '/appinfo/classpath.php';
@@ -662,7 +644,10 @@ class OC {
*/
public static function registerPreviewHooks() {
OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write');
- OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete');
+ OC_Hook::connect('OC_Filesystem', 'preDelete', 'OC\Preview', 'prepare_delete_files');
+ OC_Hook::connect('\OCP\Versions', 'preDelete', 'OC\Preview', 'prepare_delete');
+ OC_Hook::connect('\OCP\Trashbin', 'preDelete', 'OC\Preview', 'prepare_delete');
+ OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete_files');
OC_Hook::connect('\OCP\Versions', 'delete', 'OC\Preview', 'post_delete');
OC_Hook::connect('\OCP\Trashbin', 'delete', 'OC\Preview', 'post_delete');
}
@@ -725,7 +710,7 @@ class OC {
OC_App::loadApps();
}
self::checkSingleUserMode();
- OC::getRouter()->match(OC_Request::getRawPathInfo());
+ OC::$server->getRouter()->match(OC_Request::getRawPathInfo());
return;
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
//header('HTTP/1.0 404 Not Found');
diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php
index f1d3eb96294..88bb8ec9eee 100644
--- a/lib/l10n/ca.php
+++ b/lib/l10n/ca.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "L'aplicació no està habilitada",
"Authentication error" => "Error d'autenticació",
"Token expired. Please reload page." => "El testimoni ha expirat. Torneu a carregar la pàgina.",
+"Unknown user" => "Usuari desconegut",
"Files" => "Fitxers",
"Text" => "Text",
"Images" => "Imatges",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s no podeu usar punts en el nom de la base de dades",
"MS SQL username and/or password not valid: %s" => "Nom d'usuari i/o contrasenya MS SQL no vàlids: %s",
"You need to enter either an existing account or the administrator." => "Heu d'escriure un compte existent o el d'administrador.",
+"MySQL/MariaDB username and/or password not valid" => "El nom d'usuari i/o la contrasenya de MySQL/MariaDB no són vàlids",
"DB Error: \"%s\"" => "Error DB: \"%s\"",
"Offending command was: \"%s\"" => "L'ordre en conflicte és: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "L'usuari MySQL/MariaDB '%s'@'localhost' ja existeix.",
+"Drop this user from MySQL/MariaDB" => "Esborreu aquest usuari de MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "L'usuari MySQL/MariaDB '%s'@'%%' ja existeix",
+"Drop this user from MySQL/MariaDB." => "Esborreu aquest usuari de MySQL/MariaDB.",
"Oracle connection could not be established" => "No s'ha pogut establir la connexió Oracle",
"Oracle username and/or password not valid" => "Nom d'usuari i/o contrasenya Oracle no vàlids",
"Offending command was: \"%s\", name: %s, password: %s" => "L'ordre en conflicte és: \"%s\", nom: %s, contrasenya: %s",
diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php
index d74a96a5a99..7969060b2cd 100644
--- a/lib/l10n/cs_CZ.php
+++ b/lib/l10n/cs_CZ.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Aplikace není povolena",
"Authentication error" => "Chyba ověření",
"Token expired. Please reload page." => "Token vypršel. Obnovte prosím stránku.",
+"Unknown user" => "Neznámý uživatel",
"Files" => "Soubory",
"Text" => "Text",
"Images" => "Obrázky",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "V názvu databáze %s nesmíte používat tečky.",
"MS SQL username and/or password not valid: %s" => "Uživatelské jméno či heslo MSSQL není platné: %s",
"You need to enter either an existing account or the administrator." => "Musíte zadat existující účet či správce.",
+"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB uživatelské jméno a/nebo heslo je neplatné",
"DB Error: \"%s\"" => "Chyba databáze: \"%s\"",
"Offending command was: \"%s\"" => "Příslušný příkaz byl: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB uživatel '%s'@'localhost' již existuje.",
+"Drop this user from MySQL/MariaDB" => "Zahodit uživatele z MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB uživatel '%s'@'%%' již existuje",
+"Drop this user from MySQL/MariaDB." => "Zahodit uživatele z MySQL/MariaDB.",
"Oracle connection could not be established" => "Spojení s Oracle nemohlo být navázáno",
"Oracle username and/or password not valid" => "Uživatelské jméno či heslo Oracle není platné",
"Offending command was: \"%s\", name: %s, password: %s" => "Příslušný příkaz byl: \"%s\", jméno: %s, heslo: %s",
diff --git a/lib/l10n/el.php b/lib/l10n/el.php
index 18dc3b83794..148b7fc1fe5 100644
--- a/lib/l10n/el.php
+++ b/lib/l10n/el.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Δεν ενεργοποιήθηκε η εφαρμογή",
"Authentication error" => "Σφάλμα πιστοποίησης",
"Token expired. Please reload page." => "Το αναγνωριστικό έληξε. Παρακαλώ φορτώστε ξανά την σελίδα.",
+"Unknown user" => "Άγνωστος χρήστης",
"Files" => "Αρχεία",
"Text" => "Κείμενο",
"Images" => "Εικόνες",
@@ -39,8 +40,11 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s μάλλον δεν χρησιμοποιείτε τελείες στο όνομα της βάσης δεδομένων",
"MS SQL username and/or password not valid: %s" => "Το όνομα χρήστη και/ή ο κωδικός της MS SQL δεν είναι έγκυρα: %s",
"You need to enter either an existing account or the administrator." => "Χρειάζεται να εισάγετε είτε έναν υπάρχον λογαριασμό ή του διαχειριστή.",
+"MySQL/MariaDB username and/or password not valid" => "Μη έγκυρο όνομα χρήστη ή/και συνθηματικό της MySQL/MariaDB",
"DB Error: \"%s\"" => "Σφάλμα Βάσης Δεδομένων: \"%s\"",
"Offending command was: \"%s\"" => "Η εντολη παραβατικοτητας ηταν: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Υπάρχει ήδη ο χρήστης '%s'@'localhost' της MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Υπάρχει ήδη ο χρήστης '%s'@'%%' της MySQL/MariaDB",
"Oracle connection could not be established" => "Αδυναμία σύνδεσης Oracle",
"Oracle username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της Oracle",
"Offending command was: \"%s\", name: %s, password: %s" => "Η εντολη παραβατικοτητας ηταν: \"%s\", ονομα: %s, κωδικος: %s",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index ebed0588588..d866fb664ee 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "L'application n'est pas activée",
"Authentication error" => "Erreur d'authentification",
"Token expired. Please reload page." => "La session a expiré. Veuillez recharger la page.",
+"Unknown user" => "Utilisateur inconnu",
"Files" => "Fichiers",
"Text" => "Texte",
"Images" => "Images",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s vous nez pouvez pas utiliser de points dans le nom de la base de données",
"MS SQL username and/or password not valid: %s" => "Le nom d'utilisateur et/ou le mot de passe de la base MS SQL est invalide : %s",
"You need to enter either an existing account or the administrator." => "Vous devez spécifier soit le nom d'un compte existant, soit celui de l'administrateur.",
+"MySQL/MariaDB username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe MySQL/MariaDB invalide",
"DB Error: \"%s\"" => "Erreur de la base de données : \"%s\"",
"Offending command was: \"%s\"" => "La requête en cause est : \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "L'utilisateur MySQL/MariaDB '%s'@'localhost' existe déjà.",
+"Drop this user from MySQL/MariaDB" => "Retirer cet utilisateur de la base MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "L'utilisateur MySQL/MariaDB '%s'@'%%' existe déjà",
+"Drop this user from MySQL/MariaDB." => "Retirer cet utilisateur de la base MySQL/MariaDB.",
"Oracle connection could not be established" => "La connexion Oracle ne peut pas être établie",
"Oracle username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base Oracle invalide",
"Offending command was: \"%s\", name: %s, password: %s" => "La requête en cause est : \"%s\", nom : %s, mot de passe : %s",
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index 8a06f40d0e1..cc1351c2f15 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "O aplicativo non está activado",
"Authentication error" => "Produciuse un erro de autenticación",
"Token expired. Please reload page." => "Testemuña caducada. Recargue a páxina.",
+"Unknown user" => "Usuario descoñecido",
"Files" => "Ficheiros",
"Text" => "Texto",
"Images" => "Imaxes",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s non se poden empregar puntos na base de datos",
"MS SQL username and/or password not valid: %s" => "Nome de usuario e/ou contrasinal de MS SQL incorrecto: %s",
"You need to enter either an existing account or the administrator." => "Deberá introducir unha conta existente ou o administrador.",
+"MySQL/MariaDB username and/or password not valid" => "O nome e/ou o contrasinal do usuario de MySQL/MariaDB non é correcto",
"DB Error: \"%s\"" => "Produciuse un erro na base de datos: «%s»",
"Offending command was: \"%s\"" => "A orde ofensiva foi: «%s»",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Xa existe o usuario «%s»@«localhost» no MySQL/MariaDB.",
+"Drop this user from MySQL/MariaDB" => "Eliminar este usuario do MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Xa existe o usuario «%s»@«%%» no MySQL/MariaDB",
+"Drop this user from MySQL/MariaDB." => "Eliminar este usuario do MySQL/MariaDB.",
"Oracle connection could not be established" => "Non foi posíbel estabelecer a conexión con Oracle",
"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal de Oracle incorrecto",
"Offending command was: \"%s\", name: %s, password: %s" => "A orde ofensiva foi: «%s», nome: %s, contrasinal: %s",
diff --git a/lib/l10n/ja.php b/lib/l10n/ja.php
new file mode 100644
index 00000000000..015c885904e
--- /dev/null
+++ b/lib/l10n/ja.php
@@ -0,0 +1,71 @@
+<?php
+$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => " \"%s\" アプリは、このバージョンのownCloudと互換性がないためインストールできません。",
+"No app name specified" => "アプリ名が未指定",
+"Help" => "ヘルプ",
+"Personal" => "個人",
+"Settings" => "設定",
+"Users" => "ユーザー",
+"Admin" => "管理",
+"Failed to upgrade \"%s\"." => "\"%s\" へのアップグレードに失敗しました。",
+"Unknown filetype" => "不明なファイルタイプ",
+"Invalid image" => "無効な画像",
+"web services under your control" => "管理下のウェブサービス",
+"ZIP download is turned off." => "ZIPダウンロードは無効です。",
+"Files need to be downloaded one by one." => "ファイルは1つずつダウンロードする必要があります。",
+"Back to Files" => "ファイルに戻る",
+"Selected files too large to generate zip file." => "選択したファイルはZIPファイルの生成には大きすぎます。",
+"Please download the files separately in smaller chunks or kindly ask your administrator." => "少しずつに分けてファイルをダウンロードするか、管理者に問い合わせてください。",
+"No source specified when installing app" => "アプリインストール時のソースが未指定",
+"No href specified when installing app from http" => "アプリインストール時のhttpの URL が未指定",
+"No path specified when installing app from local file" => "アプリインストール時のローカルファイルのパスが未指定",
+"Archives of type %s are not supported" => "\"%s\"タイプのアーカイブ形式は未サポート",
+"Failed to open archive when installing app" => "アプリをインストール中にアーカイブファイルを開けませんでした。",
+"App does not provide an info.xml file" => "アプリにinfo.xmlファイルが入っていません",
+"App can't be installed because of not allowed code in the App" => "アプリで許可されないコードが入っているのが原因でアプリがインストールできません",
+"App can't be installed because it is not compatible with this version of ownCloud" => "アプリは、このバージョンのownCloudと互換性がないためインストールできません。",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "info.xml/versionのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません",
+"App directory already exists" => "アプリディレクトリはすでに存在します",
+"Can't create app folder. Please fix permissions. %s" => "アプリフォルダーを作成できませんでした。%s のパーミッションを修正してください。",
+"Application is not enabled" => "アプリケーションは無効です",
+"Authentication error" => "認証エラー",
+"Token expired. Please reload page." => "トークンが無効になりました。ページを再読込してください。",
+"Unknown user" => "不明なユーザー",
+"Files" => "ファイル",
+"Text" => "TTY TDD",
+"Images" => "画像",
+"%s enter the database username." => "%s のデータベースのユーザー名を入力してください。",
+"%s enter the database name." => "%s のデータベース名を入力してください。",
+"%s you may not use dots in the database name" => "%s ではデータベース名にドットを利用できないかもしれません。",
+"MS SQL username and/or password not valid: %s" => "MS SQL サーバーのユーザー名/パスワードが正しくありません: %s",
+"You need to enter either an existing account or the administrator." => "既存のアカウントもしくは管理者のどちらかを入力する必要があります。",
+"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB のユーザー名及び/またはパスワードが無効",
+"DB Error: \"%s\"" => "DBエラー: \"%s\"",
+"Offending command was: \"%s\"" => "違反コマンド: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB のユーザー '%s'@'localhost' はすでに存在します。",
+"Drop this user from MySQL/MariaDB" => "MySQL/MariaDB からこのユーザーを削除",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB のユーザー '%s'@'%%' はすでに存在します",
+"Drop this user from MySQL/MariaDB." => "MySQL/MariaDB からこのユーザーを削除。",
+"Oracle connection could not be established" => "Oracleへの接続が確立できませんでした。",
+"Oracle username and/or password not valid" => "Oracleのユーザー名もしくはパスワードは有効ではありません",
+"Offending command was: \"%s\", name: %s, password: %s" => "違反コマンド: \"%s\"、名前: %s、パスワード: %s",
+"PostgreSQL username and/or password not valid" => "PostgreSQLのユーザー名もしくはパスワードは有効ではありません",
+"Set an admin username." => "管理者のユーザー名を設定",
+"Set an admin password." => "管理者のパスワードを設定。",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "WebDAVインターフェースに問題があると思われるため、WEBサーバーはまだファイルの同期を許可するよう適切に設定されていません。",
+"Please double check the <a href='%s'>installation guides</a>." => "<a href='%s'>インストールガイド</a>をよく確認してください。",
+"%s shared »%s« with you" => "%sが あなたと »%s«を共有しました",
+"Could not find category \"%s\"" => "カテゴリ \"%s\" が見つかりませんでした",
+"seconds ago" => "数秒前",
+"_%n minute ago_::_%n minutes ago_" => array("%n 分前"),
+"_%n hour ago_::_%n hours ago_" => array("%n 時間前"),
+"today" => "今日",
+"yesterday" => "1日前",
+"_%n day go_::_%n days ago_" => array("%n日前"),
+"last month" => "1ヶ月前",
+"_%n month ago_::_%n months ago_" => array("%nヶ月前"),
+"last year" => "1年前",
+"years ago" => "年前"
+);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index 56f0b80efdb..bc5e4a947c7 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Aplikacja nie jest włączona",
"Authentication error" => "Błąd uwierzytelniania",
"Token expired. Please reload page." => "Token wygasł. Proszę ponownie załadować stronę.",
+"Unknown user" => "Nieznany użytkownik",
"Files" => "Pliki",
"Text" => "Połączenie tekstowe",
"Images" => "Obrazy",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s nie można używać kropki w nazwie bazy danych",
"MS SQL username and/or password not valid: %s" => "Nazwa i/lub hasło serwera MS SQL jest niepoprawne: %s.",
"You need to enter either an existing account or the administrator." => "Należy wprowadzić istniejące konto użytkownika lub administratora.",
+"MySQL/MariaDB username and/or password not valid" => "Użytkownik i/lub hasło do MySQL/MariaDB są niepoprawne",
"DB Error: \"%s\"" => "Błąd DB: \"%s\"",
"Offending command was: \"%s\"" => "Niepoprawna komenda: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Użytkownik '%s'@'localhost' MySQL/MariaDB już istnieje.",
+"Drop this user from MySQL/MariaDB" => "Usuń tego użytkownika z MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Użytkownik '%s'@'%%' MySQL/MariaDB już istnieje.",
+"Drop this user from MySQL/MariaDB." => "Usuń tego użytkownika z MySQL/MariaDB",
"Oracle connection could not be established" => "Nie można ustanowić połączenia z bazą Oracle",
"Oracle username and/or password not valid" => "Oracle: Nazwa użytkownika i/lub hasło jest niepoprawne",
"Offending command was: \"%s\", name: %s, password: %s" => "Niepoprawne polecania: \"%s\", nazwa: %s, hasło: %s",
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index 27d79092e76..e6dd459a7e1 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "A aplicação não está activada",
"Authentication error" => "Erro na autenticação",
"Token expired. Please reload page." => "O token expirou. Por favor recarregue a página.",
+"Unknown user" => "Utilizador desconhecido",
"Files" => "Ficheiros",
"Text" => "Texto",
"Images" => "Imagens",
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index 2a65e03b6f0..411a14370ee 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Program ni omogočen",
"Authentication error" => "Napaka overjanja",
"Token expired. Please reload page." => "Žeton je potekel. Stran je treba ponovno naložiti.",
+"Unknown user" => "Neznan uporabnik",
"Files" => "Datoteke",
"Text" => "Besedilo",
"Images" => "Slike",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s - v imenu podatkovne zbirke ni dovoljeno uporabljati pik.",
"MS SQL username and/or password not valid: %s" => "Uporabniško ime ali geslo MS SQL ni veljavno: %s",
"You need to enter either an existing account or the administrator." => "Prijaviti se je treba v obstoječi ali pa skrbniški račun.",
+"MySQL/MariaDB username and/or password not valid" => "Uporabniško ime ali geslo za MySQL/MariaDB ni veljavno",
"DB Error: \"%s\"" => "Napaka podatkovne zbirke: \"%s\"",
"Offending command was: \"%s\"" => "Napačni ukaz je: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Uporabnik podatkovne zbirke MySQL/MariaDB '%s'@'localhost' že obstaja.",
+"Drop this user from MySQL/MariaDB" => "Odstrani uporabnika iz podatkovne zbirke MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Uporabnik podatkovne zbirke MySQL/MariaDB '%s'@'%%' že obstaja.",
+"Drop this user from MySQL/MariaDB." => "Odstrani uporabnika iz podatkovne zbirke MySQL/MariaDB.",
"Oracle connection could not be established" => "Povezave s sistemom Oracle ni mogoče vzpostaviti.",
"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni veljavno",
"Offending command was: \"%s\", name: %s, password: %s" => "Napačni ukaz je: \"%s\", ime: %s, geslo: %s",
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 314012b29a8..2fce8b87bf4 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Uygulama etkinleştirilmedi",
"Authentication error" => "Kimlik doğrulama hatası",
"Token expired. Please reload page." => "Jetonun süresi geçti. Lütfen sayfayı yenileyin.",
+"Unknown user" => "Bilinmeyen kullanıcı",
"Files" => "Dosyalar",
"Text" => "Metin",
"Images" => "Resimler",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s veritabanı adında nokta kullanamayabilirsiniz",
"MS SQL username and/or password not valid: %s" => "MS SQL kullanıcı adı ve/veya parolası geçersiz: %s",
"You need to enter either an existing account or the administrator." => "Bir konto veya kullanici birlemek ihtiyacin. ",
+"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB kullanıcı adı ve/veya parolası geçersiz",
"DB Error: \"%s\"" => "DB Hata: ''%s''",
"Offending command was: \"%s\"" => "Komut rahasiz ''%s''. ",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB kullanıcı '%s'@'localhost' zaten mevcut.",
+"Drop this user from MySQL/MariaDB" => "Bu kullanıcıyı MySQL/MariaDB'dan at (drop)",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB kullanıcısı '%s'@'%%' zaten mevcut",
+"Drop this user from MySQL/MariaDB." => "Bu kullanıcıyı MySQL/MariaDB'dan at (drop)",
"Oracle connection could not be established" => "Oracle bağlantısı kurulamadı",
"Oracle username and/or password not valid" => "Adi klullanici ve/veya parola Oracle mantikli değildir. ",
"Offending command was: \"%s\", name: %s, password: %s" => "Hatalı komut: \"%s\", ad: %s, parola: %s",
diff --git a/lib/private/api.php b/lib/private/api.php
index e8e54e375e9..b3b5eb1067b 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -65,8 +65,8 @@ class OC_API {
$name = strtolower($method).$url;
$name = str_replace(array('/', '{', '}'), '_', $name);
if(!isset(self::$actions[$name])) {
- OC::getRouter()->useCollection('ocs');
- OC::getRouter()->create($name, $url)
+ OC::$server->getRouter()->useCollection('ocs');
+ OC::$server->getRouter()->create($name, $url)
->method($method)
->defaults($defaults)
->requirements($requirements)
diff --git a/lib/private/appframework/routing/routeconfig.php b/lib/private/appframework/routing/routeconfig.php
index 716358444a2..35bee75cc4d 100644
--- a/lib/private/appframework/routing/routeconfig.php
+++ b/lib/private/appframework/routing/routeconfig.php
@@ -23,6 +23,7 @@
namespace OC\AppFramework\routing;
use OC\AppFramework\DependencyInjection\DIContainer;
+use OCP\Route\IRouter;
/**
* Class RouteConfig
@@ -36,10 +37,10 @@ class RouteConfig {
/**
* @param \OC\AppFramework\DependencyInjection\DIContainer $container
- * @param \OC_Router $router
+ * @param \OCP\Route\IRouter $router
* @internal param $appName
*/
- public function __construct(DIContainer $container, \OC_Router $router, $routes) {
+ public function __construct(DIContainer $container, IRouter $router, $routes) {
$this->routes = $routes;
$this->container = $container;
$this->router = $router;
@@ -47,7 +48,7 @@ class RouteConfig {
}
/**
- * The routes and resource will be registered to the \OC_Router
+ * The routes and resource will be registered to the \OCP\Route\IRouter
*/
public function register() {
diff --git a/lib/private/connector/sabre/auth.php b/lib/private/connector/sabre/auth.php
index 0c84fa6b757..5577273df8c 100644
--- a/lib/private/connector/sabre/auth.php
+++ b/lib/private/connector/sabre/auth.php
@@ -73,6 +73,20 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
*/
public function authenticate(Sabre_DAV_Server $server, $realm) {
+ $result = $this->auth($server, $realm);
+
+ // close the session - right after authentication there is not need to write to the session any more
+ \OC::$session->close();
+
+ return $result;
+ }
+
+ /**
+ * @param Sabre_DAV_Server $server
+ * @param $realm
+ * @return bool
+ */
+ private function auth(Sabre_DAV_Server $server, $realm) {
if (OC_User::handleApacheAuth() || OC_User::isLoggedIn()) {
$user = OC_User::getUser();
OC_Util::setupFS($user);
@@ -81,5 +95,5 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
}
return parent::authenticate($server, $realm);
- }
+ }
}
diff --git a/lib/private/files/cache/legacy.php b/lib/private/files/cache/legacy.php
deleted file mode 100644
index 4d5f58741e9..00000000000
--- a/lib/private/files/cache/legacy.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 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\Cache;
-
-/**
- * Provide read only support for the old filecache
- */
-class Legacy {
- private $user;
-
- private $cacheHasItems = null;
-
- /**
- * @param string $user
- */
- public function __construct($user) {
- $this->user = $user;
- }
-
- /**
- * get the numbers of items in the legacy cache
- *
- * @return int
- */
- function getCount() {
- $sql = 'SELECT COUNT(`id`) AS `count` FROM `*PREFIX*fscache` WHERE `user` = ?';
- $result = \OC_DB::executeAudited($sql, array($this->user));
- if ($row = $result->fetchRow()) {
- return $row['count'];
- } else {
- return 0;
- }
- }
-
- /**
- * check if a legacy cache is present and holds items
- *
- * @return bool
- */
- function hasItems() {
- if (!is_null($this->cacheHasItems)) {
- return $this->cacheHasItems;
- }
- try {
- $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*fscache` WHERE `user` = ?',1);
- } catch (\Exception $e) {
- $this->cacheHasItems = false;
- return false;
- }
- try {
- $result = $query->execute(array($this->user));
- } catch (\Exception $e) {
- $this->cacheHasItems = false;
- return false;
- }
-
- if ($result === false || property_exists($result, 'error_message_prefix')) {
- $this->cacheHasItems = false;
- return false;
- }
-
- $this->cacheHasItems = (bool)$result->fetchRow();
- return $this->cacheHasItems;
- }
-
- /**
- * get an item from the legacy cache
- *
- * @param string $path
- * @return array
- */
- function get($path) {
- if (is_numeric($path)) {
- $sql = 'SELECT * FROM `*PREFIX*fscache` WHERE `id` = ?';
- } else {
- $sql = 'SELECT * FROM `*PREFIX*fscache` WHERE `path` = ?';
- }
- $result = \OC_DB::executeAudited($sql, array($path));
- $data = $result->fetchRow();
- $data['etag'] = $this->getEtag($data['path'], $data['user']);
- return $data;
- }
-
- /**
- * Get the ETag for the given path
- *
- * @param type $path
- * @return string
- */
- function getEtag($path, $user = null) {
- static $query = null;
-
- $pathDetails = explode('/', $path, 4);
- if((!$user) && !isset($pathDetails[1])) {
- //no user!? Too odd, return empty string.
- return '';
- } else if(!$user) {
- //guess user from path, if no user passed.
- $user = $pathDetails[1];
- }
-
- if(!isset($pathDetails[3]) || is_null($pathDetails[3])) {
- $relativePath = '';
- } else {
- $relativePath = $pathDetails[3];
- }
-
- if(is_null($query)){
- $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = \'{DAV:}getetag\'');
- }
- $result = \OC_DB::executeAudited($query,array($user, '/' . $relativePath));
- if ($row = $result->fetchRow()) {
- return trim($row['propertyvalue'], '"');
- } else {
- return '';
- }
- }
-
- /**
- * get all child items of an item from the legacy cache
- *
- * @param int $id
- * @return array
- */
- function getChildren($id) {
- $result = \OC_DB::executeAudited('SELECT * FROM `*PREFIX*fscache` WHERE `parent` = ?', array($id));
- $data = $result->fetchAll();
- foreach ($data as $i => $item) {
- $data[$i]['etag'] = $this->getEtag($item['path'], $item['user']);
- }
- return $data;
- }
-}
diff --git a/lib/private/files/cache/upgrade.php b/lib/private/files/cache/upgrade.php
deleted file mode 100644
index e3a46896cbf..00000000000
--- a/lib/private/files/cache/upgrade.php
+++ /dev/null
@@ -1,235 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 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\Cache;
-
-class Upgrade {
- /**
- * @var Legacy $legacy
- */
- private $legacy;
-
- private $numericIds = array();
-
- private $mimeTypeIds = array();
-
- /**
- * @param Legacy $legacy
- */
- public function __construct($legacy) {
- $this->legacy = $legacy;
- }
-
- /**
- * Preform a upgrade a path and it's childs
- *
- * @param string $path
- * @param bool $mode
- */
- function upgradePath($path, $mode = Scanner::SCAN_RECURSIVE) {
- if (!$this->legacy->hasItems()) {
- return;
- }
- \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $path);
- if ($row = $this->legacy->get($path)) {
- $data = $this->getNewData($row);
- if ($data) {
- $this->insert($data);
- $this->upgradeChilds($data['id'], $mode);
- }
- }
- }
-
- /**
- * upgrade all child elements of an item
- *
- * @param int $id
- * @param bool $mode
- */
- function upgradeChilds($id, $mode = Scanner::SCAN_RECURSIVE) {
- $children = $this->legacy->getChildren($id);
- foreach ($children as $child) {
- $childData = $this->getNewData($child);
- \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $child['path']);
- if ($childData) {
- $this->insert($childData);
- if ($mode == Scanner::SCAN_RECURSIVE) {
- $this->upgradeChilds($child['id']);
- }
- }
- }
- }
-
- /**
- * insert data into the new cache
- *
- * @param array $data the data for the new cache
- */
- function insert($data) {
- static $insertQuery = null;
- if(is_null($insertQuery)) {
- $insertQuery = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache`
- ( `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag` )
- VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
- }
- if (!$this->inCache($data['storage'], $data['path_hash'], $data['id'])) {
- \OC_DB::executeAudited($insertQuery, array($data['id'], $data['storage'],
- $data['path'], $data['path_hash'], $data['parent'], $data['name'],
- $data['mimetype'], $data['mimepart'], $data['size'], $data['mtime'], $data['encrypted'], $data['etag']));
- }
- }
-
- /**
- * check if an item is already in the new cache
- *
- * @param string $storage
- * @param string $pathHash
- * @param string $id
- * @return bool
- */
- function inCache($storage, $pathHash, $id) {
- static $query = null;
- if(is_null($query)) {
- $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE (`storage` = ? AND `path_hash` = ?) OR `fileid` = ?');
- }
- $result = \OC_DB::executeAudited($query, array($storage, $pathHash, $id));
- return (bool)$result->fetchRow();
- }
-
- /**
- * get the new data array from the old one
- *
- * @param array $data the data from the old cache
- * Example data array
- * Array
- * (
- * [id] => 418
- * [path] => /tina/files/picture.jpg //relative to datadir
- * [path_hash] => 66d4547e372888deed80b24fec9b192b
- * [parent] => 234
- * [name] => picture.jpg
- * [user] => tina
- * [size] => 1265283
- * [ctime] => 1363909709
- * [mtime] => 1363909709
- * [mimetype] => image/jpeg
- * [mimepart] => image
- * [encrypted] => 0
- * [versioned] => 0
- * [writable] => 1
- * )
- *
- * @return array
- */
- function getNewData($data) {
- //Make sure there is a path, otherwise we can do nothing.
- if(!isset($data['path'])) {
- return false;
- }
- $newData = $data;
- /**
- * @var \OC\Files\Storage\Storage $storage
- * @var string $internalPath;
- */
- list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($data['path']);
- if ($storage) {
- $newData['etag'] = $data['etag'];
- $newData['path_hash'] = md5($internalPath);
- $newData['path'] = $internalPath;
- $newData['storage'] = $this->getNumericId($storage);
- $newData['parent'] = ($internalPath === '') ? -1 : $data['parent'];
- $newData['permissions'] = ($data['writable']) ? \OCP\PERMISSION_ALL : \OCP\PERMISSION_READ;
- $newData['storage_object'] = $storage;
- $newData['mimetype'] = $this->getMimetypeId($newData['mimetype'], $storage);
- $newData['mimepart'] = $this->getMimetypeId($newData['mimepart'], $storage);
- return $newData;
- } else {
- \OC_Log::write('core', 'Unable to migrate data from old cache for '.$data['path'].' because the storage was not found', \OC_Log::ERROR);
- return false;
- }
- }
-
- /**
- * get the numeric storage id
- *
- * @param \OC\Files\Storage\Storage $storage
- * @return int
- */
- function getNumericId($storage) {
- $storageId = $storage->getId();
- if (!isset($this->numericIds[$storageId])) {
- $cache = $storage->getCache();
- $this->numericIds[$storageId] = $cache->getNumericStorageId();
- }
- return $this->numericIds[$storageId];
- }
-
- /**
- * get the numeric id for a mimetype
- *
- * @param string $mimetype
- * @param \OC\Files\Storage\Storage $storage
- * @return int
- */
- function getMimetypeId($mimetype, $storage) {
- if (!isset($this->mimeTypeIds[$mimetype])) {
- $cache = new Cache($storage);
- $this->mimeTypeIds[$mimetype] = $cache->getMimetypeId($mimetype);
- }
- return $this->mimeTypeIds[$mimetype];
- }
-
- /**
- * check if a cache upgrade is required for $user
- *
- * @param string $user
- * @return bool
- */
- static function needUpgrade($user) {
- $cacheVersion = (int)\OCP\Config::getUserValue($user, 'files', 'cache_version', 4);
- if ($cacheVersion < 5) {
- $legacy = new \OC\Files\Cache\Legacy($user);
- if ($legacy->hasItems()) {
- return true;
- }
- self::upgradeDone($user);
- }
-
- return false;
- }
-
- /**
- * mark the filecache as upgrade
- *
- * @param string $user
- */
- static function upgradeDone($user) {
- \OCP\Config::setUserValue($user, 'files', 'cache_version', 5);
- }
-
- /**
- * Does a "silent" upgrade, i.e. without an Event-Source as triggered
- * on User-Login via Ajax. This method is called within the regular
- * ownCloud upgrade.
- *
- * @param string $user a User ID
- */
- public static function doSilentUpgrade($user) {
- if(!self::needUpgrade($user)) {
- return;
- }
- $legacy = new \OC\Files\Cache\Legacy($user);
- if ($legacy->hasItems()) {
- \OC_DB::beginTransaction();
- $upgrade = new \OC\Files\Cache\Upgrade($legacy);
- $upgrade->upgradePath('/' . $user . '/files');
- \OC_DB::commit();
- }
- \OC\Files\Cache\Upgrade::upgradeDone($user);
- }
-}
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 0b1a26bbecd..98a86388d20 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -308,7 +308,7 @@ class OC_Helper {
/**
* @brief Make a computer file size
- * @param string $str file size in a fancy format
+ * @param string $str file size in human readable format
* @return int a file size in bytes
*
* Makes 2kB to 2048.
@@ -338,41 +338,12 @@ class OC_Helper {
$bytes *= $bytes_array[$matches[1]];
}
- $bytes = round($bytes, 2);
+ $bytes = round($bytes);
return $bytes;
}
/**
- * @brief Recursive editing of file permissions
- * @param string $path path to file or folder
- * @param int $filemode unix style file permissions
- * @return bool
- */
- static function chmodr($path, $filemode) {
- if (!is_dir($path))
- return chmod($path, $filemode);
- $dh = opendir($path);
- if(is_resource($dh)) {
- while (($file = readdir($dh)) !== false) {
- if ($file != '.' && $file != '..') {
- $fullpath = $path . '/' . $file;
- if (is_link($fullpath))
- return false;
- elseif (!is_dir($fullpath) && !@chmod($fullpath, $filemode))
- return false; elseif (!self::chmodr($fullpath, $filemode))
- return false;
- }
- }
- closedir($dh);
- }
- if (@chmod($path, $filemode))
- return true;
- else
- return false;
- }
-
- /**
* @brief Recursive copying of folders
* @param string $src source folder
* @param string $dest target folder
diff --git a/lib/private/image.php b/lib/private/image.php
index a4a23f0f097..c987ce92c3c 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -35,7 +35,7 @@ class OC_Image {
/**
* @brief Get mime type for an image file.
* @param string|null $filepath The path to a local image file.
- * @returns string The mime type if the it could be determined, otherwise an empty string.
+ * @return string The mime type if the it could be determined, otherwise an empty string.
*/
static public function getMimeTypeForFile($filePath) {
// exif_imagetype throws "read error!" if file is less than 12 byte
@@ -48,10 +48,11 @@ class OC_Image {
}
/**
- * @brief Constructor.
- * @param string|resource $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
- * @returns bool False on error
- */
+ * @brief Constructor.
+ * @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by
+ * an imagecreate* function.
+ * @return \OC_Image False on error
+ */
public function __construct($imageRef = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
@@ -70,7 +71,7 @@ class OC_Image {
/**
* @brief Determine whether the object contains an image resource.
- * @returns bool
+ * @return bool
*/
public function valid() { // apparently you can't name a method 'empty'...
return is_resource($this->resource);
@@ -78,7 +79,7 @@ class OC_Image {
/**
* @brief Returns the MIME type of the image or an empty string if no image is loaded.
- * @returns int
+ * @return int
*/
public function mimeType() {
return $this->valid() ? $this->mimeType : '';
@@ -86,7 +87,7 @@ class OC_Image {
/**
* @brief Returns the width of the image or -1 if no image is loaded.
- * @returns int
+ * @return int
*/
public function width() {
return $this->valid() ? imagesx($this->resource) : -1;
@@ -94,7 +95,7 @@ class OC_Image {
/**
* @brief Returns the height of the image or -1 if no image is loaded.
- * @returns int
+ * @return int
*/
public function height() {
return $this->valid() ? imagesy($this->resource) : -1;
@@ -102,7 +103,7 @@ class OC_Image {
/**
* @brief Returns the width when the image orientation is top-left.
- * @returns int
+ * @return int
*/
public function widthTopLeft() {
$o = $this->getOrientation();
@@ -125,7 +126,7 @@ class OC_Image {
/**
* @brief Returns the height when the image orientation is top-left.
- * @returns int
+ * @return int
*/
public function heightTopLeft() {
$o = $this->getOrientation();
@@ -147,34 +148,46 @@ class OC_Image {
}
/**
- * @brief Outputs the image.
- * @returns bool
- */
- public function show() {
- header('Content-Type: '.$this->mimeType());
- return $this->_output();
+ * @brief Outputs the image.
+ * @param string $mimeType
+ * @return bool
+ */
+ public function show($mimeType=null) {
+ if($mimeType === null) {
+ $mimeType = $this->mimeType();
+ }
+ header('Content-Type: '.$mimeType);
+ return $this->_output(null, $mimeType);
}
/**
- * @brief Saves the image.
- * @returns bool
- * @param string $filePath
- */
+ * @brief Saves the image.
+ * @param string $filePath
+ * @param string $mimeType
+ * @return bool
+ */
- public function save($filePath=null) {
+ public function save($filePath=null, $mimeType=null) {
+ if($mimeType === null) {
+ $mimeType = $this->mimeType();
+ }
if($filePath === null && $this->filePath === null) {
OC_Log::write('core', __METHOD__.'(): called with no path.', OC_Log::ERROR);
return false;
} elseif($filePath === null && $this->filePath !== null) {
$filePath = $this->filePath;
}
- return $this->_output($filePath);
+ return $this->_output($filePath, $mimeType);
}
/**
- * @brief Outputs/saves the image.
- */
- private function _output($filePath=null) {
+ * @brief Outputs/saves the image.
+ * @param string $filePath
+ * @param string $mimeType
+ * @return bool
+ * @throws Exception
+ */
+ private function _output($filePath=null, $mimeType=null) {
if($filePath) {
if (!file_exists(dirname($filePath)))
mkdir(dirname($filePath), 0777, true);
@@ -192,7 +205,30 @@ class OC_Image {
return false;
}
- switch($this->imageType) {
+ $imageType = $this->imageType;
+ if($mimeType !== null) {
+ switch($mimeType) {
+ case 'image/gif':
+ $imageType = IMAGETYPE_GIF;
+ break;
+ case 'image/jpeg':
+ $imageType = IMAGETYPE_JPEG;
+ break;
+ case 'image/png':
+ $imageType = IMAGETYPE_PNG;
+ break;
+ case 'image/x-xbitmap':
+ $imageType = IMAGETYPE_XBM;
+ break;
+ case 'image/bmp':
+ $imageType = IMAGETYPE_BMP;
+ break;
+ default:
+ throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format');
+ }
+ }
+
+ switch($imageType) {
case IMAGETYPE_GIF:
$retVal = imagegif($this->resource, $filePath);
break;
@@ -203,7 +239,12 @@ class OC_Image {
$retVal = imagepng($this->resource, $filePath);
break;
case IMAGETYPE_XBM:
- $retVal = imagexbm($this->resource, $filePath);
+ if (function_exists('imagexbm')) {
+ $retVal = imagexbm($this->resource, $filePath);
+ } else {
+ throw new Exception('\OC_Image::_output(): imagexbm() is not supported.');
+ }
+
break;
case IMAGETYPE_WBMP:
$retVal = imagewbmp($this->resource, $filePath);
@@ -225,14 +266,14 @@ class OC_Image {
}
/**
- * @returns resource Returns the image resource in any.
+ * @return resource Returns the image resource in any.
*/
public function resource() {
return $this->resource;
}
/**
- * @returns Returns the raw image data.
+ * @return string Returns the raw image data.
*/
function data() {
ob_start();
@@ -267,7 +308,7 @@ class OC_Image {
/**
* (I'm open for suggestions on better method name ;)
* @brief Get the orientation based on EXIF data.
- * @returns The orientation or -1 if no EXIF data is available.
+ * @return int The orientation or -1 if no EXIF data is available.
*/
public function getOrientation() {
if(!is_callable('exif_read_data')) {
@@ -295,7 +336,7 @@ class OC_Image {
/**
* (I'm open for suggestions on better method name ;)
* @brief Fixes orientation based on EXIF data.
- * @returns bool.
+ * @return bool.
*/
public function fixOrientation() {
$o = $this->getOrientation();
@@ -355,10 +396,10 @@ class OC_Image {
}
/**
- * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function.
- * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
- * @returns An image resource or false on error
- */
+ * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function.
+ * @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
+ * @return resource|false An image resource or false on error
+ */
public function load($imageRef) {
if(is_resource($imageRef)) {
if(get_resource_type($imageRef) == 'gd') {
@@ -383,7 +424,7 @@ class OC_Image {
* @brief Loads an image from an open file handle.
* It is the responsibility of the caller to position the pointer at the correct place and to close the handle again.
* @param resource $handle
- * @returns An image resource or false on error
+ * @return An image resource or false on error
*/
public function loadFromFileHandle($handle) {
OC_Log::write('core', __METHOD__.'(): Trying', OC_Log::DEBUG);
@@ -395,8 +436,8 @@ class OC_Image {
/**
* @brief Loads an image from a local file.
- * @param $imagePath The path to a local file.
- * @returns An image resource or false on error
+ * @param bool|string $imagePath The path to a local file.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromFile($imagePath=false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
@@ -496,8 +537,8 @@ class OC_Image {
/**
* @brief Loads an image from a string of data.
- * @param $str A string of image data as read from a file.
- * @returns An image resource or false on error
+ * @param string $str A string of image data as read from a file.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromData($str) {
if(is_resource($str)) {
@@ -521,8 +562,8 @@ class OC_Image {
/**
* @brief Loads an image from a base64 encoded string.
- * @param $str A string base64 encoded string of image data.
- * @returns An image resource or false on error
+ * @param string $str A string base64 encoded string of image data.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromBase64($str) {
if(!is_string($str)) {
@@ -551,7 +592,7 @@ class OC_Image {
* @param string $fileName <p>
* Path to the BMP image.
* </p>
- * @return resource an image resource identifier on success, <b>FALSE</b> on errors.
+ * @return bool|resource an image resource identifier on success, <b>FALSE</b> on errors.
*/
private function imagecreatefrombmp($fileName) {
if (!($fh = fopen($fileName, 'rb'))) {
@@ -690,7 +731,7 @@ class OC_Image {
/**
* @brief Resizes the image preserving ratio.
* @param integer $maxSize The maximum size of either the width or height.
- * @returns bool
+ * @return bool
*/
public function resize($maxSize) {
if(!$this->valid()) {
@@ -713,6 +754,11 @@ class OC_Image {
return true;
}
+ /**
+ * @param int $width
+ * @param int $height
+ * @return bool
+ */
public function preciseResize($width, $height) {
if (!$this->valid()) {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
@@ -748,8 +794,8 @@ class OC_Image {
/**
* @brief Crops the image to the middle square. If the image is already square it just returns.
- * @param int maximum size for the result (optional)
- * @returns bool for success or failure
+ * @param int $size maximum size for the result (optional)
+ * @return bool for success or failure
*/
public function centerCrop($size=0) {
if(!$this->valid()) {
@@ -807,11 +853,11 @@ class OC_Image {
/**
* @brief Crops the image from point $x$y with dimension $wx$h.
- * @param $x Horizontal position
- * @param $y Vertical position
- * @param $w Width
- * @param $h Height
- * @returns bool for success or failure
+ * @param int $x Horizontal position
+ * @param int $y Vertical position
+ * @param int $w Width
+ * @param int $h Height
+ * @return bool for success or failure
*/
public function crop($x, $y, $w, $h) {
if(!$this->valid()) {
@@ -839,7 +885,7 @@ class OC_Image {
* @brief Resizes the image to fit within a boundry while preserving ratio.
* @param integer $maxWidth
* @param integer $maxHeight
- * @returns bool
+ * @return bool
*/
public function fitIn($maxWidth, $maxHeight) {
if(!$this->valid()) {
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index a216414c9dd..91bcf584267 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -77,6 +77,7 @@ return array(
'md' => 'text/markdown',
'mdb' => 'application/msaccess',
'mdwn' => 'text/markdown',
+ 'mkv' => 'video/x-matroska',
'mobi' => 'application/x-mobipocket-ebook',
'mov' => 'video/quicktime',
'mp3' => 'audio/mpeg',
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 74051fbc2a3..0c1af3c9588 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -42,6 +42,10 @@ class Preview {
private $scalingup;
private $mimetype;
+ //filemapper used for deleting previews
+ // index is path, value is fileinfo
+ static public $deleteFileMapper = array();
+
//preview images object
/**
* @var \OC_Image
@@ -166,7 +170,11 @@ class Preview {
}
protected function getFileInfo() {
- if (!$this->info) {
+ $absPath = $this->fileView->getAbsolutePath($this->file);
+ $absPath = Files\Filesystem::normalizePath($absPath);
+ if(array_key_exists($absPath, self::$deleteFileMapper)) {
+ $this->info = self::$deleteFileMapper[$absPath];
+ } else if (!$this->info) {
$this->info = $this->fileView->getFileInfo($this->file);
}
return $this->info;
@@ -181,7 +189,10 @@ class Preview {
$this->file = $file;
$this->info = null;
if ($file !== '') {
- $this->mimetype = $this->getFileInfo()->getMimetype();
+ $this->getFileInfo();
+ if($this->info !== null && $this->info !== false) {
+ $this->mimetype = $this->info->getMimetype();
+ }
}
return $this;
}
@@ -274,10 +285,13 @@ class Preview {
$file = $this->getFile();
$fileInfo = $this->getFileInfo($file);
- $fileId = $fileInfo->getId();
+ if($fileInfo !== null && $fileInfo !== false) {
+ $fileId = $fileInfo->getId();
- $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
- return $this->userView->unlink($previewPath);
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
+ return $this->userView->unlink($previewPath);
+ }
+ return false;
}
/**
@@ -288,11 +302,14 @@ class Preview {
$file = $this->getFile();
$fileInfo = $this->getFileInfo($file);
- $fileId = $fileInfo->getId();
+ if($fileInfo !== null && $fileInfo !== false) {
+ $fileId = $fileInfo->getId();
- $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
- $this->userView->deleteAll($previewPath);
- return $this->userView->rmdir($previewPath);
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+ $this->userView->deleteAll($previewPath);
+ return $this->userView->rmdir($previewPath);
+ }
+ return false;
}
/**
@@ -398,6 +415,9 @@ class Preview {
$scalingUp = $this->getScalingUp();
$fileInfo = $this->getFileInfo($file);
+ if($fileInfo === null || $fileInfo === false) {
+ return new \OC_Image();
+ }
$fileId = $fileInfo->getId();
$cached = $this->isCached();
@@ -463,7 +483,7 @@ class Preview {
if (is_null($this->preview)) {
$this->getPreview();
}
- $this->preview->show();
+ $this->preview->show('image/png');
return;
}
@@ -623,12 +643,35 @@ class Preview {
self::post_delete($args);
}
- public static function post_delete($args) {
+ public static function prepare_delete_files($args) {
+ self::prepare_delete($args, 'files/');
+ }
+
+ public static function prepare_delete($args, $prefix='') {
$path = $args['path'];
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
- $preview = new Preview(\OC_User::getUser(), 'files/', $path);
+
+ $view = new \OC\Files\View('/' . \OC_User::getUser() . '/' . $prefix);
+ $info = $view->getFileInfo($path);
+
+ \OC\Preview::$deleteFileMapper = array_merge(
+ \OC\Preview::$deleteFileMapper,
+ array(
+ Files\Filesystem::normalizePath($view->getAbsolutePath($path)) => $info,
+ )
+ );
+ }
+
+ public static function post_delete_files($args) {
+ self::post_delete($args, 'files/');
+ }
+
+ public static function post_delete($args, $prefix='') {
+ $path = Files\Filesystem::normalizePath($args['path']);
+
+ $preview = new Preview(\OC_User::getUser(), $prefix, $path);
$preview->deleteAllPreviews();
}
diff --git a/lib/private/route.php b/lib/private/route/route.php
index fb7da456b62..6ade9ec15f6 100644
--- a/lib/private/route.php
+++ b/lib/private/route/route.php
@@ -6,13 +6,17 @@
* See the COPYING-README file.
*/
-use Symfony\Component\Routing\Route;
+namespace OC\Route;
-class OC_Route extends Route {
+use OCP\Route\IRoute;
+use Symfony\Component\Routing\Route as SymfonyRoute;
+
+class Route extends SymfonyRoute implements IRoute {
/**
* Specify the method when this route is to be used
*
* @param string $method HTTP method (uppercase)
+ * @return \OC\Route\Route
*/
public function method($method) {
$this->setRequirement('_method', strtoupper($method));
@@ -63,6 +67,7 @@ class OC_Route extends Route {
* Defaults to use for this route
*
* @param array $defaults The defaults
+ * @return \OC\Route\Route
*/
public function defaults($defaults) {
$action = $this->getDefault('action');
@@ -78,6 +83,7 @@ class OC_Route extends Route {
* Requirements for this route
*
* @param array $requirements The requirements
+ * @return \OC\Route\Route
*/
public function requirements($requirements) {
$method = $this->getRequirement('_method');
@@ -93,8 +99,10 @@ class OC_Route extends Route {
/**
* The action to execute when this route matches
+ *
* @param string|callable $class the class or a callable
* @param string $function the function to use with the class
+ * @return \OC\Route\Route
*
* This function is called with $class set to a callable or
* to the class with $function
diff --git a/lib/private/router.php b/lib/private/route/router.php
index 918e3b13206..60ba5878401 100644
--- a/lib/private/router.php
+++ b/lib/private/route/router.php
@@ -6,68 +6,103 @@
* See the COPYING-README file.
*/
+namespace OC\Route;
+
+use OCP\Route\IRouter;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
-//use Symfony\Component\Routing\Route;
-class OC_Router {
+class Router implements IRouter {
+ /**
+ * @var \Symfony\Component\Routing\RouteCollection[]
+ */
protected $collections = array();
+
+ /**
+ * @var \Symfony\Component\Routing\RouteCollection
+ */
protected $collection = null;
+
+ /**
+ * @var \Symfony\Component\Routing\RouteCollection
+ */
protected $root = null;
+ /**
+ * @var \Symfony\Component\Routing\Generator\UrlGenerator
+ */
protected $generator = null;
- protected $routing_files;
- protected $cache_key;
+
+ /**
+ * @var string[]
+ */
+ protected $routingFiles;
+
+ /**
+ * @var string
+ */
+ protected $cacheKey;
+
+ protected $loaded = false;
public function __construct() {
- $baseUrl = OC_Helper::linkTo('', 'index.php');
- if ( !OC::$CLI) {
+ $baseUrl = \OC_Helper::linkTo('', 'index.php');
+ if (!\OC::$CLI) {
$method = $_SERVER['REQUEST_METHOD'];
- }else{
+ } else {
$method = 'GET';
}
- $host = OC_Request::serverHost();
- $schema = OC_Request::serverProtocol();
+ $host = \OC_Request::serverHost();
+ $schema = \OC_Request::serverProtocol();
$this->context = new RequestContext($baseUrl, $method, $host, $schema);
// TODO cache
$this->root = $this->getCollection('root');
}
+ /**
+ * Get the files to load the routes from
+ *
+ * @return string[]
+ */
public function getRoutingFiles() {
- if (!isset($this->routing_files)) {
- $this->routing_files = array();
- foreach(OC_APP::getEnabledApps() as $app) {
- $file = OC_App::getAppPath($app).'/appinfo/routes.php';
- if(file_exists($file)) {
- $this->routing_files[$app] = $file;
+ if (!isset($this->routingFiles)) {
+ $this->routingFiles = array();
+ foreach (\OC_APP::getEnabledApps() as $app) {
+ $file = \OC_App::getAppPath($app) . '/appinfo/routes.php';
+ if (file_exists($file)) {
+ $this->routingFiles[$app] = $file;
}
}
}
- return $this->routing_files;
+ return $this->routingFiles;
}
public function getCacheKey() {
- if (!isset($this->cache_key)) {
+ if (!isset($this->cacheKey)) {
$files = $this->getRoutingFiles();
$files[] = 'settings/routes.php';
$files[] = 'core/routes.php';
$files[] = 'ocs/routes.php';
- $this->cache_key = OC_Cache::generateCacheKeyFromFiles($files);
+ $this->cacheKey = \OC_Cache::generateCacheKeyFromFiles($files);
}
- return $this->cache_key;
+ return $this->cacheKey;
}
/**
* loads the api routes
*/
public function loadRoutes() {
- foreach($this->getRoutingFiles() as $app => $file) {
+ if ($this->loaded) {
+ return;
+ }
+ $this->loaded = true;
+ foreach ($this->getRoutingFiles() as $app => $file) {
$this->useCollection($app);
require_once $file;
$collection = $this->getCollection($app);
- $collection->addPrefix('/apps/'.$app);
+ $collection->addPrefix('/apps/' . $app);
$this->root->addCollection($collection);
}
$this->useCollection('root');
@@ -81,6 +116,10 @@ class OC_Router {
$this->root->addCollection($collection);
}
+ /**
+ * @param string $name
+ * @return \Symfony\Component\Routing\RouteCollection
+ */
protected function getCollection($name) {
if (!isset($this->collections[$name])) {
$this->collections[$name] = new RouteCollection();
@@ -91,22 +130,23 @@ class OC_Router {
/**
* Sets the collection to use for adding routes
*
- * @param string $name Name of the colletion to use.
+ * @param string $name Name of the collection to use.
*/
public function useCollection($name) {
$this->collection = $this->getCollection($name);
}
/**
- * Create a OC_Route.
+ * Create a \OC\Route\Route.
*
* @param string $name Name of the route to create.
* @param string $pattern The pattern to match
- * @param array $defaults An array of default parameter values
- * @param array $requirements An array of requirements for parameters (regexes)
+ * @param array $defaults An array of default parameter values
+ * @param array $requirements An array of requirements for parameters (regexes)
+ * @return \OC\Route\Route
*/
public function create($name, $pattern, array $defaults = array(), array $requirements = array()) {
- $route = new OC_Route($pattern, $defaults, $requirements);
+ $route = new Route($pattern, $defaults, $requirements);
$this->collection->add($name, $route);
return $route;
}
@@ -115,6 +155,7 @@ class OC_Router {
* Find the route matching $url.
*
* @param string $url The url to find
+ * @throws \Exception
*/
public function match($url) {
$matcher = new UrlMatcher($this->root, $this->context);
@@ -123,14 +164,14 @@ class OC_Router {
$action = $parameters['action'];
if (!is_callable($action)) {
var_dump($action);
- throw new Exception('not a callable action');
+ throw new \Exception('not a callable action');
}
unset($parameters['action']);
call_user_func($action, $parameters);
} elseif (isset($parameters['file'])) {
include $parameters['file'];
} else {
- throw new Exception('no action available');
+ throw new \Exception('no action available');
}
}
@@ -138,8 +179,7 @@ class OC_Router {
* Get the url generator
*
*/
- public function getGenerator()
- {
+ public function getGenerator() {
if (null !== $this->generator) {
return $this->generator;
}
@@ -152,9 +192,10 @@ class OC_Router {
*
* @param string $name Name of the route to use.
* @param array $parameters Parameters for the route
+ * @param bool $absolute
+ * @return string
*/
- public function generate($name, $parameters = array(), $absolute = false)
- {
+ public function generate($name, $parameters = array(), $absolute = false) {
return $this->getGenerator()->generate($name, $parameters, $absolute);
}
diff --git a/lib/private/server.php b/lib/private/server.php
index 7696fc207fd..8c9ea39c562 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -158,6 +158,10 @@ class Server extends SimpleContainer implements IServerContainer {
$config = $c->getConfig();
return new \OC\BackgroundJob\JobList($c->getDatabaseConnection(), $config);
});
+ $this->registerService('Router', function ($c){
+ $router = new \OC\Route\Router();
+ return $router;
+ });
}
/**
@@ -364,4 +368,15 @@ class Server extends SimpleContainer implements IServerContainer {
function getJobList(){
return $this->query('JobList');
}
+
+ /**
+ * Returns a router for generating and matching urls
+ *
+ * @return \OCP\Route\IRouter
+ */
+ function getRouter(){
+ $router = $this->query('Router');
+ $router->loadRoutes();
+ return $router;
+ }
}
diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php
index a7c9e2fdefd..42ec9606dc9 100644
--- a/lib/private/session/internal.php
+++ b/lib/private/session/internal.php
@@ -26,8 +26,7 @@ class Internal extends Memory {
}
public function __destruct() {
- $_SESSION = array_merge($_SESSION, $this->data);
- session_write_close();
+ $this->close();
}
/**
@@ -47,4 +46,15 @@ class Internal extends Memory {
@session_start();
$this->data = $_SESSION = array();
}
+
+ public function close() {
+ $_SESSION = array_merge($_SESSION, $this->data);
+ session_write_close();
+
+ parent::close();
+ }
+
+ public function reopen() {
+ throw new \Exception('The session cannot be reopened - reopen() is ony to be used in unit testing.');
+ }
}
diff --git a/lib/private/session/memory.php b/lib/private/session/memory.php
index 1b9ac452575..1497c0f8928 100644
--- a/lib/private/session/memory.php
+++ b/lib/private/session/memory.php
@@ -28,6 +28,7 @@ class Memory extends Session {
* @param integer $value
*/
public function set($key, $value) {
+ $this->validateSession();
$this->data[$key] = $value;
}
@@ -54,10 +55,29 @@ class Memory extends Session {
* @param string $key
*/
public function remove($key) {
+ $this->validateSession();
unset($this->data[$key]);
}
public function clear() {
$this->data = array();
}
+
+ /**
+ * Helper function for PHPUnit execution - don't use in non-test code
+ */
+ public function reopen() {
+ $this->sessionClosed = false;
+ }
+
+ /**
+ * In case the session has already been locked an exception will be thrown
+ *
+ * @throws \Exception
+ */
+ private function validateSession() {
+ if ($this->sessionClosed) {
+ throw new \Exception('Session has been closed - no further changes to the session as allowed');
+ }
+ }
}
diff --git a/lib/private/session/session.php b/lib/private/session/session.php
index fe160faa267..6f6c804f384 100644
--- a/lib/private/session/session.php
+++ b/lib/private/session/session.php
@@ -13,6 +13,11 @@ use OCP\ISession;
abstract class Session implements \ArrayAccess, ISession {
/**
+ * @var bool
+ */
+ protected $sessionClosed = false;
+
+ /**
* $name serves as a namespace for the session keys
*
* @param string $name
@@ -49,4 +54,11 @@ abstract class Session implements \ArrayAccess, ISession {
public function offsetUnset($offset) {
$this->remove($offset);
}
+
+ /**
+ * Close the session and release the lock
+ */
+ public function close() {
+ $this->sessionClosed = true;
+ }
}
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 89d328ada19..4d0c9b52a4d 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -10,13 +10,20 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
//check if the database user has admin rights
- $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname=postgres user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
// Try if we can connect to the DB with the specified name
$e_dbname = addslashes($this->dbname);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection)
@@ -63,7 +70,14 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 2ca705193cc..18864c17ec9 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -16,9 +16,6 @@ use OC\Hooks\BasicEmitter;
* - maintenanceStart()
* - maintenanceEnd()
* - dbUpgrade()
- * - filecacheStart()
- * - filecacheProgress(int $percentage)
- * - filecacheDone()
* - failure(string $message)
*/
class Updater extends BasicEmitter {
@@ -113,7 +110,7 @@ class Updater extends BasicEmitter {
/*
* START CONFIG CHANGES FOR OLDER VERSIONS
*/
- if (version_compare($currentVersion, '6.90.1', '<')) {
+ if (!\OC::$CLI && version_compare($currentVersion, '6.90.1', '<')) {
// Add the overwriteHost config if it is not existant
// This is added to prevent host header poisoning
\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
@@ -127,9 +124,6 @@ class Updater extends BasicEmitter {
\OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
$this->emit('\OC\Updater', 'dbUpgrade');
- // do a file cache upgrade for users with files
- // this can take loooooooooooooooooooooooong
- $this->upgradeFileCache();
} catch (\Exception $exception) {
$this->emit('\OC\Updater', 'failure', array($exception->getMessage()));
}
@@ -147,42 +141,5 @@ class Updater extends BasicEmitter {
$this->emit('\OC\Updater', 'maintenanceEnd');
}
- private function upgradeFileCache() {
- try {
- $query = \OC_DB::prepare('
- SELECT DISTINCT `user`
- FROM `*PREFIX*fscache`
- ');
- $result = $query->execute();
- } catch (\Exception $e) {
- return;
- }
- $users = $result->fetchAll();
- if (count($users) == 0) {
- return;
- }
- $step = 100 / count($users);
- $percentCompleted = 0;
- $lastPercentCompletedOutput = 0;
- $startInfoShown = false;
- foreach ($users as $userRow) {
- $user = $userRow['user'];
- \OC\Files\Filesystem::initMountPoints($user);
- \OC\Files\Cache\Upgrade::doSilentUpgrade($user);
- if (!$startInfoShown) {
- //We show it only now, because otherwise Info about upgraded apps
- //will appear between this and progress info
- $this->emit('\OC\Updater', 'filecacheStart');
- $startInfoShown = true;
- }
- $percentCompleted += $step;
- $out = floor($percentCompleted);
- if ($out != $lastPercentCompletedOutput) {
- $this->emit('\OC\Updater', 'filecacheProgress', array($out));
- $lastPercentCompletedOutput = $out;
- }
- }
- $this->emit('\OC\Updater', 'filecacheDone');
- }
}
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index 60da34f2d6e..44b46ef6700 100644
--- a/lib/private/urlgenerator.php
+++ b/lib/private/urlgenerator.php
@@ -39,7 +39,7 @@ class URLGenerator implements IURLGenerator {
* Returns a url to the given app and file.
*/
public function linkToRoute($route, $parameters = array()) {
- $urlLinkTo = \OC::getRouter()->generate($route, $parameters);
+ $urlLinkTo = \OC::$server->getRouter()->generate($route, $parameters);
return $urlLinkTo;
}
diff --git a/lib/private/util.php b/lib/private/util.php
index 75e1711b0de..70dadb1befd 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -531,7 +531,7 @@ class OC_Util {
.' cannot be listed by other users.';
$perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, -1) != '0') {
- OC_Helper::chmodr($dataDirectory, 0770);
+ chmod($dataDirectory, 0770);
clearstatcache();
$perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, 2, 1) != '0') {
diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php
index 90150245c41..21612327879 100644
--- a/lib/public/appframework/app.php
+++ b/lib/public/appframework/app.php
@@ -67,7 +67,7 @@ class App {
* $a = new TasksApp();
* $a->registerRoutes($this, $routes);
*
- * @param \OC_Router $router
+ * @param \OCP\Route\IRouter $router
* @param array $routes
*/
public function registerRoutes($router, $routes) {
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index 5fb51f9ecd5..dc3aff663d4 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -190,4 +190,10 @@ interface IServerContainer {
*/
function getJobList();
+ /**
+ * Returns a router for generating and matching urls
+ *
+ * @return \OCP\Route\IRouter
+ */
+ function getRouter();
}
diff --git a/lib/public/isession.php b/lib/public/isession.php
index 20da712cda3..dc5719625cc 100644
--- a/lib/public/isession.php
+++ b/lib/public/isession.php
@@ -75,4 +75,9 @@ interface ISession {
*/
public function clear();
+ /**
+ * Close the session and release the lock
+ */
+ public function close();
+
}
diff --git a/lib/public/route/iroute.php b/lib/public/route/iroute.php
new file mode 100644
index 00000000000..66fdb841821
--- /dev/null
+++ b/lib/public/route/iroute.php
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Copyright (c) 2014 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 OCP\Route;
+
+interface IRoute {
+ /**
+ * Specify PATCH as the method to use with this route
+ */
+ public function patch();
+
+ /**
+ * Specify the method when this route is to be used
+ *
+ * @param string $method HTTP method (uppercase)
+ * @return \OCP\Route\IRoute
+ */
+ public function method($method);
+
+ /**
+ * The action to execute when this route matches, includes a file like
+ * it is called directly
+ *
+ * @param $file
+ */
+ public function actionInclude($file);
+
+ /**
+ * Specify GET as the method to use with this route
+ */
+ public function get();
+
+ /**
+ * Specify POST as the method to use with this route
+ */
+ public function post();
+
+ /**
+ * Specify DELETE as the method to use with this route
+ */
+ public function delete();
+
+ /**
+ * The action to execute when this route matches
+ *
+ * @param string|callable $class the class or a callable
+ * @param string $function the function to use with the class
+ * @return \OCP\Route\IRoute
+ *
+ * This function is called with $class set to a callable or
+ * to the class with $function
+ */
+ public function action($class, $function = null);
+
+ /**
+ * Defaults to use for this route
+ *
+ * @param array $defaults The defaults
+ * @return \OCP\Route\IRoute
+ */
+ public function defaults($defaults);
+
+ /**
+ * Requirements for this route
+ *
+ * @param array $requirements The requirements
+ * @return \OCP\Route\IRoute
+ */
+ public function requirements($requirements);
+
+ /**
+ * Specify PUT as the method to use with this route
+ */
+ public function put();
+}
diff --git a/lib/public/route/irouter.php b/lib/public/route/irouter.php
new file mode 100644
index 00000000000..d6b0750ba6f
--- /dev/null
+++ b/lib/public/route/irouter.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Copyright (c) 2014 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 OCP\Route;
+
+interface IRouter {
+
+ public function __construct();
+
+ /**
+ * Get the files to load the routes from
+ *
+ * @return string[]
+ */
+ public function getRoutingFiles();
+
+ public function getCacheKey();
+
+ /**
+ * loads the api routes
+ */
+ public function loadRoutes();
+
+ /**
+ * Sets the collection to use for adding routes
+ *
+ * @param string $name Name of the collection to use.
+ */
+ public function useCollection($name);
+
+ /**
+ * Create a \OCP\Route\IRoute.
+ *
+ * @param string $name Name of the route to create.
+ * @param string $pattern The pattern to match
+ * @param array $defaults An array of default parameter values
+ * @param array $requirements An array of requirements for parameters (regexes)
+ * @return \OCP\Route\IRoute
+ */
+ public function create($name, $pattern, array $defaults = array(), array $requirements = array());
+
+ /**
+ * Find the route matching $url.
+ *
+ * @param string $url The url to find
+ * @throws \Exception
+ */
+ public function match($url);
+
+ /**
+ * Get the url generator
+ *
+ */
+ public function getGenerator();
+
+ /**
+ * Generate url based on $name and $parameters
+ *
+ * @param string $name Name of the route to use.
+ * @param array $parameters Parameters for the route
+ * @param bool $absolute
+ * @return string
+ */
+ public function generate($name, $parameters = array(), $absolute = false);
+
+}
diff --git a/lib/public/share.php b/lib/public/share.php
index dd9e1bbf9a9..5066d40354d 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1250,10 +1250,12 @@ class Share {
// Remove root from file source paths if retrieving own shared items
if (isset($uidOwner) && isset($row['path'])) {
if (isset($row['parent'])) {
+ // FIXME: Doesn't always construct the correct path, example:
+ // Folder '/a/b', share '/a' and '/a/b' to user2
+ // user2 reshares /Shared/b and ask for share status of /Shared/a/b
+ // expected result: path=/Shared/a/b; actual result /Shared/b because of the parent
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
$parentResult = $query->execute(array($row['parent']));
- //$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
- //$parentResult = $query->execute(array($row['id']));
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where,
diff --git a/lib/public/util.php b/lib/public/util.php
index 585c5d22634..a159bf1423c 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -89,14 +89,11 @@ class Util {
*/
public static function logException( $app, \Exception $ex ) {
$class = get_class($ex);
- if ($class !== 'Exception') {
- $message = $class . ': ';
- }
- $message .= $ex->getMessage();
+ $message = $class . ': ' . $ex->getMessage();
if ($ex->getCode()) {
$message .= ' [' . $ex->getCode() . ']';
}
- \OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
+ \OCP\Util::writeLog($app, $message, \OCP\Util::FATAL);
if (defined('DEBUG') and DEBUG) {
// also log stack trace
$stack = explode("\n", $ex->getTraceAsString());