diff options
Diffstat (limited to 'lib')
620 files changed, 5622 insertions, 1451 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php index 10cd5a8016a..e7262af0ca9 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -6,11 +6,12 @@ * @author Markus Goetz <markus@woboq.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Victor Dubiniuk <dubiniuk@owncloud.com> + * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/base.php b/lib/base.php index 80b1a2bafcd..970eabce6af 100644 --- a/lib/base.php +++ b/lib/base.php @@ -26,16 +26,16 @@ * @author Phil Davis <phil.davis@inf.org> * @author Ramiro Aparicio <rapariciog@gmail.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author scolebrook <scolebrook@mac.com> - * @author Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * @author Volkan Gezer <volkangezer@gmail.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -826,7 +826,7 @@ class OC { $setupHelper = new OC\Setup(\OC::$server->getConfig(), \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom()); - $controller = new OC\Core\Setup\Controller($setupHelper); + $controller = new OC\Core\Controller\SetupController($setupHelper); $controller->run($_POST); exit(); } @@ -1076,7 +1076,7 @@ class OC { if ($config->getSystemValue('debug', false)) { self::$server->getLogger()->debug('Setting remember login to cookie', array('app' => 'core')); } - $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32); + $token = \OC::$server->getSecureRandom()->generate(32); $config->setUserValue($userId, 'login_token', $token, time()); OC_User::setMagicInCookie($userId, $token); } else { diff --git a/lib/l10n/cs_CZ.js b/lib/l10n/cs_CZ.js index 5b17429465a..fdbabd0ce70 100644 --- a/lib/l10n/cs_CZ.js +++ b/lib/l10n/cs_CZ.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Archivy typu %s nejsou podporovány", "Failed to open archive when installing app" : "Chyba při otevírání archivu během instalace aplikace", "App does not provide an info.xml file" : "Aplikace neposkytuje soubor info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Podpis nelze ověřit. Kontaktujte prosím vývojáře aplikace a zkontrolujte obrazovku administrace.", "App can't be installed because of not allowed code in the App" : "Aplikace nemůže být nainstalována, protože obsahuje nepovolený kód", "App can't be installed because it is not compatible with this version of ownCloud" : "Aplikace nemůže být nainstalována, protože není kompatibilní s touto verzí ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Aplikace nemůže být nainstalována, protože obsahuje značku\n<shipped>\n\ntrue\n</shipped>\n\ncož není povoleno pro nedodávané aplikace", diff --git a/lib/l10n/cs_CZ.json b/lib/l10n/cs_CZ.json index e1788a6bfe5..1ef95bfacb6 100644 --- a/lib/l10n/cs_CZ.json +++ b/lib/l10n/cs_CZ.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Archivy typu %s nejsou podporovány", "Failed to open archive when installing app" : "Chyba při otevírání archivu během instalace aplikace", "App does not provide an info.xml file" : "Aplikace neposkytuje soubor info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Podpis nelze ověřit. Kontaktujte prosím vývojáře aplikace a zkontrolujte obrazovku administrace.", "App can't be installed because of not allowed code in the App" : "Aplikace nemůže být nainstalována, protože obsahuje nepovolený kód", "App can't be installed because it is not compatible with this version of ownCloud" : "Aplikace nemůže být nainstalována, protože není kompatibilní s touto verzí ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Aplikace nemůže být nainstalována, protože obsahuje značku\n<shipped>\n\ntrue\n</shipped>\n\ncož není povoleno pro nedodávané aplikace", diff --git a/lib/l10n/es.js b/lib/l10n/es.js index b37631114a0..67d08d8a3e3 100644 --- a/lib/l10n/es.js +++ b/lib/l10n/es.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Los ficheros de tipo %s no son soportados", "Failed to open archive when installing app" : "Falló la apertura ded fichero mientras se instalaba la aplicación", "App does not provide an info.xml file" : "La aplicación no suministra un fichero info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La firma no pudo ser evaluada. Por favor, contacte con el desarrollador de la aplicación y compruebe su pantalla de administración.", "App can't be installed because of not allowed code in the App" : "La aplicación no puede ser instalada por tener código no autorizado en la aplicación", "App can't be installed because it is not compatible with this version of ownCloud" : "La aplicación no se puede instalar porque no es compatible con esta versión de ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "La aplicación no se puede instalar porque contiene la etiqueta\n<shipped>\ntrue\n</shipped>\nque no está permitida para aplicaciones no distribuidas", @@ -96,6 +97,7 @@ OC.L10N.register( "Sharing %s failed, because %s is not a member of the group %s" : "Se falló al compartir %s, ya que %s no es miembro del grupo %s", "You need to provide a password to create a public link, only protected links are allowed" : "Es necesario definir una contraseña para crear un enlace publico. Solo los enlaces protegidos están permitidos", "Sharing %s failed, because sharing with links is not allowed" : "Se falló al compartir %s, ya que no está permitida la compartición con enlaces", + "Not allowed to create a federated share with the same user" : "No se permite crear un recurso compartido federado con el mismo usuario", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Se falló al compartir %s. No se pudo hallar %s, quizás haya un problema de conexión con el servidor.", "Share type %s is not valid for %s" : "Compartir tipo %s no es válido para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "La configuración de permisos para %s ha fallado, ya que los permisos superan los permisos dados a %s", @@ -111,6 +113,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "Se ha fallado al compartir %s, ya que volver a compartir no está permitido", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen", "Sharing %s failed, because the file could not be found in the file cache" : "Se ha fallado al compartir %s, ya que el archivo no pudo ser encontrado en el cache de archivo", + "Cannot increase permissions of %s" : "No se pueden incrementar los permisos de %s", + "Expiration date is in the past" : "Ha pasado la fecha de caducidad", + "Cannot set expiration date more than %s days in the future" : "No se puede fijar la fecha de caducidad más de %s días en el futuro.", "Could not find category \"%s\"" : "No puede encontrar la categoría \"%s\"", "Apps" : "Aplicaciones", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Solo los siguientes caracteres están permitidos en un nombre de usuario: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"", @@ -149,6 +154,8 @@ OC.L10N.register( "Could not obtain lock type %d on \"%s\"." : "No se pudo realizar el bloqueo %d en \"%s\".", "Storage unauthorized. %s" : "Almacenamiento no autorizado. %s", "Storage incomplete configuration. %s" : "Configuración de almacenamiento incompleta. %s", - "Storage not available" : "Almacenamiento no disponible" + "Storage connection error. %s" : "Error de conexión de almacenamiento. %s", + "Storage not available" : "Almacenamiento no disponible", + "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s" }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/es.json b/lib/l10n/es.json index 9be893bbb60..73d3ac59512 100644 --- a/lib/l10n/es.json +++ b/lib/l10n/es.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Los ficheros de tipo %s no son soportados", "Failed to open archive when installing app" : "Falló la apertura ded fichero mientras se instalaba la aplicación", "App does not provide an info.xml file" : "La aplicación no suministra un fichero info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La firma no pudo ser evaluada. Por favor, contacte con el desarrollador de la aplicación y compruebe su pantalla de administración.", "App can't be installed because of not allowed code in the App" : "La aplicación no puede ser instalada por tener código no autorizado en la aplicación", "App can't be installed because it is not compatible with this version of ownCloud" : "La aplicación no se puede instalar porque no es compatible con esta versión de ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "La aplicación no se puede instalar porque contiene la etiqueta\n<shipped>\ntrue\n</shipped>\nque no está permitida para aplicaciones no distribuidas", @@ -94,6 +95,7 @@ "Sharing %s failed, because %s is not a member of the group %s" : "Se falló al compartir %s, ya que %s no es miembro del grupo %s", "You need to provide a password to create a public link, only protected links are allowed" : "Es necesario definir una contraseña para crear un enlace publico. Solo los enlaces protegidos están permitidos", "Sharing %s failed, because sharing with links is not allowed" : "Se falló al compartir %s, ya que no está permitida la compartición con enlaces", + "Not allowed to create a federated share with the same user" : "No se permite crear un recurso compartido federado con el mismo usuario", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Se falló al compartir %s. No se pudo hallar %s, quizás haya un problema de conexión con el servidor.", "Share type %s is not valid for %s" : "Compartir tipo %s no es válido para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "La configuración de permisos para %s ha fallado, ya que los permisos superan los permisos dados a %s", @@ -109,6 +111,9 @@ "Sharing %s failed, because resharing is not allowed" : "Se ha fallado al compartir %s, ya que volver a compartir no está permitido", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen", "Sharing %s failed, because the file could not be found in the file cache" : "Se ha fallado al compartir %s, ya que el archivo no pudo ser encontrado en el cache de archivo", + "Cannot increase permissions of %s" : "No se pueden incrementar los permisos de %s", + "Expiration date is in the past" : "Ha pasado la fecha de caducidad", + "Cannot set expiration date more than %s days in the future" : "No se puede fijar la fecha de caducidad más de %s días en el futuro.", "Could not find category \"%s\"" : "No puede encontrar la categoría \"%s\"", "Apps" : "Aplicaciones", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Solo los siguientes caracteres están permitidos en un nombre de usuario: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"", @@ -147,6 +152,8 @@ "Could not obtain lock type %d on \"%s\"." : "No se pudo realizar el bloqueo %d en \"%s\".", "Storage unauthorized. %s" : "Almacenamiento no autorizado. %s", "Storage incomplete configuration. %s" : "Configuración de almacenamiento incompleta. %s", - "Storage not available" : "Almacenamiento no disponible" + "Storage connection error. %s" : "Error de conexión de almacenamiento. %s", + "Storage not available" : "Almacenamiento no disponible", + "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/fr.js b/lib/l10n/fr.js index d2ad6e66a31..52dab63fcee 100644 --- a/lib/l10n/fr.js +++ b/lib/l10n/fr.js @@ -55,6 +55,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Les archives de type %s ne sont pas prises en charge", "Failed to open archive when installing app" : "Échec de l'ouverture de l'archive lors de l'installation de l'application", "App does not provide an info.xml file" : "L'application ne fournit pas de fichier info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La signature n'a pas pu être vérifiée. Merci de contacter le développeur de l'application et de vérifier votre page d'administration.", "App can't be installed because of not allowed code in the App" : "L'application ne peut être installée car elle contient du code non-autorisé", "App can't be installed because it is not compatible with this version of ownCloud" : "L'application ne peut être installée car elle n'est pas compatible avec cette version de ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "L'application ne peut être installée car elle contient la balise <shipped>true</shipped> qui n'est pas autorisée pour les applications non incluses par défaut", @@ -113,6 +114,7 @@ OC.L10N.register( "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.", "Cannot increase permissions of %s" : "Impossible d'augmenter les permissions de %s", "Expiration date is in the past" : "La date d'expiration est dans le passé", + "Cannot set expiration date more than %s days in the future" : "Impossible de définir la date d'expiration à plus de %s jours dans le futur", "Could not find category \"%s\"" : "Impossible de trouver la catégorie \"%s\"", "Apps" : "Applications", "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 9749604a137..ce1a313acb7 100644 --- a/lib/l10n/fr.json +++ b/lib/l10n/fr.json @@ -53,6 +53,7 @@ "Archives of type %s are not supported" : "Les archives de type %s ne sont pas prises en charge", "Failed to open archive when installing app" : "Échec de l'ouverture de l'archive lors de l'installation de l'application", "App does not provide an info.xml file" : "L'application ne fournit pas de fichier info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La signature n'a pas pu être vérifiée. Merci de contacter le développeur de l'application et de vérifier votre page d'administration.", "App can't be installed because of not allowed code in the App" : "L'application ne peut être installée car elle contient du code non-autorisé", "App can't be installed because it is not compatible with this version of ownCloud" : "L'application ne peut être installée car elle n'est pas compatible avec cette version de ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "L'application ne peut être installée car elle contient la balise <shipped>true</shipped> qui n'est pas autorisée pour les applications non incluses par défaut", @@ -111,6 +112,7 @@ "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.", "Cannot increase permissions of %s" : "Impossible d'augmenter les permissions de %s", "Expiration date is in the past" : "La date d'expiration est dans le passé", + "Cannot set expiration date more than %s days in the future" : "Impossible de définir la date d'expiration à plus de %s jours dans le futur", "Could not find category \"%s\"" : "Impossible de trouver la catégorie \"%s\"", "Apps" : "Applications", "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/he.js b/lib/l10n/he.js index ce99a984cac..5d7236a7604 100644 --- a/lib/l10n/he.js +++ b/lib/l10n/he.js @@ -1,27 +1,81 @@ OC.L10N.register( "lib", { + "Cannot write into \"config\" directory!" : "לא ניתן לכתוב לתיקיית \"config\"!", + "This can usually be fixed by giving the webserver write access to the config directory" : "בדרך כלל ניתן לפתור את הבעיה על ידי כך שנותנים ל- webserver הרשאות כניסה לתיקיית confg", + "See %s" : "ניתן לראות %s", + "This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "בדרך כלל ניתן לפתור את הבעיה על ידי כך ש- %s נותן ל- webserver הרשאות כניסה לתיקיית config %s.", + "Sample configuration detected" : "התגלתה דוגמת תצורה", + "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "התגלה שדוגמת התצורה הועתקה. דבר זה עלול לשבור את ההתקנה ולא נתמך.יש לקרוא את מסמכי התיעוד לפני שמבצעים שינויים ב- config.php", + "PHP %s or higher is required." : "נדרש PHP בגרסת %s ומעלה.", + "PHP with a version lower than %s is required." : "נדרש PHP בגרסה נמוכה מ- %s.", + "Following databases are supported: %s" : "מסדי הנתונים הבאים נתמכים: %s", + "The command line tool %s could not be found" : "כלי שורת הפקודה %s לא אותר", + "The library %s is not available." : "הספריה %s אינה זמינה.", + "Library %s with a version higher than %s is required - available version %s." : "ספריה %s בגרסה גבוהה מ- %s נדרשת - גרסה זמינה %s.", + "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 %s or lower is required." : "נדרש ownCloud %s ומטה.", "Help" : "עזרה", "Personal" : "אישי", "Users" : "משתמשים", "Admin" : "מנהל", + "Recommended" : "מומלץ", + "App \"%s\" cannot be installed because it is not compatible with this version of ownCloud." : "היישום \"%s\" לא ניתן להתקנה כיוון שאינו תואם לגרסה זו של ownCloud.", + "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "היישום \"%s\" לא ניתן להתקנה כיוון שיחסי התלות הבאים אינם מתקיימים: %s", + "No app name specified" : "לא הוגדר שם יישום", "Unknown filetype" : "סוג קובץ לא מוכר", "Invalid image" : "תמונה לא חוקית", "today" : "היום", "yesterday" : "אתמול", + "_%n day ago_::_%n days ago_" : ["לפני %n יום","לפני %n ימים"], "last month" : "חודש שעבר", "last year" : "שנה שעברה", + "_%n year ago_::_%n years ago_" : ["לפני %n שנה","לפני %n שנים"], "seconds ago" : "שניות", "web services under your control" : "שירותי רשת תחת השליטה שלך", + "Module with id: %s does not exist. Please enable it in your apps settings or contact your administrator." : "מודול עם זהות: %s אינו קיים. יש לאפשר את זה בהגדרות היישומים או ליצור קשר עם המנהל.", + "Empty filename is not allowed" : "שם קובץ ריק אינו מאושר", + "Dot files are not allowed" : "קבצי Dot אינם מותרים", + "4-byte characters are not supported in file names" : "תווי 4-byte אינם נתמכים בשמות קבצים", + "File name is a reserved word" : "שם קובץ הנו מילה שמורה", "File name contains at least one invalid character" : "שם קובץ כולל לפחות תו אחד לא חוקי", + "File name is too long" : "שם קובץ ארוך מדי", + "File is currently busy, please try again later" : "הקובץ בשימוש כרגע, יש לנסות שוב מאוחר יותר", + "Can't read file" : "לא ניתן לקרוא קובץ", + "App directory already exists" : "תיקיית יישום כבר קיימת", + "Can't create app folder. Please fix permissions. %s" : "לא ניתן ליצור תיקיית יישום. יש לתקן הרשאות. %s", + "Archive does not contain a directory named %s" : "הארכיב לא כולל שם תיקייה %s", + "No source specified when installing app" : "לא נקבע מקור בתהליך התקנת היישום", + "No href specified when installing app from http" : "לא נקבע href בתהליך התקנת היישום מהאינטרנט", + "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", "Application is not enabled" : "יישומים אינם מופעלים", "Authentication error" : "שגיאת הזדהות", "Token expired. Please reload page." : "פג תוקף. נא לטעון שוב את הדף.", + "Unknown user" : "משתמש לא ידוע", + "%s enter the database username." : "%s נכנס למסד נתוני שמות המשתמשים.", + "%s enter the database name." : "%s נכנס למסד נתוני השמות.", + "DB Error: \"%s\"" : "שגיאת מסד נתונים: \"%s\"", + "Set an admin username." : "קביעת שם משתמש מנהל", + "Set an admin password." : "קביעת סיסמת מנהל", "%s shared »%s« with you" : "%s שיתף/שיתפה איתך את »%s«", + "%s via %s" : "%s על בסיס %s", + "Expiration date is in the past" : "תאריך תפוגה הנו בעבר", "Could not find category \"%s\"" : "לא ניתן למצוא את הקטגוריה „%s“", "Apps" : "יישומים", "A valid username must be provided" : "יש לספק שם משתמש תקני", "A valid password must be provided" : "יש לספק ססמה תקנית", - "Storage not available" : "אחסון לא זמין" + "Cannot write into \"apps\" directory" : "לא ניתן לכתוב לתיקיית \"apps\"", + "PHP module %s not installed." : "מודול PHP %s אינו מותקן.", + "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "זה ככל הנראה נגרם על ידי מאיץ/מטמון כמו Zend OPcache או eAccelerator.", + "Storage unauthorized. %s" : "אחסון לא מורשה. %s", + "Storage incomplete configuration. %s" : "תצורה לא מושלמת של האחסון. %s", + "Storage connection error. %s" : "שגיאת חיבור אחסון. %s", + "Storage not available" : "אחסון לא זמין", + "Storage connection timeout. %s" : "פסק זמן חיבור אחסון. %s" }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/he.json b/lib/l10n/he.json index 2b39879cf82..69e8a16657a 100644 --- a/lib/l10n/he.json +++ b/lib/l10n/he.json @@ -1,25 +1,79 @@ { "translations": { + "Cannot write into \"config\" directory!" : "לא ניתן לכתוב לתיקיית \"config\"!", + "This can usually be fixed by giving the webserver write access to the config directory" : "בדרך כלל ניתן לפתור את הבעיה על ידי כך שנותנים ל- webserver הרשאות כניסה לתיקיית confg", + "See %s" : "ניתן לראות %s", + "This can usually be fixed by %sgiving the webserver write access to the config directory%s." : "בדרך כלל ניתן לפתור את הבעיה על ידי כך ש- %s נותן ל- webserver הרשאות כניסה לתיקיית config %s.", + "Sample configuration detected" : "התגלתה דוגמת תצורה", + "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "התגלה שדוגמת התצורה הועתקה. דבר זה עלול לשבור את ההתקנה ולא נתמך.יש לקרוא את מסמכי התיעוד לפני שמבצעים שינויים ב- config.php", + "PHP %s or higher is required." : "נדרש PHP בגרסת %s ומעלה.", + "PHP with a version lower than %s is required." : "נדרש PHP בגרסה נמוכה מ- %s.", + "Following databases are supported: %s" : "מסדי הנתונים הבאים נתמכים: %s", + "The command line tool %s could not be found" : "כלי שורת הפקודה %s לא אותר", + "The library %s is not available." : "הספריה %s אינה זמינה.", + "Library %s with a version higher than %s is required - available version %s." : "ספריה %s בגרסה גבוהה מ- %s נדרשת - גרסה זמינה %s.", + "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 %s or lower is required." : "נדרש ownCloud %s ומטה.", "Help" : "עזרה", "Personal" : "אישי", "Users" : "משתמשים", "Admin" : "מנהל", + "Recommended" : "מומלץ", + "App \"%s\" cannot be installed because it is not compatible with this version of ownCloud." : "היישום \"%s\" לא ניתן להתקנה כיוון שאינו תואם לגרסה זו של ownCloud.", + "App \"%s\" cannot be installed because the following dependencies are not fulfilled: %s" : "היישום \"%s\" לא ניתן להתקנה כיוון שיחסי התלות הבאים אינם מתקיימים: %s", + "No app name specified" : "לא הוגדר שם יישום", "Unknown filetype" : "סוג קובץ לא מוכר", "Invalid image" : "תמונה לא חוקית", "today" : "היום", "yesterday" : "אתמול", + "_%n day ago_::_%n days ago_" : ["לפני %n יום","לפני %n ימים"], "last month" : "חודש שעבר", "last year" : "שנה שעברה", + "_%n year ago_::_%n years ago_" : ["לפני %n שנה","לפני %n שנים"], "seconds ago" : "שניות", "web services under your control" : "שירותי רשת תחת השליטה שלך", + "Module with id: %s does not exist. Please enable it in your apps settings or contact your administrator." : "מודול עם זהות: %s אינו קיים. יש לאפשר את זה בהגדרות היישומים או ליצור קשר עם המנהל.", + "Empty filename is not allowed" : "שם קובץ ריק אינו מאושר", + "Dot files are not allowed" : "קבצי Dot אינם מותרים", + "4-byte characters are not supported in file names" : "תווי 4-byte אינם נתמכים בשמות קבצים", + "File name is a reserved word" : "שם קובץ הנו מילה שמורה", "File name contains at least one invalid character" : "שם קובץ כולל לפחות תו אחד לא חוקי", + "File name is too long" : "שם קובץ ארוך מדי", + "File is currently busy, please try again later" : "הקובץ בשימוש כרגע, יש לנסות שוב מאוחר יותר", + "Can't read file" : "לא ניתן לקרוא קובץ", + "App directory already exists" : "תיקיית יישום כבר קיימת", + "Can't create app folder. Please fix permissions. %s" : "לא ניתן ליצור תיקיית יישום. יש לתקן הרשאות. %s", + "Archive does not contain a directory named %s" : "הארכיב לא כולל שם תיקייה %s", + "No source specified when installing app" : "לא נקבע מקור בתהליך התקנת היישום", + "No href specified when installing app from http" : "לא נקבע href בתהליך התקנת היישום מהאינטרנט", + "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", "Application is not enabled" : "יישומים אינם מופעלים", "Authentication error" : "שגיאת הזדהות", "Token expired. Please reload page." : "פג תוקף. נא לטעון שוב את הדף.", + "Unknown user" : "משתמש לא ידוע", + "%s enter the database username." : "%s נכנס למסד נתוני שמות המשתמשים.", + "%s enter the database name." : "%s נכנס למסד נתוני השמות.", + "DB Error: \"%s\"" : "שגיאת מסד נתונים: \"%s\"", + "Set an admin username." : "קביעת שם משתמש מנהל", + "Set an admin password." : "קביעת סיסמת מנהל", "%s shared »%s« with you" : "%s שיתף/שיתפה איתך את »%s«", + "%s via %s" : "%s על בסיס %s", + "Expiration date is in the past" : "תאריך תפוגה הנו בעבר", "Could not find category \"%s\"" : "לא ניתן למצוא את הקטגוריה „%s“", "Apps" : "יישומים", "A valid username must be provided" : "יש לספק שם משתמש תקני", "A valid password must be provided" : "יש לספק ססמה תקנית", - "Storage not available" : "אחסון לא זמין" + "Cannot write into \"apps\" directory" : "לא ניתן לכתוב לתיקיית \"apps\"", + "PHP module %s not installed." : "מודול PHP %s אינו מותקן.", + "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "זה ככל הנראה נגרם על ידי מאיץ/מטמון כמו Zend OPcache או eAccelerator.", + "Storage unauthorized. %s" : "אחסון לא מורשה. %s", + "Storage incomplete configuration. %s" : "תצורה לא מושלמת של האחסון. %s", + "Storage connection error. %s" : "שגיאת חיבור אחסון. %s", + "Storage not available" : "אחסון לא זמין", + "Storage connection timeout. %s" : "פסק זמן חיבור אחסון. %s" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/it.js b/lib/l10n/it.js index 1be68c0d847..e12e621f61f 100644 --- a/lib/l10n/it.js +++ b/lib/l10n/it.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Gli archivi di tipo %s non sono supportati", "Failed to open archive when installing app" : "Apertura archivio non riuscita durante l'installazione dell'applicazione", "App does not provide an info.xml file" : "L'applicazione non fornisce un file info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La firma non può essere verificata. Contatta lo sviluppatore dell'applicazione e controlla la schermata di amministrazione.", "App can't be installed because of not allowed code in the App" : "L'applicazione non può essere installata a causa di codice non consentito al suo interno", "App can't be installed because it is not compatible with this version of ownCloud" : "L'applicazione non può essere installata poiché non è compatibile con questa versione di ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "L'applicazione non può essere installata poiché contiene il tag <shipped>true<shipped> che è consentito per le applicazioni native", diff --git a/lib/l10n/it.json b/lib/l10n/it.json index d9d9c6b3240..a76e19d46f5 100644 --- a/lib/l10n/it.json +++ b/lib/l10n/it.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Gli archivi di tipo %s non sono supportati", "Failed to open archive when installing app" : "Apertura archivio non riuscita durante l'installazione dell'applicazione", "App does not provide an info.xml file" : "L'applicazione non fornisce un file info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "La firma non può essere verificata. Contatta lo sviluppatore dell'applicazione e controlla la schermata di amministrazione.", "App can't be installed because of not allowed code in the App" : "L'applicazione non può essere installata a causa di codice non consentito al suo interno", "App can't be installed because it is not compatible with this version of ownCloud" : "L'applicazione non può essere installata poiché non è compatibile con questa versione di ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "L'applicazione non può essere installata poiché contiene il tag <shipped>true<shipped> che è consentito per le applicazioni native", diff --git a/lib/l10n/ja.js b/lib/l10n/ja.js index a0619055f3a..1752eca4971 100644 --- a/lib/l10n/ja.js +++ b/lib/l10n/ja.js @@ -56,6 +56,7 @@ OC.L10N.register( "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ファイルが入っていません", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "署名が確認できませんでした。このアプリの開発者へ連絡し、管理画面を確認してください。", "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>タグが含まれているためにアプリをインストールできません。", diff --git a/lib/l10n/ja.json b/lib/l10n/ja.json index 681b479ff23..685d9743dd2 100644 --- a/lib/l10n/ja.json +++ b/lib/l10n/ja.json @@ -54,6 +54,7 @@ "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ファイルが入っていません", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "署名が確認できませんでした。このアプリの開発者へ連絡し、管理画面を確認してください。", "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>タグが含まれているためにアプリをインストールできません。", diff --git a/lib/l10n/nb_NO.js b/lib/l10n/nb_NO.js index b7fa5a63510..1d50aec03d1 100644 --- a/lib/l10n/nb_NO.js +++ b/lib/l10n/nb_NO.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Arkiver av type %s støttes ikke", "Failed to open archive when installing app" : "Klarte ikke å åpne arkiv ved installering av app", "App does not provide an info.xml file" : "App-en inneholder ikke filen info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Signatur kunne ikke sjekkes. Kontakt app-utvikleren og sjekk admin-bildet.", "App can't be installed because of not allowed code in the App" : "App kan ikke installeres på grunn av ulovlig kode i appen.", "App can't be installed because it is not compatible with this version of ownCloud" : "App kan ikke installeres fordi den ikke er kompatibel med denne versjonen av ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "App kan ikke installeres fordi den inneholder tag <shipped>true</shipped> som ikke er tillatt for apper som ikke leveres med systemet", @@ -112,6 +113,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "Deling av %s feilet, fordi videre-deling ikke er tillatt", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Deling av %s feilet, fordi delings-serveren for %s ikke kunne finne kilden", "Sharing %s failed, because the file could not be found in the file cache" : "Deling av %s feilet, fordi filen ikke ble funnet i fil-mellomlageret", + "Cannot increase permissions of %s" : "Kan ikke øke tillatelser for %s", + "Expiration date is in the past" : "Utløpsdato er tilbake i tid", + "Cannot set expiration date more than %s days in the future" : "Kan ikke sette utløpsdato mer enn %s dager fram i tid", "Could not find category \"%s\"" : "Kunne ikke finne kategori \"%s\"", "Apps" : "Apper", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Bare disse tegnene tillates i et brukernavn: \"a-z\", \"A-Z\", \"0-9\" og \"_.@-\"", diff --git a/lib/l10n/nb_NO.json b/lib/l10n/nb_NO.json index a2a2a9c1b7f..067db0b1450 100644 --- a/lib/l10n/nb_NO.json +++ b/lib/l10n/nb_NO.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Arkiver av type %s støttes ikke", "Failed to open archive when installing app" : "Klarte ikke å åpne arkiv ved installering av app", "App does not provide an info.xml file" : "App-en inneholder ikke filen info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Signatur kunne ikke sjekkes. Kontakt app-utvikleren og sjekk admin-bildet.", "App can't be installed because of not allowed code in the App" : "App kan ikke installeres på grunn av ulovlig kode i appen.", "App can't be installed because it is not compatible with this version of ownCloud" : "App kan ikke installeres fordi den ikke er kompatibel med denne versjonen av ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "App kan ikke installeres fordi den inneholder tag <shipped>true</shipped> som ikke er tillatt for apper som ikke leveres med systemet", @@ -110,6 +111,9 @@ "Sharing %s failed, because resharing is not allowed" : "Deling av %s feilet, fordi videre-deling ikke er tillatt", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Deling av %s feilet, fordi delings-serveren for %s ikke kunne finne kilden", "Sharing %s failed, because the file could not be found in the file cache" : "Deling av %s feilet, fordi filen ikke ble funnet i fil-mellomlageret", + "Cannot increase permissions of %s" : "Kan ikke øke tillatelser for %s", + "Expiration date is in the past" : "Utløpsdato er tilbake i tid", + "Cannot set expiration date more than %s days in the future" : "Kan ikke sette utløpsdato mer enn %s dager fram i tid", "Could not find category \"%s\"" : "Kunne ikke finne kategori \"%s\"", "Apps" : "Apper", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Bare disse tegnene tillates i et brukernavn: \"a-z\", \"A-Z\", \"0-9\" og \"_.@-\"", diff --git a/lib/l10n/nl.js b/lib/l10n/nl.js index bb3bd551841..e782091343c 100644 --- a/lib/l10n/nl.js +++ b/lib/l10n/nl.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Archiefbestanden van type %s niet ondersteund", "Failed to open archive when installing app" : "Kon archiefbestand bij installatie van de app niet openen", "App does not provide an info.xml file" : "De app heeft geen info.xml bestand", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Handtekening kon niet worden geverifieerd. Nee contact op met de ontwikkelaar van de app en check uw beheerscherm.", "App can't be installed because of not allowed code in the App" : "De app kan niet worden geïnstalleerd wegens onjuiste code in de app", "App can't be installed because it is not compatible with this version of ownCloud" : "De app kan niet worden geïnstalleerd omdat die niet compatible is met deze versie van ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "De app kan niet worden geïnstallerd omdat het de <shipped>true</shipped> tag bevat die niet is toegestaan voor niet gepubliceerde apps", @@ -112,6 +113,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "Delen van %s is mislukt, omdat her-delen niet is toegestaan", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Delen van %s is mislukt, omdat de share-backend voor %s de bron niet kon vinden", "Sharing %s failed, because the file could not be found in the file cache" : "Delen van %s is mislukt, omdat het bestand niet in de bestandscache kon worden gevonden", + "Cannot increase permissions of %s" : "Kan de rechten van %s niet verruimen", + "Expiration date is in the past" : "De vervaldatum ligt in het verleden", + "Cannot set expiration date more than %s days in the future" : "Kan vervaldatum niet verder dan %s dagen in de toekomst instellen", "Could not find category \"%s\"" : "Kon categorie \"%s\" niet vinden", "Apps" : "Apps", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Alleen de volgende tekens zijn toegestaan in een gebruikersnaam: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"", diff --git a/lib/l10n/nl.json b/lib/l10n/nl.json index 8388c0a502e..d245b6d53d7 100644 --- a/lib/l10n/nl.json +++ b/lib/l10n/nl.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Archiefbestanden van type %s niet ondersteund", "Failed to open archive when installing app" : "Kon archiefbestand bij installatie van de app niet openen", "App does not provide an info.xml file" : "De app heeft geen info.xml bestand", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Handtekening kon niet worden geverifieerd. Nee contact op met de ontwikkelaar van de app en check uw beheerscherm.", "App can't be installed because of not allowed code in the App" : "De app kan niet worden geïnstalleerd wegens onjuiste code in de app", "App can't be installed because it is not compatible with this version of ownCloud" : "De app kan niet worden geïnstalleerd omdat die niet compatible is met deze versie van ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "De app kan niet worden geïnstallerd omdat het de <shipped>true</shipped> tag bevat die niet is toegestaan voor niet gepubliceerde apps", @@ -110,6 +111,9 @@ "Sharing %s failed, because resharing is not allowed" : "Delen van %s is mislukt, omdat her-delen niet is toegestaan", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Delen van %s is mislukt, omdat de share-backend voor %s de bron niet kon vinden", "Sharing %s failed, because the file could not be found in the file cache" : "Delen van %s is mislukt, omdat het bestand niet in de bestandscache kon worden gevonden", + "Cannot increase permissions of %s" : "Kan de rechten van %s niet verruimen", + "Expiration date is in the past" : "De vervaldatum ligt in het verleden", + "Cannot set expiration date more than %s days in the future" : "Kan vervaldatum niet verder dan %s dagen in de toekomst instellen", "Could not find category \"%s\"" : "Kon categorie \"%s\" niet vinden", "Apps" : "Apps", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Alleen de volgende tekens zijn toegestaan in een gebruikersnaam: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"", diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js index 435aee8e6f2..0c11cf36101 100644 --- a/lib/l10n/pt_BR.js +++ b/lib/l10n/pt_BR.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Arquivos do tipo %s não são suportados", "Failed to open archive when installing app" : "Falha para abrir o arquivo enquanto instalava o aplicativo", "App does not provide an info.xml file" : "O aplicativo não fornece um arquivo info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "A assinatura não pode ser verificada. Por favor entre em contato com o desenvolvedor do aplicativo e verificar sua tela de administração.", "App can't be installed because of not allowed code in the App" : "O aplicativo não pode ser instalado por causa do código não permitido no Aplivativo", "App can't be installed because it is not compatible with this version of ownCloud" : "O aplicativo não pode ser instalado porque não é compatível com esta versão do ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "O aplicativo não pode ser instalado porque ele contém a marca <shipped>verdadeiro</shipped> que não é permitido para aplicações não embarcadas", diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json index d3a7f463841..e75cb070f0e 100644 --- a/lib/l10n/pt_BR.json +++ b/lib/l10n/pt_BR.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Arquivos do tipo %s não são suportados", "Failed to open archive when installing app" : "Falha para abrir o arquivo enquanto instalava o aplicativo", "App does not provide an info.xml file" : "O aplicativo não fornece um arquivo info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "A assinatura não pode ser verificada. Por favor entre em contato com o desenvolvedor do aplicativo e verificar sua tela de administração.", "App can't be installed because of not allowed code in the App" : "O aplicativo não pode ser instalado por causa do código não permitido no Aplivativo", "App can't be installed because it is not compatible with this version of ownCloud" : "O aplicativo não pode ser instalado porque não é compatível com esta versão do ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "O aplicativo não pode ser instalado porque ele contém a marca <shipped>verdadeiro</shipped> que não é permitido para aplicações não embarcadas", diff --git a/lib/l10n/pt_PT.js b/lib/l10n/pt_PT.js index 6843d0832a0..a38f6bd5f39 100644 --- a/lib/l10n/pt_PT.js +++ b/lib/l10n/pt_PT.js @@ -53,6 +53,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Arquivos do tipo %s não são suportados", "Failed to open archive when installing app" : "Ocorreu um erro ao abrir o ficheiro de instalação desta aplicação", "App does not provide an info.xml file" : "A aplicação não disponibiliza um ficheiro info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Assinatura não foi verificada. Contate o desenvolvedor da aplicação e verifique o painel de administrador.", "App can't be installed because of not allowed code in the App" : "A aplicação não pode ser instalado devido a código não permitido dentro da aplicação", "App can't be installed because it is not compatible with this version of ownCloud" : "A aplicação não pode ser instalada por não ser compatível com esta versão do ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Esta aplicação não pode ser instalada por que contém o tag <shipped>true</shipped> que só é permitido para aplicações nativas", @@ -84,13 +85,16 @@ OC.L10N.register( "Sharing %s failed, because the backend does not allow shares from type %i" : "A partilha de %s falhou porque a interface não permite as partilhas do tipo %i", "Sharing %s failed, because the file does not exist" : "A partilha de %s falhou, porque o ficheiro não existe", "You are not allowed to share %s" : "Não está autorizado a partilhar %s", + "Sharing %s failed, because you can not share with yourself" : "A partilha de %s falhou, porque não é possível partilhar consigo mesmo", "Sharing %s failed, because the user %s does not exist" : "A partilha %s falhou, porque o utilizador %s nao existe", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "A partilha %s falhou, porque o utilizador %s não pertence a nenhum dos grupos que %s é membro de", "Sharing %s failed, because this item is already shared with %s" : "A partilha %s falhou, porque o item já está a ser partilhado com %s", + "Sharing %s failed, because this item is already shared with user %s" : "A partilha de %s falhou, porque este item já está a ser partilhado com o utilizador %s", "Sharing %s failed, because the group %s does not exist" : "A partilha %s falhou, porque o grupo %s não existe", "Sharing %s failed, because %s is not a member of the group %s" : "A partilha %s falhou, porque o utilizador %s não é membro do grupo %s", "You need to provide a password to create a public link, only protected links are allowed" : "Necessita de fornecer a senha para criar um link publico, só são permitidos links protegidos", "Sharing %s failed, because sharing with links is not allowed" : "A partilha de %s falhou, porque partilhar com links não é permitido", + "Not allowed to create a federated share with the same user" : "Não é possível criar uma partilha federada com o mesmo utilizador", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "A partilha de %s falhou, não foi possível encontrar %s. É possível que o servidor esteja inacessível.", "Share type %s is not valid for %s" : "O tipo de partilha %s não é válido para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "Definir permissões para %s falhou, porque as permissões excedem as permissões concedidas a %s", @@ -106,6 +110,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "A partilha %s falhou, porque repartilhar não é permitido", "Sharing %s failed, because the sharing backend for %s could not find its source" : "A partilha %s falhou porque a partilha da interface para %s não conseguiu encontrar a sua fonte", "Sharing %s failed, because the file could not be found in the file cache" : "A partilha %s falhou, devido ao ficheiro não poder ser encontrado na cache de ficheiros", + "Cannot increase permissions of %s" : "Não é possível aumentar as permissões de %s", + "Expiration date is in the past" : "A data de expiração está no passado", + "Cannot set expiration date more than %s days in the future" : "Não é possível definir data de expiração a mais de %s dias no futuro", "Could not find category \"%s\"" : "Não foi encontrado a categoria \"%s\"", "Apps" : "Apps", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Apenas os seguintes caracteres são permitidos no nome de utilizador: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-\"", @@ -114,6 +121,7 @@ OC.L10N.register( "The username is already being used" : "O nome de utilizador já está a ser usado", "No database drivers (sqlite, mysql, or postgresql) installed." : "Nenhuma base de dados de drivers (sqlite, mysql, or postgresql) instaladas.", "Microsoft Windows Platform is not supported" : "A plataforma Microsoft Windows não é suportada", + "Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself. Find Linux packages as well as easy to deploy virtual machine images on <a href=\"%s\">%s</a>. For migrating existing installations to Linux you can find some tips and a migration script in <a href=\"%s\">our documentation</a>." : "Executar um Servidor ownCloud na plataforma Microsoft Windows não é suportado. Nós sugerimos que use um servidor Linux numa máquina virtual se não tiver opção parar migrar o servidor por si mesmo. Encontre pacotes Linux, assim como imagens de máquinas virtuais prontas a correr em <a href=\"%s\">%s</a>. Parar migrar instalações existentes para Linux, poderás encontrar algumas dicas e um script de migração na <a href=\"%s\">nossa documentação</a>.", "Cannot write into \"config\" directory" : "Não é possível escrever na directoria \"configurar\"", "Cannot write into \"apps\" directory" : "Não é possivel escrever na directoria \"aplicações\"", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "Isto pode ser normalmente resolvido %sdando ao servidor web direito de escrita para o directório de aplicação%s ou desactivando a loja de aplicações no ficheiro de configuração.", @@ -126,6 +134,9 @@ OC.L10N.register( "PHP module %s not installed." : "O modulo %s PHP não está instalado.", "PHP setting \"%s\" is not set to \"%s\"." : "Configuração PHP \"%s\" não está definida para \"%s\".", "Adjusting this setting in php.ini will make ownCloud run again" : "Ajustar esta configuração no php.ini fará com que o ownCloud funcione de novo", + "mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload está configurado para \"%s\" invés do valor habitual de \"0\"", + "To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "Para corrigir este problema altere o <code>mbstring.func_overload</code> para <code>0</code> no seu php.ini", + "PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "PHP está aparentemente configurado a remover blocos doc em linha. Isto vai tornar algumas aplicações básicas inacessíveis.", "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto é provavelmente causado por uma cache/acelerador como o Zend OPcache or eAcelerador.", "PHP modules have been installed, but they are still listed as missing?" : "Os módulos PHP foram instalados, mas eles ainda estão listados como desaparecidos?", "Please ask your server administrator to restart the web server." : "Pro favor pergunte ao seu administrador do servidor para reiniciar o servidor da internet.", @@ -138,6 +149,10 @@ OC.L10N.register( "Data directory (%s) is invalid" : "Directoria data (%s) é invalida", "Please check that the data directory contains a file \".ocdata\" in its root." : "Por favor verifique que a directoria data contem um ficheiro \".ocdata\" na sua raiz.", "Could not obtain lock type %d on \"%s\"." : "Não foi possível obter o tipo de bloqueio %d em \"%s\".", - "Storage not available" : "Armazenamento indisposinvel" + "Storage unauthorized. %s" : "Armazenamento desautorizado. %s", + "Storage incomplete configuration. %s" : "Configuração incompleta do armazenamento. %s", + "Storage connection error. %s" : "Erro de ligação ao armazenamento. %s", + "Storage not available" : "Armazenamento indisposinvel", + "Storage connection timeout. %s" : "Tempo de ligação ao armazenamento expirou. %s" }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/pt_PT.json b/lib/l10n/pt_PT.json index 43449a30557..0a0e8f69dbb 100644 --- a/lib/l10n/pt_PT.json +++ b/lib/l10n/pt_PT.json @@ -51,6 +51,7 @@ "Archives of type %s are not supported" : "Arquivos do tipo %s não são suportados", "Failed to open archive when installing app" : "Ocorreu um erro ao abrir o ficheiro de instalação desta aplicação", "App does not provide an info.xml file" : "A aplicação não disponibiliza um ficheiro info.xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Assinatura não foi verificada. Contate o desenvolvedor da aplicação e verifique o painel de administrador.", "App can't be installed because of not allowed code in the App" : "A aplicação não pode ser instalado devido a código não permitido dentro da aplicação", "App can't be installed because it is not compatible with this version of ownCloud" : "A aplicação não pode ser instalada por não ser compatível com esta versão do ownCloud", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Esta aplicação não pode ser instalada por que contém o tag <shipped>true</shipped> que só é permitido para aplicações nativas", @@ -82,13 +83,16 @@ "Sharing %s failed, because the backend does not allow shares from type %i" : "A partilha de %s falhou porque a interface não permite as partilhas do tipo %i", "Sharing %s failed, because the file does not exist" : "A partilha de %s falhou, porque o ficheiro não existe", "You are not allowed to share %s" : "Não está autorizado a partilhar %s", + "Sharing %s failed, because you can not share with yourself" : "A partilha de %s falhou, porque não é possível partilhar consigo mesmo", "Sharing %s failed, because the user %s does not exist" : "A partilha %s falhou, porque o utilizador %s nao existe", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "A partilha %s falhou, porque o utilizador %s não pertence a nenhum dos grupos que %s é membro de", "Sharing %s failed, because this item is already shared with %s" : "A partilha %s falhou, porque o item já está a ser partilhado com %s", + "Sharing %s failed, because this item is already shared with user %s" : "A partilha de %s falhou, porque este item já está a ser partilhado com o utilizador %s", "Sharing %s failed, because the group %s does not exist" : "A partilha %s falhou, porque o grupo %s não existe", "Sharing %s failed, because %s is not a member of the group %s" : "A partilha %s falhou, porque o utilizador %s não é membro do grupo %s", "You need to provide a password to create a public link, only protected links are allowed" : "Necessita de fornecer a senha para criar um link publico, só são permitidos links protegidos", "Sharing %s failed, because sharing with links is not allowed" : "A partilha de %s falhou, porque partilhar com links não é permitido", + "Not allowed to create a federated share with the same user" : "Não é possível criar uma partilha federada com o mesmo utilizador", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "A partilha de %s falhou, não foi possível encontrar %s. É possível que o servidor esteja inacessível.", "Share type %s is not valid for %s" : "O tipo de partilha %s não é válido para %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "Definir permissões para %s falhou, porque as permissões excedem as permissões concedidas a %s", @@ -104,6 +108,9 @@ "Sharing %s failed, because resharing is not allowed" : "A partilha %s falhou, porque repartilhar não é permitido", "Sharing %s failed, because the sharing backend for %s could not find its source" : "A partilha %s falhou porque a partilha da interface para %s não conseguiu encontrar a sua fonte", "Sharing %s failed, because the file could not be found in the file cache" : "A partilha %s falhou, devido ao ficheiro não poder ser encontrado na cache de ficheiros", + "Cannot increase permissions of %s" : "Não é possível aumentar as permissões de %s", + "Expiration date is in the past" : "A data de expiração está no passado", + "Cannot set expiration date more than %s days in the future" : "Não é possível definir data de expiração a mais de %s dias no futuro", "Could not find category \"%s\"" : "Não foi encontrado a categoria \"%s\"", "Apps" : "Apps", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "Apenas os seguintes caracteres são permitidos no nome de utilizador: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-\"", @@ -112,6 +119,7 @@ "The username is already being used" : "O nome de utilizador já está a ser usado", "No database drivers (sqlite, mysql, or postgresql) installed." : "Nenhuma base de dados de drivers (sqlite, mysql, or postgresql) instaladas.", "Microsoft Windows Platform is not supported" : "A plataforma Microsoft Windows não é suportada", + "Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself. Find Linux packages as well as easy to deploy virtual machine images on <a href=\"%s\">%s</a>. For migrating existing installations to Linux you can find some tips and a migration script in <a href=\"%s\">our documentation</a>." : "Executar um Servidor ownCloud na plataforma Microsoft Windows não é suportado. Nós sugerimos que use um servidor Linux numa máquina virtual se não tiver opção parar migrar o servidor por si mesmo. Encontre pacotes Linux, assim como imagens de máquinas virtuais prontas a correr em <a href=\"%s\">%s</a>. Parar migrar instalações existentes para Linux, poderás encontrar algumas dicas e um script de migração na <a href=\"%s\">nossa documentação</a>.", "Cannot write into \"config\" directory" : "Não é possível escrever na directoria \"configurar\"", "Cannot write into \"apps\" directory" : "Não é possivel escrever na directoria \"aplicações\"", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "Isto pode ser normalmente resolvido %sdando ao servidor web direito de escrita para o directório de aplicação%s ou desactivando a loja de aplicações no ficheiro de configuração.", @@ -124,6 +132,9 @@ "PHP module %s not installed." : "O modulo %s PHP não está instalado.", "PHP setting \"%s\" is not set to \"%s\"." : "Configuração PHP \"%s\" não está definida para \"%s\".", "Adjusting this setting in php.ini will make ownCloud run again" : "Ajustar esta configuração no php.ini fará com que o ownCloud funcione de novo", + "mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload está configurado para \"%s\" invés do valor habitual de \"0\"", + "To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "Para corrigir este problema altere o <code>mbstring.func_overload</code> para <code>0</code> no seu php.ini", + "PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible." : "PHP está aparentemente configurado a remover blocos doc em linha. Isto vai tornar algumas aplicações básicas inacessíveis.", "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto é provavelmente causado por uma cache/acelerador como o Zend OPcache or eAcelerador.", "PHP modules have been installed, but they are still listed as missing?" : "Os módulos PHP foram instalados, mas eles ainda estão listados como desaparecidos?", "Please ask your server administrator to restart the web server." : "Pro favor pergunte ao seu administrador do servidor para reiniciar o servidor da internet.", @@ -136,6 +147,10 @@ "Data directory (%s) is invalid" : "Directoria data (%s) é invalida", "Please check that the data directory contains a file \".ocdata\" in its root." : "Por favor verifique que a directoria data contem um ficheiro \".ocdata\" na sua raiz.", "Could not obtain lock type %d on \"%s\"." : "Não foi possível obter o tipo de bloqueio %d em \"%s\".", - "Storage not available" : "Armazenamento indisposinvel" + "Storage unauthorized. %s" : "Armazenamento desautorizado. %s", + "Storage incomplete configuration. %s" : "Configuração incompleta do armazenamento. %s", + "Storage connection error. %s" : "Erro de ligação ao armazenamento. %s", + "Storage not available" : "Armazenamento indisposinvel", + "Storage connection timeout. %s" : "Tempo de ligação ao armazenamento expirou. %s" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/ru.js b/lib/l10n/ru.js index fcb6d9b42bc..87ba4c57482 100644 --- a/lib/l10n/ru.js +++ b/lib/l10n/ru.js @@ -56,6 +56,7 @@ OC.L10N.register( "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", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Подпись не может быть проверена. Пожалуйста, свяжитесь с разработчиком приложения и проверьте свою страницу администратора.", "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>true</shipped> который не допустим для приложений, не входящих в поставку.", diff --git a/lib/l10n/ru.json b/lib/l10n/ru.json index 79c53f85ace..e249b187449 100644 --- a/lib/l10n/ru.json +++ b/lib/l10n/ru.json @@ -54,6 +54,7 @@ "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", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Подпись не может быть проверена. Пожалуйста, свяжитесь с разработчиком приложения и проверьте свою страницу администратора.", "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>true</shipped> который не допустим для приложений, не входящих в поставку.", diff --git a/lib/l10n/sq.js b/lib/l10n/sq.js index a6f377529e1..e8fd3d09327 100644 --- a/lib/l10n/sq.js +++ b/lib/l10n/sq.js @@ -56,6 +56,7 @@ OC.L10N.register( "Archives of type %s are not supported" : "Nuk mbulohen arkivat e llojit %s", "Failed to open archive when installing app" : "Dështoi në hapje arkivi teksa instalohej aplikacioni", "App does not provide an info.xml file" : "Aplikacioni s’ofron kartele të vlefshme .xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Nënshkrimi s’u kontrollua dot. Ju lutemi, lidhuni me zhvilluesin e aplikacionit dhe kontrolloni te skena juaj e përgjegjësit.", "App can't be installed because of not allowed code in the App" : "Aplikacioni s’mund të instalohet, për shkak kodi të palejuar te Aplikacioni", "App can't be installed because it is not compatible with this version of ownCloud" : "Aplikacioni s’mund të instalohet, ngaqë s’është i përputhshëm me këtë version të ownCloud-it", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Aplikacioni s’mund të instalohet, ngaqë përmban etiketën <shipped>true</shipped> e cila nuk lejohet për aplikacione që s’janë hedhur në qarkullim", diff --git a/lib/l10n/sq.json b/lib/l10n/sq.json index c173372f1bc..8c20c179813 100644 --- a/lib/l10n/sq.json +++ b/lib/l10n/sq.json @@ -54,6 +54,7 @@ "Archives of type %s are not supported" : "Nuk mbulohen arkivat e llojit %s", "Failed to open archive when installing app" : "Dështoi në hapje arkivi teksa instalohej aplikacioni", "App does not provide an info.xml file" : "Aplikacioni s’ofron kartele të vlefshme .xml", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "Nënshkrimi s’u kontrollua dot. Ju lutemi, lidhuni me zhvilluesin e aplikacionit dhe kontrolloni te skena juaj e përgjegjësit.", "App can't be installed because of not allowed code in the App" : "Aplikacioni s’mund të instalohet, për shkak kodi të palejuar te Aplikacioni", "App can't be installed because it is not compatible with this version of ownCloud" : "Aplikacioni s’mund të instalohet, ngaqë s’është i përputhshëm me këtë version të ownCloud-it", "App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" : "Aplikacioni s’mund të instalohet, ngaqë përmban etiketën <shipped>true</shipped> e cila nuk lejohet për aplikacione që s’janë hedhur në qarkullim", diff --git a/lib/l10n/th_TH.js b/lib/l10n/th_TH.js index da84e9758c3..c49d194b517 100644 --- a/lib/l10n/th_TH.js +++ b/lib/l10n/th_TH.js @@ -56,6 +56,7 @@ OC.L10N.register( "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", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "ไม่สามารถตรวจสอบลายเซ็น โปรดติดต่อนักพัฒนาแอพพลิเคชันและตรวจสอบหน้าจอแผงควบคุมระบบของคุณ", "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> แท็กที่ไม่ได้รับอนุญาต", @@ -96,6 +97,7 @@ OC.L10N.register( "Sharing %s failed, because %s is not a member of the group %s" : "การแชร์ %s ล้มเหลวเพราะ %s ไม่ได้เป็นสมาชิกของกลุ่ม %s", "You need to provide a password to create a public link, only protected links are allowed" : "คุณจำเป็นต้องระบุรหัสผ่านเพื่อสร้างลิงค์สาธารณะ, ลิงค์ที่มีการป้องกันเท่านั้นที่ได้รับอนุญาต", "Sharing %s failed, because sharing with links is not allowed" : "การแชร์ %s ล้มเหลวเพราะมีการแชร์ลิงค์ไม่ได้รับอนุญาต", + "Not allowed to create a federated share with the same user" : "ไม่อนุญาตให้สร้างแชร์สหพันธ์กับผู้ใช้เดียวกัน", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "การแชร์ %s ล้มเหลวไม่สามารถหา %s, บางทีอาจจะยังไม่สามารถเข้าถึงเซิร์ฟเวอร์ปัจจุบัน", "Share type %s is not valid for %s" : "ประเภท %s ที่แชร์ไม่ถูกต้องสำหรับ %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "การตั้งค่าสิทธิ์สำหรับ %s ล้มเหลวเพราะเกินสิทธิ์ที่ได้อนุญาตให้ %s", @@ -111,6 +113,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "การแชร์ %s ล้มเหลวเพราะการแชร์ต่อไม่ได้รับอนุญาต", "Sharing %s failed, because the sharing backend for %s could not find its source" : "การแชร์ %s ล้มเหลวเพราะการแชร์แบ็กเอนด์สำหรับ %s ไม่สามารถหาแหล่งที่มา", "Sharing %s failed, because the file could not be found in the file cache" : "การแชร์ %s ล้มเหลวเพราะไม่พบไฟล์ในแคชไฟล์", + "Cannot increase permissions of %s" : "ไม่สามารถเพิ่มสิทธิ์ของ %s", + "Expiration date is in the past" : "วันหมดอายุอยู่ในอดีตที่ผ่านมา", + "Cannot set expiration date more than %s days in the future" : "ไม่สามารถกำหนดวันหมดอายุให้มากกว่า %s วันในอนาคต", "Could not find category \"%s\"" : "ไม่พบหมวดหมู่ \"%s\"", "Apps" : "แอปฯ", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "ตัวอักษรที่อนุญาตให้ใช้ในชื่อผู้ใช้: \"a-z\", \"A-Z\", \"0-9\" และ \"_.@-\"", @@ -149,6 +154,8 @@ OC.L10N.register( "Could not obtain lock type %d on \"%s\"." : "ไม่สามารถรับล็อคชนิด %d บน \"%s\"", "Storage unauthorized. %s" : "การจัดเก็บข้อมูลไม่ได้รับอนุญาต %s", "Storage incomplete configuration. %s" : "การตั้งค่าการจัดเก็บข้อมูลไม่สำเร็จ %s", - "Storage not available" : "ไม่สามารถใช้พื้นที่จัดเก็บข้อมูลได้" + "Storage connection error. %s" : "ข้อผิดพลาดการเชื่อมต่อพื้นที่จัดเก็บข้อมูล %s", + "Storage not available" : "ไม่สามารถใช้พื้นที่จัดเก็บข้อมูลได้", + "Storage connection timeout. %s" : "หมดเวลาการเชื่อมต่อพื้นที่จัดเก็บข้อมูล %s" }, "nplurals=1; plural=0;"); diff --git a/lib/l10n/th_TH.json b/lib/l10n/th_TH.json index 8a951a1468d..4da887a615c 100644 --- a/lib/l10n/th_TH.json +++ b/lib/l10n/th_TH.json @@ -54,6 +54,7 @@ "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", + "Signature could not get checked. Please contact the app developer and check your admin screen." : "ไม่สามารถตรวจสอบลายเซ็น โปรดติดต่อนักพัฒนาแอพพลิเคชันและตรวจสอบหน้าจอแผงควบคุมระบบของคุณ", "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> แท็กที่ไม่ได้รับอนุญาต", @@ -94,6 +95,7 @@ "Sharing %s failed, because %s is not a member of the group %s" : "การแชร์ %s ล้มเหลวเพราะ %s ไม่ได้เป็นสมาชิกของกลุ่ม %s", "You need to provide a password to create a public link, only protected links are allowed" : "คุณจำเป็นต้องระบุรหัสผ่านเพื่อสร้างลิงค์สาธารณะ, ลิงค์ที่มีการป้องกันเท่านั้นที่ได้รับอนุญาต", "Sharing %s failed, because sharing with links is not allowed" : "การแชร์ %s ล้มเหลวเพราะมีการแชร์ลิงค์ไม่ได้รับอนุญาต", + "Not allowed to create a federated share with the same user" : "ไม่อนุญาตให้สร้างแชร์สหพันธ์กับผู้ใช้เดียวกัน", "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "การแชร์ %s ล้มเหลวไม่สามารถหา %s, บางทีอาจจะยังไม่สามารถเข้าถึงเซิร์ฟเวอร์ปัจจุบัน", "Share type %s is not valid for %s" : "ประเภท %s ที่แชร์ไม่ถูกต้องสำหรับ %s", "Setting permissions for %s failed, because the permissions exceed permissions granted to %s" : "การตั้งค่าสิทธิ์สำหรับ %s ล้มเหลวเพราะเกินสิทธิ์ที่ได้อนุญาตให้ %s", @@ -109,6 +111,9 @@ "Sharing %s failed, because resharing is not allowed" : "การแชร์ %s ล้มเหลวเพราะการแชร์ต่อไม่ได้รับอนุญาต", "Sharing %s failed, because the sharing backend for %s could not find its source" : "การแชร์ %s ล้มเหลวเพราะการแชร์แบ็กเอนด์สำหรับ %s ไม่สามารถหาแหล่งที่มา", "Sharing %s failed, because the file could not be found in the file cache" : "การแชร์ %s ล้มเหลวเพราะไม่พบไฟล์ในแคชไฟล์", + "Cannot increase permissions of %s" : "ไม่สามารถเพิ่มสิทธิ์ของ %s", + "Expiration date is in the past" : "วันหมดอายุอยู่ในอดีตที่ผ่านมา", + "Cannot set expiration date more than %s days in the future" : "ไม่สามารถกำหนดวันหมดอายุให้มากกว่า %s วันในอนาคต", "Could not find category \"%s\"" : "ไม่พบหมวดหมู่ \"%s\"", "Apps" : "แอปฯ", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "ตัวอักษรที่อนุญาตให้ใช้ในชื่อผู้ใช้: \"a-z\", \"A-Z\", \"0-9\" และ \"_.@-\"", @@ -147,6 +152,8 @@ "Could not obtain lock type %d on \"%s\"." : "ไม่สามารถรับล็อคชนิด %d บน \"%s\"", "Storage unauthorized. %s" : "การจัดเก็บข้อมูลไม่ได้รับอนุญาต %s", "Storage incomplete configuration. %s" : "การตั้งค่าการจัดเก็บข้อมูลไม่สำเร็จ %s", - "Storage not available" : "ไม่สามารถใช้พื้นที่จัดเก็บข้อมูลได้" + "Storage connection error. %s" : "ข้อผิดพลาดการเชื่อมต่อพื้นที่จัดเก็บข้อมูล %s", + "Storage not available" : "ไม่สามารถใช้พื้นที่จัดเก็บข้อมูลได้", + "Storage connection timeout. %s" : "หมดเวลาการเชื่อมต่อพื้นที่จัดเก็บข้อมูล %s" },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/lib/l10n/zh_TW.js b/lib/l10n/zh_TW.js index 2fd08b7a8f7..b140e78ca1e 100644 --- a/lib/l10n/zh_TW.js +++ b/lib/l10n/zh_TW.js @@ -81,6 +81,7 @@ OC.L10N.register( "Can't create or write into the data directory %s" : "無法建立或寫入資料目錄 %s", "Invalid Federated Cloud ID" : "無效的雲端聯盟ID:", "%s shared »%s« with you" : "%s 與您分享了 %s", + "%s via %s" : "%s 經由 %s", "Sharing %s failed, because the backend does not allow shares from type %i" : "分享 %s失敗,不允許分享這樣的 %i 類別", "Sharing %s failed, because the file does not exist" : "分享 %s 失敗,因為檔案不存在", "You are not allowed to share %s" : "你不被允許分享 %s", @@ -108,6 +109,9 @@ OC.L10N.register( "Sharing %s failed, because resharing is not allowed" : "分享 %s 失敗,不允許重複分享", "Sharing %s failed, because the sharing backend for %s could not find its source" : "分享 %s 失敗,因為 %s 的分享後端找不到它的來源", "Sharing %s failed, because the file could not be found in the file cache" : "分享 %s 失敗,因為在快取中找不到該檔案", + "Cannot increase permissions of %s" : "無法增加%s的權限", + "Expiration date is in the past" : "到期日是之前的時間", + "Cannot set expiration date more than %s days in the future" : "無法設定到期日超過未來%s天", "Could not find category \"%s\"" : "找不到分類:\"%s\"", "Apps" : "應用程式", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "使用者名稱當中只能包含下列字元:\"a-z\", \"A-Z\", \"0-9\", 和 \"_.@-\"", @@ -131,6 +135,7 @@ OC.L10N.register( "Adjusting this setting in php.ini will make ownCloud run again" : "調整php.ini裡的這項設定會讓ownCloud再次運行", "mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload 應該要被設定成 \"0\"而不是目前的設定 \"%s\" ", "To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "為了修正這個問題,請到php.ini將 <code>mbstring.func_overload</code> 的值改為 <code>0</code>", + "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "這大概是由快取或是加速器像是 Zend OPcache, eAccelerator 造成的", "PHP modules have been installed, but they are still listed as missing?" : "你已經安裝了指定的 PHP 模組,可是還是顯示為找不到嗎?", "Please ask your server administrator to restart the web server." : "請聯絡您的系統管理員重新啟動網頁伺服器", "PostgreSQL >= 9 required" : "需要 PostgreSQL 版本 >= 9", @@ -142,6 +147,10 @@ OC.L10N.register( "Data directory (%s) is invalid" : "資料目錄 (%s) 無效", "Please check that the data directory contains a file \".ocdata\" in its root." : "請確保資料目錄當中包含一個 .ocdata 的檔案", "Could not obtain lock type %d on \"%s\"." : "無法取得鎖定:類型 %d ,檔案 %s", - "Storage not available" : "無法存取儲存空間" + "Storage unauthorized. %s" : "儲存空間未經授權。%s", + "Storage incomplete configuration. %s" : "儲存空間配置尚未完成。%s", + "Storage connection error. %s" : "儲存空間連線錯誤。%s", + "Storage not available" : "無法存取儲存空間", + "Storage connection timeout. %s" : "儲存空間連線逾時。%s" }, "nplurals=1; plural=0;"); diff --git a/lib/l10n/zh_TW.json b/lib/l10n/zh_TW.json index 25b16b9cae0..973312064dc 100644 --- a/lib/l10n/zh_TW.json +++ b/lib/l10n/zh_TW.json @@ -79,6 +79,7 @@ "Can't create or write into the data directory %s" : "無法建立或寫入資料目錄 %s", "Invalid Federated Cloud ID" : "無效的雲端聯盟ID:", "%s shared »%s« with you" : "%s 與您分享了 %s", + "%s via %s" : "%s 經由 %s", "Sharing %s failed, because the backend does not allow shares from type %i" : "分享 %s失敗,不允許分享這樣的 %i 類別", "Sharing %s failed, because the file does not exist" : "分享 %s 失敗,因為檔案不存在", "You are not allowed to share %s" : "你不被允許分享 %s", @@ -106,6 +107,9 @@ "Sharing %s failed, because resharing is not allowed" : "分享 %s 失敗,不允許重複分享", "Sharing %s failed, because the sharing backend for %s could not find its source" : "分享 %s 失敗,因為 %s 的分享後端找不到它的來源", "Sharing %s failed, because the file could not be found in the file cache" : "分享 %s 失敗,因為在快取中找不到該檔案", + "Cannot increase permissions of %s" : "無法增加%s的權限", + "Expiration date is in the past" : "到期日是之前的時間", + "Cannot set expiration date more than %s days in the future" : "無法設定到期日超過未來%s天", "Could not find category \"%s\"" : "找不到分類:\"%s\"", "Apps" : "應用程式", "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" : "使用者名稱當中只能包含下列字元:\"a-z\", \"A-Z\", \"0-9\", 和 \"_.@-\"", @@ -129,6 +133,7 @@ "Adjusting this setting in php.ini will make ownCloud run again" : "調整php.ini裡的這項設定會讓ownCloud再次運行", "mbstring.func_overload is set to \"%s\" instead of the expected value \"0\"" : "mbstring.func_overload 應該要被設定成 \"0\"而不是目前的設定 \"%s\" ", "To fix this issue set <code>mbstring.func_overload</code> to <code>0</code> in your php.ini" : "為了修正這個問題,請到php.ini將 <code>mbstring.func_overload</code> 的值改為 <code>0</code>", + "This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "這大概是由快取或是加速器像是 Zend OPcache, eAccelerator 造成的", "PHP modules have been installed, but they are still listed as missing?" : "你已經安裝了指定的 PHP 模組,可是還是顯示為找不到嗎?", "Please ask your server administrator to restart the web server." : "請聯絡您的系統管理員重新啟動網頁伺服器", "PostgreSQL >= 9 required" : "需要 PostgreSQL 版本 >= 9", @@ -140,6 +145,10 @@ "Data directory (%s) is invalid" : "資料目錄 (%s) 無效", "Please check that the data directory contains a file \".ocdata\" in its root." : "請確保資料目錄當中包含一個 .ocdata 的檔案", "Could not obtain lock type %d on \"%s\"." : "無法取得鎖定:類型 %d ,檔案 %s", - "Storage not available" : "無法存取儲存空間" + "Storage unauthorized. %s" : "儲存空間未經授權。%s", + "Storage incomplete configuration. %s" : "儲存空間配置尚未完成。%s", + "Storage connection error. %s" : "儲存空間連線錯誤。%s", + "Storage not available" : "無法存取儲存空間", + "Storage connection timeout. %s" : "儲存空間連線逾時。%s" },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/lib/private/activity/event.php b/lib/private/activity/event.php index 413ff613186..b7e271b2104 100644 --- a/lib/private/activity/event.php +++ b/lib/private/activity/event.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Phil Davis <phil.davis@inf.org> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php index fadfedf277f..e5235cb9bfe 100644 --- a/lib/private/activitymanager.php +++ b/lib/private/activitymanager.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/allconfig.php b/lib/private/allconfig.php index 7c2037e8048..3c85bfacbb8 100644 --- a/lib/private/allconfig.php +++ b/lib/private/allconfig.php @@ -8,7 +8,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -205,57 +205,28 @@ class AllConfig implements \OCP\IConfig { // TODO - FIXME $this->fixDIInit(); - // Check if the key does exist - $sql = 'SELECT `configvalue` FROM `*PREFIX*preferences` '. - 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'; - $result = $this->connection->executeQuery($sql, array($userId, $appName, $key)); - $oldValue = $result->fetchColumn(); - $result->closeCursor(); - $exists = $oldValue !== false; - - if($oldValue === strval($value)) { - // no changes - return; + $preconditionArray = []; + if (isset($preCondition)) { + $preconditionArray = [ + 'configvalue' => $preCondition, + ]; } - $affectedRows = 0; - if (!$exists && $preCondition === null) { - $this->connection->insertIfNotExist('*PREFIX*preferences', [ - 'configvalue' => $value, - 'userid' => $userId, - 'appid' => $appName, - 'configkey' => $key, - ], ['configkey', 'userid', 'appid']); - $affectedRows = 1; - } elseif ($exists) { - $data = array($value, $userId, $appName, $key); - - $sql = 'UPDATE `*PREFIX*preferences` SET `configvalue` = ? '. - 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? '; - - if($preCondition !== null) { - if($this->getSystemValue('dbtype', 'sqlite') === 'oci') { - //oracle hack: need to explicitly cast CLOB to CHAR for comparison - $sql .= 'AND to_char(`configvalue`) = ?'; - } else { - $sql .= 'AND `configvalue` = ?'; - } - $data[] = $preCondition; - } - $affectedRows = $this->connection->executeUpdate($sql, $data); - } + $this->connection->setValues('preferences', [ + 'userid' => $userId, + 'appid' => $appName, + 'configkey' => $key, + ], [ + 'configvalue' => $value, + ], $preconditionArray); // only add to the cache if we already loaded data for the user - if ($affectedRows > 0 && isset($this->userCache[$userId])) { + if (isset($this->userCache[$userId])) { if (!isset($this->userCache[$userId][$appName])) { $this->userCache[$userId][$appName] = array(); } $this->userCache[$userId][$appName][$key] = $value; } - - if ($preCondition !== null && $affectedRows === 0) { - throw new PreConditionNotMetException; - } } /** diff --git a/lib/private/api.php b/lib/private/api.php index edee30dfc96..1fbe3201f85 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -13,7 +13,7 @@ * @author Tom Needham <tom@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app.php b/lib/private/app.php index bfec84759f5..2abc015a91f 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -20,7 +20,8 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author RealRancor <Fisch.666@gmx.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sam Tuke <mail@samtuke.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> @@ -28,7 +29,7 @@ * @author Tom Needham <tom@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -312,14 +313,14 @@ class OC_App { * @param string $app * @return int */ - public static function downloadApp($app) { + private static function downloadApp($app) { $ocsClient = new OCSClient( \OC::$server->getHTTPClientService(), \OC::$server->getConfig(), \OC::$server->getLogger() ); $appData = $ocsClient->getApplication($app, \OCP\Util::getVersion()); - $download= $ocsClient->getApplicationDownload($app, \OCP\Util::getVersion()); + $download = $ocsClient->getApplicationDownload($app, \OCP\Util::getVersion()); if(isset($download['downloadlink']) and $download['downloadlink']!='') { // Replace spaces in download link without encoding entire URL $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']); @@ -370,6 +371,7 @@ class OC_App { */ public static function getSettingsNavigation() { $l = \OC::$server->getL10N('lib'); + $urlGenerator = \OC::$server->getURLGenerator(); $settings = array(); // by default, settings only contain the help menu @@ -380,9 +382,9 @@ class OC_App { array( "id" => "help", "order" => 1000, - "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_help'), + "href" => $urlGenerator->linkToRoute('settings_help'), "name" => $l->t("Help"), - "icon" => OC_Helper::imagePath("settings", "help.svg") + "icon" => $urlGenerator->imagePath("settings", "help.svg") ) ); } @@ -393,9 +395,9 @@ class OC_App { $settings[] = array( "id" => "personal", "order" => 1, - "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_personal'), + "href" => $urlGenerator->linkToRoute('settings_personal'), "name" => $l->t("Personal"), - "icon" => OC_Helper::imagePath("settings", "personal.svg") + "icon" => $urlGenerator->imagePath("settings", "personal.svg") ); //SubAdmins are also allowed to access user management @@ -409,9 +411,9 @@ class OC_App { $settings[] = array( "id" => "core_users", "order" => 2, - "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_users'), + "href" => $urlGenerator->linkToRoute('settings_users'), "name" => $l->t("Users"), - "icon" => OC_Helper::imagePath("settings", "users.svg") + "icon" => $urlGenerator->imagePath("settings", "users.svg") ); } @@ -421,9 +423,9 @@ class OC_App { $settings[] = array( "id" => "admin", "order" => 1000, - "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_admin'), + "href" => $urlGenerator->linkToRoute('settings_admin'), "name" => $l->t("Admin"), - "icon" => OC_Helper::imagePath("settings", "admin.svg") + "icon" => $urlGenerator->imagePath("settings", "admin.svg") ); } } @@ -812,12 +814,12 @@ class OC_App { $appIcon = self::getAppPath($app) . '/img/' . $app . '.svg'; if (file_exists($appIcon)) { - $info['preview'] = OC_Helper::imagePath($app, $app . '.svg'); + $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg'); $info['previewAsIcon'] = true; } else { $appIcon = self::getAppPath($app) . '/img/app.svg'; if (file_exists($appIcon)) { - $info['preview'] = OC_Helper::imagePath($app, 'app.svg'); + $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg'); $info['previewAsIcon'] = true; } } @@ -855,7 +857,7 @@ class OC_App { * @param string $ocsID * @return string|false */ - protected static function getInternalAppIdByOcs($ocsID) { + public static function getInternalAppIdByOcs($ocsID) { if(is_numeric($ocsID)) { $idArray = \OC::$server->getAppConfig()->getValues(false, 'ocsid'); if(array_search($ocsID, $idArray)) { @@ -1032,7 +1034,7 @@ class OC_App { /** - * @param mixed $app + * @param string $app * @return bool * @throws Exception if app is not compatible with this version of ownCloud * @throws Exception if no app-name was specified diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 8ae93f98832..bf07a2ef548 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -4,9 +4,10 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -34,6 +35,18 @@ use OCP\IUserSession; class AppManager implements IAppManager { + /** + * Apps with these types can not be enabled for certain groups only + * @var string[] + */ + protected $protectedAppTypes = [ + 'filesystem', + 'prelogin', + 'authentication', + 'logging', + 'prevent_group_restriction', + ]; + /** @var \OCP\IUserSession */ private $userSession; @@ -147,6 +160,10 @@ class AppManager implements IAppManager { } elseif (is_null($user)) { return false; } else { + if(empty($enabled)){ + return false; + } + $groupIds = json_decode($enabled); if (!is_array($groupIds)) { @@ -192,8 +209,17 @@ class AppManager implements IAppManager { * * @param string $appId * @param \OCP\IGroup[] $groups + * @throws \Exception if app can't be enabled for groups */ public function enableAppForGroups($appId, $groups) { + $info = $this->getAppInfo($appId); + if (!empty($info['types'])) { + $protectedTypes = array_intersect($this->protectedAppTypes, $info['types']); + if (!empty($protectedTypes)) { + throw new \Exception("$appId can't be enabled for groups."); + } + } + $groupIds = array_map(function ($group) { /** @var \OCP\IGroup $group */ return $group->getGID(); diff --git a/lib/private/app/codechecker/abstractcheck.php b/lib/private/app/codechecker/abstractcheck.php index c1c6524e42f..ca91d366482 100644 --- a/lib/private/app/codechecker/abstractcheck.php +++ b/lib/private/app/codechecker/abstractcheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/codechecker.php b/lib/private/app/codechecker/codechecker.php index ef7dc7f3e4d..0ca597ccb4e 100644 --- a/lib/private/app/codechecker/codechecker.php +++ b/lib/private/app/codechecker/codechecker.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/deprecationcheck.php b/lib/private/app/codechecker/deprecationcheck.php index 1d287edc858..fa5eae8ab1d 100644 --- a/lib/private/app/codechecker/deprecationcheck.php +++ b/lib/private/app/codechecker/deprecationcheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/emptycheck.php b/lib/private/app/codechecker/emptycheck.php index 0e5df55d090..b779926d5e4 100644 --- a/lib/private/app/codechecker/emptycheck.php +++ b/lib/private/app/codechecker/emptycheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/icheck.php b/lib/private/app/codechecker/icheck.php index a00e0d8fa13..97e0bc9b8a0 100644 --- a/lib/private/app/codechecker/icheck.php +++ b/lib/private/app/codechecker/icheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/infochecker.php b/lib/private/app/codechecker/infochecker.php index 2589277118b..ac92ee2661c 100644 --- a/lib/private/app/codechecker/infochecker.php +++ b/lib/private/app/codechecker/infochecker.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/nodevisitor.php b/lib/private/app/codechecker/nodevisitor.php index cf850147fd8..f9386caeeae 100644 --- a/lib/private/app/codechecker/nodevisitor.php +++ b/lib/private/app/codechecker/nodevisitor.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/privatecheck.php b/lib/private/app/codechecker/privatecheck.php index bafcfd1d03e..32248ab21e2 100644 --- a/lib/private/app/codechecker/privatecheck.php +++ b/lib/private/app/codechecker/privatecheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/codechecker/strongcomparisoncheck.php b/lib/private/app/codechecker/strongcomparisoncheck.php index 3072027b258..919647a6a54 100644 --- a/lib/private/app/codechecker/strongcomparisoncheck.php +++ b/lib/private/app/codechecker/strongcomparisoncheck.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/dependencyanalyzer.php b/lib/private/app/dependencyanalyzer.php index 5d86368ea83..0cf4bc72161 100644 --- a/lib/private/app/dependencyanalyzer.php +++ b/lib/private/app/dependencyanalyzer.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -73,7 +73,7 @@ class DependencyAnalyzer { * 5.2.6.5 and 5.1 will be turned into 5.2 and 5.1 * @param string $first * @param string $second - * @return array first element is the first version, second element is the + * @return string[] first element is the first version, second element is the * second version */ private function normalizeVersions($first, $second) { diff --git a/lib/private/app/infoparser.php b/lib/private/app/infoparser.php index a84163612e8..c33e5349f3b 100644 --- a/lib/private/app/infoparser.php +++ b/lib/private/app/infoparser.php @@ -1,10 +1,11 @@ <?php /** * @author Andreas Fischer <bantu@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/platform.php b/lib/private/app/platform.php index c16f050e13c..1d4c3767121 100644 --- a/lib/private/app/platform.php +++ b/lib/private/app/platform.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/app/platformrepository.php b/lib/private/app/platformrepository.php index fa71bd7d91a..7363b2a44b1 100644 --- a/lib/private/app/platformrepository.php +++ b/lib/private/app/platformrepository.php @@ -2,7 +2,7 @@ /** * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -206,6 +206,9 @@ class PlatformRepository { throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage); } + /** + * @param string $stability + */ private function expandStability($stability) { $stability = strtolower($stability); switch ($stability) { diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index 17e474bd77d..035495992ef 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -7,10 +7,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php index 5cad32bbd09..376a8559454 100644 --- a/lib/private/appframework/app.php +++ b/lib/private/appframework/app.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/core/api.php b/lib/private/appframework/core/api.php index 28c846b8d40..67b696948f0 100644 --- a/lib/private/appframework/core/api.php +++ b/lib/private/appframework/core/api.php @@ -4,10 +4,10 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/db/db.php b/lib/private/appframework/db/db.php index 9f912f9c0a4..5fdc5d1066c 100644 --- a/lib/private/appframework/db/db.php +++ b/lib/private/appframework/db/db.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -147,6 +147,21 @@ class Db implements IDb { } /** + * Insert or update a row value + * + * @param string $table + * @param array $keys (column name => value) + * @param array $values (column name => value) + * @param array $updatePreconditionValues ensure values match preconditions (column name => value) + * @return int number of new rows + * @throws \Doctrine\DBAL\DBALException + * @throws PreconditionNotMetException + */ + public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) { + return $this->connection->setValues($table, $keys, $values, $updatePreconditionValues); + } + + /** * Start a transaction */ public function beginTransaction() { diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index 69476d84c9b..175d6c747e4 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -1,15 +1,16 @@ <?php /** * @author Bernhard Posselt <dev@bernhard-posselt.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 McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -173,6 +174,10 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getNavigationManager(); }); + $this->registerService('OCP\\Notification\IManager', function($c) { + return $this->getServer()->getNotificationManager(); + }); + $this->registerService('OCP\\IPreview', function($c) { return $this->getServer()->getPreviewManager(); }); @@ -214,6 +219,10 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getHasher(); }); + $this->registerService('OCP\\Security\\ICredentialsManager', function($c) { + return $this->getServer()->getCredentialsManager(); + }); + $this->registerService('OCP\\Security\\ISecureRandom', function($c) { return $this->getServer()->getSecureRandom(); }); diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php index e64759fa924..a99f7ea437f 100644 --- a/lib/private/appframework/http.php +++ b/lib/private/appframework/http.php @@ -1,13 +1,14 @@ <?php /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/http/dispatcher.php b/lib/private/appframework/http/dispatcher.php index 5fabdad75b9..641339c0d94 100644 --- a/lib/private/appframework/http/dispatcher.php +++ b/lib/private/appframework/http/dispatcher.php @@ -7,7 +7,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/http/output.php b/lib/private/appframework/http/output.php index f4773ab1063..dfb03e6a516 100644 --- a/lib/private/appframework/http/output.php +++ b/lib/private/appframework/http/output.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index 6ba1d8f644d..2b944c116eb 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -5,13 +5,16 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> + * @author Mitar <mitar.git@tnode.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -465,7 +468,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { } if(empty($this->requestId)) { - $this->requestId = $this->secureRandom->getLowStrengthGenerator()->generate(20); + $this->requestId = $this->secureRandom->generate(20); } return $this->requestId; diff --git a/lib/private/appframework/middleware/middlewaredispatcher.php b/lib/private/appframework/middleware/middlewaredispatcher.php index 5d4cf3786f1..e2b2eff42ab 100644 --- a/lib/private/appframework/middleware/middlewaredispatcher.php +++ b/lib/private/appframework/middleware/middlewaredispatcher.php @@ -6,7 +6,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/corsmiddleware.php b/lib/private/appframework/middleware/security/corsmiddleware.php index 0e37e81c5be..e42513b44a2 100644 --- a/lib/private/appframework/middleware/security/corsmiddleware.php +++ b/lib/private/appframework/middleware/security/corsmiddleware.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/exceptions/appnotenabledexception.php b/lib/private/appframework/middleware/security/exceptions/appnotenabledexception.php index 54cb08f4385..59e247f3307 100644 --- a/lib/private/appframework/middleware/security/exceptions/appnotenabledexception.php +++ b/lib/private/appframework/middleware/security/exceptions/appnotenabledexception.php @@ -1,8 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/exceptions/crosssiterequestforgeryexception.php b/lib/private/appframework/middleware/security/exceptions/crosssiterequestforgeryexception.php index c59c921f5eb..0eeb81730d4 100644 --- a/lib/private/appframework/middleware/security/exceptions/crosssiterequestforgeryexception.php +++ b/lib/private/appframework/middleware/security/exceptions/crosssiterequestforgeryexception.php @@ -1,8 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/exceptions/notadminexception.php b/lib/private/appframework/middleware/security/exceptions/notadminexception.php index 3fa03cae896..be0f2f9d2a9 100644 --- a/lib/private/appframework/middleware/security/exceptions/notadminexception.php +++ b/lib/private/appframework/middleware/security/exceptions/notadminexception.php @@ -1,8 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/exceptions/notloggedinexception.php b/lib/private/appframework/middleware/security/exceptions/notloggedinexception.php index 5f27625aa52..f5b2e032032 100644 --- a/lib/private/appframework/middleware/security/exceptions/notloggedinexception.php +++ b/lib/private/appframework/middleware/security/exceptions/notloggedinexception.php @@ -1,8 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/exceptions/securityexception.php b/lib/private/appframework/middleware/security/exceptions/securityexception.php index 9b99282ce86..c86614ec477 100644 --- a/lib/private/appframework/middleware/security/exceptions/securityexception.php +++ b/lib/private/appframework/middleware/security/exceptions/securityexception.php @@ -1,8 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php index 725ce689b48..4ef043ad50f 100644 --- a/lib/private/appframework/middleware/security/securitymiddleware.php +++ b/lib/private/appframework/middleware/security/securitymiddleware.php @@ -7,7 +7,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/middleware/sessionmiddleware.php b/lib/private/appframework/middleware/sessionmiddleware.php index 64f0b5e5c51..b218b48ea11 100644 --- a/lib/private/appframework/middleware/sessionmiddleware.php +++ b/lib/private/appframework/middleware/sessionmiddleware.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/routing/routeactionhandler.php b/lib/private/appframework/routing/routeactionhandler.php index 1dfa9425814..b282fc1b452 100644 --- a/lib/private/appframework/routing/routeactionhandler.php +++ b/lib/private/appframework/routing/routeactionhandler.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/routing/routeconfig.php b/lib/private/appframework/routing/routeconfig.php index 7cef3f700b4..dd029ba9a00 100644 --- a/lib/private/appframework/routing/routeconfig.php +++ b/lib/private/appframework/routing/routeconfig.php @@ -4,10 +4,10 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Patrick Paysant <ppaysant@linagora.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/utility/controllermethodreflector.php b/lib/private/appframework/utility/controllermethodreflector.php index 1118332f930..de83749fbaf 100644 --- a/lib/private/appframework/utility/controllermethodreflector.php +++ b/lib/private/appframework/utility/controllermethodreflector.php @@ -3,11 +3,10 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/utility/simplecontainer.php b/lib/private/appframework/utility/simplecontainer.php index e55d4e20a81..78ded39735e 100644 --- a/lib/private/appframework/utility/simplecontainer.php +++ b/lib/private/appframework/utility/simplecontainer.php @@ -4,10 +4,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/appframework/utility/timefactory.php b/lib/private/appframework/utility/timefactory.php index 011413db6bb..5241b367069 100644 --- a/lib/private/appframework/utility/timefactory.php +++ b/lib/private/appframework/utility/timefactory.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/apphelper.php b/lib/private/apphelper.php index 478787b21d8..c19ed2f5b67 100644 --- a/lib/private/apphelper.php +++ b/lib/private/apphelper.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/archive.php b/lib/private/archive.php index 54c5a71f715..62512d1448a 100644 --- a/lib/private/archive.php +++ b/lib/private/archive.php @@ -8,11 +8,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Remco Brenninkmeijer <requist1@starmail.nl> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/archive/tar.php b/lib/private/archive/tar.php index 4066e1d86c1..905d99f116b 100644 --- a/lib/private/archive/tar.php +++ b/lib/private/archive/tar.php @@ -1,6 +1,7 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> + * @author Christian Weiske <cweiske@cweiske.de> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Felix Moeller <mail@felixmoeller.de> * @author Frank Karlitschek <frank@owncloud.org> @@ -9,11 +10,11 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Remco Brenninkmeijer <requist1@starmail.nl> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/archive/zip.php b/lib/private/archive/zip.php index 430dccc49b7..2c617a8e633 100644 --- a/lib/private/archive/zip.php +++ b/lib/private/archive/zip.php @@ -11,7 +11,7 @@ * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 966e4903649..d4e5f5225dc 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -6,11 +6,11 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/avatarmanager.php b/lib/private/avatarmanager.php index 6969b386e15..b14f8133e63 100644 --- a/lib/private/avatarmanager.php +++ b/lib/private/avatarmanager.php @@ -4,10 +4,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/backgroundjob/job.php b/lib/private/backgroundjob/job.php index 40a27491fe6..e7268894848 100644 --- a/lib/private/backgroundjob/job.php +++ b/lib/private/backgroundjob/job.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -52,7 +52,10 @@ abstract class Job implements IJob { $this->run($this->argument); } catch (\Exception $e) { if ($logger) { - $logger->error('Error while running background job: ' . $e->getMessage()); + $logger->logException($e, [ + 'app' => 'core', + 'message' => 'Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')' + ]); } } } diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index 446de2fa1a4..cc9be574807 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -1,11 +1,11 @@ <?php /** - * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/backgroundjob/legacy/queuedjob.php b/lib/private/backgroundjob/legacy/queuedjob.php index e9d5825ca9a..983c06fe551 100644 --- a/lib/private/backgroundjob/legacy/queuedjob.php +++ b/lib/private/backgroundjob/legacy/queuedjob.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/backgroundjob/legacy/regularjob.php b/lib/private/backgroundjob/legacy/regularjob.php index 49a777a1e27..8e8b6634c11 100644 --- a/lib/private/backgroundjob/legacy/regularjob.php +++ b/lib/private/backgroundjob/legacy/regularjob.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/backgroundjob/queuedjob.php b/lib/private/backgroundjob/queuedjob.php index c4cf8b0e5e0..bf34db7cc02 100644 --- a/lib/private/backgroundjob/queuedjob.php +++ b/lib/private/backgroundjob/queuedjob.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/backgroundjob/timedjob.php b/lib/private/backgroundjob/timedjob.php index 63db1fed61c..abf487a89e1 100644 --- a/lib/private/backgroundjob/timedjob.php +++ b/lib/private/backgroundjob/timedjob.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/cache/cappedmemorycache.php b/lib/private/cache/cappedmemorycache.php new file mode 100644 index 00000000000..e3efbf76a23 --- /dev/null +++ b/lib/private/cache/cappedmemorycache.php @@ -0,0 +1,87 @@ +<?php +/** + * @author Robin Appelman <icewind@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Cache; + +use OCP\ICache; + +/** + * In-memory cache with a capacity limit to keep memory usage in check + * + * Uses a simple FIFO expiry mechanism + */ +class CappedMemoryCache implements ICache, \ArrayAccess { + + private $capacity; + private $cache = []; + + public function __construct($capacity = 512) { + $this->capacity = $capacity; + } + + public function hasKey($key) { + return isset($this->cache[$key]); + } + + public function get($key) { + return isset($this->cache[$key]) ? $this->cache[$key] : null; + } + + public function set($key, $value, $ttl = 0) { + $this->cache[$key] = $value; + $this->garbageCollect(); + } + + public function remove($key) { + unset($this->cache[$key]); + return true; + } + + public function clear($prefix = '') { + $this->cache = []; + return true; + } + + public function offsetExists($offset) { + return $this->hasKey($offset); + } + + public function &offsetGet($offset) { + return $this->cache[$offset]; + } + + public function offsetSet($offset, $value) { + $this->set($offset, $value); + } + + public function offsetUnset($offset) { + $this->remove($offset); + } + + + private function garbageCollect() { + while (count($this->cache) > $this->capacity) { + reset($this->cache); + $key = key($this->cache); + $this->remove($key); + } + } +} diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index 31d4718d18a..989e05275b7 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -1,10 +1,12 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -99,7 +101,7 @@ class File implements ICache { $storage = $this->getStorage(); $result = false; // unique id to avoid chunk collision, just in case - $uniqueId = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate( + $uniqueId = \OC::$server->getSecureRandom()->generate( 16, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER ); diff --git a/lib/private/capabilitiesmanager.php b/lib/private/capabilitiesmanager.php index c36a96af68b..8b89692faa9 100644 --- a/lib/private/capabilitiesmanager.php +++ b/lib/private/capabilitiesmanager.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/asyncbus.php b/lib/private/command/asyncbus.php index c007affc7f4..eb692f9a8fb 100644 --- a/lib/private/command/asyncbus.php +++ b/lib/private/command/asyncbus.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/callablejob.php b/lib/private/command/callablejob.php index b61721863f0..acfeb83d606 100644 --- a/lib/private/command/callablejob.php +++ b/lib/private/command/callablejob.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/closurejob.php b/lib/private/command/closurejob.php index bae98db51cf..be2b5f0a4ba 100644 --- a/lib/private/command/closurejob.php +++ b/lib/private/command/closurejob.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/commandjob.php b/lib/private/command/commandjob.php index 9f0292fc38b..5d613c0305b 100644 --- a/lib/private/command/commandjob.php +++ b/lib/private/command/commandjob.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/fileaccess.php b/lib/private/command/fileaccess.php index b4af557153e..6fe3e111aef 100644 --- a/lib/private/command/fileaccess.php +++ b/lib/private/command/fileaccess.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/command/queuebus.php b/lib/private/command/queuebus.php index 76caf76a575..be4ee589e6f 100644 --- a/lib/private/command/queuebus.php +++ b/lib/private/command/queuebus.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/comments/comment.php b/lib/private/comments/comment.php index 219e7ec8e4b..1e1514a5872 100644 --- a/lib/private/comments/comment.php +++ b/lib/private/comments/comment.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Comments; use OCP\Comments\IComment; diff --git a/lib/private/comments/manager.php b/lib/private/comments/manager.php index 09e59f28370..64013a9e11f 100644 --- a/lib/private/comments/manager.php +++ b/lib/private/comments/manager.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Comments; use Doctrine\DBAL\Exception\DriverException; diff --git a/lib/private/comments/managerfactory.php b/lib/private/comments/managerfactory.php index 41978d0cf4b..281e8ca7fef 100644 --- a/lib/private/comments/managerfactory.php +++ b/lib/private/comments/managerfactory.php @@ -1,14 +1,48 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Comments; use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManagerFactory; - +use OCP\IServerContainer; class ManagerFactory implements ICommentsManagerFactory { /** + * Server container + * + * @var IServerContainer + */ + private $serverContainer; + + /** + * Constructor for the comments manager factory + * + * @param IServerContainer $serverContainer server container + */ + public function __construct(IServerContainer $serverContainer) { + $this->serverContainer = $serverContainer; + } + + /** * creates and returns an instance of the ICommentsManager * * @return ICommentsManager @@ -16,8 +50,8 @@ class ManagerFactory implements ICommentsManagerFactory { */ public function getManager() { return new Manager( - \OC::$server->getDatabaseConnection(), - \OC::$server->getLogger() + $this->serverContainer->getDatabaseConnection(), + $this->serverContainer->getLogger() ); } } diff --git a/lib/private/config.php b/lib/private/config.php index 94b4fd56daa..30baa3fe0e6 100644 --- a/lib/private/config.php +++ b/lib/private/config.php @@ -12,10 +12,9 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Volkan Gezer <volkangezer@gmail.com> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/console/application.php b/lib/private/console/application.php index e6d8677b72e..c7d9c24d7cb 100644 --- a/lib/private/console/application.php +++ b/lib/private/console/application.php @@ -1,11 +1,11 @@ <?php /** - * @author Martin Mattel <martin.mattel@diemattels.at> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/console/timestampformatter.php b/lib/private/console/timestampformatter.php index f0c0f4c4520..3beac5e2f9f 100644 --- a/lib/private/console/timestampformatter.php +++ b/lib/private/console/timestampformatter.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/contacts/localaddressbook.php b/lib/private/contacts/localaddressbook.php index 7f10c6d3338..6fba63ae327 100644 --- a/lib/private/contacts/localaddressbook.php +++ b/lib/private/contacts/localaddressbook.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/contactsmanager.php b/lib/private/contactsmanager.php index 28285412377..a2640d36945 100644 --- a/lib/private/contactsmanager.php +++ b/lib/private/contactsmanager.php @@ -3,11 +3,11 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tobia De Koninck <tobia@ledfan.be> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/databaseexception.php b/lib/private/databaseexception.php index a382a4ac60b..4d50fe82b0f 100644 --- a/lib/private/databaseexception.php +++ b/lib/private/databaseexception.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/databasesetupexception.php b/lib/private/databasesetupexception.php index 395b85d5349..30bd00de2d6 100644 --- a/lib/private/databasesetupexception.php +++ b/lib/private/databasesetupexception.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/datetimeformatter.php b/lib/private/datetimeformatter.php index 912a5faa2e3..5639ab1cace 100644 --- a/lib/private/datetimeformatter.php +++ b/lib/private/datetimeformatter.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/datetimezone.php b/lib/private/datetimezone.php index 512c39be3ea..5359cd6b391 100644 --- a/lib/private/datetimezone.php +++ b/lib/private/datetimezone.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db.php b/lib/private/db.php index d47b7d4f31a..6535bb70d6d 100644 --- a/lib/private/db.php +++ b/lib/private/db.php @@ -2,17 +2,15 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> - * @author Dan Bartram <daneybartram@gmail.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Tom Needham <tom@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adapter.php b/lib/private/db/adapter.php index f104a62d2d5..9522f768c88 100644 --- a/lib/private/db/adapter.php +++ b/lib/private/db/adapter.php @@ -7,7 +7,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adaptermysql.php b/lib/private/db/adaptermysql.php index fda8554e1c4..ab87c589747 100644 --- a/lib/private/db/adaptermysql.php +++ b/lib/private/db/adaptermysql.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adapteroci8.php b/lib/private/db/adapteroci8.php index 76c265bc178..970d3eefa4d 100644 --- a/lib/private/db/adapteroci8.php +++ b/lib/private/db/adapteroci8.php @@ -3,8 +3,9 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adapterpgsql.php b/lib/private/db/adapterpgsql.php index 1f2119e92a5..a7d9377a0bf 100644 --- a/lib/private/db/adapterpgsql.php +++ b/lib/private/db/adapterpgsql.php @@ -3,7 +3,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adaptersqlite.php b/lib/private/db/adaptersqlite.php index e133a20f543..d7769238abc 100644 --- a/lib/private/db/adaptersqlite.php +++ b/lib/private/db/adaptersqlite.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/adaptersqlsrv.php b/lib/private/db/adaptersqlsrv.php index 7e181c37cc5..f208b2ba787 100644 --- a/lib/private/db/adaptersqlsrv.php +++ b/lib/private/db/adaptersqlsrv.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php index d32d1c5fa46..6c4f518dfb5 100644 --- a/lib/private/db/connection.php +++ b/lib/private/db/connection.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -32,6 +32,7 @@ use Doctrine\Common\EventManager; use OC\DB\QueryBuilder\ExpressionBuilder; use OC\DB\QueryBuilder\QueryBuilder; use OCP\IDBConnection; +use OCP\PreconditionNotMetException; class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { /** @@ -241,6 +242,64 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { return $this->adapter->insertIfNotExist($table, $input, $compare); } + private function getType($value) { + if (is_bool($value)) { + return \PDO::PARAM_BOOL; + } else if (is_int($value)) { + return \PDO::PARAM_INT; + } else { + return \PDO::PARAM_STR; + } + } + + /** + * Insert or update a row value + * + * @param string $table + * @param array $keys (column name => value) + * @param array $values (column name => value) + * @param array $updatePreconditionValues ensure values match preconditions (column name => value) + * @return int number of new rows + * @throws \Doctrine\DBAL\DBALException + * @throws PreconditionNotMetException + */ + public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) { + try { + $insertQb = $this->getQueryBuilder(); + $insertQb->insert($table) + ->values( + array_map(function($value) use ($insertQb) { + return $insertQb->createNamedParameter($value, $this->getType($value)); + }, array_merge($keys, $values)) + ); + return $insertQb->execute(); + } catch (\Doctrine\DBAL\Exception\ConstraintViolationException $e) { + // value already exists, try update + $updateQb = $this->getQueryBuilder(); + $updateQb->update($table); + foreach ($values as $name => $value) { + $updateQb->set($name, $updateQb->createNamedParameter($value), $this->getType($value)); + } + $where = $updateQb->expr()->andx(); + $whereValues = array_merge($keys, $updatePreconditionValues); + foreach ($whereValues as $name => $value) { + $where->add($updateQb->expr()->eq( + $name, + $updateQb->createNamedParameter($value, $this->getType($value)), + $this->getType($value) + )); + } + $updateQb->where($where); + $affected = $updateQb->execute(); + + if ($affected === 0) { + throw new PreconditionNotMetException(); + } + + return 0; + } + } + /** * returns the error code and message as a string for logging * works with DoctrineException diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php index b6c3396e147..0856d8d19c0 100644 --- a/lib/private/db/connectionfactory.php +++ b/lib/private/db/connectionfactory.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php index 6fa9a63ec00..495ccb902d6 100644 --- a/lib/private/db/mdb2schemamanager.php +++ b/lib/private/db/mdb2schemamanager.php @@ -5,11 +5,11 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author tbelau666 <thomas.belau@gmx.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -75,7 +75,7 @@ class MDB2SchemaManager { * @return \OC\DB\Migrator */ public function getMigrator() { - $random = \OC::$server->getSecureRandom()->getMediumStrengthGenerator(); + $random = \OC::$server->getSecureRandom(); $platform = $this->conn->getDatabasePlatform(); $config = \OC::$server->getConfig(); if ($platform instanceof SqlitePlatform) { diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php index 946ef1c621d..6f99206e5c8 100644 --- a/lib/private/db/mdb2schemareader.php +++ b/lib/private/db/mdb2schemareader.php @@ -5,12 +5,12 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Oliver Gasser <oliver.gasser@gmail.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/mdb2schemawriter.php b/lib/private/db/mdb2schemawriter.php index 0ff04008b61..803e7cda0b4 100644 --- a/lib/private/db/mdb2schemawriter.php +++ b/lib/private/db/mdb2schemawriter.php @@ -7,7 +7,7 @@ * @author tbelau666 <thomas.belau@gmx.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/migrationexception.php b/lib/private/db/migrationexception.php index e79644f2268..57e4c5b8334 100644 --- a/lib/private/db/migrationexception.php +++ b/lib/private/db/migrationexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php index 6a587ede631..7ca3f981358 100644 --- a/lib/private/db/migrator.php +++ b/lib/private/db/migrator.php @@ -8,7 +8,7 @@ * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -52,7 +52,7 @@ class Migrator { protected $config; /** - * @param \Doctrine\DBAL\Connection $connection + * @param Connection $connection * @param ISecureRandom $random * @param IConfig $config */ diff --git a/lib/private/db/mysqlmigrator.php b/lib/private/db/mysqlmigrator.php index 41f179db000..1b3f70a817d 100644 --- a/lib/private/db/mysqlmigrator.php +++ b/lib/private/db/mysqlmigrator.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/nocheckmigrator.php b/lib/private/db/nocheckmigrator.php index 3ecbe6b721c..23afae11816 100644 --- a/lib/private/db/nocheckmigrator.php +++ b/lib/private/db/nocheckmigrator.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/ocsqliteplatform.php b/lib/private/db/ocsqliteplatform.php index 2456d262fe3..fe68bc3cc91 100644 --- a/lib/private/db/ocsqliteplatform.php +++ b/lib/private/db/ocsqliteplatform.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/oracleconnection.php b/lib/private/db/oracleconnection.php index 15cd1231b77..a95f37a8e6c 100644 --- a/lib/private/db/oracleconnection.php +++ b/lib/private/db/oracleconnection.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/oraclemigrator.php b/lib/private/db/oraclemigrator.php index fa30a9989aa..ceb89cf64d4 100644 --- a/lib/private/db/oraclemigrator.php +++ b/lib/private/db/oraclemigrator.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/pgsqltools.php b/lib/private/db/pgsqltools.php index 9a95d0e81d2..e9e507551e6 100644 --- a/lib/private/db/pgsqltools.php +++ b/lib/private/db/pgsqltools.php @@ -5,7 +5,7 @@ * @author tbelau666 <thomas.belau@gmx.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/querybuilder/compositeexpression.php b/lib/private/db/querybuilder/compositeexpression.php index 523f397e235..927dfe38378 100644 --- a/lib/private/db/querybuilder/compositeexpression.php +++ b/lib/private/db/querybuilder/compositeexpression.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/querybuilder/expressionbuilder.php b/lib/private/db/querybuilder/expressionbuilder.php index cd5b7fbfc54..1e86db5a081 100644 --- a/lib/private/db/querybuilder/expressionbuilder.php +++ b/lib/private/db/querybuilder/expressionbuilder.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -27,10 +27,10 @@ use OCP\IDBConnection; class ExpressionBuilder implements IExpressionBuilder { /** @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */ - private $expressionBuilder; + protected $expressionBuilder; /** @var QuoteHelper */ - private $helper; + protected $helper; /** * Initializes a new <tt>ExpressionBuilder</tt>. @@ -109,10 +109,12 @@ class ExpressionBuilder implements IExpressionBuilder { * * @param mixed $x The left expression. * @param mixed $y The right expression. + * @param int|null $type one of the \PDO::PARAM_* constants + * required when comparing text fields for oci compatibility * * @return string */ - public function eq($x, $y) { + public function eq($x, $y, $type = null) { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); return $this->expressionBuilder->eq($x, $y); diff --git a/lib/private/db/querybuilder/literal.php b/lib/private/db/querybuilder/literal.php index 361b5ccf3b8..0cc96ab48b4 100644 --- a/lib/private/db/querybuilder/literal.php +++ b/lib/private/db/querybuilder/literal.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/querybuilder/ociexpressionbuilder.php b/lib/private/db/querybuilder/ociexpressionbuilder.php new file mode 100644 index 00000000000..742611bf719 --- /dev/null +++ b/lib/private/db/querybuilder/ociexpressionbuilder.php @@ -0,0 +1,33 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\DB\QueryBuilder; + +class OCIExpressionBuilder extends ExpressionBuilder { + public function eq($x, $y, $type = null) { + $x = $this->helper->quoteColumnName($x); + $y = $this->helper->quoteColumnName($y); + if ($type === \PDO::PARAM_STR) { + $x = new QueryFunction('to_char(' . $x . ')'); + } + return $this->expressionBuilder->eq($x, $y); + } +} diff --git a/lib/private/db/querybuilder/parameter.php b/lib/private/db/querybuilder/parameter.php index c14b4e21925..1c233c83f1d 100644 --- a/lib/private/db/querybuilder/parameter.php +++ b/lib/private/db/querybuilder/parameter.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/querybuilder/querybuilder.php b/lib/private/db/querybuilder/querybuilder.php index a4cbb5abd76..42b290b90e7 100644 --- a/lib/private/db/querybuilder/querybuilder.php +++ b/lib/private/db/querybuilder/querybuilder.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -21,6 +21,7 @@ namespace OC\DB\QueryBuilder; +use OC\DB\OracleConnection; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryFunction; use OCP\DB\QueryBuilder\IParameter; @@ -82,7 +83,11 @@ class QueryBuilder implements IQueryBuilder { * @return \OCP\DB\QueryBuilder\IExpressionBuilder */ public function expr() { - return new ExpressionBuilder($this->connection); + if ($this->connection instanceof OracleConnection) { + return new OCIExpressionBuilder($this->connection); + } else { + return new ExpressionBuilder($this->connection); + } } /** diff --git a/lib/private/db/querybuilder/queryfunction.php b/lib/private/db/querybuilder/queryfunction.php index 2a47d83b917..ac6d73f3cbf 100644 --- a/lib/private/db/querybuilder/queryfunction.php +++ b/lib/private/db/querybuilder/queryfunction.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/querybuilder/quotehelper.php b/lib/private/db/querybuilder/quotehelper.php index 5ceb76bbf93..fda243a3786 100644 --- a/lib/private/db/querybuilder/quotehelper.php +++ b/lib/private/db/querybuilder/quotehelper.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/sqlitemigrator.php b/lib/private/db/sqlitemigrator.php index 063ccd87841..8ea32581011 100644 --- a/lib/private/db/sqlitemigrator.php +++ b/lib/private/db/sqlitemigrator.php @@ -5,7 +5,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/sqlitesessioninit.php b/lib/private/db/sqlitesessioninit.php index c8d2a3940d1..0683c47d08e 100644 --- a/lib/private/db/sqlitesessioninit.php +++ b/lib/private/db/sqlitesessioninit.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/db/statementwrapper.php b/lib/private/db/statementwrapper.php index c888fab0774..6422d8d5f1b 100644 --- a/lib/private/db/statementwrapper.php +++ b/lib/private/db/statementwrapper.php @@ -5,10 +5,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/defaults.php b/lib/private/defaults.php index 23f0baad96e..43e8c8082cc 100644 --- a/lib/private/defaults.php +++ b/lib/private/defaults.php @@ -7,12 +7,12 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Pascal de Bruijn <pmjdebruijn@pcode.nl> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author scolebrook <scolebrook@mac.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Volkan Gezer <volkangezer@gmail.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -261,6 +261,9 @@ class OC_Defaults { return $footer; } + /** + * @param string $key + */ public function buildDocLinkToKey($key) { if ($this->themeExist('buildDocLinkToKey')) { return $this->theme->buildDocLinkToKey($key); diff --git a/lib/private/diagnostics/event.php b/lib/private/diagnostics/event.php index 541a84ffa10..8b5bb7e3bd8 100644 --- a/lib/private/diagnostics/event.php +++ b/lib/private/diagnostics/event.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/diagnostics/eventlogger.php b/lib/private/diagnostics/eventlogger.php index 2345abb3fff..3d909ce79cd 100644 --- a/lib/private/diagnostics/eventlogger.php +++ b/lib/private/diagnostics/eventlogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/diagnostics/nulleventlogger.php b/lib/private/diagnostics/nulleventlogger.php index 0a8d656a5fc..1b5e7af3ac9 100644 --- a/lib/private/diagnostics/nulleventlogger.php +++ b/lib/private/diagnostics/nulleventlogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/diagnostics/nullquerylogger.php b/lib/private/diagnostics/nullquerylogger.php index e35d28118d6..98ddef2e783 100644 --- a/lib/private/diagnostics/nullquerylogger.php +++ b/lib/private/diagnostics/nullquerylogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/diagnostics/query.php b/lib/private/diagnostics/query.php index 203ef15d677..567bc83ed4b 100644 --- a/lib/private/diagnostics/query.php +++ b/lib/private/diagnostics/query.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/diagnostics/querylogger.php b/lib/private/diagnostics/querylogger.php index 289005a1c41..794e7a5e263 100644 --- a/lib/private/diagnostics/querylogger.php +++ b/lib/private/diagnostics/querylogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/decryptall.php b/lib/private/encryption/decryptall.php index e19ee6b745f..7a965a5f227 100644 --- a/lib/private/encryption/decryptall.php +++ b/lib/private/encryption/decryptall.php @@ -2,7 +2,7 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/decryptionfailedexception.php b/lib/private/encryption/exceptions/decryptionfailedexception.php index 406ae12968e..a0cbbc5cce0 100644 --- a/lib/private/encryption/exceptions/decryptionfailedexception.php +++ b/lib/private/encryption/exceptions/decryptionfailedexception.php @@ -3,7 +3,7 @@ * @author Clark Tomlinson <fallen013@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/emptyencryptiondataexception.php b/lib/private/encryption/exceptions/emptyencryptiondataexception.php index 739614b3ec2..2c90c2db7df 100644 --- a/lib/private/encryption/exceptions/emptyencryptiondataexception.php +++ b/lib/private/encryption/exceptions/emptyencryptiondataexception.php @@ -3,7 +3,7 @@ * @author Clark Tomlinson <fallen013@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/encryptionfailedexception.php b/lib/private/encryption/exceptions/encryptionfailedexception.php index 4195ca0a5a8..98e92eb199c 100644 --- a/lib/private/encryption/exceptions/encryptionfailedexception.php +++ b/lib/private/encryption/exceptions/encryptionfailedexception.php @@ -3,7 +3,7 @@ * @author Clark Tomlinson <fallen013@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/encryptionheaderkeyexistsexception.php b/lib/private/encryption/exceptions/encryptionheaderkeyexistsexception.php index d927939484f..ab1a166018c 100644 --- a/lib/private/encryption/exceptions/encryptionheaderkeyexistsexception.php +++ b/lib/private/encryption/exceptions/encryptionheaderkeyexistsexception.php @@ -3,7 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/encryptionheadertolargeexception.php b/lib/private/encryption/exceptions/encryptionheadertolargeexception.php index 40c51782a32..7b706e621de 100644 --- a/lib/private/encryption/exceptions/encryptionheadertolargeexception.php +++ b/lib/private/encryption/exceptions/encryptionheadertolargeexception.php @@ -3,7 +3,7 @@ * @author Clark Tomlinson <fallen013@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/modulealreadyexistsexception.php b/lib/private/encryption/exceptions/modulealreadyexistsexception.php index c72ad7b7ab2..fcd08679acc 100644 --- a/lib/private/encryption/exceptions/modulealreadyexistsexception.php +++ b/lib/private/encryption/exceptions/modulealreadyexistsexception.php @@ -3,7 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/moduledoesnotexistsexception.php b/lib/private/encryption/exceptions/moduledoesnotexistsexception.php index d6fbb2b6e51..282c9ec080b 100644 --- a/lib/private/encryption/exceptions/moduledoesnotexistsexception.php +++ b/lib/private/encryption/exceptions/moduledoesnotexistsexception.php @@ -3,7 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/exceptions/unknowncipherexception.php b/lib/private/encryption/exceptions/unknowncipherexception.php index 91535183169..beb4cb7f2e5 100644 --- a/lib/private/encryption/exceptions/unknowncipherexception.php +++ b/lib/private/encryption/exceptions/unknowncipherexception.php @@ -3,7 +3,7 @@ * @author Clark Tomlinson <fallen013@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/file.php b/lib/private/encryption/file.php index 6d261f46d0f..ec55c2cea00 100644 --- a/lib/private/encryption/file.php +++ b/lib/private/encryption/file.php @@ -3,7 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/hookmanager.php b/lib/private/encryption/hookmanager.php index 8969379c957..0bc42ec8159 100644 --- a/lib/private/encryption/hookmanager.php +++ b/lib/private/encryption/hookmanager.php @@ -3,7 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/keys/storage.php b/lib/private/encryption/keys/storage.php index e21fd62e366..47360f45aa5 100644 --- a/lib/private/encryption/keys/storage.php +++ b/lib/private/encryption/keys/storage.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php index d38ec6684a6..d1d17a92887 100644 --- a/lib/private/encryption/manager.php +++ b/lib/private/encryption/manager.php @@ -5,7 +5,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/update.php b/lib/private/encryption/update.php index 64cccc16ed8..62c23c1fe0c 100644 --- a/lib/private/encryption/update.php +++ b/lib/private/encryption/update.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php index ef500883865..860c541934a 100644 --- a/lib/private/encryption/util.php +++ b/lib/private/encryption/util.php @@ -5,7 +5,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/eventsource.php b/lib/private/eventsource.php index 0e98bdc2628..f567d1e6ca5 100644 --- a/lib/private/eventsource.php +++ b/lib/private/eventsource.php @@ -8,7 +8,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php index 64399ad4366..8c341df4a8b 100644 --- a/lib/private/filechunking.php +++ b/lib/private/filechunking.php @@ -10,7 +10,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files.php b/lib/private/files.php index 1cda28496cb..7b451ac19be 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -3,6 +3,7 @@ * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Frank Karlitschek <frank@owncloud.org> * @author Jakob Sack <mail@jakobsack.de> * @author Joas Schilling <nickvergessen@owncloud.com> @@ -10,14 +11,14 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Nicolai Ehemann <en@enlightened.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thibaut GRIDEL <tgridel@free.fr> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index e6110c1925d..527c8b76e52 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -1,7 +1,6 @@ <?php /** * @author Andreas Fischer <bantu@owncloud.com> - * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Florin Peter <github@florin-peter.de> * @author Jens-Christian Fischer <jens-christian.fischer@switch.ch> @@ -10,12 +9,12 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author TheSFReader <TheSFReader@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -34,6 +33,8 @@ namespace OC\Files\Cache; +use OCP\Files\Cache\ICache; +use OCP\Files\Cache\ICacheEntry; use \OCP\Files\IMimeTypeLoader; use OCP\IDBConnection; @@ -47,12 +48,7 @@ use OCP\IDBConnection; * - Updater: listens to changes made to the filesystem inside of the ownCloud instance and updates the cache where needed * - ChangePropagator: updates the mtime and etags of parent folders whenever a change to the cache is made to the cache by the updater */ -class Cache { - const NOT_FOUND = 0; - const PARTIAL = 1; //only partial data available, file not cached in the database - const SHALLOW = 2; //folder in cache, but not all child files are completely scanned - const COMPLETE = 3; - +class Cache implements ICache { /** * @var array partial data for the cache */ @@ -106,28 +102,8 @@ class Cache { /** * get the stored metadata of a file or folder * - * the returned cache entry contains at least the following values: - * [ - * 'fileid' => int, the numeric id of a file (see getId) - * 'storage' => int, the numeric id of the storage the file is stored on - * 'path' => string, the path of the file within the storage ('foo/bar.txt') - * 'name' => string, the basename of a file ('bar.txt) - * 'mimetype' => string, the full mimetype of the file ('text/plain') - * 'mimepart' => string, the first half of the mimetype ('text') - * 'size' => int, the size of the file or folder in bytes - * 'mtime' => int, the last modified date of the file as unix timestamp as shown in the ui - * 'storage_mtime' => int, the last modified date of the file as unix timestamp as stored on the storage - * Note that when a file is updated we also update the mtime of all parent folders to make it visible to the user which folder has had updates most recently - * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed - * 'etag' => string, the etag for the file - * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes - * Etag for folders change whenever a file in the folder has changed - * 'permissions' int, the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE - * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE - * ] - * * @param string | int $file either the path of a file or folder or the file id for a file or folder - * @return array|false the cache entry as array of false if the file is not found in the cache + * @return ICacheEntry|false the cache entry as array of false if the file is not found in the cache */ public function get($file) { if (is_string($file) or $file == '') { @@ -157,6 +133,7 @@ class Cache { if (isset($this->partial[$file])) { $data = $this->partial[$file]; } + return $data; } else { //fix types $data['fileid'] = (int)$data['fileid']; @@ -172,16 +149,15 @@ class Cache { $data['storage_mtime'] = $data['mtime']; } $data['permissions'] = (int)$data['permissions']; + return new CacheEntry($data); } - - return $data; } /** * get the metadata of all files stored in $folder * * @param string $folder - * @return array + * @return ICacheEntry[] */ public function getFolderContents($folder) { $fileId = $this->getId($folder); @@ -192,7 +168,7 @@ class Cache { * get the metadata of all files stored in $folder * * @param int $fileId the file id of the folder - * @return array + * @return ICacheEntry[] */ public function getFolderContentsById($fileId) { if ($fileId > -1) { @@ -212,7 +188,9 @@ class Cache { $file['storage_mtime'] = (int)$file['storage_mtime']; $file['size'] = 0 + $file['size']; } - return $files; + return array_map(function (array $data) { + return new CacheEntry($data); + }, $files); } else { return array(); } @@ -393,7 +371,7 @@ class Cache { return -1; } else { $parent = $this->getParentPath($file); - return (int) $this->getId($parent); + return (int)$this->getId($parent); } } @@ -482,12 +460,12 @@ class Cache { /** * Move a file or folder in the cache * - * @param \OC\Files\Cache\Cache $sourceCache + * @param \OCP\Files\Cache\ICache $sourceCache * @param string $sourcePath * @param string $targetPath * @throws \OC\DatabaseException */ - public function moveFromCache(Cache $sourceCache, $sourcePath, $targetPath) { + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { // normalize source and target $sourcePath = $this->normalize($sourcePath); $targetPath = $this->normalize($targetPath); @@ -572,7 +550,7 @@ class Cache { * search for files matching $pattern * * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') - * @return array an array of cache entries where the name matches the search pattern + * @return ICacheEntry[] an array of cache entries where the name matches the search pattern */ public function search($pattern) { // normalize pattern @@ -595,7 +573,9 @@ class Cache { $row['mimepart'] = $this->mimetypeLoader->getMimetypeById($row['mimepart']); $files[] = $row; } - return $files; + return array_map(function(array $data) { + return new CacheEntry($data); + }, $files); } /** @@ -603,7 +583,7 @@ class Cache { * * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') * where it will search for all mimetypes in the group ('image/*') - * @return array an array of cache entries where the mimetype matches the search + * @return ICacheEntry[] an array of cache entries where the mimetype matches the search */ public function searchByMime($mimetype) { if (strpos($mimetype, '/')) { @@ -621,7 +601,9 @@ class Cache { $row['mimepart'] = $this->mimetypeLoader->getMimetypeById($row['mimepart']); $files[] = $row; } - return $files; + return array_map(function (array $data) { + return new CacheEntry($data); + }, $files); } /** @@ -631,7 +613,7 @@ class Cache { * * @param string|int $tag name or tag id * @param string $userId owner of the tags - * @return array file data + * @return ICacheEntry[] file data */ public function searchByTag($tag, $userId) { $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' . @@ -666,7 +648,9 @@ class Cache { while ($row = $result->fetch()) { $files[] = $row; } - return $files; + return array_map(function (array $data) { + return new CacheEntry($data); + }, $files); } /** diff --git a/lib/private/files/cache/cacheentry.php b/lib/private/files/cache/cacheentry.php new file mode 100644 index 00000000000..3db3b3f8aa0 --- /dev/null +++ b/lib/private/files/cache/cacheentry.php @@ -0,0 +1,114 @@ +<?php +/** + * @author Robin Appelman <icewind@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\Files\Cache; + +use OCP\Files\Cache\ICacheEntry; + +/** + * meta data for a file or folder + */ +class CacheEntry implements ICacheEntry, \ArrayAccess { + /** + * @var array + */ + private $data; + + public function __construct(array $data) { + $this->data = $data; + } + + public function offsetSet($offset, $value) { + $this->data[$offset] = $value; + } + + public function offsetExists($offset) { + return isset($this->data[$offset]); + } + + public function offsetUnset($offset) { + unset($this->data[$offset]); + } + + public function offsetGet($offset) { + if (isset($this->data[$offset])) { + return $this->data[$offset]; + } else { + return null; + } + } + + public function getId() { + return (int)$this->data['fileid']; + } + + public function getStorageId() { + return $this->data['storage']; + } + + + public function getPath() { + return $this->data['path']; + } + + + public function getName() { + return $this->data['name']; + } + + + public function getMimeType() { + return $this->data['mimetype']; + } + + + public function getMimePart() { + return $this->data['mimepart']; + } + + public function getSize() { + return $this->data['size']; + } + + public function getMTime() { + return $this->data['mtime']; + } + + public function getStorageMTime() { + return $this->data['storage_mtime']; + } + + public function getEtag() { + return $this->data['etag']; + } + + public function getPermissions() { + return $this->data['permissions']; + } + + public function isEncrypted() { + return isset($this->data['encrypted']) && $this->data['encrypted']; + } + + public function getData() { + return $this->data; + } +} diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php index 1b85462d615..ae92504ddd6 100644 --- a/lib/private/files/cache/homecache.php +++ b/lib/private/files/cache/homecache.php @@ -7,7 +7,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -26,6 +26,8 @@ namespace OC\Files\Cache; +use OCP\Files\Cache\ICacheEntry; + class HomeCache extends Cache { /** * get the size of a folder and set it in the cache @@ -67,7 +69,7 @@ class HomeCache extends Cache { /** * @param string $path - * @return array + * @return ICacheEntry */ public function get($path) { $data = parent::get($path); diff --git a/lib/private/files/cache/propagator.php b/lib/private/files/cache/propagator.php index bd11cef5990..50264e54d44 100644 --- a/lib/private/files/cache/propagator.php +++ b/lib/private/files/cache/propagator.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -21,10 +21,12 @@ namespace OC\Files\Cache; +use OCP\Files\Cache\IPropagator; + /** * Propagate etags and mtimes within the storage */ -class Propagator { +class Propagator implements IPropagator { /** * @var \OC\Files\Storage\Storage */ @@ -41,9 +43,10 @@ class Propagator { /** * @param string $internalPath * @param int $time + * @param int $sizeDifference number of bytes the file has grown * @return array[] all propagated entries */ - public function propagateChange($internalPath, $time) { + public function propagateChange($internalPath, $time, $sizeDifference = 0) { $cache = $this->storage->getCache($internalPath); $parentId = $cache->getParentId($internalPath); @@ -56,7 +59,12 @@ class Propagator { } $mtime = max($time, $entry['mtime']); - $cache->update($parentId, ['mtime' => $mtime, 'etag' => $this->storage->getETag($entry['path'])]); + if ($entry['size'] === -1) { + $newSize = -1; + } else { + $newSize = $entry['size'] + $sizeDifference; + } + $cache->update($parentId, ['mtime' => $mtime, 'etag' => $this->storage->getETag($entry['path']), 'size' => $newSize]); $parentId = $entry['parent']; } diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 88bb57d2b5c..60daa323b4b 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -2,6 +2,7 @@ /** * @author Arthur Schiwon <blizzz@owncloud.com> * @author Björn Schießle <schiessle@owncloud.com> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Martin Mattel <martin.mattel@diemattels.at> @@ -10,11 +11,11 @@ * @author Olivier Paroz <github@oparoz.com> * @author Owen Winkler <a_github@midnightcircus.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -36,6 +37,8 @@ namespace OC\Files\Cache; use OC\Files\Filesystem; use OC\Hooks\BasicEmitter; use OCP\Config; +use OCP\Files\Cache\IScanner; +use OCP\Files\Storage\ILockingStorage; use OCP\Lock\ILockingProvider; /** @@ -49,7 +52,7 @@ use OCP\Lock\ILockingProvider; * * @package OC\Files\Cache */ -class Scanner extends BasicEmitter { +class Scanner extends BasicEmitter implements IScanner { /** * @var \OC\Files\Storage\Storage $storage */ @@ -80,12 +83,6 @@ class Scanner extends BasicEmitter { */ protected $lockingProvider; - const SCAN_RECURSIVE = true; - const SCAN_SHALLOW = false; - - const REUSE_ETAG = 1; - const REUSE_SIZE = 2; - public function __construct(\OC\Files\Storage\Storage $storage) { $this->storage = $storage; $this->storageId = $this->storage->getId(); @@ -111,7 +108,7 @@ class Scanner extends BasicEmitter { * @param string $path * @return array an array of metadata of the file */ - public function getData($path) { + protected function getData($path) { $data = $this->storage->getMetaData($path); if (is_null($data)) { \OCP\Util::writeLog('OC\Files\Cache\Scanner', "!!! Path '$path' is not accessible or present !!!", \OCP\Util::DEBUG); @@ -132,16 +129,27 @@ class Scanner extends BasicEmitter { * @throws \OCP\Lock\LockedException */ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { - if (!self::isPartialFile($file) - and !Filesystem::isFileBlacklisted($file) - ) { + + // only proceed if $file is not a partial file nor a blacklisted file + if (!self::isPartialFile($file) and !Filesystem::isFileBlacklisted($file)) { + + //acquire a lock if ($lock) { - $this->storage->acquireLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->acquireLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + } } - $this->emit('\OC\Files\Cache\Scanner', 'scanFile', array($file, $this->storageId)); - \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); + $data = $this->getData($file); + if ($data) { + + // pre-emit only if it was a file. By that we avoid counting/treating folders as files + if ($data['mimetype'] !== 'httpd/unix-directory') { + $this->emit('\OC\Files\Cache\Scanner', 'scanFile', array($file, $this->storageId)); + \OC_Hook::emit('\OC\Files\Cache\Scanner', 'scan_file', array('path' => $file, 'storage' => $this->storageId)); + } + $parent = dirname($file); if ($parent === '.' or $parent === '/') { $parent = ''; @@ -159,6 +167,7 @@ class Scanner extends BasicEmitter { $data['parent'] = $parentId; } if (is_null($cacheData)) { + /** @var CacheEntry $cacheData */ $cacheData = $this->cache->get($file); } if ($cacheData and $reuseExisting and isset($cacheData['fileid'])) { @@ -181,7 +190,7 @@ class Scanner extends BasicEmitter { } } // Only update metadata that has changed - $newData = array_diff_assoc($data, $cacheData); + $newData = array_diff_assoc($data, $cacheData->getData()); } else { $newData = $data; $fileId = -1; @@ -189,16 +198,28 @@ class Scanner extends BasicEmitter { if (!empty($newData)) { $data['fileid'] = $this->addToCache($file, $newData, $fileId); } - $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId)); - \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId)); + $data['oldSize'] = $cacheData['size']; + + // post-emit only if it was a file. By that we avoid counting/treating folders as files + if ($data['mimetype'] !== 'httpd/unix-directory') { + $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId)); + \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId)); + } + } else { $this->removeFromCache($file); } + + //release the acquired lock if ($lock) { - $this->storage->releaseLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->releaseLock($file, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + } } + return $data; } + return null; } @@ -262,7 +283,9 @@ class Scanner extends BasicEmitter { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; } if ($lock) { - $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + } } $data = $this->scanFile($path, $reuse, -1, null, $lock); if ($data and $data['mimetype'] === 'httpd/unix-directory') { @@ -270,7 +293,9 @@ class Scanner extends BasicEmitter { $data['size'] = $size; } if ($lock) { - $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); + } } return $data; } diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index 4998c622e84..90c451ecc21 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -4,11 +4,11 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index 4d11fa3a251..80ba704883e 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -1,13 +1,12 @@ <?php /** * @author Björn Schießle <schiessle@owncloud.com> - * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -25,12 +24,14 @@ */ namespace OC\Files\Cache; +use OCP\Files\Cache\IUpdater; +use OCP\Files\Storage\IStorage; /** * Update the cache and propagate changes * */ -class Updater { +class Updater implements IUpdater { /** * @var bool */ @@ -117,9 +118,15 @@ class Updater { } $data = $this->scanner->scan($path, Scanner::SCAN_SHALLOW, -1, false); + if (isset($data['oldSize']) && isset($data['size'])) { + $sizeDifference = $data['size'] - $data['oldSize']; + } else { + // scanner didn't provide size info, fallback to full size calculation + $sizeDifference = 0; + $this->cache->correctFolderSize($path, $data); + } $this->correctParentStorageMtime($path); - $this->cache->correctFolderSize($path, $data); - $this->propagator->propagateChange($path, $time); + $this->propagator->propagateChange($path, $time, $sizeDifference); } /** @@ -146,18 +153,18 @@ class Updater { /** * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders * - * @param \OC\Files\Storage\Storage $sourceStorage + * @param IStorage $sourceStorage * @param string $source * @param string $target */ - public function renameFromStorage(\OC\Files\Storage\Storage $sourceStorage, $source, $target) { + public function renameFromStorage(IStorage $sourceStorage, $source, $target) { if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) { return; } $time = time(); - $sourceCache = $sourceStorage->getCache($source); + $sourceCache = $sourceStorage->getCache(); $sourceUpdater = $sourceStorage->getUpdater(); $sourcePropagator = $sourceStorage->getPropagator(); @@ -182,7 +189,9 @@ class Updater { $sourceCache->correctFolderSize($source); $this->cache->correctFolderSize($target); - $sourceUpdater->correctParentStorageMtime($source); + if ($sourceUpdater instanceof Updater) { + $sourceUpdater->correctParentStorageMtime($source); + } $this->correctParentStorageMtime($target); $this->updateStorageMTimeOnly($target); $sourcePropagator->propagateChange($source, $time); @@ -206,7 +215,7 @@ class Updater { * * @param string $internalPath */ - public function correctParentStorageMtime($internalPath) { + private function correctParentStorageMtime($internalPath) { $parentId = $this->cache->getParentId($internalPath); $parent = dirname($internalPath); if ($parentId != -1) { diff --git a/lib/private/files/cache/watcher.php b/lib/private/files/cache/watcher.php index e660e56bfee..a00e875a2d4 100644 --- a/lib/private/files/cache/watcher.php +++ b/lib/private/files/cache/watcher.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -22,14 +22,13 @@ */ namespace OC\Files\Cache; +use OCP\Files\Cache\ICacheEntry; +use OCP\Files\Cache\IWatcher; /** * check the storage backends for updates and change the cache accordingly */ -class Watcher { - const CHECK_NEVER = 0; // never check the underlying filesystem for updates - const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file - const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates +class Watcher implements IWatcher { protected $watchPolicy = self::CHECK_ONCE; @@ -77,7 +76,7 @@ class Watcher { * check $path for updates and update if needed * * @param string $path - * @param array $cachedEntry + * @param ICacheEntry|null $cachedEntry * @return boolean true if path was updated */ public function checkUpdate($path, $cachedEntry = null) { @@ -96,7 +95,7 @@ class Watcher { * Update the cache for changes to $path * * @param string $path - * @param array $cachedData + * @param ICacheEntry $cachedData */ public function update($path, $cachedData) { if ($this->storage->is_dir($path)) { @@ -114,7 +113,7 @@ class Watcher { * Check if the cache for $path needs to be updated * * @param string $path - * @param array $cachedData + * @param ICacheEntry $cachedData * @return bool */ public function needsUpdate($path, $cachedData) { diff --git a/lib/private/files/cache/wrapper/cachejail.php b/lib/private/files/cache/wrapper/cachejail.php index 9a673b07737..4d708c2d191 100644 --- a/lib/private/files/cache/wrapper/cachejail.php +++ b/lib/private/files/cache/wrapper/cachejail.php @@ -2,10 +2,10 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/cache/wrapper/cachepermissionsmask.php b/lib/private/files/cache/wrapper/cachepermissionsmask.php index 15307a4d7e8..1eeb3c4783d 100644 --- a/lib/private/files/cache/wrapper/cachepermissionsmask.php +++ b/lib/private/files/cache/wrapper/cachepermissionsmask.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/cache/wrapper/cachewrapper.php b/lib/private/files/cache/wrapper/cachewrapper.php index bb136456762..39a6b63205b 100644 --- a/lib/private/files/cache/wrapper/cachewrapper.php +++ b/lib/private/files/cache/wrapper/cachewrapper.php @@ -2,10 +2,10 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ namespace OC\Files\Cache\Wrapper; use OC\Files\Cache\Cache; +use OCP\Files\Cache\ICacheEntry; class CacheWrapper extends Cache { /** @@ -42,8 +43,8 @@ class CacheWrapper extends Cache { /** * Make it easy for wrappers to modify every returned cache entry * - * @param array $entry - * @return array + * @param ICacheEntry $entry + * @return ICacheEntry */ protected function formatCacheEntry($entry) { return $entry; @@ -53,7 +54,7 @@ class CacheWrapper extends Cache { * get the stored metadata of a file or folder * * @param string /int $file - * @return array|false + * @return ICacheEntry|false */ public function get($file) { $result = $this->cache->get($file); @@ -67,7 +68,7 @@ class CacheWrapper extends Cache { * get the metadata of all files stored in $folder * * @param string $folder - * @return array + * @return ICacheEntry[] */ public function getFolderContents($folder) { // cant do a simple $this->cache->.... call here since getFolderContentsById needs to be called on this @@ -178,7 +179,7 @@ class CacheWrapper extends Cache { * search for files matching $pattern * * @param string $pattern - * @return array an array of file data + * @return ICacheEntry[] an array of file data */ public function search($pattern) { $results = $this->cache->search($pattern); @@ -189,7 +190,7 @@ class CacheWrapper extends Cache { * search for files by mimetype * * @param string $mimetype - * @return array + * @return ICacheEntry[] */ public function searchByMime($mimetype) { $results = $this->cache->searchByMime($mimetype); @@ -201,7 +202,7 @@ class CacheWrapper extends Cache { * * @param string|int $tag name or tag id * @param string $userId owner of the tags - * @return array file data + * @return ICacheEntry[] file data */ public function searchByTag($tag, $userId) { $results = $this->cache->searchByTag($tag, $userId); diff --git a/lib/private/files/config/cachedmountinfo.php b/lib/private/files/config/cachedmountinfo.php new file mode 100644 index 00000000000..dba07715edc --- /dev/null +++ b/lib/private/files/config/cachedmountinfo.php @@ -0,0 +1,107 @@ +<?php +/** + * @author Robin Appelman <icewind@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\Files\Config; + +use OC\Files\Filesystem; +use OCP\Files\Config\ICachedMountInfo; +use OCP\Files\Node; +use OCP\IUser; + +class CachedMountInfo implements ICachedMountInfo { + /** + * @var IUser + */ + private $user; + + /** + * @var int + */ + private $storageId; + + /** + * @var int + */ + private $rootId; + + /** + * @var string + */ + private $mountPoint; + + /** + * CachedMountInfo constructor. + * + * @param IUser $user + * @param int $storageId + * @param int $rootId + * @param string $mountPoint + */ + public function __construct(IUser $user, $storageId, $rootId, $mountPoint) { + $this->user = $user; + $this->storageId = $storageId; + $this->rootId = $rootId; + $this->mountPoint = $mountPoint; + } + + /** + * @return IUser + */ + public function getUser() { + return $this->user; + } + + /** + * @return int the numeric storage id of the mount + */ + public function getStorageId() { + return $this->storageId; + } + + /** + * @return int the fileid of the root of the mount + */ + public function getRootId() { + return $this->rootId; + } + + /** + * @return Node the root node of the mount + */ + public function getMountPointNode() { + // TODO injection etc + Filesystem::initMountPoints($this->user->getUID()); + $userNode = \OC::$server->getUserFolder($this->user->getUID()); + $nodes = $userNode->getById($this->rootId); + if (count($nodes) > 0) { + return $nodes[0]; + } else { + return null; + } + } + + /** + * @return string the mount point of the mount for the user + */ + public function getMountPoint() { + return $this->mountPoint; + } +} diff --git a/lib/private/files/config/mountprovidercollection.php b/lib/private/files/config/mountprovidercollection.php index c75c64ae445..499fa576fbc 100644 --- a/lib/private/files/config/mountprovidercollection.php +++ b/lib/private/files/config/mountprovidercollection.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -26,6 +26,8 @@ use OC\Hooks\Emitter; use OC\Hooks\EmitterTrait; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\Config\IMountProvider; +use OCP\Files\Config\IUserMountCache; +use OCP\Files\Mount\IMountPoint; use OCP\Files\Storage\IStorageFactory; use OCP\IUser; @@ -43,10 +45,17 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { private $loader; /** + * @var \OCP\Files\Config\IUserMountCache + */ + private $mountCache; + + /** * @param \OCP\Files\Storage\IStorageFactory $loader + * @param IUserMountCache $mountCache */ - public function __construct(IStorageFactory $loader) { + public function __construct(IStorageFactory $loader, IUserMountCache $mountCache) { $this->loader = $loader; + $this->mountCache = $mountCache; } /** @@ -77,4 +86,23 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { $this->providers[] = $provider; $this->emit('\OC\Files\Config', 'registerMountProvider', [$provider]); } + + /** + * Cache mounts for user + * + * @param IUser $user + * @param IMountPoint[] $mountPoints + */ + public function registerMounts(IUser $user, array $mountPoints) { + $this->mountCache->registerMounts($user, $mountPoints); + } + + /** + * Get the mount cache which can be used to search for mounts without setting up the filesystem + * + * @return IUserMountCache + */ + public function getMountCache() { + return $this->mountCache; + } } diff --git a/lib/private/files/config/usermountcache.php b/lib/private/files/config/usermountcache.php new file mode 100644 index 00000000000..e3a494e93a1 --- /dev/null +++ b/lib/private/files/config/usermountcache.php @@ -0,0 +1,232 @@ +<?php +/** + * @author Robin Appelman <icewind@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\Files\Config; + +use Doctrine\DBAL\Exception\UniqueConstraintViolationException; +use OCP\Files\Config\ICachedMountInfo; +use OCP\Files\Config\IUserMountCache; +use OCP\Files\Mount\IMountPoint; +use OCP\ICache; +use OCP\IDBConnection; +use OCP\ILogger; +use OCP\IUser; +use OCP\IUserManager; + +/** + * Cache mounts points per user in the cache so we can easilly look them up + */ +class UserMountCache implements IUserMountCache { + /** + * @var IDBConnection + */ + private $connection; + + /** + * @var IUserManager + */ + private $userManager; + + /** @var ICachedMountInfo[][] [$userId => [$cachedMountInfo, ....], ...] */ + private $mountsForUsers = []; + + /** + * @var ILogger + */ + private $logger; + + /** + * UserMountCache constructor. + * + * @param IDBConnection $connection + * @param IUserManager $userManager + * @param ILogger $logger + */ + public function __construct(IDBConnection $connection, IUserManager $userManager, ILogger $logger) { + $this->connection = $connection; + $this->userManager = $userManager; + $this->logger = $logger; + } + + public function registerMounts(IUser $user, array $mounts) { + // filter out non-proper storages coming from unit tests + $mounts = array_filter($mounts, function (IMountPoint $mount) { + return $mount->getStorage()->getCache(); + }); + /** @var ICachedMountInfo[] $newMounts */ + $newMounts = array_map(function (IMountPoint $mount) use ($user) { + $storage = $mount->getStorage(); + $rootId = (int)$storage->getCache()->getId(''); + $storageId = (int)$storage->getStorageCache()->getNumericId(); + // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) + if ($rootId === -1) { + return null; + } else { + return new CachedMountInfo($user, $storageId, $rootId, $mount->getMountPoint()); + } + }, $mounts); + $newMounts = array_values(array_filter($newMounts)); + + $cachedMounts = $this->getMountsForUser($user); + $mountDiff = function (ICachedMountInfo $mount1, ICachedMountInfo $mount2) { + // since we are only looking for mounts for a specific user comparing on root id is enough + return $mount1->getRootId() - $mount2->getRootId(); + }; + + /** @var ICachedMountInfo[] $addedMounts */ + $addedMounts = array_udiff($newMounts, $cachedMounts, $mountDiff); + /** @var ICachedMountInfo[] $removedMounts */ + $removedMounts = array_udiff($cachedMounts, $newMounts, $mountDiff); + + $changedMounts = array_uintersect($newMounts, $cachedMounts, function (ICachedMountInfo $mount1, ICachedMountInfo $mount2) { + // filter mounts with the same root id and different mountpoints + if ($mount1->getRootId() !== $mount2->getRootId()) { + return -1; + } + return ($mount1->getMountPoint() !== $mount2->getMountPoint()) ? 0 : 1; + }); + + foreach ($addedMounts as $mount) { + $this->addToCache($mount); + $this->mountsForUsers[$user->getUID()][] = $mount; + } + foreach ($removedMounts as $mount) { + $this->removeFromCache($mount); + $index = array_search($mount, $this->mountsForUsers[$user->getUID()]); + unset($this->mountsForUsers[$user->getUID()][$index]); + } + foreach ($changedMounts as $mount) { + $this->setMountPoint($mount); + } + } + + private function addToCache(ICachedMountInfo $mount) { + $this->connection->insertIfNotExist('*PREFIX*mounts', [ + 'storage_id' => $mount->getStorageId(), + 'root_id' => $mount->getRootId(), + 'user_id' => $mount->getUser()->getUID(), + 'mount_point' => $mount->getMountPoint() + ]); + } + + private function setMountPoint(ICachedMountInfo $mount) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->update('mounts') + ->set('mount_point', $builder->createNamedParameter($mount->getMountPoint())) + ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($mount->getUser()->getUID()))) + ->andWhere($builder->expr()->eq('root_id', $builder->createNamedParameter($mount->getRootId(), \PDO::PARAM_INT))); + + $query->execute(); + } + + private function removeFromCache(ICachedMountInfo $mount) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->delete('mounts') + ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($mount->getUser()->getUID()))) + ->andWhere($builder->expr()->eq('root_id', $builder->createNamedParameter($mount->getRootId(), \PDO::PARAM_INT))); + $query->execute(); + } + + private function dbRowToMountInfo(array $row) { + $user = $this->userManager->get($row['user_id']); + return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point']); + } + + /** + * @param IUser $user + * @return ICachedMountInfo[] + */ + public function getMountsForUser(IUser $user) { + if (!isset($this->mountsForUsers[$user->getUID()])) { + $builder = $this->connection->getQueryBuilder(); + $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point') + ->from('mounts') + ->where($builder->expr()->eq('user_id', $builder->createPositionalParameter($user->getUID()))); + + $rows = $query->execute()->fetchAll(); + + $this->mountsForUsers[$user->getUID()] = array_map([$this, 'dbRowToMountInfo'], $rows); + } + return $this->mountsForUsers[$user->getUID()]; + } + + /** + * @param int $numericStorageId + * @return CachedMountInfo[] + */ + public function getMountsForStorageId($numericStorageId) { + $builder = $this->connection->getQueryBuilder(); + $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point') + ->from('mounts') + ->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, \PDO::PARAM_INT))); + + $rows = $query->execute()->fetchAll(); + + return array_map([$this, 'dbRowToMountInfo'], $rows); + } + + /** + * @param int $rootFileId + * @return CachedMountInfo[] + */ + public function getMountsForRootId($rootFileId) { + $builder = $this->connection->getQueryBuilder(); + $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point') + ->from('mounts') + ->where($builder->expr()->eq('root_id', $builder->createPositionalParameter($rootFileId, \PDO::PARAM_INT))); + + $rows = $query->execute()->fetchAll(); + + return array_map([$this, 'dbRowToMountInfo'], $rows); + } + + /** + * Remove all cached mounts for a user + * + * @param IUser $user + */ + public function removeUserMounts(IUser $user) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->delete('mounts') + ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($user->getUID()))); + $query->execute(); + } + + public function removeUserStorageMount($storageId, $userId) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->delete('mounts') + ->where($builder->expr()->eq('user_id', $builder->createNamedParameter($userId))) + ->andWhere($builder->expr()->eq('storage_id', $builder->createNamedParameter($storageId, \PDO::PARAM_INT))); + $query->execute(); + } + + public function remoteStorageMounts($storageId) { + $builder = $this->connection->getQueryBuilder(); + + $query = $builder->delete('mounts') + ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter($storageId, \PDO::PARAM_INT))); + $query->execute(); + } +} diff --git a/lib/private/files/config/usermountcachelistener.php b/lib/private/files/config/usermountcachelistener.php new file mode 100644 index 00000000000..344bebe342d --- /dev/null +++ b/lib/private/files/config/usermountcachelistener.php @@ -0,0 +1,48 @@ +<?php +/** + * @author Robin Appelman <icewind@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\Files\Config; + +use OC\User\Manager; +use OCP\Files\Config\IUserMountCache; + +/** + * Listen to hooks and update the mount cache as needed + */ +class UserMountCacheListener { + /** + * @var IUserMountCache + */ + private $userMountCache; + + /** + * UserMountCacheListener constructor. + * + * @param IUserMountCache $userMountCache + */ + public function __construct(IUserMountCache $userMountCache) { + $this->userMountCache = $userMountCache; + } + + public function listen(Manager $manager) { + $manager->listen('\OC\User', 'postDelete', [$this->userMountCache, 'removeUserMounts']); + } +} diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index 5ed65cd3795..1e6fe474f7b 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -4,12 +4,13 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author tbartenstein <tbartenstein@users.noreply.github.com> * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -28,6 +29,7 @@ namespace OC\Files; +use OCP\Files\Cache\ICacheEntry; use OCP\IUser; class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { @@ -70,7 +72,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @param string|boolean $path * @param Storage\Storage $storage * @param string $internalPath - * @param array $data + * @param array|ICacheEntry $data * @param \OCP\Files\Mount\IMountPoint $mount * @param \OCP\IUser|null $owner */ diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 9d1b7150687..9d4a2c0aa05 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -11,13 +11,13 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Sam Tuke <mail@samtuke.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Stephan Peijnik <speijnik@anexia-it.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -59,8 +59,10 @@ namespace OC\Files; use OC\Files\Config\MountProviderCollection; +use OC\Files\Mount\MountPoint; use OC\Files\Storage\StorageFactory; use OCP\Files\Config\IMountProvider; +use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\IUserManager; @@ -412,7 +414,8 @@ class Filesystem { $homeStorage['arguments']['legacy'] = true; } - self::mount($homeStorage['class'], $homeStorage['arguments'], $user); + $mount = new MountPoint($homeStorage['class'], '/' . $user, $homeStorage['arguments'], self::getLoader()); + self::getMountManager()->addMount($mount); $home = \OC\Files\Filesystem::getStorage($user); @@ -424,6 +427,8 @@ class Filesystem { if ($userObject) { $mounts = $mountConfigManager->getMountsForUser($userObject); array_walk($mounts, array(self::$mounts, 'addMount')); + $mounts[] = $mount; + $mountConfigManager->registerMounts($userObject, $mounts); } self::listenForNewMountProviders($mountConfigManager, $userManager); diff --git a/lib/private/files/mount/manager.php b/lib/private/files/mount/manager.php index d5bd4d7ddf4..ba4a7f8d910 100644 --- a/lib/private/files/mount/manager.php +++ b/lib/private/files/mount/manager.php @@ -3,9 +3,9 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php index fad8678aae1..b606c625cb1 100644 --- a/lib/private/files/mount/mountpoint.php +++ b/lib/private/files/mount/mountpoint.php @@ -4,11 +4,11 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/mount/moveablemount.php b/lib/private/files/mount/moveablemount.php index d0f7703d80a..8a1bd7dd9c5 100644 --- a/lib/private/files/mount/moveablemount.php +++ b/lib/private/files/mount/moveablemount.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/file.php b/lib/private/files/node/file.php index 735bee3fd59..c3d18cdb358 100644 --- a/lib/private/files/node/file.php +++ b/lib/private/files/node/file.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php index be76b70b2ce..e8c49cd2c0b 100644 --- a/lib/private/files/node/folder.php +++ b/lib/private/files/node/folder.php @@ -3,10 +3,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/hookconnector.php b/lib/private/files/node/hookconnector.php index 360aaafdd71..5c36ca3848e 100644 --- a/lib/private/files/node/hookconnector.php +++ b/lib/private/files/node/hookconnector.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php index 1b52243fcb4..7769f15ee59 100644 --- a/lib/private/files/node/node.php +++ b/lib/private/files/node/node.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/nonexistingfile.php b/lib/private/files/node/nonexistingfile.php index 68fb7d1b6f9..c1d09bcc491 100644 --- a/lib/private/files/node/nonexistingfile.php +++ b/lib/private/files/node/nonexistingfile.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/nonexistingfolder.php b/lib/private/files/node/nonexistingfolder.php index 5044eb524f5..7d6576f1bd6 100644 --- a/lib/private/files/node/nonexistingfolder.php +++ b/lib/private/files/node/nonexistingfolder.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php index 4df926748de..35163be0a0d 100644 --- a/lib/private/files/node/root.php +++ b/lib/private/files/node/root.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/objectstore/homeobjectstorestorage.php b/lib/private/files/objectstore/homeobjectstorestorage.php index 77b5437c24d..6a330e2dab3 100644 --- a/lib/private/files/objectstore/homeobjectstorestorage.php +++ b/lib/private/files/objectstore/homeobjectstorestorage.php @@ -4,7 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/objectstore/noopscanner.php b/lib/private/files/objectstore/noopscanner.php index cdcc0149ab3..f5316175ecf 100644 --- a/lib/private/files/objectstore/noopscanner.php +++ b/lib/private/files/objectstore/noopscanner.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php index b34a6bdfb84..35c2c19c75b 100644 --- a/lib/private/files/objectstore/objectstorestorage.php +++ b/lib/private/files/objectstore/objectstorestorage.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ namespace OC\Files\ObjectStore; use Icewind\Streams\IteratorDirectory; +use OC\Files\Cache\CacheEntry; use OCP\Files\ObjectStore\IObjectStore; class ObjectStoreStorage extends \OC\Files\Storage\Common { @@ -192,7 +193,12 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { public function stat($path) { $path = $this->normalizePath($path); - return $this->getCache()->get($path); + $cacheEntry = $this->getCache()->get($path); + if ($cacheEntry instanceof CacheEntry) { + return $cacheEntry->getData(); + } else { + return false; + } } /** diff --git a/lib/private/files/objectstore/swift.php b/lib/private/files/objectstore/swift.php index 50bb0d9adf5..4af09dca254 100644 --- a/lib/private/files/objectstore/swift.php +++ b/lib/private/files/objectstore/swift.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 1e30d48f613..95bb3f74ba7 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -11,13 +11,13 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Sam Tuke <mail@samtuke.com> * @author scambra <sergio@entrecables.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -46,6 +46,7 @@ use OCP\Files\FileNameTooLongException; use OCP\Files\InvalidCharacterInPathException; use OCP\Files\InvalidPathException; use OCP\Files\ReservedWordException; +use OCP\Files\Storage\ILockingStorage; use OCP\Lock\ILockingProvider; /** @@ -59,7 +60,7 @@ use OCP\Lock\ILockingProvider; * Some \OC\Files\Storage\Common methods call functions which are first defined * in classes which extend it, e.g. $this->stat() . */ -abstract class Common implements Storage { +abstract class Common implements Storage, ILockingStorage { use LocalTempFileTrait; diff --git a/lib/private/files/storage/commontest.php b/lib/private/files/storage/commontest.php index d4dbeecbbd6..0047a51169c 100644 --- a/lib/private/files/storage/commontest.php +++ b/lib/private/files/storage/commontest.php @@ -8,7 +8,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php index 9afebab1dd7..a6e77e1b232 100644 --- a/lib/private/files/storage/dav.php +++ b/lib/private/files/storage/dav.php @@ -14,7 +14,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/flysystem.php b/lib/private/files/storage/flysystem.php index 3ad2b8adc4c..608639b71a6 100644 --- a/lib/private/files/storage/flysystem.php +++ b/lib/private/files/storage/flysystem.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index 1b4297ddd76..35a7e8360f3 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -6,7 +6,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index 2b2a433c013..aa2b4628283 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -14,7 +14,7 @@ * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/localtempfiletrait.php b/lib/private/files/storage/localtempfiletrait.php index 8875c2c4493..88f11e4e752 100644 --- a/lib/private/files/storage/localtempfiletrait.php +++ b/lib/private/files/storage/localtempfiletrait.php @@ -1,9 +1,10 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/polyfill/copydirectory.php b/lib/private/files/storage/polyfill/copydirectory.php index df4f5c27dcf..22bfe369738 100644 --- a/lib/private/files/storage/polyfill/copydirectory.php +++ b/lib/private/files/storage/polyfill/copydirectory.php @@ -3,7 +3,7 @@ * @author Martin Mattel <martin.mattel@diemattels.at> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/storage.php b/lib/private/files/storage/storage.php index fb59752ede1..c066336d4b8 100644 --- a/lib/private/files/storage/storage.php +++ b/lib/private/files/storage/storage.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/storagefactory.php b/lib/private/files/storage/storagefactory.php index e8df5090f09..5df91fd1eb4 100644 --- a/lib/private/files/storage/storagefactory.php +++ b/lib/private/files/storage/storagefactory.php @@ -6,7 +6,7 @@ * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/temporary.php b/lib/private/files/storage/temporary.php index 8abc19929b0..2d8e84c2d52 100644 --- a/lib/private/files/storage/temporary.php +++ b/lib/private/files/storage/temporary.php @@ -5,7 +5,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/wrapper/availability.php b/lib/private/files/storage/wrapper/availability.php index d2fbbbacf75..1550c318ce3 100644 --- a/lib/private/files/storage/wrapper/availability.php +++ b/lib/private/files/storage/wrapper/availability.php @@ -1,8 +1,9 @@ <?php /** - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 8f5a7a05f01..69438ef0c7c 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -28,6 +28,7 @@ namespace OC\Files\Storage\Wrapper; use OC\Encryption\Exceptions\ModuleDoesNotExistsException; use OC\Encryption\Update; use OC\Encryption\Util; +use OC\Files\Cache\CacheEntry; use OC\Files\Filesystem; use OC\Files\Mount\Manager; use OC\Files\Storage\LocalTempFileTrait; @@ -123,13 +124,14 @@ class Encryption extends Wrapper { public function filesize($path) { $fullPath = $this->getFullPath($path); + /** @var CacheEntry $info */ $info = $this->getCache()->get($path); if (isset($this->unencryptedSize[$fullPath])) { $size = $this->unencryptedSize[$fullPath]; // update file cache $info['encrypted'] = true; $info['size'] = $size; - $this->getCache()->put($path, $info); + $this->getCache()->put($path, $info->getData()); return $size; } diff --git a/lib/private/files/storage/wrapper/jail.php b/lib/private/files/storage/wrapper/jail.php index 2857e74de46..40738befd93 100644 --- a/lib/private/files/storage/wrapper/jail.php +++ b/lib/private/files/storage/wrapper/jail.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/wrapper/permissionsmask.php b/lib/private/files/storage/wrapper/permissionsmask.php index e1822905692..7fa64f82ba6 100644 --- a/lib/private/files/storage/wrapper/permissionsmask.php +++ b/lib/private/files/storage/wrapper/permissionsmask.php @@ -3,9 +3,9 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index 98664e27e2d..844505679df 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -3,10 +3,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -25,6 +25,8 @@ namespace OC\Files\Storage\Wrapper; +use OCP\Files\Cache\ICacheEntry; + class Quota extends Wrapper { /** @@ -64,7 +66,7 @@ class Quota extends Wrapper { $cache = $storage->getCache(); } $data = $cache->get($path); - if (is_array($data) and isset($data['size'])) { + if ($data instanceof ICacheEntry and isset($data['size'])) { return $data['size']; } else { return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php index 81284c7aa69..c632aa399e1 100644 --- a/lib/private/files/storage/wrapper/wrapper.php +++ b/lib/private/files/storage/wrapper/wrapper.php @@ -2,11 +2,11 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -26,9 +26,10 @@ namespace OC\Files\Storage\Wrapper; use OCP\Files\InvalidPathException; +use OCP\Files\Storage\ILockingStorage; use OCP\Lock\ILockingProvider; -class Wrapper implements \OC\Files\Storage\Storage { +class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { /** * @var \OC\Files\Storage\Storage $storage */ @@ -583,7 +584,9 @@ class Wrapper implements \OC\Files\Storage\Storage { * @throws \OCP\Lock\LockedException */ public function acquireLock($path, $type, ILockingProvider $provider) { - $this->storage->acquireLock($path, $type, $provider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->acquireLock($path, $type, $provider); + } } /** @@ -592,7 +595,9 @@ class Wrapper implements \OC\Files\Storage\Storage { * @param \OCP\Lock\ILockingProvider $provider */ public function releaseLock($path, $type, ILockingProvider $provider) { - $this->storage->releaseLock($path, $type, $provider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->releaseLock($path, $type, $provider); + } } /** @@ -601,6 +606,8 @@ class Wrapper implements \OC\Files\Storage\Storage { * @param \OCP\Lock\ILockingProvider $provider */ public function changeLock($path, $type, ILockingProvider $provider) { - $this->storage->changeLock($path, $type, $provider); + if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $this->storage->changeLock($path, $type, $provider); + } } } diff --git a/lib/private/files/stream/close.php b/lib/private/files/stream/close.php index f704c875a14..1c9b30705dd 100644 --- a/lib/private/files/stream/close.php +++ b/lib/private/files/stream/close.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/stream/dir.php b/lib/private/files/stream/dir.php index 94f1cf81a2f..fabadb0d596 100644 --- a/lib/private/files/stream/dir.php +++ b/lib/private/files/stream/dir.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php index 585a697c5d1..c884cd8fa07 100644 --- a/lib/private/files/stream/encryption.php +++ b/lib/private/files/stream/encryption.php @@ -2,10 +2,11 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author jknockaert <jasper@knockaert.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/stream/oc.php b/lib/private/files/stream/oc.php index 9087b812b2a..8439770e8fa 100644 --- a/lib/private/files/stream/oc.php +++ b/lib/private/files/stream/oc.php @@ -3,9 +3,9 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/stream/quota.php b/lib/private/files/stream/quota.php index 5db58817a2b..8d27575c568 100644 --- a/lib/private/files/stream/quota.php +++ b/lib/private/files/stream/quota.php @@ -5,7 +5,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/stream/staticstream.php b/lib/private/files/stream/staticstream.php index 74f921ceb96..7aacf7a9fe4 100644 --- a/lib/private/files/stream/staticstream.php +++ b/lib/private/files/stream/staticstream.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index 0e2bab39e5b..9cc2e97c3cc 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -5,11 +5,11 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/type/loader.php b/lib/private/files/type/loader.php index 55dc09ab9b8..95ba7597257 100644 --- a/lib/private/files/type/loader.php +++ b/lib/private/files/type/loader.php @@ -1,8 +1,8 @@ <?php /** - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/type/templatemanager.php b/lib/private/files/type/templatemanager.php index 33d3f7bfc76..363fb7a2a6c 100644 --- a/lib/private/files/type/templatemanager.php +++ b/lib/private/files/type/templatemanager.php @@ -2,9 +2,9 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 5621bf13910..59673a306cb 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -7,7 +7,7 @@ * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 357f854e5e2..d4cc24ae0f5 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -15,15 +15,14 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> - * @author Roman Geber <rgeber@owncloudapps.com> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -44,15 +43,16 @@ namespace OC\Files; use Icewind\Streams\CallbackWrapper; -use OC\Files\Cache\Updater; use OC\Files\Mount\MoveableMount; use OC\Files\Storage\Storage; use OC\User\User; +use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileNameTooLongException; use OCP\Files\InvalidCharacterInPathException; use OCP\Files\InvalidPathException; use OCP\Files\NotFoundException; use OCP\Files\ReservedWordException; +use OCP\Files\Storage\ILockingStorage; use OCP\IUser; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; @@ -1275,7 +1275,7 @@ class View { if ($storage) { $data = $this->getCacheEntry($storage, $internalPath, $relativePath); - if (!is_array($data)) { + if (!$data instanceof ICacheEntry) { return false; } @@ -1335,7 +1335,7 @@ class View { $data = $this->getCacheEntry($storage, $internalPath, $directory); - if (!is_array($data) || !isset($data['fileid'])) { + if (!$data instanceof ICacheEntry || !isset($data['fileid'])) { return []; } @@ -1346,7 +1346,7 @@ class View { /** * @var \OC\Files\FileInfo[] $files */ - $files = array_map(function (array $content) use ($path, $storage, $mount, $sharingDisabled) { + $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { if ($sharingDisabled) { $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; } @@ -1573,10 +1573,15 @@ class View { * Get the owner for a file or folder * * @param string $path - * @return string + * @return string the user id of the owner + * @throws NotFoundException */ public function getOwner($path) { - return $this->basicOperation('getOwner', $path); + $info = $this->getFileInfo($path); + if (!$info) { + throw new NotFoundException($path . ' not found while trying to get owner'); + } + return $info->getOwner()->getUID(); } /** @@ -1835,11 +1840,14 @@ class View { $mount = $this->getMountForLock($absolutePath, $lockMountPoint); if ($mount) { try { - $mount->getStorage()->acquireLock( - $mount->getInternalPath($absolutePath), - $type, - $this->lockingProvider - ); + $storage = $mount->getStorage(); + if ($storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $storage->acquireLock( + $mount->getInternalPath($absolutePath), + $type, + $this->lockingProvider + ); + } } catch (\OCP\Lock\LockedException $e) { // rethrow with the a human-readable path throw new \OCP\Lock\LockedException( @@ -1873,11 +1881,14 @@ class View { $mount = $this->getMountForLock($absolutePath, $lockMountPoint); if ($mount) { try { - $mount->getStorage()->changeLock( - $mount->getInternalPath($absolutePath), - $type, - $this->lockingProvider - ); + $storage = $mount->getStorage(); + if ($storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $storage->changeLock( + $mount->getInternalPath($absolutePath), + $type, + $this->lockingProvider + ); + } } catch (\OCP\Lock\LockedException $e) { // rethrow with the a human-readable path throw new \OCP\Lock\LockedException( @@ -1908,11 +1919,14 @@ class View { $mount = $this->getMountForLock($absolutePath, $lockMountPoint); if ($mount) { - $mount->getStorage()->releaseLock( - $mount->getInternalPath($absolutePath), - $type, - $this->lockingProvider - ); + $storage = $mount->getStorage(); + if ($storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { + $storage->releaseLock( + $mount->getInternalPath($absolutePath), + $type, + $this->lockingProvider + ); + } } return true; @@ -2012,4 +2026,28 @@ class View { } return ''; } + + /** + * @param string $filename + * @return array + * @throws \OC\User\NoUserException + * @throws NotFoundException + */ + public function getUidAndFilename($filename) { + $info = $this->getFileInfo($filename); + if (!$info instanceof \OCP\Files\FileInfo) { + throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); + } + $uid = $info->getOwner()->getUID(); + if ($uid != \OCP\User::getUser()) { + Filesystem::initMountPoints($uid); + $ownerView = new View('/' . $uid . '/files'); + try { + $filename = $ownerView->getPath($info['fileid']); + } catch (NotFoundException $e) { + throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); + } + } + return [$uid, $filename]; + } } diff --git a/lib/private/forbiddenexception.php b/lib/private/forbiddenexception.php index e40cb33f4cf..48be35ba316 100644 --- a/lib/private/forbiddenexception.php +++ b/lib/private/forbiddenexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/group.php b/lib/private/group.php index fdf8086f1e8..48fbe51007a 100644 --- a/lib/private/group.php +++ b/lib/private/group.php @@ -12,11 +12,11 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Qingping Hou <dave2008713@gmail.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/group/backend.php b/lib/private/group/backend.php index 52afb8fdcf0..ed2a2f4bb68 100644 --- a/lib/private/group/backend.php +++ b/lib/private/group/backend.php @@ -8,10 +8,10 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -53,7 +53,7 @@ define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000); /** * Abstract base class for user management */ -abstract class OC_Group_Backend implements OC_Group_Interface { +abstract class OC_Group_Backend implements \OCP\GroupInterface { /** * error code for functions not provided by the group backend */ @@ -82,7 +82,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface { * @return int bitwise-or'ed actions * * Returns the supported actions as int to be - * compared with OC_USER_BACKEND_CREATE_USER etc. + * compared with \OC_Group_Backend::CREATE_GROUP etc. */ public function getSupportedActions() { $actions = 0; @@ -101,7 +101,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface { * @return bool * * Returns the supported actions as int to be - * compared with OC_GROUP_BACKEND_CREATE_GROUP etc. + * compared with \OC_Group_Backend::CREATE_GROUP etc. */ public function implementsActions($actions) { return (bool)($this->getSupportedActions() & $actions); diff --git a/lib/private/group/database.php b/lib/private/group/database.php index ad6174808bb..21e7b103554 100644 --- a/lib/private/group/database.php +++ b/lib/private/group/database.php @@ -9,10 +9,10 @@ * @author michag86 <micha_g@arcor.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -50,6 +50,30 @@ */ class OC_Group_Database extends OC_Group_Backend { + /** @var string[] */ + private $groupCache = []; + + /** @var \OCP\IDBConnection */ + private $dbConn; + + /** + * OC_Group_Database constructor. + * + * @param \OCP\IDBConnection|null $dbConn + */ + public function __construct(\OCP\IDBConnection $dbConn = null) { + $this->dbConn = $dbConn; + } + + /** + * FIXME: This function should not be required! + */ + private function fixDI() { + if ($this->dbConn === null) { + $this->dbConn = \OC::$server->getDatabaseConnection(); + } + } + /** * Try to create a new group * @param string $gid The name of the group to create @@ -59,21 +83,17 @@ class OC_Group_Database extends OC_Group_Backend { * be returned. */ public function createGroup( $gid ) { - // Check for existence - $stmt = OC_DB::prepare( "SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` = ?" ); - $result = $stmt->execute( array( $gid )); + $this->fixDI(); - if( $result->fetchRow() ) { - // Can not add an existing group - return false; - } - else{ - // Add group and exit - $stmt = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" ); - $result = $stmt->execute( array( $gid )); + // Add group + $result = $this->dbConn->insertIfNotExist('*PREFIX*groups', [ + 'gid' => $gid, + ]); - return $result ? true : false; - } + // Add to cache + $this->groupCache[$gid] = $gid; + + return $result === 1; } /** @@ -84,17 +104,28 @@ class OC_Group_Database extends OC_Group_Backend { * Deletes a group and removes it from the group_user-table */ public function deleteGroup( $gid ) { + $this->fixDI(); + // Delete the group - $stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE `gid` = ?" ); - $stmt->execute( array( $gid )); + $qb = $this->dbConn->getQueryBuilder(); + $qb->delete('groups') + ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->execute(); // Delete the group-user relation - $stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `gid` = ?" ); - $stmt->execute( array( $gid )); + $qb = $this->dbConn->getQueryBuilder(); + $qb->delete('group_user') + ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->execute(); // Delete the group-groupadmin relation - $stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*group_admin` WHERE `gid` = ?" ); - $stmt->execute( array( $gid )); + $qb = $this->dbConn->getQueryBuilder(); + $qb->delete('group_admin') + ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->execute(); + + // Delete from cache + unset($this->groupCache[$gid]); return true; } @@ -108,11 +139,20 @@ class OC_Group_Database extends OC_Group_Backend { * Checks whether the user is member of a group or not. */ public function inGroup( $uid, $gid ) { + $this->fixDI(); + // check - $stmt = OC_DB::prepare( "SELECT `uid` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` = ?" ); - $result = $stmt->execute( array( $gid, $uid )); + $qb = $this->dbConn->getQueryBuilder(); + $cursor = $qb->select('uid') + ->from('group_user') + ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) + ->execute(); - return $result->fetchRow() ? true : false; + $result = $cursor->fetch(); + $cursor->closeCursor(); + + return $result ? true : false; } /** @@ -124,10 +164,15 @@ class OC_Group_Database extends OC_Group_Backend { * Adds a user to a group. */ public function addToGroup( $uid, $gid ) { + $this->fixDI(); + // No duplicate entries! if( !$this->inGroup( $uid, $gid )) { - $stmt = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" ); - $stmt->execute( array( $uid, $gid )); + $qb = $this->dbConn->getQueryBuilder(); + $qb->insert('group_user') + ->setValue('uid', $qb->createNamedParameter($uid)) + ->setValue('gid', $qb->createNamedParameter($gid)) + ->execute(); return true; }else{ return false; @@ -143,8 +188,13 @@ class OC_Group_Database extends OC_Group_Backend { * removes the user from a group. */ public function removeFromGroup( $uid, $gid ) { - $stmt = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); - $stmt->execute( array( $uid, $gid )); + $this->fixDI(); + + $qb = $this->dbConn->getQueryBuilder(); + $qb->delete('group_user') + ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) + ->andWhere($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->execute(); return true; } @@ -158,14 +208,21 @@ class OC_Group_Database extends OC_Group_Backend { * if the user exists at all. */ public function getUserGroups( $uid ) { + $this->fixDI(); + // No magic! - $stmt = OC_DB::prepare( "SELECT `gid` FROM `*PREFIX*group_user` WHERE `uid` = ?" ); - $result = $stmt->execute( array( $uid )); + $qb = $this->dbConn->getQueryBuilder(); + $cursor = $qb->select('gid') + ->from('group_user') + ->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid))) + ->execute(); - $groups = array(); - while( $row = $result->fetchRow()) { + $groups = []; + while( $row = $cursor->fetch()) { $groups[] = $row["gid"]; + $this->groupCache[$row['gid']] = $row['gid']; } + $cursor->closeCursor(); return $groups; } @@ -202,9 +259,23 @@ class OC_Group_Database extends OC_Group_Backend { * @return bool */ public function groupExists($gid) { - $query = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` = ?'); - $result = $query->execute(array($gid))->fetchOne(); + $this->fixDI(); + + // Check cache first + if (isset($this->groupCache[$gid])) { + return true; + } + + $qb = $this->dbConn->getQueryBuilder(); + $cursor = $qb->select('gid') + ->from('groups') + ->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid))) + ->execute(); + $result = $cursor->fetch(); + $cursor->closeCursor(); + if ($result !== false) { + $this->groupCache[$gid] = $gid; return true; } return false; diff --git a/lib/private/group/dummy.php b/lib/private/group/dummy.php index 330b086ab3f..c0d206a34e1 100644 --- a/lib/private/group/dummy.php +++ b/lib/private/group/dummy.php @@ -6,11 +6,11 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/group/example.php b/lib/private/group/example.php index fa2ed06129b..17fae90f2e0 100644 --- a/lib/private/group/example.php +++ b/lib/private/group/example.php @@ -6,9 +6,9 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/group/group.php b/lib/private/group/group.php index f76ea1f36a7..064b9f899e6 100644 --- a/lib/private/group/group.php +++ b/lib/private/group/group.php @@ -6,9 +6,9 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/group/interface.php b/lib/private/group/interface.php index c3a3cc052d6..240a50fe961 100644 --- a/lib/private/group/interface.php +++ b/lib/private/group/interface.php @@ -5,9 +5,9 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -24,63 +24,8 @@ * */ -interface OC_Group_Interface { - /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return boolean - * - * Returns the supported actions as int to be - * compared with \OC_Group_Backend::CREATE_GROUP etc. - */ - public function implementsActions($actions); - - /** - * is user in group? - * @param string $uid uid of the user - * @param string $gid gid of the group - * @return bool - * - * Checks whether the user is member of a group or not. - */ - public function inGroup($uid, $gid); - - /** - * Get all groups a user belongs to - * @param string $uid Name of the user - * @return array an array of group names - * - * This function fetches all groups a user belongs to. It does not check - * if the user exists at all. - */ - public function getUserGroups($uid); - - /** - * get a list of all groups - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of group names - * - * Returns a list with all groups - */ - public function getGroups($search = '', $limit = -1, $offset = 0); - - /** - * check if a group exists - * @param string $gid - * @return bool - */ - public function groupExists($gid); - - /** - * get a list of all users in a group - * @param string $gid - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of user ids - */ - public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0); - -} +/** + * Interface OC_Group_Interface + * @deprecated use the public \OCP\GroupInterface instead + */ +interface OC_Group_Interface extends \OCP\GroupInterface {} diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index 7387b423643..98e5551bcc5 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -8,12 +8,12 @@ * @author macjohnny <estebanmarin@gmx.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author voxsim <Simon Vocella> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -33,6 +33,7 @@ namespace OC\Group; use OC\Hooks\PublicEmitter; +use OCP\GroupInterface; use OCP\IGroupManager; /** @@ -52,7 +53,7 @@ use OCP\IGroupManager; */ class Manager extends PublicEmitter implements IGroupManager { /** - * @var \OC_Group_Backend[]|\OC_Group_Database[] $backends + * @var GroupInterface[] $backends */ private $backends = array(); @@ -121,14 +122,19 @@ class Manager extends PublicEmitter implements IGroupManager { } /** - * @param \OC_Group_Backend $backend + * @param \OCP\GroupInterface $backend */ public function addBackend($backend) { $this->backends[] = $backend; + $this->clearCaches(); } public function clearBackends() { $this->backends = array(); + $this->clearCaches(); + } + + protected function clearCaches() { $this->cachedGroups = array(); $this->cachedUserGroups = array(); } diff --git a/lib/private/group/metadata.php b/lib/private/group/metadata.php index 63ac0928563..8e0866479c1 100644 --- a/lib/private/group/metadata.php +++ b/lib/private/group/metadata.php @@ -7,7 +7,7 @@ * @author Stephan Peijnik <speijnik@anexia-it.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/helper.php b/lib/private/helper.php index 64952903712..495f95e72d2 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -4,10 +4,10 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Christopher Schäpers <kondou@ts.unde.re> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Fabian Henze <flyser42@gmx.de> * @author Felix Moeller <mail@felixmoeller.de> * @author Frank Karlitschek <frank@owncloud.org> - * @author François Kubler <francois@kubler.org> * @author Georg Ehrke <georg@owncloud.com> * @author Jakob Sack <mail@jakobsack.de> * @author Jan-Christoph Borchardt <hey@jancborchardt.net> @@ -16,20 +16,18 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Nicolas Grekas <nicolas.grekas@gmail.com> * @author Olivier Paroz <github@oparoz.com> * @author Owen Winkler <a_github@midnightcircus.com> * @author Pellaeon Lin <nfsmwlin@gmail.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Simon Könnecke <simonkoennecke@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> - * @author Valerio Ponte <valerio.ponte@gmail.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -71,19 +69,6 @@ class OC_Helper { } /** - * Creates path to an image - * @param string $app app - * @param string $image image name - * @return string the url - * @deprecated Use \OC::$server->getURLGenerator()->imagePath($app, $image) - * - * Returns the path to the image. - */ - public static function imagePath($app, $image) { - return OC::$server->getURLGenerator()->imagePath($app, $image); - } - - /** * get path to preview of file * @param string $path path * @return string the url @@ -114,7 +99,7 @@ class OC_Helper { } $bytes = round($bytes / 1024, 0); if ($bytes < 1024) { - return "$bytes kB"; + return "$bytes KB"; } $bytes = round($bytes / 1024, 1); if ($bytes < 1024) { diff --git a/lib/private/hintexception.php b/lib/private/hintexception.php index 3afc029f322..f673ac82ace 100644 --- a/lib/private/hintexception.php +++ b/lib/private/hintexception.php @@ -5,7 +5,7 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hook.php b/lib/private/hook.php index 2ff045c8a66..e9b18b3fc38 100644 --- a/lib/private/hook.php +++ b/lib/private/hook.php @@ -5,12 +5,12 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -56,7 +56,7 @@ class OC_Hook{ self::$registered[$signalClass][$signalName] = array(); } - // dont connect hooks twice + // don't connect hooks twice foreach (self::$registered[$signalClass][$signalName] as $hook) { if ($hook['class'] === $slotClass and $hook['name'] === $slotName) { return false; @@ -79,8 +79,8 @@ class OC_Hook{ * @param string $signalName name of signal * @param mixed $params default: array() array with additional data * @return bool true if slots exists or false if not - * @throws \OC\ServerNotAvailableException - * Emits a signal. To get data from the slot use references! + * @throws \OC\HintException + * @throws \OC\ServerNotAvailableException Emits a signal. To get data from the slot use references! * * TODO: write example */ @@ -104,38 +104,30 @@ class OC_Hook{ call_user_func( array( $i["class"], $i["name"] ), $params ); } catch (Exception $e){ self::$thrownExceptions[] = $e; - $class = $i["class"]; - if (is_object($i["class"])) { - $class = get_class($i["class"]); - } - $message = $e->getMessage(); - if (empty($message)) { - $message = get_class($e); + \OC::$server->getLogger()->logException($e); + if($e instanceof \OC\HintException) { + throw $e; } - \OCP\Util::writeLog('hook', - 'error while running hook (' . $class . '::' . $i["name"] . '): ' . $message, - \OCP\Util::ERROR); if($e instanceof \OC\ServerNotAvailableException) { throw $e; } } } - // return true return true; } /** * clear hooks - * @param string $signalclass - * @param string $signalname + * @param string $signalClass + * @param string $signalName */ - static public function clear($signalclass='', $signalname='') { - if($signalclass) { - if($signalname) { - self::$registered[$signalclass][$signalname]=array(); + static public function clear($signalClass='', $signalName='') { + if ($signalClass) { + if ($signalName) { + self::$registered[$signalClass][$signalName]=array(); }else{ - self::$registered[$signalclass]=array(); + self::$registered[$signalClass]=array(); } }else{ self::$registered=array(); diff --git a/lib/private/hooks/basicemitter.php b/lib/private/hooks/basicemitter.php index ae0f96fbc8c..067962ec081 100644 --- a/lib/private/hooks/basicemitter.php +++ b/lib/private/hooks/basicemitter.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hooks/emitter.php b/lib/private/hooks/emitter.php index bea3f289b8d..d639e5ef892 100644 --- a/lib/private/hooks/emitter.php +++ b/lib/private/hooks/emitter.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hooks/emittertrait.php b/lib/private/hooks/emittertrait.php index 256bf468c4f..775f46f838c 100644 --- a/lib/private/hooks/emittertrait.php +++ b/lib/private/hooks/emittertrait.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hooks/forwardingemitter.php b/lib/private/hooks/forwardingemitter.php index 90c1970f480..6a1fc571cea 100644 --- a/lib/private/hooks/forwardingemitter.php +++ b/lib/private/hooks/forwardingemitter.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hooks/legacyemitter.php b/lib/private/hooks/legacyemitter.php index b28854f4638..ac83477a144 100644 --- a/lib/private/hooks/legacyemitter.php +++ b/lib/private/hooks/legacyemitter.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/hooks/publicemitter.php b/lib/private/hooks/publicemitter.php index 12de07b27c7..4fe71073a1e 100644 --- a/lib/private/hooks/publicemitter.php +++ b/lib/private/hooks/publicemitter.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/http/client/client.php b/lib/private/http/client/client.php index 5f298e1acd7..bd9e82ddae7 100644 --- a/lib/private/http/client/client.php +++ b/lib/private/http/client/client.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -58,12 +58,18 @@ class Client implements IClient { * Sets the default options to the client */ private function setDefaultOptions() { - // Either use default bundle or the user bundle if nothing is specified - if($this->certificateManager->listCertificates() !== []) { - $dataDir = $this->config->getSystemValue('datadirectory'); - $this->client->setDefaultOption('verify', $dataDir.'/'.$this->certificateManager->getCertificateBundle()); + // Either use user bundle or the system bundle if nothing is specified + if ($this->certificateManager->listCertificates() !== []) { + $this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath()); } else { - $this->client->setDefaultOption('verify', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); + // If the instance is not yet setup we need to use the static path as + // $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate + // a view + if($this->config->getSystemValue('installed', false)) { + $this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath(null)); + } else { + $this->client->setDefaultOption('verify', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); + } } $this->client->setDefaultOption('headers/User-Agent', 'ownCloud Server Crawler'); diff --git a/lib/private/http/client/clientservice.php b/lib/private/http/client/clientservice.php index c9b415a7429..7e280dbf3ca 100644 --- a/lib/private/http/client/clientservice.php +++ b/lib/private/http/client/clientservice.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/http/client/response.php b/lib/private/http/client/response.php index b3429f36d04..7a879eab111 100644 --- a/lib/private/http/client/response.php +++ b/lib/private/http/client/response.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/httphelper.php b/lib/private/httphelper.php index 9d9edb6a351..f33d4a51745 100644 --- a/lib/private/httphelper.php +++ b/lib/private/httphelper.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/image.php b/lib/private/image.php index a5de7e86b94..dc01f989d79 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -1,8 +1,8 @@ <?php /** * @author Andreas Fischer <bantu@owncloud.com> - * @author Bart Visscher <bartv@thisnet.nl> * @author Bartek Przybylski <bart.p.pl@gmail.com> + * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Byron Marohn <combustible@live.com> * @author Christopher Schäpers <kondou@ts.unde.re> @@ -11,6 +11,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Johannes Willnecker <johannes@willnecker.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> @@ -18,7 +19,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/installer.php b/lib/private/installer.php index ed50503b3dc..f30db9ca659 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -3,6 +3,7 @@ * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Brice Maron <brice@bmaron.net> + * @author Christian Weiske <cweiske@cweiske.de> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Felix Moeller <mail@felixmoeller.de> * @author Frank Karlitschek <frank@owncloud.org> @@ -15,13 +16,12 @@ * @author michag86 <micha_g@arcor.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author root <root@oc.(none)> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> - * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -38,6 +38,9 @@ * */ +use OC\App\CodeChecker\CodeChecker; +use OC\App\CodeChecker\EmptyCheck; +use OC\App\CodeChecker\PrivateCheck; use OC\OCSClient; /** @@ -82,9 +85,10 @@ class OC_Installer{ $l = \OC::$server->getL10N('lib'); list($extractDir, $path) = self::downloadApp($data); - $info = self::checkAppsIntegrity($data, $extractDir, $path); - $basedir=OC_App::getInstallPath().'/'.$info['id']; + $info = self::checkAppsIntegrity($data, $extractDir, $path); + $appId = OC_App::cleanAppId($info['id']); + $basedir = OC_App::getInstallPath().'/'.$appId; //check if the destination directory already exists if(is_dir($basedir)) { OC_Helper::rmdirr($extractDir); @@ -127,8 +131,8 @@ class OC_Installer{ } //run appinfo/install.php - if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) { - include $basedir.'/appinfo/install.php'; + if((!isset($data['noinstall']) or $data['noinstall']==false)) { + self::includeAppScript($basedir . '/appinfo/install.php'); } //set the installed version @@ -163,6 +167,8 @@ class OC_Installer{ * @brief Update an application * @param array $info * @param bool $isShipped + * @throws Exception + * @return bool * * This function could work like described below, but currently it disables and then * enables the app again. This does result in an updated app. @@ -191,7 +197,7 @@ class OC_Installer{ * upgrade.php can determine the current installed version of the app using * "\OC::$server->getAppConfig()->getValue($appid, 'installed_version')" */ - public static function updateApp( $info=array(), $isShipped=false) { + public static function updateApp($info=array(), $isShipped=false) { list($extractDir, $path) = self::downloadApp($info); $info = self::checkAppsIntegrity($info, $extractDir, $path, $isShipped); @@ -307,11 +313,12 @@ class OC_Installer{ * check an app's integrity * @param array $data * @param string $extractDir + * @param string $path * @param bool $isShipped * @return array * @throws \Exception */ - public static function checkAppsIntegrity($data, $extractDir, $path, $isShipped=false) { + public static function checkAppsIntegrity($data, $extractDir, $path, $isShipped = false) { $l = \OC::$server->getL10N('lib'); //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')) { @@ -329,12 +336,41 @@ class OC_Installer{ } if(!is_file($extractDir.'/appinfo/info.xml')) { OC_Helper::rmdirr($extractDir); - if($data['source']=='http') { + if($data['source'] === 'http') { unlink($path); } throw new \Exception($l->t("App does not provide an info.xml file")); } - $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); + + $info = OC_App::getAppInfo($extractDir.'/appinfo/info.xml', true); + + // We can't trust the parsed info.xml file as it may have been tampered + // with by an attacker and thus we need to use the local data to check + // whether the application needs to be signed. + $appId = OC_App::cleanAppId($data['appdata']['id']); + $appBelongingToId = OC_App::getInternalAppIdByOcs($appId); + if(is_string($appBelongingToId)) { + $previouslySigned = \OC::$server->getConfig()->getAppValue($appBelongingToId, 'signed', 'false'); + } else { + $appBelongingToId = $info['id']; + $previouslySigned = 'false'; + } + if($data['appdata']['level'] === OC_App::officialApp || $previouslySigned === 'true') { + \OC::$server->getConfig()->setAppValue($appBelongingToId, 'signed', 'true'); + $integrityResult = \OC::$server->getIntegrityCodeChecker()->verifyAppSignature( + $appBelongingToId, + $extractDir + ); + if($integrityResult !== []) { + $e = new \Exception( + $l->t( + 'Signature could not get checked. Please contact the app developer and check your admin screen.' + ) + ); + throw $e; + } + } + // check the code for not allowed calls if(!$isShipped && !OC_Installer::checkCode($extractDir)) { OC_Helper::rmdirr($extractDir); @@ -527,15 +563,16 @@ class OC_Installer{ */ public static function installShippedApp($app) { //install the database - if(is_file(OC_App::getAppPath($app)."/appinfo/database.xml")) { - OC_DB::createDbFromStructure(OC_App::getAppPath($app)."/appinfo/database.xml"); + $appPath = OC_App::getAppPath($app); + if(is_file("$appPath/appinfo/database.xml")) { + OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); } //run appinfo/install.php - if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")) { - include OC_App::getAppPath($app)."/appinfo/install.php"; - } - $info=OC_App::getAppInfo($app); + \OC::$loader->addValidRoot($appPath); + self::includeAppScript("$appPath/appinfo/install.php"); + + $info = OC_App::getAppInfo($app); if (is_null($info)) { return false; } @@ -571,9 +608,18 @@ class OC_Installer{ return true; } - $codeChecker = new \OC\App\CodeChecker(); + $codeChecker = new CodeChecker(new PrivateCheck(new EmptyCheck())); $errors = $codeChecker->analyseFolder($folder); return empty($errors); } + + /** + * @param $basedir + */ + private static function includeAppScript($script) { + if ( file_exists($script) ){ + include $script; + } + } } diff --git a/lib/private/integritycheck/checker.php b/lib/private/integritycheck/checker.php index edfe6b082e7..c256fe66d32 100644 --- a/lib/private/integritycheck/checker.php +++ b/lib/private/integritycheck/checker.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -82,10 +82,39 @@ class Checker { } /** + * Whether code signing is enforced or not. + * + * @return bool + */ + public function isCodeCheckEnforced() { + // FIXME: Once the signing server is instructed to sign daily, beta and + // RCs as well these need to be included also. + $signedChannels = [ + 'stable', + ]; + if(!in_array($this->environmentHelper->getChannel(), $signedChannels, true)) { + return false; + } + + /** + * This config option is undocumented and supposed to be so, it's only + * applicable for very specific scenarios and we should not advertise it + * too prominent. So please do not add it to config.sample.php. + */ + $isIntegrityCheckDisabled = $this->config->getSystemValue('integrity.check.disabled', false); + if($isIntegrityCheckDisabled === true) { + return false; + } + + return true; + } + + /** * Enumerates all files belonging to the folder. Sensible defaults are excluded. * * @param string $folderToIterate * @return \RecursiveIteratorIterator + * @throws \Exception */ private function getFolderIterator($folderToIterate) { $dirItr = new \RecursiveDirectoryIterator( @@ -121,16 +150,33 @@ class Checker { } $relativeFileName = substr($filename, $baseDirectoryLength); + $relativeFileName = ltrim($relativeFileName, '/'); // Exclude signature.json files in the appinfo and root folder - if($relativeFileName === '/appinfo/signature.json') { + if($relativeFileName === 'appinfo/signature.json') { continue; } // Exclude signature.json files in the appinfo and core folder - if($relativeFileName === '/core/signature.json') { + if($relativeFileName === 'core/signature.json') { continue; } + // The .htaccess file in the root folder of ownCloud can contain + // custom content after the installation due to the fact that dynamic + // content is written into it at installation time as well. This + // includes for example the 404 and 403 instructions. + // Thus we ignore everything below the first occurrence of + // "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the + // hash generated based on this. + if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') { + $fileContent = file_get_contents($filename); + $explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent); + if(count($explodedArray) === 2) { + $hashes[$relativeFileName] = hash('sha512', $explodedArray[0]); + continue; + } + } + $hashes[$relativeFileName] = hash_file('sha512', $filename); } return $hashes; @@ -161,17 +207,19 @@ class Checker { } /** - * Write the signature of the specified app + * Write the signature of the app in the specified folder * - * @param string $appId + * @param string $path * @param X509 $certificate * @param RSA $privateKey * @throws \Exception */ - public function writeAppSignature($appId, + public function writeAppSignature($path, X509 $certificate, RSA $privateKey) { - $path = $this->appLocator->getAppPath($appId); + if(!is_dir($path)) { + throw new \Exception('Directory does not exist.'); + } $iterator = $this->getFolderIterator($path); $hashes = $this->generateHashes($iterator, $path); $signature = $this->createSignatureData($hashes, $certificate, $privateKey); @@ -209,6 +257,10 @@ class Checker { * @throws \Exception */ private function verify($signaturePath, $basePath, $certificateCN) { + if(!$this->isCodeCheckEnforced()) { + return []; + } + $signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true); if(!is_array($signatureData)) { throw new InvalidSignatureException('Signature data not found.'); @@ -320,6 +372,14 @@ class Checker { $this->cache->set(self::CACHE_KEY, json_encode($resultArray)); } + /** + * + * Clean previous results for a proper rescanning. Otherwise + */ + private function cleanResults() { + $this->config->deleteAppValue('core', self::CACHE_KEY); + $this->cache->remove(self::CACHE_KEY); + } /** * Verify the signature of $appId. Returns an array with the following content: @@ -350,11 +410,14 @@ class Checker { * Array may be empty in case no problems have been found. * * @param string $appId + * @param string $path Optional path. If none is given it will be guessed. * @return array */ - public function verifyAppSignature($appId) { + public function verifyAppSignature($appId, $path = '') { try { - $path = $this->appLocator->getAppPath($appId); + if($path === '') { + $path = $this->appLocator->getAppPath($appId); + } $result = $this->verify( $path . '/appinfo/signature.json', $path, @@ -428,6 +491,7 @@ class Checker { * and store the results. */ public function runInstanceVerification() { + $this->cleanResults(); $this->verifyCoreSignature(); $appIds = $this->appLocator->getAllApps(); foreach($appIds as $appId) { diff --git a/lib/private/integritycheck/exceptions/invalidsignatureexception.php b/lib/private/integritycheck/exceptions/invalidsignatureexception.php index 9e05e5884f5..521171642b2 100644 --- a/lib/private/integritycheck/exceptions/invalidsignatureexception.php +++ b/lib/private/integritycheck/exceptions/invalidsignatureexception.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/integritycheck/helpers/applocator.php b/lib/private/integritycheck/helpers/applocator.php index b732cb80893..af22fca1fe4 100644 --- a/lib/private/integritycheck/helpers/applocator.php +++ b/lib/private/integritycheck/helpers/applocator.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/integritycheck/helpers/environmenthelper.php b/lib/private/integritycheck/helpers/environmenthelper.php index d7747dbb966..f56f07486c2 100644 --- a/lib/private/integritycheck/helpers/environmenthelper.php +++ b/lib/private/integritycheck/helpers/environmenthelper.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -34,6 +34,15 @@ class EnvironmentHelper { * @return string */ public function getServerRoot() { - return \OC::$SERVERROOT; + return rtrim(\OC::$SERVERROOT, '/'); + } + + /** + * Provides \OC_Util::getChannel() + * + * @return string + */ + public function getChannel() { + return \OC_Util::getChannel(); } } diff --git a/lib/private/integritycheck/helpers/fileaccesshelper.php b/lib/private/integritycheck/helpers/fileaccesshelper.php index 23f592122dc..f0bf6576d35 100644 --- a/lib/private/integritycheck/helpers/fileaccesshelper.php +++ b/lib/private/integritycheck/helpers/fileaccesshelper.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php b/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php index c75554a7cc9..51850852cbd 100644 --- a/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php +++ b/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php index 43f19475862..c3994197fc6 100644 --- a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php +++ b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -35,6 +35,7 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator { $this->excludedFolders = array_merge([ rtrim(\OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'), '/'), rtrim(\OC::$SERVERROOT.'/themes', '/'), + rtrim(\OC::$SERVERROOT.'/config', '/'), ], $appFolders); } diff --git a/lib/private/json.php b/lib/private/json.php index 0bf4e8bcd01..adee28a1593 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -11,7 +11,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 7835285bd49..b53fadc2bdd 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -4,7 +4,6 @@ * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @author Felix Moeller <mail@felixmoeller.de> * @author Jakob Sack <mail@jakobsack.de> * @author Jan-Christoph Borchardt <hey@jancborchardt.net> * @author Joas Schilling <nickvergessen@owncloud.com> @@ -13,13 +12,13 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -77,17 +76,6 @@ class OC_L10N implements \OCP\IL10N { private $pluralFormFunction = null; /** - * get an L10N instance - * @param string $app - * @param string|null $lang - * @return \OCP\IL10N - * @deprecated Use \OC::$server->getL10NFactory()->get() instead - */ - public static function get($app, $lang=null) { - return \OC::$server->getL10NFactory()->get($app, $lang); - } - - /** * The constructor * @param string $app app requesting l10n * @param string $lang default: null Language diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index b92c21b2d5d..c3c7cc21bba 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -4,9 +4,9 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/l10n/string.php b/lib/private/l10n/string.php index 77469f88d19..84d1603871f 100644 --- a/lib/private/l10n/string.php +++ b/lib/private/l10n/string.php @@ -8,7 +8,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/largefilehelper.php b/lib/private/largefilehelper.php index 3e841850456..f5252ee01e7 100644 --- a/lib/private/largefilehelper.php +++ b/lib/private/largefilehelper.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/lock/abstractlockingprovider.php b/lib/private/lock/abstractlockingprovider.php index db5f1c72dd7..7dee8c709a0 100644 --- a/lib/private/lock/abstractlockingprovider.php +++ b/lib/private/lock/abstractlockingprovider.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index 1b5142a90d2..647250cdb6f 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -5,7 +5,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/lock/memcachelockingprovider.php b/lib/private/lock/memcachelockingprovider.php index af95200d159..08c92950e49 100644 --- a/lib/private/lock/memcachelockingprovider.php +++ b/lib/private/lock/memcachelockingprovider.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/lock/nooplockingprovider.php b/lib/private/lock/nooplockingprovider.php index 9f88e6148f8..dc58230f77e 100644 --- a/lib/private/lock/nooplockingprovider.php +++ b/lib/private/lock/nooplockingprovider.php @@ -3,7 +3,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/log.php b/lib/private/log.php index a722243dc69..addefe6e53d 100644 --- a/lib/private/log.php +++ b/lib/private/log.php @@ -2,13 +2,14 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -31,6 +32,7 @@ use InterfaSys\LogNormalizer\Normalizer; use \OCP\ILogger; use OCP\Security\StringUtils; +use OCP\Util; /** * logging utilities @@ -46,11 +48,13 @@ class Log implements ILogger { /** @var string */ private $logger; + /** @var SystemConfig */ private $config; /** @var boolean|null cache the result of the log condition check for the request */ private $logConditionSatisfied = null; + /** @var Normalizer */ private $normalizer; @@ -82,15 +86,15 @@ class Log implements ILogger { } - /** * System is unusable. * * @param string $message * @param array $context + * @return void */ public function emergency($message, array $context = array()) { - $this->log(\OCP\Util::FATAL, $message, $context); + $this->log(Util::FATAL, $message, $context); } /** @@ -101,9 +105,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function alert($message, array $context = array()) { - $this->log(\OCP\Util::ERROR, $message, $context); + $this->log(Util::ERROR, $message, $context); } /** @@ -113,9 +118,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function critical($message, array $context = array()) { - $this->log(\OCP\Util::ERROR, $message, $context); + $this->log(Util::ERROR, $message, $context); } /** @@ -124,9 +130,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function error($message, array $context = array()) { - $this->log(\OCP\Util::ERROR, $message, $context); + $this->log(Util::ERROR, $message, $context); } /** @@ -137,9 +144,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function warning($message, array $context = array()) { - $this->log(\OCP\Util::WARN, $message, $context); + $this->log(Util::WARN, $message, $context); } /** @@ -147,9 +155,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function notice($message, array $context = array()) { - $this->log(\OCP\Util::INFO, $message, $context); + $this->log(Util::INFO, $message, $context); } /** @@ -159,9 +168,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function info($message, array $context = array()) { - $this->log(\OCP\Util::INFO, $message, $context); + $this->log(Util::INFO, $message, $context); } /** @@ -169,9 +179,10 @@ class Log implements ILogger { * * @param string $message * @param array $context + * @return void */ public function debug($message, array $context = array()) { - $this->log(\OCP\Util::DEBUG, $message, $context); + $this->log(Util::DEBUG, $message, $context); } @@ -181,9 +192,10 @@ class Log implements ILogger { * @param mixed $level * @param string $message * @param array $context + * @return void */ public function log($level, $message, array $context = array()) { - $minLevel = min($this->config->getValue('loglevel', \OCP\Util::WARN), \OCP\Util::ERROR); + $minLevel = min($this->config->getValue('loglevel', Util::WARN), Util::ERROR); $logCondition = $this->config->getValue('log.condition', []); array_walk($context, [$this->normalizer, 'format']); @@ -198,7 +210,7 @@ class Log implements ILogger { if(!empty($logCondition) && isset($logCondition['apps']) && in_array($app, $logCondition['apps'], true)) { - $minLevel = \OCP\Util::DEBUG; + $minLevel = Util::DEBUG; } } else { @@ -246,7 +258,7 @@ class Log implements ILogger { // if log condition is satisfied change the required log level to DEBUG if($this->logConditionSatisfied) { - $minLevel = \OCP\Util::DEBUG; + $minLevel = Util::DEBUG; } if ($level >= $minLevel) { @@ -273,6 +285,8 @@ class Log implements ILogger { 'Line' => $exception->getLine(), ); $exception['Trace'] = preg_replace('!(login|checkPassword)\(.*\)!', '$1(*** username and password replaced ***)', $exception['Trace']); - $this->error('Exception: ' . json_encode($exception), $context); + $msg = isset($context['message']) ? $context['message'] : 'Exception'; + $msg .= ': ' . json_encode($exception); + $this->error($msg, $context); } } diff --git a/lib/private/log/errorhandler.php b/lib/private/log/errorhandler.php index d10c44cc0cd..27cde4aa242 100644 --- a/lib/private/log/errorhandler.php +++ b/lib/private/log/errorhandler.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php index e455824a8dd..f9ce671aa93 100644 --- a/lib/private/log/owncloud.php +++ b/lib/private/log/owncloud.php @@ -2,13 +2,14 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> + * @author Christian Schnidrig <christian.schnidrig@switch.ch> * @author Georg Ehrke <georg@owncloud.com> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/log/rotate.php b/lib/private/log/rotate.php index 98ebef25988..458661c82d0 100644 --- a/lib/private/log/rotate.php +++ b/lib/private/log/rotate.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/log/syslog.php b/lib/private/log/syslog.php index 7a638c36a77..96cf463d042 100644 --- a/lib/private/log/syslog.php +++ b/lib/private/log/syslog.php @@ -3,9 +3,8 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> - * @author Volker Fröhlich <volker27@gmx.at> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/mail/mailer.php b/lib/private/mail/mailer.php index bd93f3e3d58..742ff554892 100644 --- a/lib/private/mail/mailer.php +++ b/lib/private/mail/mailer.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/mail/message.php b/lib/private/mail/message.php index 98a95e4e583..0e33e6383f7 100644 --- a/lib/private/mail/message.php +++ b/lib/private/mail/message.php @@ -1,8 +1,9 @@ <?php /** * @author Lukas Reschke <lukas@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/apc.php b/lib/private/memcache/apc.php index e38b4bd3a39..2354ad07749 100644 --- a/lib/private/memcache/apc.php +++ b/lib/private/memcache/apc.php @@ -1,11 +1,12 @@ <?php /** * @author Andreas Fischer <bantu@owncloud.com> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Otto Sabart <ottosabart@seberm.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/apcu.php b/lib/private/memcache/apcu.php index 778e27d4567..ddd16ae1202 100644 --- a/lib/private/memcache/apcu.php +++ b/lib/private/memcache/apcu.php @@ -2,10 +2,11 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -59,7 +60,7 @@ class APCu extends Cache implements IMemcache { if(class_exists('\APCIterator')) { $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY); } else { - $iter = new \APCUIterator('user', '/^' . $ns . '/', APC_ITER_KEY); + $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); } return apcu_delete($iter); } diff --git a/lib/private/memcache/arraycache.php b/lib/private/memcache/arraycache.php index 33c8bea8746..837f888a307 100644 --- a/lib/private/memcache/arraycache.php +++ b/lib/private/memcache/arraycache.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/cache.php b/lib/private/memcache/cache.php index 30fae30aaea..63d20721aac 100644 --- a/lib/private/memcache/cache.php +++ b/lib/private/memcache/cache.php @@ -3,9 +3,9 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/cadtrait.php b/lib/private/memcache/cadtrait.php index e9836e24040..d44d98cba0b 100644 --- a/lib/private/memcache/cadtrait.php +++ b/lib/private/memcache/cadtrait.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/castrait.php b/lib/private/memcache/castrait.php index c52538023fb..43253fc966b 100644 --- a/lib/private/memcache/castrait.php +++ b/lib/private/memcache/castrait.php @@ -2,7 +2,7 @@ /** * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php index fe82558e731..21149d8b6bf 100644 --- a/lib/private/memcache/factory.php +++ b/lib/private/memcache/factory.php @@ -5,11 +5,11 @@ * @author Markus Goetz <markus@woboq.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/memcached.php b/lib/private/memcache/memcached.php index 22b54f7bc95..c13be68b47f 100644 --- a/lib/private/memcache/memcached.php +++ b/lib/private/memcache/memcached.php @@ -4,9 +4,10 @@ * @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 Robin McCorkell <robin@mccorkell.me.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/nullcache.php b/lib/private/memcache/nullcache.php index de27b03e71d..c490ca7e03c 100644 --- a/lib/private/memcache/nullcache.php +++ b/lib/private/memcache/nullcache.php @@ -2,11 +2,11 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/redis.php b/lib/private/memcache/redis.php index 68b62e7534a..db5461db669 100644 --- a/lib/private/memcache/redis.php +++ b/lib/private/memcache/redis.php @@ -2,11 +2,12 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Michael Telatynski <7t3chguy@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/memcache/xcache.php b/lib/private/memcache/xcache.php index 0d2e43a1c18..eea55fefc4d 100644 --- a/lib/private/memcache/xcache.php +++ b/lib/private/memcache/xcache.php @@ -2,11 +2,12 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> + * @author Clark Tomlinson <fallen013@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/naturalsort.php b/lib/private/naturalsort.php index 2071ede43e0..f44e8032d36 100644 --- a/lib/private/naturalsort.php +++ b/lib/private/naturalsort.php @@ -3,11 +3,11 @@ * @author AW-UC <git@a-wesemann.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/naturalsort_defaultcollator.php b/lib/private/naturalsort_defaultcollator.php index ba408121088..7b8400fa8e1 100644 --- a/lib/private/naturalsort_defaultcollator.php +++ b/lib/private/naturalsort_defaultcollator.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/navigationmanager.php b/lib/private/navigationmanager.php index f724963aa1b..6dbb9c925e0 100644 --- a/lib/private/navigationmanager.php +++ b/lib/private/navigationmanager.php @@ -3,10 +3,10 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/needsupdateexception.php b/lib/private/needsupdateexception.php index 5024d8ce924..90c642780d8 100644 --- a/lib/private/needsupdateexception.php +++ b/lib/private/needsupdateexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/notification/action.php b/lib/private/notification/action.php index 8eade697025..deac6807653 100644 --- a/lib/private/notification/action.php +++ b/lib/private/notification/action.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -22,6 +22,8 @@ namespace OC\Notification; +use OCP\Notification\IAction; + class Action implements IAction { /** @var string */ diff --git a/lib/private/notification/manager.php b/lib/private/notification/manager.php index 0d5bb9be514..a14a1deec0c 100644 --- a/lib/private/notification/manager.php +++ b/lib/private/notification/manager.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -22,6 +22,11 @@ namespace OC\Notification; +use OCP\Notification\IApp; +use OCP\Notification\IManager; +use OCP\Notification\INotification; +use OCP\Notification\INotifier; + class Manager implements IManager { /** @var IApp */ protected $apps; @@ -29,17 +34,25 @@ class Manager implements IManager { /** @var INotifier */ protected $notifiers; - /** @var \Closure */ + /** @var array[] */ + protected $notifiersInfo; + + /** @var \Closure[] */ protected $appsClosures; - /** @var \Closure */ + /** @var \Closure[] */ protected $notifiersClosures; + /** @var \Closure[] */ + protected $notifiersInfoClosures; + public function __construct() { $this->apps = []; $this->notifiers = []; + $this->notifiersInfo = []; $this->appsClosures = []; $this->notifiersClosures = []; + $this->notifiersInfoClosures = []; } /** @@ -56,12 +69,16 @@ class Manager implements IManager { /** * @param \Closure $service The service must implement INotifier, otherwise a * \InvalidArgumentException is thrown later + * @param \Closure $info An array with the keys 'id' and 'name' containing + * the app id and the app name * @return null - * @since 8.2.0 + * @since 8.2.0 - Parameter $info was added in 9.0.0 */ - public function registerNotifier(\Closure $service) { + public function registerNotifier(\Closure $service, \Closure $info) { $this->notifiersClosures[] = $service; + $this->notifiersInfoClosures[] = $info; $this->notifiers = []; + $this->notifiersInfo = []; } /** @@ -96,7 +113,7 @@ class Manager implements IManager { foreach ($this->notifiersClosures as $closure) { $notifier = $closure(); if (!($notifier instanceof INotifier)) { - throw new \InvalidArgumentException('The given notification app does not implement the INotifier interface'); + throw new \InvalidArgumentException('The given notifier does not implement the INotifier interface'); } $this->notifiers[] = $notifier; } @@ -105,6 +122,29 @@ class Manager implements IManager { } /** + * @return array[] + */ + public function listNotifiers() { + if (!empty($this->notifiersInfo)) { + return $this->notifiersInfo; + } + + $this->notifiersInfo = []; + foreach ($this->notifiersInfoClosures as $closure) { + $notifier = $closure(); + if (!is_array($notifier) || sizeof($notifier) !== 2 || !isset($notifier['id']) || !isset($notifier['name'])) { + throw new \InvalidArgumentException('The given notifier information is invalid'); + } + if (isset($this->notifiersInfo[$notifier['id']])) { + throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use'); + } + $this->notifiersInfo[$notifier['id']] = $notifier['name']; + } + + return $this->notifiersInfo; + } + + /** * @return INotification * @since 8.2.0 */ diff --git a/lib/private/notification/notification.php b/lib/private/notification/notification.php index 70964fc0366..6568f53f255 100644 --- a/lib/private/notification/notification.php +++ b/lib/private/notification/notification.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -22,6 +22,9 @@ namespace OC\Notification; +use OCP\Notification\IAction; +use OCP\Notification\INotification; + class Notification implements INotification { /** @var string */ protected $app; @@ -167,8 +170,7 @@ class Notification implements INotification { * @param string $id * @return $this * @throws \InvalidArgumentException if the object type or id is invalid - * @since 8.2.0 - * @changed 9.0.0 Type of $id changed to string + * @since 8.2.0 - 9.0.0: Type of $id changed to string */ public function setObject($type, $id) { if (!is_string($type) || $type === '' || isset($type[64])) { @@ -193,8 +195,7 @@ class Notification implements INotification { /** * @return string - * @since 8.2.0 - * @changed 9.0.0 Return type changed to string + * @since 8.2.0 - 9.0.0: Return type changed to string */ public function getObjectId() { return $this->objectId; diff --git a/lib/private/notsquareexception.php b/lib/private/notsquareexception.php index 23d6ebca2c0..e3494463850 100644 --- a/lib/private/notsquareexception.php +++ b/lib/private/notsquareexception.php @@ -3,7 +3,7 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs.php b/lib/private/ocs.php index 7b474fa439f..f48879a98b1 100644 --- a/lib/private/ocs.php +++ b/lib/private/ocs.php @@ -7,7 +7,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index 1b04f43d477..1d47fb208a7 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -5,7 +5,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/config.php b/lib/private/ocs/config.php index fc9640b6cc4..db04dcbd400 100644 --- a/lib/private/ocs/config.php +++ b/lib/private/ocs/config.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/corecapabilities.php b/lib/private/ocs/corecapabilities.php index f2d530a8419..388a58791b4 100644 --- a/lib/private/ocs/corecapabilities.php +++ b/lib/private/ocs/corecapabilities.php @@ -1,8 +1,9 @@ <?php /** * @author Roeland Jago Douma <rullzer@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/exception.php b/lib/private/ocs/exception.php index 93bee773771..ca67ac5e841 100644 --- a/lib/private/ocs/exception.php +++ b/lib/private/ocs/exception.php @@ -2,7 +2,7 @@ /** * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/person.php b/lib/private/ocs/person.php index 0059982c55e..7162fa5e4fb 100644 --- a/lib/private/ocs/person.php +++ b/lib/private/ocs/person.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/privatedata.php b/lib/private/ocs/privatedata.php index 92f029aa12a..e514c05a3dd 100644 --- a/lib/private/ocs/privatedata.php +++ b/lib/private/ocs/privatedata.php @@ -8,7 +8,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php index 2c3f676510c..c342bc582fe 100644 --- a/lib/private/ocs/result.php +++ b/lib/private/ocs/result.php @@ -5,11 +5,11 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index 81c9abee058..a783a1f8425 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -9,11 +9,11 @@ * @author Kamil Domanski <kdomanski@kdemail.net> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -284,7 +284,7 @@ class OCSClient { } $app = []; - $app['id'] = (int)$tmp->id; + $app['id'] = (int)$id; $app['name'] = (string)$tmp->name; $app['version'] = (string)$tmp->version; $app['type'] = (string)$tmp->typeid; diff --git a/lib/private/preview.php b/lib/private/preview.php index 44d38b354a9..df6eeceddcb 100644 --- a/lib/private/preview.php +++ b/lib/private/preview.php @@ -9,10 +9,11 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tobias Kaminsky <tobias@kaminsky.me> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/bitmap.php b/lib/private/preview/bitmap.php index ad0ef000510..34bc2f93fc7 100644 --- a/lib/private/preview/bitmap.php +++ b/lib/private/preview/bitmap.php @@ -5,7 +5,7 @@ * @author Olivier Paroz <github@oparoz.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/bmp.php b/lib/private/preview/bmp.php index 36439626f08..da13cd9e5b8 100644 --- a/lib/private/preview/bmp.php +++ b/lib/private/preview/bmp.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/font.php b/lib/private/preview/font.php index 197297a6df6..caac2923789 100644 --- a/lib/private/preview/font.php +++ b/lib/private/preview/font.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/gif.php b/lib/private/preview/gif.php index a3b57484999..0716a6f4406 100644 --- a/lib/private/preview/gif.php +++ b/lib/private/preview/gif.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/illustrator.php b/lib/private/preview/illustrator.php index ac9dcb5ffbf..ef8448d7b53 100644 --- a/lib/private/preview/illustrator.php +++ b/lib/private/preview/illustrator.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php index 9287d9c888b..b377f0e855d 100644 --- a/lib/private/preview/image.php +++ b/lib/private/preview/image.php @@ -7,7 +7,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/jpeg.php b/lib/private/preview/jpeg.php index 96f89f4d57e..2ee5dd24419 100644 --- a/lib/private/preview/jpeg.php +++ b/lib/private/preview/jpeg.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/markdown.php b/lib/private/preview/markdown.php index f5e74697621..394af6576c7 100644 --- a/lib/private/preview/markdown.php +++ b/lib/private/preview/markdown.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/movie.php b/lib/private/preview/movie.php index 2c2e6d09399..ee56f017229 100644 --- a/lib/private/preview/movie.php +++ b/lib/private/preview/movie.php @@ -2,10 +2,11 @@ /** * @author Georg Ehrke <georg@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/mp3.php b/lib/private/preview/mp3.php index ffe596db71b..b984cb4e10d 100644 --- a/lib/private/preview/mp3.php +++ b/lib/private/preview/mp3.php @@ -5,7 +5,7 @@ * @author Olivier Paroz <github@oparoz.com> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/msoffice2003.php b/lib/private/preview/msoffice2003.php index dd00cacedf3..20dbe13543a 100644 --- a/lib/private/preview/msoffice2003.php +++ b/lib/private/preview/msoffice2003.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/msoffice2007.php b/lib/private/preview/msoffice2007.php index 8fcdabc0484..ef6758843f1 100644 --- a/lib/private/preview/msoffice2007.php +++ b/lib/private/preview/msoffice2007.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/msofficedoc.php b/lib/private/preview/msofficedoc.php index 6ce003387fb..05d839d508f 100644 --- a/lib/private/preview/msofficedoc.php +++ b/lib/private/preview/msofficedoc.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php index acf3683def0..6496e091b1d 100644 --- a/lib/private/preview/office.php +++ b/lib/private/preview/office.php @@ -1,11 +1,12 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/opendocument.php b/lib/private/preview/opendocument.php index 21df2b5909a..0da1e88cafa 100644 --- a/lib/private/preview/opendocument.php +++ b/lib/private/preview/opendocument.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php index 220cbf14faf..6ddf33cdea2 100644 --- a/lib/private/preview/pdf.php +++ b/lib/private/preview/pdf.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/photoshop.php b/lib/private/preview/photoshop.php index 73c2e82d096..df91247f072 100644 --- a/lib/private/preview/photoshop.php +++ b/lib/private/preview/photoshop.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/png.php b/lib/private/preview/png.php index bab63c16ada..5dd9ae484a5 100644 --- a/lib/private/preview/png.php +++ b/lib/private/preview/png.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/postscript.php b/lib/private/preview/postscript.php index d69e86edc7f..edfd43968c2 100644 --- a/lib/private/preview/postscript.php +++ b/lib/private/preview/postscript.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/provider.php b/lib/private/preview/provider.php index 8f4a9f9fc3f..738d13d7fc8 100644 --- a/lib/private/preview/provider.php +++ b/lib/private/preview/provider.php @@ -6,7 +6,7 @@ * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/staroffice.php b/lib/private/preview/staroffice.php index b06de79f707..6ea4efa5144 100644 --- a/lib/private/preview/staroffice.php +++ b/lib/private/preview/staroffice.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php index 26ce0fa9411..6618c1fbf82 100644 --- a/lib/private/preview/svg.php +++ b/lib/private/preview/svg.php @@ -5,7 +5,7 @@ * @author Olivier Paroz <github@oparoz.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/tiff.php b/lib/private/preview/tiff.php index 624eb5ddff2..006ced6aec0 100644 --- a/lib/private/preview/tiff.php +++ b/lib/private/preview/tiff.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/txt.php b/lib/private/preview/txt.php index b6c21b7c1b1..a27517c9f39 100644 --- a/lib/private/preview/txt.php +++ b/lib/private/preview/txt.php @@ -7,7 +7,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/preview/xbitmap.php b/lib/private/preview/xbitmap.php index 7887f2b73f5..604a51a6a83 100644 --- a/lib/private/preview/xbitmap.php +++ b/lib/private/preview/xbitmap.php @@ -2,7 +2,7 @@ /** * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/previewmanager.php b/lib/private/previewmanager.php index e351c010c85..f3c7a4de0d0 100644 --- a/lib/private/previewmanager.php +++ b/lib/private/previewmanager.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair.php b/lib/private/repair.php index 269fe4c5f09..d40c6464e14 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -9,7 +9,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/assetcache.php b/lib/private/repair/assetcache.php index c46aa63a3e4..72fe99bbe1a 100644 --- a/lib/private/repair/assetcache.php +++ b/lib/private/repair/assetcache.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/cleantags.php b/lib/private/repair/cleantags.php index d16a49fbca7..7421242eb48 100644 --- a/lib/private/repair/cleantags.php +++ b/lib/private/repair/cleantags.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/collation.php b/lib/private/repair/collation.php index 7eb14f0ded2..48035f8d331 100644 --- a/lib/private/repair/collation.php +++ b/lib/private/repair/collation.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/dropoldjobs.php b/lib/private/repair/dropoldjobs.php index 89d7f96a144..2d6172047c2 100644 --- a/lib/private/repair/dropoldjobs.php +++ b/lib/private/repair/dropoldjobs.php @@ -2,7 +2,7 @@ /** * @author Arthur Schiwon <blizzz@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/dropoldtables.php b/lib/private/repair/dropoldtables.php index 2d7fc8376b3..abd3bd49b0a 100644 --- a/lib/private/repair/dropoldtables.php +++ b/lib/private/repair/dropoldtables.php @@ -1,8 +1,9 @@ <?php /** * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/filletags.php b/lib/private/repair/filletags.php index 8cfc4a7c258..dc2ffdcbc36 100644 --- a/lib/private/repair/filletags.php +++ b/lib/private/repair/filletags.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/innodb.php b/lib/private/repair/innodb.php index 4bbfdcea20a..4e157e66045 100644 --- a/lib/private/repair/innodb.php +++ b/lib/private/repair/innodb.php @@ -5,7 +5,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/oldgroupmembershipshares.php b/lib/private/repair/oldgroupmembershipshares.php index 2d701ac9fb7..bae1bf61a7f 100644 --- a/lib/private/repair/oldgroupmembershipshares.php +++ b/lib/private/repair/oldgroupmembershipshares.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/preview.php b/lib/private/repair/preview.php index 2284da93734..481e98b42d1 100644 --- a/lib/private/repair/preview.php +++ b/lib/private/repair/preview.php @@ -2,7 +2,7 @@ /** * @author Georg Ehrke <georg@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/removegetetagentries.php b/lib/private/repair/removegetetagentries.php index 40040763654..e118da7973a 100644 --- a/lib/private/repair/removegetetagentries.php +++ b/lib/private/repair/removegetetagentries.php @@ -2,7 +2,7 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/repairinvalidshares.php b/lib/private/repair/repairinvalidshares.php index 5a4cb445ce9..ee8b23906e5 100644 --- a/lib/private/repair/repairinvalidshares.php +++ b/lib/private/repair/repairinvalidshares.php @@ -1,9 +1,10 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/repairlegacystorages.php b/lib/private/repair/repairlegacystorages.php index 5ba452cbbc6..ee189110a87 100644 --- a/lib/private/repair/repairlegacystorages.php +++ b/lib/private/repair/repairlegacystorages.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/repairmimetypes.php b/lib/private/repair/repairmimetypes.php index e687dbde688..692a7120a63 100644 --- a/lib/private/repair/repairmimetypes.php +++ b/lib/private/repair/repairmimetypes.php @@ -8,7 +8,7 @@ * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/searchlucenetables.php b/lib/private/repair/searchlucenetables.php index 52d41083c45..9f3601eeb03 100644 --- a/lib/private/repair/searchlucenetables.php +++ b/lib/private/repair/searchlucenetables.php @@ -3,7 +3,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/sqliteautoincrement.php b/lib/private/repair/sqliteautoincrement.php index 70d0adae5d7..d7cac57229d 100644 --- a/lib/private/repair/sqliteautoincrement.php +++ b/lib/private/repair/sqliteautoincrement.php @@ -2,7 +2,7 @@ /** * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/updatecertificatestore.php b/lib/private/repair/updatecertificatestore.php index 5fad309a959..ae7585f07f6 100644 --- a/lib/private/repair/updatecertificatestore.php +++ b/lib/private/repair/updatecertificatestore.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repair/updateoutdatedocsids.php b/lib/private/repair/updateoutdatedocsids.php index 5f6ee029536..60024b3055c 100644 --- a/lib/private/repair/updateoutdatedocsids.php +++ b/lib/private/repair/updateoutdatedocsids.php @@ -2,7 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repairexception.php b/lib/private/repairexception.php index 8add3958c9b..e244f2bb820 100644 --- a/lib/private/repairexception.php +++ b/lib/private/repairexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/repairstep.php b/lib/private/repairstep.php index 25cb91da68e..e1b8442fb8a 100644 --- a/lib/private/repairstep.php +++ b/lib/private/repairstep.php @@ -2,7 +2,7 @@ /** * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/response.php b/lib/private/response.php index b0eb8adc4d5..5c7eb9b52d5 100644 --- a/lib/private/response.php +++ b/lib/private/response.php @@ -5,11 +5,11 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -260,6 +260,8 @@ class OC_Response { header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE header('X-Frame-Options: Sameorigin'); // Disallow iFraming from other domains header('X-Robots-Tag: none'); // https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag + header('X-Download-Options: noopen'); // https://msdn.microsoft.com/en-us/library/jj542450(v=vs.85).aspx + header('X-Permitted-Cross-Domain-Policies: none'); // https://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html } } diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php index 2d10b8ab691..4c702bb8e04 100644 --- a/lib/private/route/cachingrouter.php +++ b/lib/private/route/cachingrouter.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/route/route.php b/lib/private/route/route.php index 86f05b85e5b..966790a63c0 100644 --- a/lib/private/route/route.php +++ b/lib/private/route/route.php @@ -5,10 +5,10 @@ * @author Felix Moeller <mail@felixmoeller.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/route/router.php b/lib/private/route/router.php index 5cfddca966a..13f7a7a1cfb 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -7,11 +7,12 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search.php b/lib/private/search.php index ea77fa4f151..7d1e2734195 100644 --- a/lib/private/search.php +++ b/lib/private/search.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search/provider/file.php b/lib/private/search/provider/file.php index 73d57def644..69ffbd3ae6b 100644 --- a/lib/private/search/provider/file.php +++ b/lib/private/search/provider/file.php @@ -6,7 +6,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search/result/audio.php b/lib/private/search/result/audio.php index 8e135ea5d29..3f9b3dc640c 100644 --- a/lib/private/search/result/audio.php +++ b/lib/private/search/result/audio.php @@ -4,7 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search/result/file.php b/lib/private/search/result/file.php index 4329f504a7d..d987d6c8e73 100644 --- a/lib/private/search/result/file.php +++ b/lib/private/search/result/file.php @@ -5,7 +5,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search/result/folder.php b/lib/private/search/result/folder.php index 18f7de2e481..6f0c0a7b2a5 100644 --- a/lib/private/search/result/folder.php +++ b/lib/private/search/result/folder.php @@ -4,7 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/search/result/image.php b/lib/private/search/result/image.php index bf4425a55f9..87b36fc9f73 100644 --- a/lib/private/search/result/image.php +++ b/lib/private/search/result/image.php @@ -4,7 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/security/certificate.php b/lib/private/security/certificate.php index 0d7fcc4148d..54486ff51fe 100644 --- a/lib/private/security/certificate.php +++ b/lib/private/security/certificate.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/security/certificatemanager.php b/lib/private/security/certificatemanager.php index ded81863a73..f4932ca568e 100644 --- a/lib/private/security/certificatemanager.php +++ b/lib/private/security/certificatemanager.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -50,7 +50,7 @@ class CertificateManager implements ICertificateManager { /** * @param string $uid - * @param \OC\Files\View $view relative zu data/ + * @param \OC\Files\View $view relative to data/ * @param IConfig $config */ public function __construct($uid, \OC\Files\View $view, IConfig $config) { @@ -83,7 +83,8 @@ class CertificateManager implements ICertificateManager { if ($file != '.' && $file != '..') { try { $result[] = new Certificate($this->view->file_get_contents($path . $file), $file); - } catch(\Exception $e) {} + } catch (\Exception $e) { + } } } closedir($handle); @@ -97,22 +98,34 @@ class CertificateManager implements ICertificateManager { $path = $this->getPathToCertificates(); $certs = $this->listCertificates(); - $fh_certs = $this->view->fopen($path . '/rootcerts.crt', 'w'); + if (!$this->view->file_exists($path)) { + $this->view->mkdir($path); + } + + $fhCerts = $this->view->fopen($path . '/rootcerts.crt', 'w'); // Write user certificates foreach ($certs as $cert) { $file = $path . '/uploads/' . $cert->getName(); $data = $this->view->file_get_contents($file); if (strpos($data, 'BEGIN CERTIFICATE')) { - fwrite($fh_certs, $data); - fwrite($fh_certs, "\r\n"); + fwrite($fhCerts, $data); + fwrite($fhCerts, "\r\n"); } } // Append the default certificates $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); - fwrite($fh_certs, $defaultCertificates); - fclose($fh_certs); + fwrite($fhCerts, $defaultCertificates); + + // Append the system certificate bundle + $systemBundle = $this->getCertificateBundle(null); + if ($this->view->file_exists($systemBundle)) { + $systemCertificates = $this->view->file_get_contents($systemBundle); + fwrite($fhCerts, $systemCertificates); + } + + fclose($fhCerts); } /** @@ -166,18 +179,72 @@ class CertificateManager implements ICertificateManager { /** * Get the path to the certificate bundle for this user * + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle * @return string */ - public function getCertificateBundle() { - return $this->getPathToCertificates() . 'rootcerts.crt'; + public function getCertificateBundle($uid = '') { + if ($uid === '') { + $uid = $this->uid; + } + return $this->getPathToCertificates($uid) . 'rootcerts.crt'; + } + + /** + * Get the full local path to the certificate bundle for this user + * + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle + * @return string + */ + public function getAbsoluteBundlePath($uid = '') { + if ($uid === '') { + $uid = $this->uid; + } + if ($this->needsRebundling($uid)) { + if (is_null($uid)) { + $manager = new CertificateManager(null, $this->view, $this->config); + $manager->createCertificateBundle(); + } else { + $this->createCertificateBundle(); + } + } + return $this->view->getLocalFile($this->getCertificateBundle($uid)); } /** + * @param string $uid (optional) user to get the certificate path for, use `null` to get the system path * @return string */ - private function getPathToCertificates() { - $path = is_null($this->uid) ? '/files_external/' : '/' . $this->uid . '/files_external/'; + private function getPathToCertificates($uid = '') { + if ($uid === '') { + $uid = $this->uid; + } + $path = is_null($uid) ? '/files_external/' : '/' . $uid . '/files_external/'; return $path; } + + /** + * Check if we need to re-bundle the certificates because one of the sources has updated + * + * @param string $uid (optional) user to get the certificate path for, use `null` to get the system path + * @return bool + */ + private function needsRebundling($uid = '') { + if ($uid === '') { + $uid = $this->uid; + } + $sourceMTimes = [filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt')]; + $targetBundle = $this->getCertificateBundle($uid); + if (!$this->view->file_exists($targetBundle)) { + return true; + } + if (!is_null($uid)) { // also depend on the system bundle + $sourceBundles[] = $this->view->filemtime($this->getCertificateBundle(null)); + } + + $sourceMTime = array_reduce($sourceMTimes, function ($max, $mtime) { + return max($max, $mtime); + }, 0); + return $sourceMTime > $this->view->filemtime($targetBundle); + } } diff --git a/lib/private/security/credentialsmanager.php b/lib/private/security/credentialsmanager.php new file mode 100644 index 00000000000..405922847be --- /dev/null +++ b/lib/private/security/credentialsmanager.php @@ -0,0 +1,125 @@ +<?php +/** + * @author Robin McCorkell <rmccorkell@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\Security; + +use OCP\Security\ICrypto; +use OCP\IDBConnection; +use OCP\Security\ICredentialsManager; +use OCP\IConfig; + +/** + * Store and retrieve credentials for external services + * + * @package OC\Security + */ +class CredentialsManager implements ICredentialsManager { + + const DB_TABLE = 'credentials'; + + /** @var ICrypto */ + protected $crypto; + + /** @var IDBConnection */ + protected $dbConnection; + + /** + * @param ICrypto $crypto + * @param IDBConnection $dbConnection + */ + public function __construct(ICrypto $crypto, IDBConnection $dbConnection) { + $this->crypto = $crypto; + $this->dbConnection = $dbConnection; + } + + /** + * Store a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @param mixed $credentials + */ + public function store($userId, $identifier, $credentials) { + $value = $this->crypto->encrypt(json_encode($credentials)); + + $this->dbConnection->setValues(self::DB_TABLE, [ + 'user' => $userId, + 'identifier' => $identifier, + ], [ + 'credentials' => $value, + ]); + } + + /** + * Retrieve a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @return mixed + */ + public function retrieve($userId, $identifier) { + $qb = $this->dbConnection->getQueryBuilder(); + $qb->select('credentials') + ->from(self::DB_TABLE) + ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId))) + ->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier))) + ; + $result = $qb->execute()->fetch(); + + if (!$result) { + return null; + } + $value = $result['credentials']; + + return json_decode($this->crypto->decrypt($value), true); + } + + /** + * Delete a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @return int rows removed + */ + public function delete($userId, $identifier) { + $qb = $this->dbConnection->getQueryBuilder(); + $qb->delete(self::DB_TABLE) + ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId))) + ->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier))) + ; + return $qb->execute(); + } + + /** + * Erase all credentials stored for a user + * + * @param string $userId + * @return int rows removed + */ + public function erase($userId) { + $qb = $this->dbConnection->getQueryBuilder(); + $qb->delete(self::DB_TABLE) + ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId))) + ; + return $qb->execute(); + } + +} diff --git a/lib/private/security/crypto.php b/lib/private/security/crypto.php index 46d0c750b2f..3c3ffb47398 100644 --- a/lib/private/security/crypto.php +++ b/lib/private/security/crypto.php @@ -3,8 +3,9 @@ * @author Andreas Fischer <bantu@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -90,7 +91,7 @@ class Crypto implements ICrypto { } $this->cipher->setPassword($password); - $iv = $this->random->getLowStrengthGenerator()->generate($this->ivLength); + $iv = $this->random->generate($this->ivLength); $this->cipher->setIV($iv); $ciphertext = bin2hex($this->cipher->encrypt($plaintext)); diff --git a/lib/private/security/hasher.php b/lib/private/security/hasher.php index 318141b6852..a8b81aa60eb 100644 --- a/lib/private/security/hasher.php +++ b/lib/private/security/hasher.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/security/securerandom.php b/lib/private/security/securerandom.php index 24affbe8988..45cb3f17ee4 100644 --- a/lib/private/security/securerandom.php +++ b/lib/private/security/securerandom.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -77,7 +77,7 @@ class SecureRandom implements ISecureRandom { $randomString = ''; while($length > 0) { - $randomNumber = random_int(0, $maxCharIndex); + $randomNumber = \random_int(0, $maxCharIndex); $randomString .= $characters[$randomNumber]; $length--; } diff --git a/lib/private/security/trusteddomainhelper.php b/lib/private/security/trusteddomainhelper.php index c1a397dd52d..885ceee23c3 100644 --- a/lib/private/security/trusteddomainhelper.php +++ b/lib/private/security/trusteddomainhelper.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/server.php b/lib/private/server.php index ead9fa95db8..ee126e0c3e6 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -12,14 +12,14 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sander <brantje@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -47,6 +47,8 @@ use OC\Diagnostics\EventLogger; use OC\Diagnostics\NullEventLogger; use OC\Diagnostics\NullQueryLogger; use OC\Diagnostics\QueryLogger; +use OC\Files\Config\UserMountCache; +use OC\Files\Config\UserMountCacheListener; use OC\Files\Node\HookConnector; use OC\Files\Node\Root; use OC\Files\View; @@ -63,6 +65,7 @@ use OC\Notification\Manager; use OC\Security\CertificateManager; use OC\Security\Crypto; use OC\Security\Hasher; +use OC\Security\CredentialsManager; use OC\Security\SecureRandom; use OC\Security\TrustedDomainHelper; use OC\Session\CryptoWrapper; @@ -136,18 +139,25 @@ class Server extends ServerContainer implements IServerContainer { return new Encryption\Keys\Storage($view, $util); }); - $this->registerService('TagMapper', function(Server $c) { + $this->registerService('TagMapper', function (Server $c) { return new TagMapper($c->getDatabaseConnection()); }); $this->registerService('TagManager', function (Server $c) { $tagMapper = $c->query('TagMapper'); return new TagManager($tagMapper, $c->getUserSession()); }); + $this->registerService('SystemTagManagerFactory', function (Server $c) { + $config = $c->getConfig(); + $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); + /** @var \OC\SystemTag\ManagerFactory $factory */ + $factory = new $factoryClass($this); + return $factory; + }); $this->registerService('SystemTagManager', function (Server $c) { - return new SystemTag\SystemTagManager($c->getDatabaseConnection()); + return $c->query('SystemTagManagerFactory')->getManager(); }); $this->registerService('SystemTagObjectMapper', function (Server $c) { - return new SystemTag\SystemTagObjectMapper($c->getDatabaseConnection(), $c->getSystemTagManager()); + return $c->query('SystemTagManagerFactory')->getObjectMapper(); }); $this->registerService('RootFolder', function (Server $c) { // TODO: get user and user manager from container as well @@ -229,6 +239,10 @@ class Server extends ServerContainer implements IServerContainer { $userSession->listen('\OC\User', 'logout', function () { \OC_Hook::emit('OC_User', 'logout', array()); }); + $userSession->listen('\OC\User', 'changeUser', function ($user) { + /** @var $user \OC\User\User */ + \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user)); + }); return $userSession; }); $this->registerService('NavigationManager', function ($c) { @@ -265,13 +279,13 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('MemCacheFactory', function (Server $c) { $config = $c->getConfig(); - if($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { + if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { $v = \OC_App::getAppVersions(); $v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php')); $version = implode(',', $v); $instanceId = \OC_Util::getInstanceId(); $path = \OC::$SERVERROOT; - $prefix = md5($instanceId.'-'.$version.'-'.$path); + $prefix = md5($instanceId . '-' . $version . '-' . $path); return new \OC\Memcache\Factory($prefix, $c->getLogger(), $config->getSystemValue('memcache.local', null), $config->getSystemValue('memcache.distributed', null), @@ -332,6 +346,9 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('Hasher', function (Server $c) { return new Hasher($c->getConfig()); }); + $this->registerService('CredentialsManager', function (Server $c) { + return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); + }); $this->registerService('DatabaseConnection', function (Server $c) { $factory = new \OC\DB\ConnectionFactory(); $systemConfig = $c->getSystemConfig(); @@ -382,7 +399,7 @@ class Server extends ServerContainer implements IServerContainer { $c->getConfig() ); }); - $this->registerService('AppManager', function(Server $c) { + $this->registerService('AppManager', function (Server $c) { return new \OC\App\AppManager( $c->getUserSession(), $c->getAppConfig(), @@ -390,13 +407,13 @@ class Server extends ServerContainer implements IServerContainer { $c->getMemCacheFactory() ); }); - $this->registerService('DateTimeZone', function(Server $c) { + $this->registerService('DateTimeZone', function (Server $c) { return new DateTimeZone( $c->getConfig(), $c->getSession() ); }); - $this->registerService('DateTimeFormatter', function(Server $c) { + $this->registerService('DateTimeFormatter', function (Server $c) { $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); return new DateTimeFormatter( @@ -404,9 +421,16 @@ class Server extends ServerContainer implements IServerContainer { $c->getL10N('lib', $language) ); }); - $this->registerService('MountConfigManager', function () { + $this->registerService('UserMountCache', function (Server $c) { + $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); + $listener = new UserMountCacheListener($mountCache); + $listener->listen($c->getUserManager()); + return $mountCache; + }); + $this->registerService('MountConfigManager', function (Server $c) { $loader = \OC\Files\Filesystem::getLoader(); - return new \OC\Files\Config\MountProviderCollection($loader); + $mountCache = $c->query('UserMountCache'); + return new \OC\Files\Config\MountProviderCollection($loader, $mountCache); }); $this->registerService('IniWrapper', function ($c) { return new IniGetWrapper(); @@ -478,14 +502,14 @@ class Server extends ServerContainer implements IServerContainer { $stream ); }); - $this->registerService('Mailer', function(Server $c) { + $this->registerService('Mailer', function (Server $c) { return new Mailer( $c->getConfig(), $c->getLogger(), new \OC_Defaults() ); }); - $this->registerService('OcsClient', function(Server $c) { + $this->registerService('OcsClient', function (Server $c) { return new OCSClient( $this->getHTTPClientService(), $this->getConfig(), @@ -507,24 +531,24 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('MountManager', function () { return new \OC\Files\Mount\Manager(); }); - $this->registerService('MimeTypeDetector', function(Server $c) { + $this->registerService('MimeTypeDetector', function (Server $c) { return new \OC\Files\Type\Detection( $c->getURLGenerator(), \OC::$SERVERROOT . '/config/', \OC::$SERVERROOT . '/resources/config/' - ); + ); }); - $this->registerService('MimeTypeLoader', function(Server $c) { + $this->registerService('MimeTypeLoader', function (Server $c) { return new \OC\Files\Type\Loader( $c->getDatabaseConnection() ); }); - $this->registerService('NotificationManager', function() { + $this->registerService('NotificationManager', function () { return new Manager(); }); $this->registerService('CapabilitiesManager', function (Server $c) { $manager = new \OC\CapabilitiesManager(); - $manager->registerCapability(function() use ($c) { + $manager->registerCapability(function () use ($c) { return new \OC\OCS\CoreCapabilities($c->getConfig()); }); return $manager; @@ -533,10 +557,10 @@ class Server extends ServerContainer implements IServerContainer { $config = $c->getConfig(); $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); /** @var \OCP\Comments\ICommentsManagerFactory $factory */ - $factory = new $factoryClass(); + $factory = new $factoryClass($this); return $factory->getManager(); }); - $this->registerService('EventDispatcher', function() { + $this->registerService('EventDispatcher', function () { return new EventDispatcher(); }); $this->registerService('CryptoWrapper', function (Server $c) { @@ -564,6 +588,25 @@ class Server extends ServerContainer implements IServerContainer { $request ); }); + $this->registerService('ShareManager', function(Server $c) { + $config = $c->getConfig(); + $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); + /** @var \OC\Share20\IProviderFactory $factory */ + $factory = new $factoryClass($this); + + $manager = new \OC\Share20\Manager( + $c->getLogger(), + $c->getConfig(), + $c->getSecureRandom(), + $c->getHasher(), + $c->getMountManager(), + $c->getGroupManager(), + $c->getL10N('core'), + $factory + ); + + return $manager; + }); } /** @@ -691,7 +734,6 @@ class Server extends ServerContainer implements IServerContainer { public function getAppFolder() { $dir = '/' . \OC_App::getCurrentApp(); $root = $this->getRootFolder(); - $folder = null; if (!$root->nodeExists($dir)) { $folder = $root->newFolder($dir); } else { @@ -901,7 +943,17 @@ class Server extends ServerContainer implements IServerContainer { } /** + * Returns a CredentialsManager instance + * + * @return \OCP\Security\ICredentialsManager + */ + public function getCredentialsManager() { + return $this->query('CredentialsManager'); + } + + /** * Returns an instance of the db facade + * * @deprecated use getDatabaseConnection, will be removed in ownCloud 10 * @return \OCP\IDb */ @@ -911,6 +963,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Returns an instance of the HTTP helper class + * * @deprecated Use getHTTPClientService() * @return \OC\HTTPHelper */ @@ -921,11 +974,11 @@ class Server extends ServerContainer implements IServerContainer { /** * Get the certificate manager for the user * - * @param string $userId (optional) if not specified the current loggedin user is used + * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in */ - public function getCertificateManager($userId = null) { - if (is_null($userId)) { + public function getCertificateManager($userId = '') { + if ($userId === '') { $userSession = $this->getUserSession(); $user = $userSession->getUser(); if (is_null($user)) { @@ -1036,7 +1089,7 @@ class Server extends ServerContainer implements IServerContainer { /** * @return \OCP\Files\Config\IMountProviderCollection */ - public function getMountProviderCollection(){ + public function getMountProviderCollection() { return $this->query('MountConfigManager'); } @@ -1052,7 +1105,7 @@ class Server extends ServerContainer implements IServerContainer { /** * @return \OCP\Command\IBus */ - public function getCommandBus(){ + public function getCommandBus() { return $this->query('AsyncCommandBus'); } @@ -1122,7 +1175,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Get the Notification Manager * - * @return \OC\Notification\IManager + * @return \OCP\Notification\IManager * @since 8.2.0 */ public function getNotificationManager() { @@ -1152,6 +1205,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Not a public API as of 8.2, wait for 9.0 + * * @return \OCA\Files_External\Service\BackendService */ public function getStoragesBackendService() { @@ -1160,6 +1214,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Not a public API as of 8.2, wait for 9.0 + * * @return \OCA\Files_External\Service\GlobalStoragesService */ public function getGlobalStoragesService() { @@ -1168,6 +1223,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Not a public API as of 8.2, wait for 9.0 + * * @return \OCA\Files_External\Service\UserGlobalStoragesService */ public function getUserGlobalStoragesService() { @@ -1176,10 +1232,19 @@ class Server extends ServerContainer implements IServerContainer { /** * Not a public API as of 8.2, wait for 9.0 + * * @return \OCA\Files_External\Service\UserStoragesService */ public function getUserStoragesService() { return \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\UserStoragesService'); } - + + + /** + * @return \OC\Share20\Manager + */ + public function getShareManager() { + return $this->query('ShareManager'); + } + } diff --git a/lib/private/servercontainer.php b/lib/private/servercontainer.php index 385700957a1..d297c9fd39c 100644 --- a/lib/private/servercontainer.php +++ b/lib/private/servercontainer.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/servernotavailableexception.php b/lib/private/servernotavailableexception.php index b273f50be98..f4b5f4f8cf3 100644 --- a/lib/private/servernotavailableexception.php +++ b/lib/private/servernotavailableexception.php @@ -2,7 +2,7 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/serviceunavailableexception.php b/lib/private/serviceunavailableexception.php index 2c08f37897c..fb4920b3607 100644 --- a/lib/private/serviceunavailableexception.php +++ b/lib/private/serviceunavailableexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/session/cryptosessiondata.php b/lib/private/session/cryptosessiondata.php index b600874412b..f6c585c1611 100644 --- a/lib/private/session/cryptosessiondata.php +++ b/lib/private/session/cryptosessiondata.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/session/cryptowrapper.php b/lib/private/session/cryptowrapper.php index 177f11ffb70..f1819b31b89 100644 --- a/lib/private/session/cryptowrapper.php +++ b/lib/private/session/cryptowrapper.php @@ -3,8 +3,9 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Phil Davis <phil.davis@inf.org> + * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -74,7 +75,7 @@ class CryptoWrapper { if (!is_null($request->getCookie(self::COOKIE_NAME))) { $this->passphrase = $request->getCookie(self::COOKIE_NAME); } else { - $this->passphrase = $this->random->getMediumStrengthGenerator()->generate(128); + $this->passphrase = $this->random->generate(128); $secureCookie = $request->getServerProtocol() === 'https'; // FIXME: Required for CI if (!defined('PHPUNIT_RUN')) { diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php index 8be3356c6db..09175bf1f2f 100644 --- a/lib/private/session/internal.php +++ b/lib/private/session/internal.php @@ -7,7 +7,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/session/memory.php b/lib/private/session/memory.php index c6090087457..777458a9aa5 100644 --- a/lib/private/session/memory.php +++ b/lib/private/session/memory.php @@ -1,12 +1,13 @@ <?php /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Phil Davis <phil.davis@inf.org> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/session/session.php b/lib/private/session/session.php index f9a1b5afa0f..198d0049956 100644 --- a/lib/private/session/session.php +++ b/lib/private/session/session.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/setup.php b/lib/private/setup.php index 770f5cdab52..a96dade0665 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -10,13 +10,15 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Martin Mattel <martin.mattel@diemattels.at> + * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sean Comeau <sean@ftlnetworks.ca> * @author Serge Martin <edb@sigluy.net> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -310,9 +312,9 @@ class Setup { } //generate a random salt that is used to salt the local user passwords - $salt = $this->random->getLowStrengthGenerator()->generate(30); + $salt = $this->random->generate(30); // generate a secret - $secret = $this->random->getMediumStrengthGenerator()->generate(48); + $secret = $this->random->generate(48); //write the config file $this->config->setSystemValues([ @@ -406,7 +408,7 @@ class Setup { \OC::$server->getSecureRandom()); $htaccessContent = file_get_contents($setupHelper->pathToHtaccess()); - $content = ''; + $content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n"; if (strpos($htaccessContent, 'ErrorDocument 403') === false) { //custom 403 error page $content.= "\nErrorDocument 403 ".\OC::$WEBROOT."/core/templates/403.php"; diff --git a/lib/private/setup/abstractdatabase.php b/lib/private/setup/abstractdatabase.php index 1ec853c3b02..c97302ab252 100644 --- a/lib/private/setup/abstractdatabase.php +++ b/lib/private/setup/abstractdatabase.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php index e8b88eb3489..e6afad6033a 100644 --- a/lib/private/setup/mysql.php +++ b/lib/private/setup/mysql.php @@ -3,9 +3,10 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Michael Göhler <somebody.here@gmx.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -143,7 +144,7 @@ class MySQL extends AbstractDatabase { $this->dbUser = $adminUser; //create a random password so we don't need to store the admin password in the config file - $this->dbPassword = $this->random->getMediumStrengthGenerator()->generate(30); + $this->dbPassword = $this->random->generate(30); $this->createDBUser($connection); diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php index d335df850cf..3d5aca96c1f 100644 --- a/lib/private/setup/oci.php +++ b/lib/private/setup/oci.php @@ -5,10 +5,11 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php index 850551e794f..4c17de4b84d 100644 --- a/lib/private/setup/postgresql.php +++ b/lib/private/setup/postgresql.php @@ -3,9 +3,11 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author eduardo <eduardo@vnexu.net> * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/setup/sqlite.php b/lib/private/setup/sqlite.php index ce6005620eb..61bc501fd75 100644 --- a/lib/private/setup/sqlite.php +++ b/lib/private/setup/sqlite.php @@ -1,8 +1,9 @@ <?php /** * @author Bart Visscher <bartv@thisnet.nl> + * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/constants.php b/lib/private/share/constants.php index 695d0c6714c..e2b87d72476 100644 --- a/lib/private/share/constants.php +++ b/lib/private/share/constants.php @@ -4,7 +4,7 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php index 0441647df83..1645e4451ab 100644 --- a/lib/private/share/helper.php +++ b/lib/private/share/helper.php @@ -5,11 +5,11 @@ * @author Miguel Prokop <miguel.prokop@vtu.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/hooks.php b/lib/private/share/hooks.php index 98143124e82..1fa233916d1 100644 --- a/lib/private/share/hooks.php +++ b/lib/private/share/hooks.php @@ -2,9 +2,9 @@ /** * @author Björn Schießle <schiessle@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index f071c7f3a3c..5d24b30cbe2 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -4,11 +4,13 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author scolebrook <scolebrook@mac.com> + * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php index bde2fd05073..c220699103a 100644 --- a/lib/private/share/searchresultsorter.php +++ b/lib/private/share/searchresultsorter.php @@ -2,10 +2,10 @@ /** * @author Arthur Schiwon <blizzz@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 63639461f0a..c695e9a156b 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -11,14 +11,14 @@ * @author Michael Kuhn <suraia@ikkoku.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sebastian Döll <sebastian.doell@libasys.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * @author Volkan Gezer <volkangezer@gmail.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -819,7 +819,7 @@ class Share extends Constants { if (isset($oldToken)) { $token = $oldToken; } else { - $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, + $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER. \OCP\Security\ISecureRandom::CHAR_DIGITS ); @@ -860,7 +860,7 @@ class Share extends Constants { throw new \Exception($message_t); } - $token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER . + $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER . \OCP\Security\ISecureRandom::CHAR_DIGITS); $shareWith = $user . '@' . $remote; diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php index a7155644920..8c193c437d3 100644 --- a/lib/private/share20/defaultshareprovider.php +++ b/lib/private/share20/defaultshareprovider.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -20,8 +20,12 @@ */ namespace OC\Share20; +use OC\Share20\Exception\InvalidShare; +use OC\Share20\Exception\ProviderException; use OC\Share20\Exception\ShareNotFound; use OC\Share20\Exception\BackendError; +use OCP\Files\NotFoundException; +use OCP\IGroup; use OCP\IUser; use OCP\IGroupManager; use OCP\IUserManager; @@ -29,8 +33,18 @@ use OCP\Files\IRootFolder; use OCP\IDBConnection; use OCP\Files\Node; +use Doctrine\DBAL\Connection; + +/** + * Class DefaultShareProvider + * + * @package OC\Share20 + */ class DefaultShareProvider implements IShareProvider { + // Special share type for user modified group shares + const SHARE_TYPE_USERGROUP = 2; + /** @var IDBConnection */ private $dbConn; @@ -63,6 +77,15 @@ class DefaultShareProvider implements IShareProvider { } /** + * Return the identifier of this provider. + * + * @return string Containing only [a-zA-Z0-9] + */ + public function identifier() { + return 'ocinternal'; + } + + /** * Share a path * * @param IShare $share @@ -78,10 +101,14 @@ class DefaultShareProvider implements IShareProvider { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { //Set the UID of the user we share with - $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()->getUID())); + /** @var IUser $sharedWith */ + $sharedWith = $share->getSharedWith(); + $qb->setValue('share_with', $qb->createNamedParameter($sharedWith->getUID())); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { //Set the GID of the group we share with - $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith()->getGID())); + /** @var IGroup $sharedWith */ + $sharedWith = $share->getSharedWith(); + $qb->setValue('share_with', $qb->createNamedParameter($sharedWith->getGID())); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { //Set the token of the share $qb->setValue('token', $qb->createNamedParameter($share->getToken())); @@ -135,7 +162,7 @@ class DefaultShareProvider implements IShareProvider { // Now fetch the inserted share and create a complete share object $qb = $this->dbConn->getQueryBuilder(); $qb->select('*') - ->from('*PREFIX*share') + ->from('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); $cursor = $qb->execute(); @@ -171,8 +198,18 @@ class DefaultShareProvider implements IShareProvider { $qb = $this->dbConn->getQueryBuilder(); $qb->select('*') ->from('share') - ->where($qb->expr()->eq('parent', $qb->createParameter('parent'))) - ->setParameter(':parent', $parent->getId()) + ->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId()))) + ->andWhere( + $qb->expr()->in( + 'share_type', + [ + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + $qb->expr()->literal(self::SHARE_TYPE_USERGROUP), + ] + ) + ) ->orderBy('id'); $cursor = $qb->execute(); @@ -196,8 +233,7 @@ class DefaultShareProvider implements IShareProvider { $qb = $this->dbConn->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('id', $qb->createParameter('id'))) - ->setParameter(':id', $share->getId()); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))); try { $qb->execute(); @@ -207,15 +243,145 @@ class DefaultShareProvider implements IShareProvider { } /** - * Get all shares by the given user + * Unshare a share from the recipient. If this is a group share + * this means we need a special entry in the share db. + * + * @param IShare $share + * @param IUser $recipient + * @throws BackendError + * @throws ProviderException + */ + public function deleteFromSelf(IShare $share, IUser $recipient) { + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + + /** @var IGroup $group */ + $group = $share->getSharedWith(); + + if (!$group->inGroup($recipient)) { + throw new ProviderException('Recipient not in receiving group'); + } + + // Try to fetch user specific share + $qb = $this->dbConn->getQueryBuilder(); + $stmt = $qb->select('*') + ->from('share') + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP))) + ->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($recipient->getUID()))) + ->andWhere($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId()))) + ->execute(); + + $data = $stmt->fetch(); + + /* + * Check if there already is a user specific group share. + * If there is update it (if required). + */ + if ($data === false) { + $qb = $this->dbConn->getQueryBuilder(); + + $type = $share->getPath() instanceof \OCP\Files\File ? 'file' : 'folder'; + + //Insert new share + $qb->insert('share') + ->values([ + 'share_type' => $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP), + 'share_with' => $qb->createNamedParameter($recipient->getUID()), + 'uid_owner' => $qb->createNamedParameter($share->getShareOwner()->getUID()), + 'uid_initiator' => $qb->createNamedParameter($share->getSharedBy()->getUID()), + 'parent' => $qb->createNamedParameter($share->getId()), + 'item_type' => $qb->createNamedParameter($type), + 'item_source' => $qb->createNamedParameter($share->getPath()->getId()), + 'file_source' => $qb->createNamedParameter($share->getPath()->getId()), + 'file_target' => $qb->createNamedParameter($share->getTarget()), + 'permissions' => $qb->createNamedParameter(0), + 'stime' => $qb->createNamedParameter($share->getSharetime()), + ])->execute(); + + } else if ($data['permissions'] !== 0) { + + // Update existing usergroup share + $qb = $this->dbConn->getQueryBuilder(); + $qb->update('share') + ->set('permissions', $qb->createNamedParameter(0)) + ->where($qb->expr()->eq('id', $qb->createNamedParameter($data['id']))) + ->execute(); + } + + } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { + + if ($share->getSharedWith() !== $recipient) { + throw new ProviderException('Recipient does not match'); + } + + // We can just delete user and link shares + $this->delete($share); + } else { + throw new ProviderException('Invalid shareType'); + } + } + + /** + * Get all shares by the given user. Sharetype and path can be used to filter. * * @param IUser $user * @param int $shareType + * @param \OCP\Files\File|\OCP\Files\Folder $node + * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator + * @param int $limit The maximum number of shares to be returned, -1 for all shares * @param int $offset - * @param int $limit * @return Share[] */ - public function getShares(IUser $user, $shareType, $offset, $limit) { + public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset) { + $qb = $this->dbConn->getQueryBuilder(); + $qb->select('*') + ->from('share'); + + $qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter($shareType))); + + /** + * Reshares for this user are shares where they are the owner. + */ + if ($reshares === false) { + //Special case for old shares created via the web UI + $or1 = $qb->expr()->andX( + $qb->expr()->eq('uid_owner', $qb->createNamedParameter($user->getUID())), + $qb->expr()->isNull('uid_initiator') + ); + + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->eq('uid_initiator', $qb->createNamedParameter($user->getUID())), + $or1 + ) + ); + } else { + $qb->andWhere( + $qb->expr()->orX( + $qb->expr()->eq('uid_owner', $qb->createNamedParameter($user->getUID())), + $qb->expr()->eq('uid_initiator', $qb->createNamedParameter($user->getUID())) + ) + ); + } + + if ($node !== null) { + $qb->andWhere($qb->expr()->eq('file_source', $qb->createNamedParameter($node->getId()))); + } + + if ($limit !== -1) { + $qb->setMaxResults($limit); + } + + $qb->setFirstResult($offset); + $qb->orderBy('id'); + + $cursor = $qb->execute(); + $shares = []; + while($data = $cursor->fetch()) { + $shares[] = $this->createShare($data); + } + $cursor->closeCursor(); + + return $shares; } /** @@ -230,8 +396,18 @@ class DefaultShareProvider implements IShareProvider { $qb->select('*') ->from('share') - ->where($qb->expr()->eq('id', $qb->createParameter('id'))) - ->setParameter(':id', $id); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))) + ->andWhere( + $qb->expr()->in( + 'share_type', + [ + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + $qb->expr()->literal(self::SHARE_TYPE_USERGROUP), + ] + ) + ); $cursor = $qb->execute(); $data = $cursor->fetch(); @@ -241,7 +417,11 @@ class DefaultShareProvider implements IShareProvider { throw new ShareNotFound(); } - $share = $this->createShare($data); + try { + $share = $this->createShare($data); + } catch (InvalidShare $e) { + throw new ShareNotFound(); + } return $share; } @@ -277,21 +457,125 @@ class DefaultShareProvider implements IShareProvider { /** * Get shared with the given user * - * @param IUser $user - * @param int $shareType - * @param Share + * @param IUser $user get shares where this user is the recipient + * @param int $shareType \OCP\Share::SHARE_TYPE_USER or \OCP\Share::SHARE_TYPE_GROUP are supported + * @param int $limit The maximum number of shares, -1 for all + * @param int $offset + * @return IShare[] + * @throws BackendError */ - public function getSharedWithMe(IUser $user, $shareType = null) { + public function getSharedWith(IUser $user, $shareType, $limit, $offset) { + /** @var Share[] $shares */ + $shares = []; + + if ($shareType === \OCP\Share::SHARE_TYPE_USER) { + //Get shares directly with this user + $qb = $this->dbConn->getQueryBuilder(); + $qb->select('*') + ->from('share'); + + // Order by id + $qb->orderBy('id'); + + // Set limit and offset + if ($limit !== -1) { + $qb->setMaxResults($limit); + } + $qb->setFirstResult($offset); + + $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_USER))); + $qb->andWhere($qb->expr()->eq('share_with', $qb->createNamedParameter($user->getUID()))); + + $cursor = $qb->execute(); + + while($data = $cursor->fetch()) { + $shares[] = $this->createShare($data); + } + $cursor->closeCursor(); + + } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + $allGroups = $this->groupManager->getUserGroups($user); + + $start = 0; + while(true) { + $groups = array_slice($allGroups, $start, 100); + $start += 100; + + if ($groups === []) { + break; + } + + $qb = $this->dbConn->getQueryBuilder(); + $qb->select('*') + ->from('share') + ->orderBy('id') + ->setFirstResult(0); + + if ($limit !== -1) { + $qb->setMaxResults($limit - count($shares)); + } + + $groups = array_map(function(IGroup $group) { return $group->getGID(); }, $groups); + + $qb->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP))); + $qb->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter( + $groups, + Connection::PARAM_STR_ARRAY + ))); + + $cursor = $qb->execute(); + while($data = $cursor->fetch()) { + if ($offset > 0) { + $offset--; + continue; + } + $shares[] = $this->createShare($data); + } + $cursor->closeCursor(); + } + + /* + * Resolve all group shares to user specific shares + * TODO: Optmize this! + */ + $shares = array_map([$this, 'resolveGroupShare'], $shares); + } else { + throw new BackendError('Invalid backend'); + } + + + return $shares; } /** - * Get a share by token and if present verify the password + * Get a share by token * * @param string $token - * @param string $password - * @param Share + * @return IShare + * @throws ShareNotFound */ - public function getShareByToken($token, $password = null) { + public function getShareByToken($token) { + $qb = $this->dbConn->getQueryBuilder(); + + $cursor = $qb->select('*') + ->from('share') + ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_LINK))) + ->andWhere($qb->expr()->eq('token', $qb->createNamedParameter($token))) + ->execute(); + + $data = $cursor->fetch(); + + if ($data === false) { + throw new ShareNotFound(); + } + + try { + $share = $this->createShare($data); + } catch (InvalidShare $e) { + throw new ShareNotFound(); + } + + return $share; } /** @@ -299,6 +583,7 @@ class DefaultShareProvider implements IShareProvider { * * @param mixed[] $data * @return Share + * @throws InvalidShare */ private function createShare($data) { $share = new Share(); @@ -310,31 +595,45 @@ class DefaultShareProvider implements IShareProvider { ->setMailSend((bool)$data['mail_send']); if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { - $share->setSharedWith($this->userManager->get($data['share_with'])); + $sharedWith = $this->userManager->get($data['share_with']); + if ($sharedWith === null) { + throw new InvalidShare(); + } + $share->setSharedWith($sharedWith); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { - $share->setSharedWith($this->groupManager->get($data['share_with'])); + $sharedWith = $this->groupManager->get($data['share_with']); + if ($sharedWith === null) { + throw new InvalidShare(); + } + $share->setSharedWith($sharedWith); } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $share->setPassword($data['share_with']); $share->setToken($data['token']); - } else { - $share->setSharedWith($data['share_with']); } if ($data['uid_initiator'] === null) { //OLD SHARE - $share->setSharedBy($this->userManager->get($data['uid_owner'])); - $folder = $this->rootFolder->getUserFolder($share->getSharedBy()->getUID()); - $path = $folder->getById((int)$data['file_source'])[0]; + $sharedBy = $this->userManager->get($data['uid_owner']); + if ($sharedBy === null) { + throw new InvalidShare(); + } + $share->setSharedBy($sharedBy); + $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); $owner = $path->getOwner(); $share->setShareOwner($owner); } else { //New share! - $share->setSharedBy($this->userManager->get($data['uid_initiator'])); - $share->setShareOwner($this->userManager->get($data['uid_owner'])); + $sharedBy = $this->userManager->get($data['uid_initiator']); + $shareOwner = $this->userManager->get($data['uid_owner']); + if ($sharedBy === null || $shareOwner === null) { + throw new InvalidShare(); + } + $share->setSharedBy($sharedBy); + $share->setShareOwner($shareOwner); } - $path = $this->rootFolder->getUserFolder($share->getShareOwner()->getUID())->getById((int)$data['file_source'])[0]; + $path = $this->getNode($share->getShareOwner(), (int)$data['file_source']); $share->setPath($path); if ($data['expiration'] !== null) { @@ -342,6 +641,59 @@ class DefaultShareProvider implements IShareProvider { $share->setExpirationDate($expiration); } + $share->setProviderId($this->identifier()); + + return $share; + } + + /** + * Get the node with file $id for $user + * + * @param IUser $user + * @param int $id + * @return \OCP\Files\File|\OCP\Files\Folder + * @throws InvalidShare + */ + private function getNode(IUser $user, $id) { + try { + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); + } catch (NotFoundException $e) { + throw new InvalidShare(); + } + + $nodes = $userFolder->getById($id); + + if (empty($nodes)) { + throw new InvalidShare(); + } + + return $nodes[0]; + } + + /** + * Resolve a group share to a user specific share + * Thus if the user moved their group share make sure this is properly reflected here. + * + * @param Share $share + * @return Share Returns the updated share if one was found else return the original share. + */ + private function resolveGroupShare(Share $share) { + $qb = $this->dbConn->getQueryBuilder(); + + $stmt = $qb->select('*') + ->from('share') + ->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId()))) + ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP))) + ->execute(); + + $data = $stmt->fetch(); + $stmt->closeCursor(); + + if ($data !== false) { + $share->setPermissions($data['permissions']); + $share->setTarget($data['file_target']); + } + return $share; } diff --git a/lib/private/share20/exception/backenderror.php b/lib/private/share20/exception/backenderror.php index 2d661533171..f15dea4a243 100644 --- a/lib/private/share20/exception/backenderror.php +++ b/lib/private/share20/exception/backenderror.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share20/exception/invalidshare.php b/lib/private/share20/exception/invalidshare.php new file mode 100644 index 00000000000..c176e4424ba --- /dev/null +++ b/lib/private/share20/exception/invalidshare.php @@ -0,0 +1,25 @@ +<?php +/** + * @author Roeland Jago Douma <rullzer@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Share20\Exception; + +class InvalidShare extends \Exception { + +} diff --git a/lib/private/share20/exception/providerexception.php b/lib/private/share20/exception/providerexception.php new file mode 100644 index 00000000000..a14d5266581 --- /dev/null +++ b/lib/private/share20/exception/providerexception.php @@ -0,0 +1,27 @@ +<?php +/** + * @author Roeland Jago Douma <rullzer@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Share20\Exception; + + +class ProviderException extends \Exception { + +} + diff --git a/lib/private/share20/exception/sharenotfound.php b/lib/private/share20/exception/sharenotfound.php index 0e18a96be68..b59f185939a 100644 --- a/lib/private/share20/exception/sharenotfound.php +++ b/lib/private/share20/exception/sharenotfound.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/share20/iproviderfactory.php b/lib/private/share20/iproviderfactory.php new file mode 100644 index 00000000000..b38666978db --- /dev/null +++ b/lib/private/share20/iproviderfactory.php @@ -0,0 +1,53 @@ +<?php +/** + * @author Roeland Jago Douma <rullzer@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Share20; + +use OC\Share20\Exception\ProviderException; +use OCP\IServerContainer; + +/** + * Interface IProviderFactory + * + * @package OC\Share20 + * @since 9.0.0 + */ +interface IProviderFactory { + + /** + * IProviderFactory constructor. + * @param IServerContainer $serverContainer + */ + public function __construct(IServerContainer $serverContainer); + + /** + * @param string $id + * @return IShareProvider + * @throws ProviderException + */ + public function getProvider($id); + + /** + * @param int $shareType + * @return IShareProvider + * @throws ProviderException + */ + public function getProviderForType($shareType); +} diff --git a/lib/private/share20/ishare.php b/lib/private/share20/ishare.php index a149c578fb2..34d1dfa4d3d 100644 --- a/lib/private/share20/ishare.php +++ b/lib/private/share20/ishare.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -36,10 +36,33 @@ interface IShare { public function getId(); /** + * Set the id of the share + * + * @param string $id + * @return IShare The modified share object + */ + public function setId($id); + + /** + * Get the full share id + * + * @return string + */ + public function getFullId(); + + /** + * Set the provider id + * + * @param string $id + * @return IShare The modified share object + */ + public function setProviderId($id); + + /** * Set the path of this share * * @param Node $path - * @return Share The modified object + * @return IShare The modified object */ public function setPath(Node $path); @@ -54,7 +77,7 @@ interface IShare { * Set the shareType * * @param int $shareType - * @return Share The modified object + * @return IShare The modified object */ public function setShareType($shareType); @@ -69,7 +92,7 @@ interface IShare { * Set the receiver of this share * * @param IUser|IGroup|string - * @return Share The modified object + * @return IShare The modified object */ public function setSharedWith($sharedWith); @@ -84,7 +107,7 @@ interface IShare { * Set the permissions * * @param int $permissions - * @return Share The modified object + * @return IShare The modified object */ public function setPermissions($permissions); @@ -99,7 +122,7 @@ interface IShare { * Set the expiration date * * @param \DateTime $expireDate - * @return Share The modified object + * @return IShare The modified object */ public function setExpirationDate($expireDate); @@ -114,7 +137,7 @@ interface IShare { * Set the sharer of the path * * @param IUser|string $sharedBy - * @return Share The modified object + * @return IShare The modified object */ public function setSharedBy($sharedBy); @@ -130,7 +153,7 @@ interface IShare { * * @param IUser|string * - * @return Share The modified object + * @return IShare The modified object */ public function setShareOwner($shareOwner); @@ -146,7 +169,7 @@ interface IShare { * * @param string $password * - * @return Share The modified object + * @return IShare The modified object */ public function setPassword($password); @@ -161,7 +184,7 @@ interface IShare { * Set the token * * @param string $token - * @return Share The modified object + * @return IShare The modified object */ public function setToken($token); @@ -183,7 +206,7 @@ interface IShare { * Set the target of this share * * @param string $target - * @return Share The modified object + * @return IShare The modified object */ public function setTarget($target); diff --git a/lib/private/share20/ishareprovider.php b/lib/private/share20/ishareprovider.php index 97a2b728d5f..17ee4abb9a8 100644 --- a/lib/private/share20/ishareprovider.php +++ b/lib/private/share20/ishareprovider.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -27,6 +27,13 @@ use OCP\IUser; interface IShareProvider { /** + * Return the identifier of this provider. + * + * @return string Containing only [a-zA-Z0-9] + */ + public function identifier(); + + /** * Share a path * * @param IShare $share @@ -51,15 +58,26 @@ interface IShareProvider { public function delete(IShare $share); /** + * Unshare a file from self as recipient. + * This may require special handling. + * + * @param IShare $share + * @param IUser $recipient + */ + public function deleteFromSelf(IShare $share, IUser $recipient); + + /** * Get all shares by the given user * * @param IUser $user * @param int $shareType + * @param \OCP\Files\File|\OCP\Files\Folder $node + * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator + * @param int $limit The maximum number of shares to be returned, -1 for all shares * @param int $offset - * @param int $limit * @return Share[] */ - public function getShares(IUser $user, $shareType, $offset, $limit); + public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset); /** * Get share by id @@ -89,18 +107,20 @@ interface IShareProvider { /** * Get shared with the given user * - * @param IUser $user + * @param IUser $user get shares where this user is the recipient * @param int $shareType + * @param int $limit The max number of entries returned, -1 for all + * @param int $offset * @param Share */ - public function getSharedWithMe(IUser $user, $shareType = null); + public function getSharedWith(IUser $user, $shareType, $limit, $offset); /** - * Get a share by token and if present verify the password + * Get a share by token * * @param string $token - * @param string $password - * @param Share + * @return IShare + * @throws ShareNotFound */ - public function getShareByToken($token, $password = null); + public function getShareByToken($token); } diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 8d753061c0c..ea6463c745c 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -21,6 +21,8 @@ namespace OC\Share20; +use OC\Share20\Exception\BackendError; +use OC\Share20\Exception\ProviderException; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; @@ -40,8 +42,11 @@ use OC\HintException; */ class Manager { - /** @var IShareProvider[] */ - private $defaultProvider; + /** @var IProviderFactory */ + private $factory; + + /** @var array */ + private $type2provider; /** @var ILogger */ private $logger; @@ -69,23 +74,26 @@ class Manager { * * @param ILogger $logger * @param IConfig $config - * @param IShareProvider $defaultProvider * @param ISecureRandom $secureRandom * @param IHasher $hasher * @param IMountManager $mountManager * @param IGroupManager $groupManager * @param IL10N $l + * @param IProviderFactory $factory */ public function __construct( ILogger $logger, IConfig $config, - IShareProvider $defaultProvider, ISecureRandom $secureRandom, IHasher $hasher, IMountManager $mountManager, IGroupManager $groupManager, - IL10N $l + IL10N $l, + IProviderFactory $factory ) { + $this->providers = []; + $this->type2provider = []; + $this->logger = $logger; $this->config = $config; $this->secureRandom = $secureRandom; @@ -93,9 +101,17 @@ class Manager { $this->mountManager = $mountManager; $this->groupManager = $groupManager; $this->l = $l; + $this->factory = $factory; + } - // TEMP SOLUTION JUST TO GET STARTED - $this->defaultProvider = $defaultProvider; + /** + * Convert from a full share id to a tuple (providerId, shareId) + * + * @param string $id + * @return string[] + */ + private function splitFullId($id) { + return explode(':', $id, 2); } /** @@ -246,9 +262,8 @@ class Manager { return $expireDate; } - /** - * Check for pre share requirements for use shares + * Check for pre share requirements for user shares * * @param IShare $share * @throws \Exception @@ -271,7 +286,8 @@ class Manager { * * Also this is not what we want in the future.. then we want to squash identical shares. */ - $existingShares = $this->defaultProvider->getSharesByPath($share->getPath()); + $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); + $existingShares = $provider->getSharesByPath($share->getPath()); foreach($existingShares as $existingShare) { // Identical share already existst if ($existingShare->getSharedWith() === $share->getSharedWith()) { @@ -306,7 +322,8 @@ class Manager { * * Also this is not what we want in the future.. then we want to squash identical shares. */ - $existingShares = $this->defaultProvider->getSharesByPath($share->getPath()); + $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); + $existingShares = $provider->getSharesByPath($share->getPath()); foreach($existingShares as $existingShare) { if ($existingShare->getSharedWith() === $share->getSharedWith()) { throw new \Exception('Path already shared with this group'); @@ -435,6 +452,16 @@ class Manager { $target = \OC\Files\Filesystem::normalizePath($target); $share->setTarget($target); + //Get sharewith for hooks + $sharedWith = null; + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { + $sharedWith = $share->getSharedWith()->getUID(); + } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + $sharedWith = $share->getSharedWith()->getGID(); + } else { + $sharedWith = $share->getSharedWith(); + } + // Pre share hook $run = true; $error = ''; @@ -447,8 +474,10 @@ class Manager { 'fileSource' => $share->getPath()->getId(), 'expiration' => $share->getExpirationDate(), 'token' => $share->getToken(), + 'itemTarget' => $share->getTarget(), + 'shareWith' => $sharedWith, 'run' => &$run, - 'error' => &$error + 'error' => &$error, ]; \OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData); @@ -456,7 +485,9 @@ class Manager { throw new \Exception($error); } - $share = $this->defaultProvider->create($share); + $provider = $this->factory->getProviderForType($share->getShareType()); + $share = $provider->create($share); + $share->setProviderId($provider->identifier()); // Post share hook $postHookData = [ @@ -469,7 +500,11 @@ class Manager { 'expiration' => $share->getExpirationDate(), 'token' => $share->getToken(), 'id' => $share->getId(), + 'shareWith' => $sharedWith, + 'itemTarget' => $share->getTarget(), + 'fileTarget' => $share->getTarget(), ]; + \OC_Hook::emit('OCP\Share', 'post_shared', $postHookData); return $share; @@ -492,11 +527,14 @@ class Manager { */ protected function deleteChildren(IShare $share) { $deletedShares = []; - foreach($this->defaultProvider->getChildren($share) as $child) { + + $provider = $this->factory->getProviderForType($share->getShareType()); + + foreach ($provider->getChildren($share) as $child) { $deletedChildren = $this->deleteChildren($child); $deletedShares = array_merge($deletedShares, $deletedChildren); - $this->defaultProvider->delete($child); + $provider->delete($child); $deletedShares[] = $child; } @@ -508,11 +546,12 @@ class Manager { * * @param IShare $share * @throws ShareNotFound - * @throws \OC\Share20\Exception\BackendError + * @throws BackendError + * @throws ShareNotFound */ public function deleteShare(IShare $share) { // Just to make sure we have all the info - $share = $this->getShareById($share->getId()); + $share = $this->getShareById($share->getFullId()); $formatHookParams = function(IShare $share) { // Prepare hook @@ -549,7 +588,8 @@ class Manager { $deletedShares = $this->deleteChildren($share); // Do the actual delete - $this->defaultProvider->delete($share); + $provider = $this->factory->getProviderForType($share->getShareType()); + $provider->delete($share); // All the deleted shares caused by this delete $deletedShares[] = $share; @@ -565,14 +605,59 @@ class Manager { \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams); } + /** - * Retrieve all shares by the current user + * Unshare a file as the recipient. + * This can be different from a regular delete for example when one of + * the users in a groups deletes that share. But the provider should + * handle this. * - * @param int $page - * @param int $perPage - * @return Share[] + * @param IShare $share + * @param IUser $recipient + */ + public function deleteFromSelf(IShare $share, IUser $recipient) { + list($providerId, $id) = $this->splitFullId($share->getId()); + $provider = $this->factory->getProvider($providerId); + + $provider->deleteFromSelf($share, $recipient); + } + + /** + * Get shares shared by (initiated) by the provided user. + * + * @param IUser $user + * @param int $shareType + * @param \OCP\Files\File|\OCP\Files\Folder $path + * @param bool $reshares + * @param int $limit The maximum number of returned results, -1 for all results + * @param int $offset + * @return IShare[] + */ + public function getSharesBy(IUser $user, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) { + if ($path !== null && + !($path instanceof \OCP\Files\File) && + !($path instanceof \OCP\Files\Folder)) { + throw new \InvalidArgumentException('invalid path'); + } + + $provider = $this->factory->getProviderForType($shareType); + + return $provider->getSharesBy($user, $shareType, $path, $reshares, $limit, $offset); + } + + /** + * Get shares shared with $user. + * + * @param IUser $user + * @param int $shareType + * @param int $limit The maximum number of shares returned, -1 for all + * @param int $offset + * @return IShare[] */ - public function getShares($page=0, $perPage=50) { + public function getSharedWith(IUser $user, $shareType, $limit = 50, $offset = 0) { + $provider = $this->factory->getProviderForType($shareType); + + return $provider->getSharedWith($user, $shareType, $limit, $offset); } /** @@ -588,7 +673,11 @@ class Manager { throw new ShareNotFound(); } - $share = $this->defaultProvider->getShareById($id); + list($providerId, $id) = $this->splitFullId($id); + $provider = $this->factory->getProvider($providerId); + + $share = $provider->getShareById($id); + $share->setProviderId($provider->identifier()); return $share; } @@ -606,28 +695,50 @@ class Manager { } /** - * Get all shares that are shared with the current user + * Get the share by token possible with password * - * @param int $shareType - * @param int $page - * @param int $perPage + * @param string $token + * @return Share * - * @return Share[] + * @throws ShareNotFound */ - public function getSharedWithMe($shareType = null, $page=0, $perPage=50) { + public function getShareByToken($token) { + $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); + + $share = $provider->getShareByToken($token); + + //TODO check if share expired + + return $share; } /** - * Get the share by token possible with password + * Verify the password of a public share * - * @param string $token + * @param IShare $share * @param string $password - * - * @return Share - * - * @throws ShareNotFound + * @return bool */ - public function getShareByToken($token, $password=null) { + public function checkPassword(IShare $share, $password) { + if ($share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK) { + //TODO maybe exception? + return false; + } + + if ($password === null || $share->getPassword() === null) { + return false; + } + + $newHash = ''; + if (!$this->hasher->verify($password, $share->getPassword(), $newHash)) { + return false; + } + + if (!empty($newHash)) { + //TODO update hash! + } + + return true; } /** diff --git a/lib/private/share20/providerfactory.php b/lib/private/share20/providerfactory.php new file mode 100644 index 00000000000..2e5282c1eb4 --- /dev/null +++ b/lib/private/share20/providerfactory.php @@ -0,0 +1,89 @@ +<?php +/** + * @author Roeland Jago Douma <rullzer@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\Share20; + +use OC\Share20\Exception\ProviderException; +use OCP\IServerContainer; + +/** + * Class ProviderFactory + * + * @package OC\Share20 + */ +class ProviderFactory implements IProviderFactory { + + /** @var IServerContainer */ + private $serverContainer; + /** @var DefaultShareProvider */ + private $defaultProvider = null; + + /** + * IProviderFactory constructor. + * @param IServerContainer $serverContainer + */ + public function __construct(IServerContainer $serverContainer) { + $this->serverContainer = $serverContainer; + } + + /** + * Create the default share provider. + * + * @return DefaultShareProvider + */ + protected function defaultShareProvider() { + if ($this->defaultProvider === null) { + $this->defaultProvider = new DefaultShareProvider( + $this->serverContainer->getDatabaseConnection(), + $this->serverContainer->getUserManager(), + $this->serverContainer->getGroupManager(), + $this->serverContainer->getRootFolder() + ); + } + + return $this->defaultProvider; + } + + /** + * @inheritdoc + */ + public function getProvider($id) { + if ($id === 'ocinternal') { + return $this->defaultShareProvider(); + } + + throw new ProviderException('No provider with id .' . $id . ' found.'); + } + + /** + * @inheritdoc + */ + public function getProviderForType($shareType) { + //FIXME we should not report type 2 + if ($shareType === \OCP\Share::SHARE_TYPE_USER || + $shareType === 2 || + $shareType === \OCP\Share::SHARE_TYPE_GROUP || + $shareType === \OCP\Share::SHARE_TYPE_LINK) { + return $this->defaultShareProvider(); + } + + throw new ProviderException('No share provider for share type ' . $shareType); + } +} diff --git a/lib/private/share20/share.php b/lib/private/share20/share.php index 4827000eefa..ee43725d9bc 100644 --- a/lib/private/share20/share.php +++ b/lib/private/share20/share.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -28,6 +28,8 @@ class Share implements IShare { /** @var string */ private $id; + /** @var string */ + private $providerId; /** @var Node */ private $path; /** @var int */ @@ -59,7 +61,7 @@ class Share implements IShare { * Set the id of the share * * @param string $id - * @return Share The modified object + * @return IShare The modified object */ public function setId($id) { $this->id = $id; @@ -76,10 +78,25 @@ class Share implements IShare { } /** + * @inheritdoc + */ + public function getFullId() { + return $this->providerId . ':' . $this->id; + } + + /** + * @inheritdoc + */ + public function setProviderId($id) { + $this->providerId = $id; + return $this; + } + + /** * Set the path of this share * * @param Node $path - * @return Share The modified object + * @return IShare The modified object */ public function setPath(Node $path) { $this->path = $path; @@ -99,7 +116,7 @@ class Share implements IShare { * Set the shareType * * @param int $shareType - * @return Share The modified object + * @return IShare The modified object */ public function setShareType($shareType) { $this->shareType = $shareType; @@ -119,7 +136,7 @@ class Share implements IShare { * Set the receiver of this share * * @param IUser|IGroup|string - * @return Share The modified object + * @return IShare The modified object */ public function setSharedWith($sharedWith) { $this->sharedWith = $sharedWith; @@ -139,7 +156,7 @@ class Share implements IShare { * Set the permissions * * @param int $permissions - * @return Share The modified object + * @return IShare The modified object */ public function setPermissions($permissions) { //TODO checkes @@ -161,7 +178,7 @@ class Share implements IShare { * Set the expiration date * * @param \DateTime $expireDate - * @return Share The modified object + * @return IShare The modified object */ public function setExpirationDate($expireDate) { //TODO checks @@ -183,7 +200,7 @@ class Share implements IShare { * Set the sharer of the path * * @param IUser|string $sharedBy - * @return Share The modified object + * @return IShare The modified object */ public function setSharedBy($sharedBy) { //TODO checks @@ -207,7 +224,7 @@ class Share implements IShare { * * @param IUser|string * - * @return Share The modified object + * @return IShare The modified object */ public function setShareOwner($shareOwner) { //TODO checks @@ -231,7 +248,7 @@ class Share implements IShare { * * @param string $password * - * @return Share The modified object + * @return IShare The modified object */ public function setPassword($password) { //TODO verify @@ -253,7 +270,7 @@ class Share implements IShare { * Set the token * * @param string $token - * @return Share The modified object + * @return IShare The modified object */ public function setToken($token) { $this->token = $token; @@ -273,7 +290,7 @@ class Share implements IShare { * Set the parent id of this share * * @param int $parent - * @return Share The modified object + * @return IShare The modified object */ public function setParent($parent) { $this->parent = $parent; @@ -293,7 +310,7 @@ class Share implements IShare { * Set the target of this share * * @param string $target - * @return Share The modified object + * @return IShare The modified object */ public function setTarget($target) { $this->target = $target; @@ -313,7 +330,7 @@ class Share implements IShare { * Set the time this share was created * * @param int $shareTime - * @return Share The modified object + * @return IShare The modified object */ public function setShareTime($shareTime) { $this->shareTime = $shareTime; @@ -333,7 +350,7 @@ class Share implements IShare { * Set mailSend * * @param bool $mailSend - * @return Share The modified object + * @return IShare The modified object */ public function setMailSend($mailSend) { $this->mailSend = $mailSend; diff --git a/lib/private/streamer.php b/lib/private/streamer.php index aa819c560a1..5fffa7ac368 100644 --- a/lib/private/streamer.php +++ b/lib/private/streamer.php @@ -4,7 +4,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/subadmin.php b/lib/private/subadmin.php index c96275e3b87..34dd40c22ff 100644 --- a/lib/private/subadmin.php +++ b/lib/private/subadmin.php @@ -1,13 +1,13 @@ <?php /** + * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Roeland Jago Douma <rullzer@owncloud.com> - * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/systemconfig.php b/lib/private/systemconfig.php index fb8c18123d7..9f99216fa4e 100644 --- a/lib/private/systemconfig.php +++ b/lib/private/systemconfig.php @@ -2,8 +2,9 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/systemtag/managerfactory.php b/lib/private/systemtag/managerfactory.php new file mode 100644 index 00000000000..7b7b9558b04 --- /dev/null +++ b/lib/private/systemtag/managerfactory.php @@ -0,0 +1,78 @@ +<?php +/** + * @author Vincent Petry <pvince81@owncloud.com> + * + * @copyright Copyright (c) 2016, 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\SystemTag; + +use OCP\SystemTag\ISystemTagManagerFactory; +use OCP\SystemTag\ISystemTagManager; +use OC\SystemTag\SystemTagManager; +use OC\SystemTag\SystemTagObjectMapper; +use OCP\IServerContainer; + +/** + * Default factory class for system tag managers + * + * @package OCP\SystemTag + * @since 9.0.0 + */ +class ManagerFactory implements ISystemTagManagerFactory { + + /** + * Server container + * + * @var IServerContainer + */ + private $serverContainer; + + /** + * Constructor for the system tag manager factory + * + * @param IServerContainer $serverContainer server container + */ + public function __construct(IServerContainer $serverContainer) { + $this->serverContainer = $serverContainer; + } + + /** + * Creates and returns an instance of the system tag manager + * + * @return ISystemTagManager + * @since 9.0.0 + */ + public function getManager() { + return new SystemTagManager( + $this->serverContainer->getDatabaseConnection() + ); + } + + /** + * Creates and returns an instance of the system tag object + * mapper + * + * @return ISystemTagObjectMapper + * @since 9.0.0 + */ + public function getObjectMapper() { + return new SystemTagObjectMapper( + $this->serverContainer->getDatabaseConnection(), + $this->getManager() + ); + } +} diff --git a/lib/private/systemtag/systemtag.php b/lib/private/systemtag/systemtag.php index 8f4f7090b21..559b6fdefa8 100644 --- a/lib/private/systemtag/systemtag.php +++ b/lib/private/systemtag/systemtag.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/systemtag/systemtagmanager.php b/lib/private/systemtag/systemtagmanager.php index 7f239dc84cf..733336f4de9 100644 --- a/lib/private/systemtag/systemtagmanager.php +++ b/lib/private/systemtag/systemtagmanager.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/systemtag/systemtagobjectmapper.php b/lib/private/systemtag/systemtagobjectmapper.php index 988fa66d77e..4b50539f155 100644 --- a/lib/private/systemtag/systemtagobjectmapper.php +++ b/lib/private/systemtag/systemtagobjectmapper.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/tagging/tag.php b/lib/private/tagging/tag.php index 4531cae53a7..e35ac433e00 100644 --- a/lib/private/tagging/tag.php +++ b/lib/private/tagging/tag.php @@ -3,7 +3,7 @@ * @author Bernhard Reiter <ockham@raz.or.at> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/tagging/tagmapper.php b/lib/private/tagging/tagmapper.php index 38ea735b102..364dbc99b4d 100644 --- a/lib/private/tagging/tagmapper.php +++ b/lib/private/tagging/tagmapper.php @@ -4,7 +4,7 @@ * @author Bernhard Reiter <ockham@raz.or.at> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/tagmanager.php b/lib/private/tagmanager.php index 5e72eb41d16..a9e1cdfe076 100644 --- a/lib/private/tagmanager.php +++ b/lib/private/tagmanager.php @@ -5,7 +5,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/tags.php b/lib/private/tags.php index c621aa3cf8f..ea5e2ca2f2b 100644 --- a/lib/private/tags.php +++ b/lib/private/tags.php @@ -6,12 +6,12 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template.php b/lib/private/template.php index b1655061a28..717f91a7034 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -4,19 +4,20 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Brice Maron <brice@bmaron.net> - * @author drarko <drarko@users.noreply.github.com> * @author Frank Karlitschek <frank@owncloud.org> + * @author Hendrik Leppelsack <hendrik@leppelsack.de> * @author Individual IT Services <info@individual-it.net> * @author Jakob Sack <mail@jakobsack.de> * @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 Raghu Nayyar <hey@raghunayyar.com> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/base.php b/lib/private/template/base.php index a18c43bb2ca..944747197b7 100644 --- a/lib/private/template/base.php +++ b/lib/private/template/base.php @@ -7,7 +7,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/cssresourcelocator.php b/lib/private/template/cssresourcelocator.php index a78b0223389..6a547931ee3 100644 --- a/lib/private/template/cssresourcelocator.php +++ b/lib/private/template/cssresourcelocator.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php index 982ecde5850..a57b3575ba9 100644 --- a/lib/private/template/functions.php +++ b/lib/private/template/functions.php @@ -7,11 +7,12 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -137,13 +138,13 @@ function component($app, $file) { } /** - * make OC_Helper::linkTo available as a simple function + * make \OCP\IURLGenerator::linkTo available as a simple function * @param string $app app * @param string $file file * @param array $args array with param=>value, will be appended to the returned url * @return string link to the file * - * For further information have a look at OC_Helper::linkTo + * For further information have a look at \OCP\IURLGenerator::linkTo */ function link_to( $app, $file, $args = array() ) { return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); @@ -158,15 +159,15 @@ function link_to_docs($key) { } /** - * make OC_Helper::imagePath available as a simple function + * make \OCP\IURLGenerator::imagePath available as a simple function * @param string $app app * @param string $image image * @return string link to the image * - * For further information have a look at OC_Helper::imagePath + * For further information have a look at \OCP\IURLGenerator::imagePath */ function image_path( $app, $image ) { - return OC_Helper::imagePath( $app, $image ); + return \OC::$server->getURLGenerator()->imagePath( $app, $image ); } /** diff --git a/lib/private/template/jsresourcelocator.php b/lib/private/template/jsresourcelocator.php index c0127a0f278..4df1ac8c7f0 100644 --- a/lib/private/template/jsresourcelocator.php +++ b/lib/private/template/jsresourcelocator.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/resourcelocator.php b/lib/private/template/resourcelocator.php index 136a40e4def..e64fce81afc 100644 --- a/lib/private/template/resourcelocator.php +++ b/lib/private/template/resourcelocator.php @@ -4,9 +4,9 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/resourcenotfoundexception.php b/lib/private/template/resourcenotfoundexception.php index 22f8bcea059..8c7f1f14175 100644 --- a/lib/private/template/resourcenotfoundexception.php +++ b/lib/private/template/resourcenotfoundexception.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/template/templatefilelocator.php b/lib/private/template/templatefilelocator.php index 1fa13aed188..f8553156914 100644 --- a/lib/private/template/templatefilelocator.php +++ b/lib/private/template/templatefilelocator.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index c29e712cccf..e14b070a7b4 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/templatelayout.php @@ -2,7 +2,6 @@ /** * @author Adam Williamson <awilliam@redhat.com> * @author Bart Visscher <bartv@thisnet.nl> - * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Clark Tomlinson <fallen013@gmail.com> * @author Joas Schilling <nickvergessen@owncloud.com> @@ -12,11 +11,12 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Remco Brenninkmeijer <requist1@starmail.nl> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/tempmanager.php b/lib/private/tempmanager.php index c4fa9231eb6..19bbaf6e78e 100644 --- a/lib/private/tempmanager.php +++ b/lib/private/tempmanager.php @@ -5,9 +5,9 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -225,11 +225,6 @@ class TempManager implements ITempManager { if ($temp = getenv('TMPDIR')) { $directories[] = $temp; } - $temp = tempnam(__FILE__, ''); - if (file_exists($temp)) { - unlink($temp); - $directories[] = dirname($temp); - } if ($temp = sys_get_temp_dir()) { $directories[] = $temp; } @@ -239,6 +234,12 @@ class TempManager implements ITempManager { return $dir; } } + + $temp = tempnam(dirname(__FILE__), ''); + if (file_exists($temp)) { + unlink($temp); + return dirname($temp); + } throw new \UnexpectedValueException('Unable to detect system temporary directory'); } diff --git a/lib/private/updater.php b/lib/private/updater.php index 9ec72bab2f9..32264484ee3 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -8,13 +8,13 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Steffen Lindner <mail@steffen-lindner.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -345,8 +345,8 @@ class Updater extends BasicEmitter { //Invalidate update feed $this->config->setAppValue('core', 'lastupdatedat', 0); - // Check for code integrity on the stable channel - if(\OC_Util::getChannel() === 'stable') { + // Check for code integrity if not disabled + if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); $this->checker->runInstanceVerification(); $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php index 94de8ed8f6e..327c0c32dfe 100644 --- a/lib/private/urlgenerator.php +++ b/lib/private/urlgenerator.php @@ -6,11 +6,11 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/user.php b/lib/private/user.php index fa1cea9072f..7d1f21cc409 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -3,26 +3,24 @@ * @author Aldo "xoen" Giambelluca <xoen@xoen.org> * @author Andreas Fischer <bantu@owncloud.com> * @author Arthur Schiwon <blizzz@owncloud.com> - * @author Bart Visscher <bartv@thisnet.nl> * @author Bartek Przybylski <bart.p.pl@gmail.com> + * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> - * @author Dominik Schmidt <dev@dominik-schmidt.de> * @author Florian Preinstorfer <nblock@archlinux.us> * @author Georg Ehrke <georg@owncloud.com> * @author Jakob Sack <mail@jakobsack.de> - * @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 Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author shkdee <louis.traynard@m4x.org> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> - * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -78,13 +76,13 @@ class OC_User { /** * Adds the backend to the list of used backends * - * @param string|OC_User_Interface $backend default: database The backend to use for user management + * @param string|\OCP\UserInterface $backend default: database The backend to use for user management * @return bool * * Set the User Authentication Module */ public static function useBackend($backend = 'database') { - if ($backend instanceof OC_User_Interface) { + if ($backend instanceof \OCP\UserInterface) { self::$_usedBackends[get_class($backend)] = $backend; \OC::$server->getUserManager()->registerBackend($backend); } else { @@ -393,7 +391,7 @@ class OC_User { * generates a password */ public static function generatePassword() { - return \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(30); + return \OC::$server->getSecureRandom()->generate(30); } /** diff --git a/lib/private/user/backend.php b/lib/private/user/backend.php index cda91398a84..c8e3577d112 100644 --- a/lib/private/user/backend.php +++ b/lib/private/user/backend.php @@ -16,7 +16,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -63,7 +63,7 @@ define('OC_USER_BACKEND_COUNT_USERS', 1 << 28); * Abstract base class for user management. Provides methods for querying backend * capabilities. */ -abstract class OC_User_Backend implements OC_User_Interface { +abstract class OC_User_Backend implements \OCP\UserInterface { /** * error code for functions not provided by the user backend */ diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 5bee509e8bd..22a05090b96 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -15,11 +15,11 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author nishiki <nishiki@yaegashi.fr> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/user/interface.php b/lib/private/user/interface.php index 0b36340c4f9..b487a046c72 100644 --- a/lib/private/user/interface.php +++ b/lib/private/user/interface.php @@ -5,10 +5,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -25,62 +25,8 @@ * */ -interface OC_User_Interface { - - /** - * Check if backend implements actions - * @param int $actions bitwise-or'ed actions - * @return boolean - * - * Returns the supported actions as int to be - * compared with \OC_User_Backend::CREATE_USER etc. - */ - public function implementsActions($actions); - - /** - * delete a user - * @param string $uid The username of the user to delete - * @return bool - */ - public function deleteUser($uid); - - /** - * Get a list of all users - * - * @param string $search - * @param null|int $limit - * @param null|int $offset - * @return string[] an array of all uids - */ - public function getUsers($search = '', $limit = null, $offset = null); - - /** - * check if a user exists - * @param string $uid the username - * @return boolean - */ - public function userExists($uid); - - /** - * get display name of the user - * @param string $uid user ID of the user - * @return string display name - */ - public function getDisplayName($uid); - - /** - * Get a list of all display names and user ids. - * - * @param string $search - * @param string|null $limit - * @param string|null $offset - * @return array an array of all displayNames (value) and the corresponding uids (key) - */ - public function getDisplayNames($search = '', $limit = null, $offset = null); - - /** - * Check if a user list is available or not - * @return boolean if users can be listed or not - */ - public function hasUserListings(); -} +/** + * Interface OC_User_Interface + * @deprecated use the public \OCP\UserInterface instead + */ +interface OC_User_Interface extends \OCP\UserInterface {} diff --git a/lib/private/user/loginexception.php b/lib/private/user/loginexception.php index fcaa4d797a8..84426f7f5da 100644 --- a/lib/private/user/loginexception.php +++ b/lib/private/user/loginexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index 2cb866d0056..86750dcd994 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -7,10 +7,11 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author RealRancor <Fisch.666@gmx.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Volkan Gezer <volkangezer@gmail.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -43,6 +44,7 @@ use OCP\IConfig; * - postDelete(\OC\User\User $user) * - preCreateUser(string $uid, string $password) * - postCreateUser(\OC\User\User $user, string $password) + * - change(\OC\User\User $user) * * @package OC\User */ @@ -254,10 +256,10 @@ class Manager extends PublicEmitter implements IUserManager { public function createUser($uid, $password) { $l = \OC::$server->getL10N('lib'); // Check the name for bad characters - // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" - if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) { + // Allowed are: "a-z", "A-Z", "0-9" and "_.@-'" + if (preg_match('/[^a-zA-Z0-9 _\.@\-\']/', $uid)) { throw new \Exception($l->t('Only the following characters are allowed in a username:' - . ' "a-z", "A-Z", "0-9", and "_.@-"')); + . ' "a-z", "A-Z", "0-9", and "_.@-\'"')); } // No empty username if (trim($uid) == '') { diff --git a/lib/private/user/nouserexception.php b/lib/private/user/nouserexception.php index 09874887469..afd5c729fcf 100644 --- a/lib/private/user/nouserexception.php +++ b/lib/private/user/nouserexception.php @@ -2,7 +2,7 @@ /** * @author Jörn Friedrich Dreyer <jfd@butonic.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/user/session.php b/lib/private/user/session.php index be38b1b1d8e..5402c5cf74f 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -7,11 +7,12 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -260,7 +261,7 @@ class Session implements IUserSession, Emitter { } // replace successfully used token with a new one \OC::$server->getConfig()->deleteUserValue($uid, 'login_token', $currentToken); - $newToken = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32); + $newToken = \OC::$server->getSecureRandom()->generate(32); \OC::$server->getConfig()->setUserValue($uid, 'login_token', $newToken, time()); $this->setMagicInCookie($user->getUID(), $newToken); diff --git a/lib/private/user/user.php b/lib/private/user/user.php index 6c89dd06f77..5b8bb6947a5 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -7,10 +7,10 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -35,6 +35,7 @@ use OCP\IImage; use OCP\IURLGenerator; use OCP\IUser; use OCP\IConfig; +use OCP\UserInterface; class User implements IUser { /** @var string $uid */ @@ -43,7 +44,7 @@ class User implements IUser { /** @var string $displayName */ private $displayName; - /** @var \OC_User_Interface $backend */ + /** @var UserInterface $backend */ private $backend; /** @var bool $enabled */ @@ -69,7 +70,7 @@ class User implements IUser { /** * @param string $uid - * @param \OC_User_Interface $backend + * @param UserInterface $backend * @param \OC\Hooks\Emitter $emitter * @param IConfig|null $config * @param IURLGenerator $urlGenerator @@ -136,8 +137,13 @@ class User implements IUser { public function setDisplayName($displayName) { $displayName = trim($displayName); if ($this->backend->implementsActions(\OC_User_Backend::SET_DISPLAYNAME) && !empty($displayName)) { - $this->displayName = $displayName; $result = $this->backend->setDisplayName($this->uid, $displayName); + if ($result) { + $this->displayName = $displayName; + if ($this->emitter) { + $this->emitter->emit('\OC\User', 'changeUser', array($this)); + } + } return $result !== false; } else { return false; @@ -145,6 +151,24 @@ class User implements IUser { } /** + * set the email address of the user + * + * @param string|null $mailAddress + * @return void + * @since 9.0.0 + */ + public function setEMailAddress($mailAddress) { + if($mailAddress === '') { + $this->config->deleteUserValue($this->uid, 'settings', 'email'); + } else { + $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); + } + if ($this->emitter) { + $this->emitter->emit('\OC\User', 'changeUser', array($this)); + } + } + + /** * returns the timestamp of the user's last login or 0 if the user did never * login * @@ -364,4 +388,5 @@ class User implements IUser { return $url; } + } diff --git a/lib/private/util.php b/lib/private/util.php index ed62f1afb4a..5ae5c452d6b 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1,6 +1,7 @@ <?php /** * @author Adam Williamson <awilliam@redhat.com> + * @author Andreas Böhler <dev@aboehler.at> * @author Andreas Fischer <bantu@owncloud.com> * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> @@ -28,7 +29,8 @@ * @author Michael Göhler <somebody.here@gmx.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Stefan Rado <owncloud@sradonia.net> * @author Thomas Müller <thomas.mueller@tmit.eu> @@ -38,7 +40,7 @@ * @author Vincent Petry <pvince81@owncloud.com> * @author Volkan Gezer <volkangezer@gmail.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -1097,7 +1099,7 @@ class OC_Util { $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); if (is_null($id)) { // We need to guarantee at least one letter in instanceid so it can be used as the session_name - $id = 'oc' . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); + $id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); \OC::$server->getSystemConfig()->setValue('instanceid', $id); } return $id; @@ -1125,7 +1127,7 @@ class OC_Util { // Check if a token exists if (!\OC::$server->getSession()->exists('requesttoken')) { // No valid token found, generate a new one. - $requestToken = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($tokenLength); + $requestToken = \OC::$server->getSecureRandom()->generate($tokenLength); \OC::$server->getSession()->set('requesttoken', $requestToken); } else { // Valid token already exists, send it @@ -1133,7 +1135,7 @@ class OC_Util { } // XOR the token to mitigate breach-like attacks - $sharedSecret = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($tokenLength); + $sharedSecret = \OC::$server->getSecureRandom()->generate($tokenLength); self::$obfuscatedToken = base64_encode($requestToken ^ $sharedSecret) .':'.$sharedSecret; return self::$obfuscatedToken; @@ -1201,6 +1203,10 @@ class OC_Util { // creating a test file $testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName; + if (file_exists($testFile)) {// already running this test, possible recursive call + return false; + } + $fp = @fopen($testFile, 'w'); if (!$fp) { throw new OC\HintException('Can\'t create test file to check for working .htaccess file.', diff --git a/lib/public/activity/iconsumer.php b/lib/public/activity/iconsumer.php index 796bf1d8884..fc536fd0a56 100644 --- a/lib/public/activity/iconsumer.php +++ b/lib/public/activity/iconsumer.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/activity/ievent.php b/lib/public/activity/ievent.php index 184c7ae503f..9b6df9126b2 100644 --- a/lib/public/activity/ievent.php +++ b/lib/public/activity/ievent.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/activity/iextension.php b/lib/public/activity/iextension.php index 5d9fe3329ef..b00dbdda20a 100644 --- a/lib/public/activity/iextension.php +++ b/lib/public/activity/iextension.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -57,8 +57,7 @@ interface IExtension { * 'desc' => "translated string description for the setting" * 'methods' => [self::METHOD_*], * ] - * @since 8.0.0 - * @changed 8.2.0 - Added support to allow limiting notifications to certain methods + * @since 8.0.0 - 8.2.0: Added support to allow limiting notifications to certain methods */ public function getNotificationTypes($languageCode); diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php index 280babb7fa9..0b97f8a07ed 100644 --- a/lib/public/activity/imanager.php +++ b/lib/public/activity/imanager.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -118,8 +118,7 @@ interface IManager { * 'desc' => "translated string description for the setting" * 'methods' => [\OCP\Activity\IExtension::METHOD_*], * ] - * @since 8.0.0 - * @changed 8.2.0 - Added support to allow limiting notifications to certain methods + * @since 8.0.0 - 8.2.0: Added support to allow limiting notifications to certain methods */ public function getNotificationTypes($languageCode); diff --git a/lib/public/api.php b/lib/public/api.php index a99a3af1c1d..4d68bef6f29 100644 --- a/lib/public/api.php +++ b/lib/public/api.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Tom Needham <tom@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/app.php b/lib/public/app.php index c75a69f0c3d..e25f025d12d 100644 --- a/lib/public/app.php +++ b/lib/public/app.php @@ -6,10 +6,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/app/iappmanager.php b/lib/public/app/iappmanager.php index 09b6bd3f2b9..0e1e0dfbebd 100644 --- a/lib/public/app/iappmanager.php +++ b/lib/public/app/iappmanager.php @@ -3,8 +3,9 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/apicontroller.php b/lib/public/appframework/apicontroller.php index 90eea47d730..64e07539de4 100644 --- a/lib/public/appframework/apicontroller.php +++ b/lib/public/appframework/apicontroller.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php index bf4e14961f5..09297d91ee8 100644 --- a/lib/public/appframework/app.php +++ b/lib/public/appframework/app.php @@ -6,7 +6,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 6e2ceff93e8..973c9044684 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -8,7 +8,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/db/doesnotexistexception.php b/lib/public/appframework/db/doesnotexistexception.php index 2cefa0fe827..9682a08d3cf 100644 --- a/lib/public/appframework/db/doesnotexistexception.php +++ b/lib/public/appframework/db/doesnotexistexception.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/db/entity.php b/lib/public/appframework/db/entity.php index f7beebef154..d7db4d3c5a7 100644 --- a/lib/public/appframework/db/entity.php +++ b/lib/public/appframework/db/entity.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php index 2b99c99b71e..065a9f01ea1 100644 --- a/lib/public/appframework/db/mapper.php +++ b/lib/public/appframework/db/mapper.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/db/multipleobjectsreturnedexception.php b/lib/public/appframework/db/multipleobjectsreturnedexception.php index 988bf6bb033..b9207051826 100644 --- a/lib/public/appframework/db/multipleobjectsreturnedexception.php +++ b/lib/public/appframework/db/multipleobjectsreturnedexception.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http.php b/lib/public/appframework/http.php index 65b62ffd15a..e0108146db7 100644 --- a/lib/public/appframework/http.php +++ b/lib/public/appframework/http.php @@ -4,7 +4,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/contentsecuritypolicy.php b/lib/public/appframework/http/contentsecuritypolicy.php index 5371d76ff22..35da4f05e80 100644 --- a/lib/public/appframework/http/contentsecuritypolicy.php +++ b/lib/public/appframework/http/contentsecuritypolicy.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author sualko <klaus@jsxc.org> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/datadisplayresponse.php b/lib/public/appframework/http/datadisplayresponse.php index 2691091347a..4209c86a059 100644 --- a/lib/public/appframework/http/datadisplayresponse.php +++ b/lib/public/appframework/http/datadisplayresponse.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/datadownloadresponse.php b/lib/public/appframework/http/datadownloadresponse.php index 612386f9801..55ef4e6c82c 100644 --- a/lib/public/appframework/http/datadownloadresponse.php +++ b/lib/public/appframework/http/datadownloadresponse.php @@ -3,7 +3,7 @@ * @author Georg Ehrke <georg@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/dataresponse.php b/lib/public/appframework/http/dataresponse.php index 555faa6ea1a..3ec4e2bdc32 100644 --- a/lib/public/appframework/http/dataresponse.php +++ b/lib/public/appframework/http/dataresponse.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/downloadresponse.php b/lib/public/appframework/http/downloadresponse.php index 0b9a8bcc6d8..af0d76951ca 100644 --- a/lib/public/appframework/http/downloadresponse.php +++ b/lib/public/appframework/http/downloadresponse.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/icallbackresponse.php b/lib/public/appframework/http/icallbackresponse.php index aa238cbcac9..97de484e917 100644 --- a/lib/public/appframework/http/icallbackresponse.php +++ b/lib/public/appframework/http/icallbackresponse.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/ioutput.php b/lib/public/appframework/http/ioutput.php index 9a4047fe30c..f4ebc304bde 100644 --- a/lib/public/appframework/http/ioutput.php +++ b/lib/public/appframework/http/ioutput.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php index 306c70327b1..89433fd23e5 100644 --- a/lib/public/appframework/http/jsonresponse.php +++ b/lib/public/appframework/http/jsonresponse.php @@ -6,7 +6,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/notfoundresponse.php b/lib/public/appframework/http/notfoundresponse.php index 968df6c310c..8dcebd7cceb 100644 --- a/lib/public/appframework/http/notfoundresponse.php +++ b/lib/public/appframework/http/notfoundresponse.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/ocsresponse.php b/lib/public/appframework/http/ocsresponse.php index f26d219e581..da9de712c0a 100644 --- a/lib/public/appframework/http/ocsresponse.php +++ b/lib/public/appframework/http/ocsresponse.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/redirectresponse.php b/lib/public/appframework/http/redirectresponse.php index 41a2e48035e..7208012295f 100644 --- a/lib/public/appframework/http/redirectresponse.php +++ b/lib/public/appframework/http/redirectresponse.php @@ -5,7 +5,7 @@ * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php index f6c9460ff15..253d58b86ff 100644 --- a/lib/public/appframework/http/response.php +++ b/lib/public/appframework/http/response.php @@ -7,7 +7,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/streamresponse.php b/lib/public/appframework/http/streamresponse.php index b2e0df3a75f..e9157f9ddb2 100644 --- a/lib/public/appframework/http/streamresponse.php +++ b/lib/public/appframework/http/streamresponse.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php index 961903a8eab..7774d881e4d 100644 --- a/lib/public/appframework/http/templateresponse.php +++ b/lib/public/appframework/http/templateresponse.php @@ -5,7 +5,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/iapi.php b/lib/public/appframework/iapi.php index 7d1d230a77f..66614328873 100644 --- a/lib/public/appframework/iapi.php +++ b/lib/public/appframework/iapi.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php index 1cc0daf68ad..905539e735e 100644 --- a/lib/public/appframework/iappcontainer.php +++ b/lib/public/appframework/iappcontainer.php @@ -6,7 +6,7 @@ * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/middleware.php b/lib/public/appframework/middleware.php index 6c75a2dfc74..a39e26a2aa0 100644 --- a/lib/public/appframework/middleware.php +++ b/lib/public/appframework/middleware.php @@ -4,7 +4,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/ocscontroller.php b/lib/public/appframework/ocscontroller.php index 8b04d65d8c3..b0e77c5d1ec 100644 --- a/lib/public/appframework/ocscontroller.php +++ b/lib/public/appframework/ocscontroller.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/queryexception.php b/lib/public/appframework/queryexception.php index c8cd0cfe9fb..62ab77dd839 100644 --- a/lib/public/appframework/queryexception.php +++ b/lib/public/appframework/queryexception.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/utility/icontrollermethodreflector.php b/lib/public/appframework/utility/icontrollermethodreflector.php index a3b57cf6936..b2f91fdb170 100644 --- a/lib/public/appframework/utility/icontrollermethodreflector.php +++ b/lib/public/appframework/utility/icontrollermethodreflector.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/appframework/utility/itimefactory.php b/lib/public/appframework/utility/itimefactory.php index 6fe2fab2557..a3333dd1949 100644 --- a/lib/public/appframework/utility/itimefactory.php +++ b/lib/public/appframework/utility/itimefactory.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/authentication/iapachebackend.php b/lib/public/authentication/iapachebackend.php index 51ca57788f3..f1f408cfa6d 100644 --- a/lib/public/authentication/iapachebackend.php +++ b/lib/public/authentication/iapachebackend.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/autoloadnotallowedexception.php b/lib/public/autoloadnotallowedexception.php index 2e6556c4a7b..f0028b7d49d 100644 --- a/lib/public/autoloadnotallowedexception.php +++ b/lib/public/autoloadnotallowedexception.php @@ -1,8 +1,8 @@ <?php /** - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index 42fcf76b876..c8acb7e538b 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -6,10 +6,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/backgroundjob/ijob.php b/lib/public/backgroundjob/ijob.php index 8d970dbe781..71cdee65636 100644 --- a/lib/public/backgroundjob/ijob.php +++ b/lib/public/backgroundjob/ijob.php @@ -1,10 +1,10 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php index 51431c42a67..13775457edd 100644 --- a/lib/public/backgroundjob/ijoblist.php +++ b/lib/public/backgroundjob/ijoblist.php @@ -1,11 +1,11 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @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 Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/capabilities/icapability.php b/lib/public/capabilities/icapability.php index b43387aad7e..0facab6f255 100644 --- a/lib/public/capabilities/icapability.php +++ b/lib/public/capabilities/icapability.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/command/ibus.php b/lib/public/command/ibus.php index 796862fbcac..62b6edef4d4 100644 --- a/lib/public/command/ibus.php +++ b/lib/public/command/ibus.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/command/icommand.php b/lib/public/command/icommand.php index ed152f4c6c3..e53d52d2fa3 100644 --- a/lib/public/command/icommand.php +++ b/lib/public/command/icommand.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/comments/icomment.php b/lib/public/comments/icomment.php index 7924ec8d5f6..d97cfe3f1cc 100644 --- a/lib/public/comments/icomment.php +++ b/lib/public/comments/icomment.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\Comments; /** diff --git a/lib/public/comments/icommentsmanager.php b/lib/public/comments/icommentsmanager.php index 7626ffd6351..b8fb3ca7f5d 100644 --- a/lib/public/comments/icommentsmanager.php +++ b/lib/public/comments/icommentsmanager.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\Comments; /** diff --git a/lib/public/comments/icommentsmanagerfactory.php b/lib/public/comments/icommentsmanagerfactory.php index 6718dd39ba0..2e71719019c 100644 --- a/lib/public/comments/icommentsmanagerfactory.php +++ b/lib/public/comments/icommentsmanagerfactory.php @@ -1,7 +1,27 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\Comments; +use OCP\IServerContainer; + /** * Interface ICommentsManagerFactory * @@ -14,6 +34,14 @@ namespace OCP\Comments; interface ICommentsManagerFactory { /** + * Constructor for the comments manager factory + * + * @param IServerContainer $serverContainer server container + * @since 9.0.0 + */ + public function __construct(IServerContainer $serverContainer); + + /** * creates and returns an instance of the ICommentsManager * * @return ICommentsManager diff --git a/lib/public/comments/illegalidchangeexception.php b/lib/public/comments/illegalidchangeexception.php index 4e13ef6e444..df7a8e41cd9 100644 --- a/lib/public/comments/illegalidchangeexception.php +++ b/lib/public/comments/illegalidchangeexception.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\Comments; /** diff --git a/lib/public/comments/notfoundexception.php b/lib/public/comments/notfoundexception.php index a82e703b79e..51f6927346c 100644 --- a/lib/public/comments/notfoundexception.php +++ b/lib/public/comments/notfoundexception.php @@ -1,5 +1,23 @@ <?php - +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\Comments; /** diff --git a/lib/public/config.php b/lib/public/config.php index 86e18de78e1..5b5dcb0e78e 100644 --- a/lib/public/config.php +++ b/lib/public/config.php @@ -9,7 +9,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/constants.php b/lib/public/constants.php index 4d44bf24928..518fbcf7ebe 100644 --- a/lib/public/constants.php +++ b/lib/public/constants.php @@ -5,7 +5,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/contacts.php b/lib/public/contacts.php index c66d1ba2ccf..590fd9af1bd 100644 --- a/lib/public/contacts.php +++ b/lib/public/contacts.php @@ -2,10 +2,10 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php index 4b7d0f7d40a..c6d557eaba7 100644 --- a/lib/public/contacts/imanager.php +++ b/lib/public/contacts/imanager.php @@ -3,10 +3,10 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db.php b/lib/public/db.php index 9c5f9424dcb..4706c5e95ee 100644 --- a/lib/public/db.php +++ b/lib/public/db.php @@ -11,7 +11,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db/querybuilder/icompositeexpression.php b/lib/public/db/querybuilder/icompositeexpression.php index 439c0ab20a8..c47ba1deb1e 100644 --- a/lib/public/db/querybuilder/icompositeexpression.php +++ b/lib/public/db/querybuilder/icompositeexpression.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db/querybuilder/iexpressionbuilder.php b/lib/public/db/querybuilder/iexpressionbuilder.php index d719f07ebd4..0549d3f0125 100644 --- a/lib/public/db/querybuilder/iexpressionbuilder.php +++ b/lib/public/db/querybuilder/iexpressionbuilder.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -84,11 +84,13 @@ interface IExpressionBuilder { * * @param mixed $x The left expression. * @param mixed $y The right expression. + * @param int|null $type @since 9.0.0 one of the \PDO::PARAM_* constants + * required when comparing text fields for oci compatibility. * * @return string * @since 8.2.0 */ - public function eq($x, $y); + public function eq($x, $y, $type = null); /** * Creates a non equality comparison expression with the given arguments. diff --git a/lib/public/db/querybuilder/iliteral.php b/lib/public/db/querybuilder/iliteral.php index a2665e47a7d..ab1cc59229a 100644 --- a/lib/public/db/querybuilder/iliteral.php +++ b/lib/public/db/querybuilder/iliteral.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db/querybuilder/iparameter.php b/lib/public/db/querybuilder/iparameter.php index ef822a9c97f..be141cea9a7 100644 --- a/lib/public/db/querybuilder/iparameter.php +++ b/lib/public/db/querybuilder/iparameter.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db/querybuilder/iquerybuilder.php b/lib/public/db/querybuilder/iquerybuilder.php index dd3ee7da5f5..c803f08a888 100644 --- a/lib/public/db/querybuilder/iquerybuilder.php +++ b/lib/public/db/querybuilder/iquerybuilder.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/db/querybuilder/iqueryfunction.php b/lib/public/db/querybuilder/iqueryfunction.php index 7051f2f38a3..8050bd295e4 100644 --- a/lib/public/db/querybuilder/iqueryfunction.php +++ b/lib/public/db/querybuilder/iqueryfunction.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/defaults.php b/lib/public/defaults.php index 723c6ecbb78..58b25d5914a 100644 --- a/lib/public/defaults.php +++ b/lib/public/defaults.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author scolebrook <scolebrook@mac.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/diagnostics/ievent.php b/lib/public/diagnostics/ievent.php index 733d5e4832c..a3e42ee137f 100644 --- a/lib/public/diagnostics/ievent.php +++ b/lib/public/diagnostics/ievent.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/diagnostics/ieventlogger.php b/lib/public/diagnostics/ieventlogger.php index c9b4653393b..34e521db10c 100644 --- a/lib/public/diagnostics/ieventlogger.php +++ b/lib/public/diagnostics/ieventlogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/diagnostics/iquery.php b/lib/public/diagnostics/iquery.php index 54853f733c9..3b4d1b4c965 100644 --- a/lib/public/diagnostics/iquery.php +++ b/lib/public/diagnostics/iquery.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/diagnostics/iquerylogger.php b/lib/public/diagnostics/iquerylogger.php index 4a6a0d0704b..285a85efde1 100644 --- a/lib/public/diagnostics/iquerylogger.php +++ b/lib/public/diagnostics/iquerylogger.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/encryption/exceptions/genericencryptionexception.php b/lib/public/encryption/exceptions/genericencryptionexception.php index c1041e81642..c1331689c7f 100644 --- a/lib/public/encryption/exceptions/genericencryptionexception.php +++ b/lib/public/encryption/exceptions/genericencryptionexception.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/encryption/iencryptionmodule.php b/lib/public/encryption/iencryptionmodule.php index bb4dfdcdda8..426e4ddecce 100644 --- a/lib/public/encryption/iencryptionmodule.php +++ b/lib/public/encryption/iencryptionmodule.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/encryption/ifile.php b/lib/public/encryption/ifile.php index 0d1381238f0..9933cb0164e 100644 --- a/lib/public/encryption/ifile.php +++ b/lib/public/encryption/ifile.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/encryption/imanager.php b/lib/public/encryption/imanager.php index c963c19e660..b07de0cbb4f 100644 --- a/lib/public/encryption/imanager.php +++ b/lib/public/encryption/imanager.php @@ -4,7 +4,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/encryption/keys/istorage.php b/lib/public/encryption/keys/istorage.php index e206373c46a..cfac4ba58f7 100644 --- a/lib/public/encryption/keys/istorage.php +++ b/lib/public/encryption/keys/istorage.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files.php b/lib/public/files.php index e3582375f38..f1b8a855194 100644 --- a/lib/public/files.php +++ b/lib/public/files.php @@ -10,7 +10,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/alreadyexistsexception.php b/lib/public/files/alreadyexistsexception.php index 2ff231c56f4..243129cb1db 100644 --- a/lib/public/files/alreadyexistsexception.php +++ b/lib/public/files/alreadyexistsexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/cache/icache.php b/lib/public/files/cache/icache.php new file mode 100644 index 00000000000..07396db4588 --- /dev/null +++ b/lib/public/files/cache/icache.php @@ -0,0 +1,249 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +/** + * Metadata cache for a storage + * + * The cache stores the metadata for all files and folders in a storage and is kept up to date trough the following mechanisms: + * + * - Scanner: scans the storage and updates the cache where needed + * - Watcher: checks for changes made to the filesystem outside of the ownCloud instance and rescans files and folder when a change is detected + * - Updater: listens to changes made to the filesystem inside of the ownCloud instance and updates the cache where needed + * - ChangePropagator: updates the mtime and etags of parent folders whenever a change to the cache is made to the cache by the updater + * + * @since 9.0.0 + */ +interface ICache { + const NOT_FOUND = 0; + const PARTIAL = 1; //only partial data available, file not cached in the database + const SHALLOW = 2; //folder in cache, but not all child files are completely scanned + const COMPLETE = 3; + + /** + * Get the numeric storage id for this cache's storage + * + * @return int + * @since 9.0.0 + */ + public function getNumericStorageId(); + + /** + * get the stored metadata of a file or folder + * + * @param string | int $file either the path of a file or folder or the file id for a file or folder + * @return ICacheEntry[]|false the cache entry or false if the file is not found in the cache + * @since 9.0.0 + */ + public function get($file); + + /** + * get the metadata of all files stored in $folder + * + * @param string $folder + * @return ICacheEntry[] + * @since 9.0.0 + */ + public function getFolderContents($folder); + + /** + * get the metadata of all files stored in $folder + * + * @param int $fileId the file id of the folder + * @return ICacheEntry[] + * @since 9.0.0 + */ + public function getFolderContentsById($fileId); + + /** + * store meta data for a file or folder + * + * @param string $file + * @param array $data + * + * @return int file id + * @throws \RuntimeException + * @since 9.0.0 + */ + public function put($file, array $data); + + /** + * update the metadata of an existing file or folder in the cache + * + * @param int $id the fileid of the existing file or folder + * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged + * @since 9.0.0 + */ + public function update($id, array $data); + + /** + * get the file id for a file + * + * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file + * + * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing + * + * @param string $file + * @return int + * @since 9.0.0 + */ + public function getId($file); + + /** + * get the id of the parent folder of a file + * + * @param string $file + * @return int + * @since 9.0.0 + */ + public function getParentId($file); + + /** + * check if a file is available in the cache + * + * @param string $file + * @return bool + * @since 9.0.0 + */ + public function inCache($file); + + /** + * remove a file or folder from the cache + * + * when removing a folder from the cache all files and folders inside the folder will be removed as well + * + * @param string $file + * @since 9.0.0 + */ + public function remove($file); + + /** + * Move a file or folder in the cache + * + * @param string $source + * @param string $target + * @since 9.0.0 + */ + public function move($source, $target); + + /** + * Move a file or folder in the cache + * + * @param \OCP\Files\Cache\ICache $sourceCache + * @param string $sourcePath + * @param string $targetPath + * @throws \OC\DatabaseException + * @since 9.0.0 + */ + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath); + + /** + * remove all entries for files that are stored on the storage from the cache + * + * @since 9.0.0 + */ + public function clear(); + + /** + * Get the scan status of a file + * + * - ICache::NOT_FOUND: File is not in the cache + * - ICache::PARTIAL: File is not stored in the cache but some incomplete data is known + * - ICache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned + * - ICache::COMPLETE: The file or folder, with all it's children) are fully scanned + * + * @param string $file + * + * @return int ICache::NOT_FOUND, ICache::PARTIAL, ICache::SHALLOW or ICache::COMPLETE + * @since 9.0.0 + */ + public function getStatus($file); + + /** + * search for files matching $pattern + * + * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') + * @return ICacheEntry[] an array of cache entries where the name matches the search pattern + * @since 9.0.0 + */ + public function search($pattern); + + /** + * search for files by mimetype + * + * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') + * where it will search for all mimetypes in the group ('image/*') + * @return ICacheEntry[] an array of cache entries where the mimetype matches the search + * @since 9.0.0 + */ + public function searchByMime($mimetype); + + /** + * Search for files by tag of a given users. + * + * Note that every user can tag files differently. + * + * @param string|int $tag name or tag id + * @param string $userId owner of the tags + * @return ICacheEntry[] file data + * @since 9.0.0 + */ + public function searchByTag($tag, $userId); + + /** + * get all file ids on the files on the storage + * + * @return int[] + * @since 9.0.0 + */ + public function getAll(); + + /** + * find a folder in the cache which has not been fully scanned + * + * If multiple incomplete folders are in the cache, the one with the highest id will be returned, + * use the one with the highest id gives the best result with the background scanner, since that is most + * likely the folder where we stopped scanning previously + * + * @return string|bool the path of the folder or false when no folder matched + * @since 9.0.0 + */ + public function getIncomplete(); + + /** + * get the path of a file on this storage by it's file id + * + * @param int $id the file id of the file or folder to search + * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache + * @since 9.0.0 + */ + public function getPathById($id); + + /** + * normalize the given path for usage in the cache + * + * @param string $path + * @return string + * @since 9.0.0 + */ + public function normalize($path); +} diff --git a/lib/public/files/cache/icacheentry.php b/lib/public/files/cache/icacheentry.php new file mode 100644 index 00000000000..8d14bd2c555 --- /dev/null +++ b/lib/public/files/cache/icacheentry.php @@ -0,0 +1,132 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +/** + * meta data for a file or folder + * + * @since 9.0.0 + */ +interface ICacheEntry { + /** + * Get the numeric id of a file + * + * @return int + * @since 9.0.0 + */ + public function getId(); + + /** + * Get the numeric id for the storage + * + * @return int + * @since 9.0.0 + */ + public function getStorageId(); + + /** + * Get the path of the file relative to the storage root + * + * @return string + * @since 9.0.0 + */ + public function getPath(); + + /** + * Get the file name + * + * @return string + * @since 9.0.0 + */ + public function getName(); + + /** + * Get the full mimetype + * + * @return string + * @since 9.0.0 + */ + public function getMimeType(); + + /** + * Get the first part of the mimetype + * + * @return string + * @since 9.0.0 + */ + public function getMimePart(); + + /** + * Get the file size in bytes + * + * @return int + * @since 9.0.0 + */ + public function getSize(); + + /** + * Get the last modified date as unix timestamp + * + * @return int + * @since 9.0.0 + */ + public function getMTime(); + + /** + * Get the last modified date on the storage as unix timestamp + * + * Note that when a file is updated we also update the mtime of all parent folders to make it visible to the user which folder has had updates most recently + * This can differ from the mtime on the underlying storage which usually only changes when a direct child is added, removed or renamed + * + * @return int + * @since 9.0.0 + */ + public function getStorageMTime(); + + /** + * Get the etag for the file + * + * An etag is used for change detection of files and folders, an etag of a file changes whenever the content of the file changes + * Etag for folders change whenever a file in the folder has changed + * + * @return string + * @since 9.0.0 + */ + public function getEtag(); + + /** + * Get the permissions for the file stored as bitwise combination of \OCP\PERMISSION_READ, \OCP\PERMISSION_CREATE + * \OCP\PERMISSION_UPDATE, \OCP\PERMISSION_DELETE and \OCP\PERMISSION_SHARE + * + * @return int + * @since 9.0.0 + */ + public function getPermissions(); + + /** + * Check if the file is encrypted + * + * @return bool + * @since 9.0.0 + */ + public function isEncrypted(); +} diff --git a/lib/public/files/cache/ipropagator.php b/lib/public/files/cache/ipropagator.php new file mode 100644 index 00000000000..7f7dbada532 --- /dev/null +++ b/lib/public/files/cache/ipropagator.php @@ -0,0 +1,37 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +/** + * Propagate etags and mtimes within the storage + * + * @since 9.0.0 + */ +interface IPropagator { + /** + * @param string $internalPath + * @param int $time + * @return array[] all propagated cache entries + * @since 9.0.0 + */ + public function propagateChange($internalPath, $time); +} diff --git a/lib/public/files/cache/iscanner.php b/lib/public/files/cache/iscanner.php new file mode 100644 index 00000000000..47e33a98bae --- /dev/null +++ b/lib/public/files/cache/iscanner.php @@ -0,0 +1,81 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +/** + * Scan files from the storage and save to the cache + * + * @since 9.0.0 + */ +interface IScanner { + const SCAN_RECURSIVE = true; + const SCAN_SHALLOW = false; + + const REUSE_ETAG = 1; + const REUSE_SIZE = 2; + + /** + * scan a single file and store it in the cache + * + * @param string $file + * @param int $reuseExisting + * @param int $parentId + * @param array | null $cacheData existing data in the cache for the file to be scanned + * @param bool $lock set to false to disable getting an additional read lock during scanning + * @return array an array of metadata of the scanned file + * @throws \OC\ServerNotAvailableException + * @throws \OCP\Lock\LockedException + * @since 9.0.0 + */ + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true); + + /** + * scan a folder and all its children + * + * @param string $path + * @param bool $recursive + * @param int $reuse + * @param bool $lock set to false to disable getting an additional read lock during scanning + * @return array an array of the meta data of the scanned file or folder + * @since 9.0.0 + */ + public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true); + + /** + * check if the file should be ignored when scanning + * NOTE: files with a '.part' extension are ignored as well! + * prevents unfinished put requests to be scanned + * + * @param string $file + * @return boolean + * @since 9.0.0 + */ + public static function isPartialFile($file); + + /** + * walk over any folders that are not fully scanned yet and scan them + * + * @since 9.0.0 + */ + public function backgroundScan(); +} + diff --git a/lib/public/files/cache/iupdater.php b/lib/public/files/cache/iupdater.php new file mode 100644 index 00000000000..241cd8636a1 --- /dev/null +++ b/lib/public/files/cache/iupdater.php @@ -0,0 +1,75 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +use OCP\Files\Storage\IStorage; + +/** + * Update the cache and propagate changes + * + * @since 9.0.0 + */ +interface IUpdater { + /** + * Get the propagator for etags and mtime for the view the updater works on + * + * @return IPropagator + * @since 9.0.0 + */ + public function getPropagator(); + + /** + * Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem + * + * @param string $path the path of the file to propagate the changes for + * @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used + * @since 9.0.0 + */ + public function propagate($path, $time = null); + + /** + * Update the cache for $path and update the size, etag and mtime of the parent folders + * + * @param string $path + * @param int $time + * @since 9.0.0 + */ + public function update($path, $time = null); + + /** + * Remove $path from the cache and update the size, etag and mtime of the parent folders + * + * @param string $path + * @since 9.0.0 + */ + public function remove($path); + + /** + * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders + * + * @param IStorage $sourceStorage + * @param string $source + * @param string $target + * @since 9.0.0 + */ + public function renameFromStorage(IStorage $sourceStorage, $source, $target); +} diff --git a/lib/public/files/cache/iwatcher.php b/lib/public/files/cache/iwatcher.php new file mode 100644 index 00000000000..a61975036f8 --- /dev/null +++ b/lib/public/files/cache/iwatcher.php @@ -0,0 +1,82 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Cache; + +/** + * check the storage backends for updates and change the cache accordingly + * + * @since 9.0.0 + */ +interface IWatcher { + const CHECK_NEVER = 0; // never check the underlying filesystem for updates + const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file + const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates + + /** + * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS + * @since 9.0.0 + */ + public function setPolicy($policy); + + /** + * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS + * @since 9.0.0 + */ + public function getPolicy(); + + /** + * check $path for updates and update if needed + * + * @param string $path + * @param ICacheEntry|null $cachedEntry + * @return boolean true if path was updated + * @since 9.0.0 + */ + public function checkUpdate($path, $cachedEntry = null); + + /** + * Update the cache for changes to $path + * + * @param string $path + * @param ICacheEntry $cachedData + * @since 9.0.0 + */ + public function update($path, $cachedData); + + /** + * Check if the cache for $path needs to be updated + * + * @param string $path + * @param ICacheEntry $cachedData + * @return bool + * @since 9.0.0 + */ + public function needsUpdate($path, $cachedData); + + /** + * remove deleted files in $path from the cache + * + * @param string $path + * @since 9.0.0 + */ + public function cleanFolder($path); +} diff --git a/lib/public/files/config/icachedmountinfo.php b/lib/public/files/config/icachedmountinfo.php new file mode 100644 index 00000000000..a587427f1f2 --- /dev/null +++ b/lib/public/files/config/icachedmountinfo.php @@ -0,0 +1,62 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Config; + +use OCP\Files\Node; +use OCP\IUser; + +/** + * Holds information about a mount for a user + * + * @since 9.0.0 + */ +interface ICachedMountInfo { + /** + * @return IUser + * @since 9.0.0 + */ + public function getUser(); + + /** + * @return int the numeric storage id of the mount + * @since 9.0.0 + */ + public function getStorageId(); + + /** + * @return int the fileid of the root of the mount + * @since 9.0.0 + */ + public function getRootId(); + + /** + * @return Node the root node of the mount + * @since 9.0.0 + */ + public function getMountPointNode(); + + /** + * @return string the mount point of the mount for the user + * @since 9.0.0 + */ + public function getMountPoint(); +} diff --git a/lib/public/files/config/imountprovider.php b/lib/public/files/config/imountprovider.php index 8e21e4c8650..d1498fd5f61 100644 --- a/lib/public/files/config/imountprovider.php +++ b/lib/public/files/config/imountprovider.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/config/imountprovidercollection.php b/lib/public/files/config/imountprovidercollection.php index a458cbf3ce7..39da61812a9 100644 --- a/lib/public/files/config/imountprovidercollection.php +++ b/lib/public/files/config/imountprovidercollection.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -22,6 +22,7 @@ namespace OCP\Files\Config; +use OCP\Files\Mount\IMountPoint; use OCP\IUser; /** @@ -45,4 +46,12 @@ interface IMountProviderCollection { * @since 8.0.0 */ public function registerProvider(IMountProvider $provider); + + /** + * Get the mount cache which can be used to search for mounts without setting up the filesystem + * + * @return IUserMountCache + * @since 9.0.0 + */ + public function getMountCache(); } diff --git a/lib/public/files/config/iusermountcache.php b/lib/public/files/config/iusermountcache.php new file mode 100644 index 00000000000..f722ad16310 --- /dev/null +++ b/lib/public/files/config/iusermountcache.php @@ -0,0 +1,89 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Config; + +use OCP\Files\Mount\IMountPoint; +use OCP\IUser; + +/** + * Cache mounts points per user in the cache so we can easily look them up + * + * @since 9.0.0 + */ +interface IUserMountCache { + /** + * Register mounts for a user to the cache + * + * @param IUser $user + * @param IMountPoint[] $mounts + * @since 9.0.0 + */ + public function registerMounts(IUser $user, array $mounts); + + /** + * @param IUser $user + * @return ICachedMountInfo[] + * @since 9.0.0 + */ + public function getMountsForUser(IUser $user); + + /** + * @param int $numericStorageId + * @return ICachedMountInfo[] + * @since 9.0.0 + */ + public function getMountsForStorageId($numericStorageId); + + /** + * @param int $rootFileId + * @return ICachedMountInfo[] + * @since 9.0.0 + */ + public function getMountsForRootId($rootFileId); + + /** + * Remove all cached mounts for a user + * + * @param IUser $user + * @since 9.0.0 + */ + public function removeUserMounts(IUser $user); + + /** + * Remove all mounts for a user and storage + * + * @param $storageId + * @param string $userId + * @return mixed + * @since 9.0.0 + */ + public function removeUserStorageMount($storageId, $userId); + + /** + * Remove all cached mounts for a storage + * + * @param $storageId + * @return mixed + * @since 9.0.0 + */ + public function remoteStorageMounts($storageId); +} diff --git a/lib/public/files/entitytoolargeexception.php b/lib/public/files/entitytoolargeexception.php index 4dcfa77728b..8dabc08f8bb 100644 --- a/lib/public/files/entitytoolargeexception.php +++ b/lib/public/files/entitytoolargeexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/file.php b/lib/public/files/file.php index 839d646edb1..3acf24b9277 100644 --- a/lib/public/files/file.php +++ b/lib/public/files/file.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/fileinfo.php b/lib/public/files/fileinfo.php index 1af13302af0..77e37d53ab9 100644 --- a/lib/public/files/fileinfo.php +++ b/lib/public/files/fileinfo.php @@ -3,10 +3,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/filenametoolongexception.php b/lib/public/files/filenametoolongexception.php index 61cb8a21fb6..68fba4ad516 100644 --- a/lib/public/files/filenametoolongexception.php +++ b/lib/public/files/filenametoolongexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/folder.php b/lib/public/files/folder.php index 533e490634f..0644ab62034 100644 --- a/lib/public/files/folder.php +++ b/lib/public/files/folder.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/forbiddenexception.php b/lib/public/files/forbiddenexception.php index 13490c6eae3..5a4f03d176d 100644 --- a/lib/public/files/forbiddenexception.php +++ b/lib/public/files/forbiddenexception.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/ihomestorage.php b/lib/public/files/ihomestorage.php index fc9b0357578..4101545aafe 100644 --- a/lib/public/files/ihomestorage.php +++ b/lib/public/files/ihomestorage.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/imimetypedetector.php b/lib/public/files/imimetypedetector.php index b2b80d4570c..7d9cd606e69 100644 --- a/lib/public/files/imimetypedetector.php +++ b/lib/public/files/imimetypedetector.php @@ -2,7 +2,7 @@ /** * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/imimetypeloader.php b/lib/public/files/imimetypeloader.php index 1ff8bc1b6c1..57a6d7ba309 100644 --- a/lib/public/files/imimetypeloader.php +++ b/lib/public/files/imimetypeloader.php @@ -1,8 +1,8 @@ <?php /** - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/invalidcharacterinpathexception.php b/lib/public/files/invalidcharacterinpathexception.php index 52e20dfcb46..8e649b5bb62 100644 --- a/lib/public/files/invalidcharacterinpathexception.php +++ b/lib/public/files/invalidcharacterinpathexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/invalidcontentexception.php b/lib/public/files/invalidcontentexception.php index 6aebf367241..f25b7fef87f 100644 --- a/lib/public/files/invalidcontentexception.php +++ b/lib/public/files/invalidcontentexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/invalidpathexception.php b/lib/public/files/invalidpathexception.php index e86d58bde7a..ee21d7432be 100644 --- a/lib/public/files/invalidpathexception.php +++ b/lib/public/files/invalidpathexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/irootfolder.php b/lib/public/files/irootfolder.php index 97dc5a31e74..3b6243f7638 100644 --- a/lib/public/files/irootfolder.php +++ b/lib/public/files/irootfolder.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/locknotacquiredexception.php b/lib/public/files/locknotacquiredexception.php index d078ff34818..247c9f5f5cb 100644 --- a/lib/public/files/locknotacquiredexception.php +++ b/lib/public/files/locknotacquiredexception.php @@ -4,7 +4,7 @@ * @author Owen Winkler <a_github@midnightcircus.com> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/mount/imountmanager.php b/lib/public/files/mount/imountmanager.php index 9a0362b12fb..9e3002a26d1 100644 --- a/lib/public/files/mount/imountmanager.php +++ b/lib/public/files/mount/imountmanager.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/mount/imountpoint.php b/lib/public/files/mount/imountpoint.php index 5452bcdb03a..9ce1396c1d1 100644 --- a/lib/public/files/mount/imountpoint.php +++ b/lib/public/files/mount/imountpoint.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/node.php b/lib/public/files/node.php index aa1115f8c28..ee3f0cb0413 100644 --- a/lib/public/files/node.php +++ b/lib/public/files/node.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/notenoughspaceexception.php b/lib/public/files/notenoughspaceexception.php index a2cc0d6956b..4e67ac26700 100644 --- a/lib/public/files/notenoughspaceexception.php +++ b/lib/public/files/notenoughspaceexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/notfoundexception.php b/lib/public/files/notfoundexception.php index ae93e8d1e6d..10a3dacda44 100644 --- a/lib/public/files/notfoundexception.php +++ b/lib/public/files/notfoundexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/notpermittedexception.php b/lib/public/files/notpermittedexception.php index ee82ae56e51..3dcbd9e499b 100644 --- a/lib/public/files/notpermittedexception.php +++ b/lib/public/files/notpermittedexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/objectstore/iobjectstore.php b/lib/public/files/objectstore/iobjectstore.php index 5943731849e..78be18fb2e9 100644 --- a/lib/public/files/objectstore/iobjectstore.php +++ b/lib/public/files/objectstore/iobjectstore.php @@ -3,7 +3,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/reservedwordexception.php b/lib/public/files/reservedwordexception.php index fc70c607185..6a560a563fe 100644 --- a/lib/public/files/reservedwordexception.php +++ b/lib/public/files/reservedwordexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php index c42a2d05bc3..1c125221449 100644 --- a/lib/public/files/storage.php +++ b/lib/public/files/storage.php @@ -4,11 +4,11 @@ * @author Michael Roth <michael.roth@rz.uni-augsburg.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -33,16 +33,19 @@ // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP\Files; -use OCP\Files\InvalidPathException; + +use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; /** * Provide a common interface to all different storage options * * All paths passed to the storage are relative to the storage and should NOT have a leading slash. + * * @since 6.0.0 + * @deprecated 9.0.0 use \OCP\Files\Storage\IStorage instead */ -interface Storage { +interface Storage extends IStorage { /** * $parameters is a free form array with the configuration options needed to construct the storage * @@ -462,10 +465,4 @@ interface Storage { * @param bool $isAvailable */ public function setAvailability($isAvailable); - - /** - * @param $path path for which to retrieve the owner - * @since 9.0.0 - */ - public function getOwner($path); } diff --git a/lib/public/files/storage/ilockingstorage.php b/lib/public/files/storage/ilockingstorage.php new file mode 100644 index 00000000000..32cc32ffb05 --- /dev/null +++ b/lib/public/files/storage/ilockingstorage.php @@ -0,0 +1,60 @@ +<?php +/** + * @author Robin Appelman <icewind@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 OCP\Files\Storage; + +use OCP\Lock\ILockingProvider; + +/** + * Storage backends that require explicit locking + * + * Storage backends implementing this interface do not need to implement their own locking implementation but should use the provided lockingprovider instead + * The implementation of the locking methods only need to map internal storage paths to "lock keys" + * + * @since 9.0.0 + */ +interface ILockingStorage { + /** + * @param string $path The path of the file to acquire the lock for + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + * @since 9.0.0 + */ + public function acquireLock($path, $type, ILockingProvider $provider); + + /** + * @param string $path The path of the file to acquire the lock for + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @since 9.0.0 + */ + public function releaseLock($path, $type, ILockingProvider $provider); + + /** + * @param string $path The path of the file to change the lock for + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + * @since 9.0.0 + */ + public function changeLock($path, $type, ILockingProvider $provider); +} diff --git a/lib/public/files/storage/istorage.php b/lib/public/files/storage/istorage.php new file mode 100644 index 00000000000..4bc5e3536dc --- /dev/null +++ b/lib/public/files/storage/istorage.php @@ -0,0 +1,482 @@ +<?php +/** + * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Michael Roth <michael.roth@rz.uni-augsburg.de> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * @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/> + * + */ + +/** + * Public interface of ownCloud for apps to use. + * Files/Storage interface + */ + +// use OCP namespace for all classes that are considered public. +// This means that they should be used by apps instead of the internal ownCloud classes +namespace OCP\Files\Storage; + +use OCP\Files\Cache\ICache; +use OCP\Files\Cache\IPropagator; +use OCP\Files\Cache\IScanner; +use OCP\Files\Cache\IUpdater; +use OCP\Files\Cache\IWatcher; +use OCP\Files\InvalidPathException; + +/** + * Provide a common interface to all different storage options + * + * All paths passed to the storage are relative to the storage and should NOT have a leading slash. + * + * @since 9.0.0 + */ +interface IStorage { + /** + * $parameters is a free form array with the configuration options needed to construct the storage + * + * @param array $parameters + * @since 9.0.0 + */ + public function __construct($parameters); + + /** + * Get the identifier for the storage, + * the returned id should be the same for every storage object that is created with the same parameters + * and two storage objects with the same id should refer to two storages that display the same files. + * + * @return string + * @since 9.0.0 + */ + public function getId(); + + /** + * see http://php.net/manual/en/function.mkdir.php + * implementations need to implement a recursive mkdir + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function mkdir($path); + + /** + * see http://php.net/manual/en/function.rmdir.php + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function rmdir($path); + + /** + * see http://php.net/manual/en/function.opendir.php + * + * @param string $path + * @return resource|false + * @since 9.0.0 + */ + public function opendir($path); + + /** + * see http://php.net/manual/en/function.is-dir.php + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function is_dir($path); + + /** + * see http://php.net/manual/en/function.is-file.php + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function is_file($path); + + /** + * see http://php.net/manual/en/function.stat.php + * only the following keys are required in the result: size and mtime + * + * @param string $path + * @return array|false + * @since 9.0.0 + */ + public function stat($path); + + /** + * see http://php.net/manual/en/function.filetype.php + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function filetype($path); + + /** + * see http://php.net/manual/en/function.filesize.php + * The result for filesize when called on a folder is required to be 0 + * + * @param string $path + * @return int|false + * @since 9.0.0 + */ + public function filesize($path); + + /** + * check if a file can be created in $path + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function isCreatable($path); + + /** + * check if a file can be read + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function isReadable($path); + + /** + * check if a file can be written to + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function isUpdatable($path); + + /** + * check if a file can be deleted + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function isDeletable($path); + + /** + * check if a file can be shared + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function isSharable($path); + + /** + * get the full permissions of a path. + * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php + * + * @param string $path + * @return int + * @since 9.0.0 + */ + public function getPermissions($path); + + /** + * see http://php.net/manual/en/function.file_exists.php + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function file_exists($path); + + /** + * see http://php.net/manual/en/function.filemtime.php + * + * @param string $path + * @return int|false + * @since 9.0.0 + */ + public function filemtime($path); + + /** + * see http://php.net/manual/en/function.file_get_contents.php + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function file_get_contents($path); + + /** + * see http://php.net/manual/en/function.file_put_contents.php + * + * @param string $path + * @param string $data + * @return bool + * @since 9.0.0 + */ + public function file_put_contents($path, $data); + + /** + * see http://php.net/manual/en/function.unlink.php + * + * @param string $path + * @return bool + * @since 9.0.0 + */ + public function unlink($path); + + /** + * see http://php.net/manual/en/function.rename.php + * + * @param string $path1 + * @param string $path2 + * @return bool + * @since 9.0.0 + */ + public function rename($path1, $path2); + + /** + * see http://php.net/manual/en/function.copy.php + * + * @param string $path1 + * @param string $path2 + * @return bool + * @since 9.0.0 + */ + public function copy($path1, $path2); + + /** + * see http://php.net/manual/en/function.fopen.php + * + * @param string $path + * @param string $mode + * @return resource|false + * @since 9.0.0 + */ + public function fopen($path, $mode); + + /** + * get the mimetype for a file or folder + * The mimetype for a folder is required to be "httpd/unix-directory" + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function getMimeType($path); + + /** + * see http://php.net/manual/en/function.hash-file.php + * + * @param string $type + * @param string $path + * @param bool $raw + * @return string|false + * @since 9.0.0 + */ + public function hash($type, $path, $raw = false); + + /** + * see http://php.net/manual/en/function.free_space.php + * + * @param string $path + * @return int|false + * @since 9.0.0 + */ + public function free_space($path); + + /** + * search for occurrences of $query in file names + * + * @param string $query + * @return array|false + * @since 9.0.0 + */ + public function search($query); + + /** + * see http://php.net/manual/en/function.touch.php + * If the backend does not support the operation, false should be returned + * + * @param string $path + * @param int $mtime + * @return bool + * @since 9.0.0 + */ + public function touch($path, $mtime = null); + + /** + * get the path to a local version of the file. + * The local version of the file can be temporary and doesn't have to be persistent across requests + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function getLocalFile($path); + + /** + * get the path to a local version of the folder. + * The local version of the folder can be temporary and doesn't have to be persistent across requests + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function getLocalFolder($path); + + /** + * check if a file or folder has been updated since $time + * + * @param string $path + * @param int $time + * @return bool + * @since 9.0.0 + * + * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. + * returning true for other changes in the folder is optional + */ + public function hasUpdated($path, $time); + + /** + * get the ETag for a file or folder + * + * @param string $path + * @return string|false + * @since 9.0.0 + */ + public function getETag($path); + + /** + * Returns whether the storage is local, which means that files + * are stored on the local filesystem instead of remotely. + * Calling getLocalFile() for local storages should always + * return the local files, whereas for non-local storages + * it might return a temporary file. + * + * @return bool true if the files are stored locally, false otherwise + * @since 9.0.0 + */ + public function isLocal(); + + /** + * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class + * + * @param string $class + * @return bool + * @since 9.0.0 + */ + public function instanceOfStorage($class); + + /** + * A custom storage implementation can return an url for direct download of a give file. + * + * For now the returned array can hold the parameter url - in future more attributes might follow. + * + * @param string $path + * @return array|false + * @since 9.0.0 + */ + public function getDirectDownload($path); + + /** + * @param string $path the path of the target folder + * @param string $fileName the name of the file itself + * @return void + * @throws InvalidPathException + * @since 9.0.0 + */ + public function verifyPath($path, $fileName); + + /** + * @param \OCP\Files\Storage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + * @since 9.0.0 + */ + public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + + /** + * @param \OCP\Files\Storage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + * @since 9.0.0 + */ + public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); + + /** + * Test a storage for availability + * + * @since 9.0.0 + * @return bool + */ + public function test(); + + /** + * @since 9.0.0 + * @return array [ available, last_checked ] + */ + public function getAvailability(); + + /** + * @since 9.0.0 + * @param bool $isAvailable + */ + public function setAvailability($isAvailable); + + /** + * @param string $path path for which to retrieve the owner + * @since 9.0.0 + */ + public function getOwner($path); + + /** + * @return ICache + * @since 9.0.0 + */ + public function getCache(); + + /** + * @return IPropagator + * @since 9.0.0 + */ + public function getPropagator(); + + /** + * @return IScanner + * @since 9.0.0 + */ + public function getScanner(); + + /** + * @return IUpdater + * @since 9.0.0 + */ + public function getUpdater(); + + /** + * @return IWatcher + * @since 9.0.0 + */ + public function getWatcher(); +} diff --git a/lib/public/files/storage/istoragefactory.php b/lib/public/files/storage/istoragefactory.php index bd9651299cf..01a05eeff12 100644 --- a/lib/public/files/storage/istoragefactory.php +++ b/lib/public/files/storage/istoragefactory.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storageauthexception.php b/lib/public/files/storageauthexception.php index 6b49065038b..35a2907b856 100644 --- a/lib/public/files/storageauthexception.php +++ b/lib/public/files/storageauthexception.php @@ -1,8 +1,8 @@ <?php /** - * @author Jesus Macias <jesus@owncloud.com> + * @author Jesús Macias <jmacias@solidgear.es> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storagebadconfigexception.php b/lib/public/files/storagebadconfigexception.php index d72ad3358e5..1c340b18b7c 100644 --- a/lib/public/files/storagebadconfigexception.php +++ b/lib/public/files/storagebadconfigexception.php @@ -1,8 +1,8 @@ <?php /** - * @author Jesus Macias <jesus@owncloud.com> + * @author Jesús Macias <jmacias@solidgear.es> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storageconnectionexception.php b/lib/public/files/storageconnectionexception.php index c17367046e0..8938a60265c 100644 --- a/lib/public/files/storageconnectionexception.php +++ b/lib/public/files/storageconnectionexception.php @@ -1,8 +1,8 @@ <?php /** - * @author Jesus Macias <jesus@owncloud.com> + * @author Jesús Macias <jmacias@solidgear.es> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storageinvalidexception.php b/lib/public/files/storageinvalidexception.php index 11099c2fe03..a34ee7ae49a 100644 --- a/lib/public/files/storageinvalidexception.php +++ b/lib/public/files/storageinvalidexception.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/files/storagenotavailableexception.php b/lib/public/files/storagenotavailableexception.php index 323f5d9b7f8..4572a69f047 100644 --- a/lib/public/files/storagenotavailableexception.php +++ b/lib/public/files/storagenotavailableexception.php @@ -1,9 +1,11 @@ <?php /** + * @author Björn Schießle <schiessle@owncloud.com> + * @author Jesús Macias <jmacias@solidgear.es> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -32,8 +34,7 @@ use OC\HintException; /** * Storage is temporarily not available - * @since 6.0.0 - * @changed 8.2.1 based on HintException + * @since 6.0.0 - since 8.2.1 based on HintException */ class StorageNotAvailableException extends HintException { diff --git a/lib/public/files/storagetimeoutexception.php b/lib/public/files/storagetimeoutexception.php index c6682604b6d..ed4d98af89b 100644 --- a/lib/public/files/storagetimeoutexception.php +++ b/lib/public/files/storagetimeoutexception.php @@ -1,8 +1,8 @@ <?php /** - * @author Jesus Macias <jesus@owncloud.com> + * @author Jesús Macias <jmacias@solidgear.es> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/groupinterface.php b/lib/public/groupinterface.php index 16de6bc8663..142b3dea046 100644 --- a/lib/public/groupinterface.php +++ b/lib/public/groupinterface.php @@ -4,7 +4,7 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -32,9 +32,75 @@ namespace OCP; /** - * Interface GroupInterface + * TODO actually this is a IGroupBackend * * @package OCP * @since 4.5.0 */ -interface GroupInterface extends \OC_Group_Interface {} +interface GroupInterface { + + /** + * Check if backend implements actions + * @param int $actions bitwise-or'ed actions + * @return boolean + * @since 4.5.0 + * + * Returns the supported actions as int to be + * compared with \OC_Group_Backend::CREATE_GROUP etc. + */ + public function implementsActions($actions); + + /** + * is user in group? + * @param string $uid uid of the user + * @param string $gid gid of the group + * @return bool + * @since 4.5.0 + * + * Checks whether the user is member of a group or not. + */ + public function inGroup($uid, $gid); + + /** + * Get all groups a user belongs to + * @param string $uid Name of the user + * @return array an array of group names + * @since 4.5.0 + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public function getUserGroups($uid); + + /** + * get a list of all groups + * @param string $search + * @param int $limit + * @param int $offset + * @return array an array of group names + * @since 4.5.0 + * + * Returns a list with all groups + */ + public function getGroups($search = '', $limit = -1, $offset = 0); + + /** + * check if a group exists + * @param string $gid + * @return bool + * @since 4.5.0 + */ + public function groupExists($gid); + + /** + * get a list of all users in a group + * @param string $gid + * @param string $search + * @param int $limit + * @param int $offset + * @return array an array of user ids + * @since 4.5.0 + */ + public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0); + +} diff --git a/lib/public/http/client/iclient.php b/lib/public/http/client/iclient.php index 494ca7d419e..85db2a9ad02 100644 --- a/lib/public/http/client/iclient.php +++ b/lib/public/http/client/iclient.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/http/client/iclientservice.php b/lib/public/http/client/iclientservice.php index 14dfcc071b8..907aa42fd3b 100644 --- a/lib/public/http/client/iclientservice.php +++ b/lib/public/http/client/iclientservice.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/http/client/iresponse.php b/lib/public/http/client/iresponse.php index 18371ddbbe6..09189d77014 100644 --- a/lib/public/http/client/iresponse.php +++ b/lib/public/http/client/iresponse.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iaddressbook.php b/lib/public/iaddressbook.php index f3f60ab22d7..63e7e061448 100644 --- a/lib/public/iaddressbook.php +++ b/lib/public/iaddressbook.php @@ -2,10 +2,10 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iappconfig.php b/lib/public/iappconfig.php index d89ffd9194a..a4bcc970188 100644 --- a/lib/public/iappconfig.php +++ b/lib/public/iappconfig.php @@ -3,10 +3,10 @@ * @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 Robin McCorkell <robin@mccorkell.me.uk> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iavatar.php b/lib/public/iavatar.php index 3d92d00b83d..fc4058ab4f2 100644 --- a/lib/public/iavatar.php +++ b/lib/public/iavatar.php @@ -4,9 +4,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iavatarmanager.php b/lib/public/iavatarmanager.php index 5ad5bf6a364..264c4fcf051 100644 --- a/lib/public/iavatarmanager.php +++ b/lib/public/iavatarmanager.php @@ -3,9 +3,9 @@ * @author Arthur Schiwon <blizzz@owncloud.com> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/icache.php b/lib/public/icache.php index d7593a263c8..3319013ddfa 100644 --- a/lib/public/icache.php +++ b/lib/public/icache.php @@ -4,7 +4,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/icachefactory.php b/lib/public/icachefactory.php index a030b7fc5bc..233a4f5525d 100644 --- a/lib/public/icachefactory.php +++ b/lib/public/icachefactory.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/icertificate.php b/lib/public/icertificate.php index 73abc030934..c3a003fbf0a 100644 --- a/lib/public/icertificate.php +++ b/lib/public/icertificate.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/icertificatemanager.php b/lib/public/icertificatemanager.php index b1a16d8b5ee..27eebcf0491 100644 --- a/lib/public/icertificatemanager.php +++ b/lib/public/icertificatemanager.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -54,8 +54,18 @@ interface ICertificateManager { /** * Get the path to the certificate bundle for this user * + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle (since 9.0.0) * @return string * @since 8.0.0 */ - public function getCertificateBundle(); + public function getCertificateBundle($uid = ''); + + /** + * Get the full local path to the certificate bundle for this user + * + * @param string $uid (optional) user to get the certificate bundle for, use `null` to get the system bundle + * @return string + * @since 9.0.0 + */ + public function getAbsoluteBundlePath($uid = ''); } diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php index 933eef97ae1..8dac390a99c 100644 --- a/lib/public/iconfig.php +++ b/lib/public/iconfig.php @@ -8,7 +8,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/icontainer.php b/lib/public/icontainer.php index 23c75aeaaf8..d23ee5ea3b5 100644 --- a/lib/public/icontainer.php +++ b/lib/public/icontainer.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/idatetimeformatter.php b/lib/public/idatetimeformatter.php index 77afd6930ce..e8d357ae50f 100644 --- a/lib/public/idatetimeformatter.php +++ b/lib/public/idatetimeformatter.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/idatetimezone.php b/lib/public/idatetimezone.php index 2334f1314b5..3df705a2413 100644 --- a/lib/public/idatetimezone.php +++ b/lib/public/idatetimezone.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/idb.php b/lib/public/idb.php index f3e7915d9f7..f21fedd1f54 100644 --- a/lib/public/idb.php +++ b/lib/public/idb.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php index 945ca142163..c5767e65a82 100644 --- a/lib/public/idbconnection.php +++ b/lib/public/idbconnection.php @@ -6,7 +6,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -109,6 +109,20 @@ interface IDBConnection { public function insertIfNotExist($table, $input, array $compare = null); /** + * Insert or update a row value + * + * @param string $table + * @param array $keys (column name => value) + * @param array $values (column name => value) + * @param array $updatePreconditionValues ensure values match preconditions (column name => value) + * @return int number of new rows + * @throws \Doctrine\DBAL\DBALException + * @throws PreconditionNotMetException + * @since 9.0.0 + */ + public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []); + + /** * Start a transaction * @since 6.0.0 */ diff --git a/lib/public/ieventsource.php b/lib/public/ieventsource.php index 176d5677f0a..b643d1c9da7 100644 --- a/lib/public/ieventsource.php +++ b/lib/public/ieventsource.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/igroup.php b/lib/public/igroup.php index b16bb94d43f..02f2ef201fd 100644 --- a/lib/public/igroup.php +++ b/lib/public/igroup.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/igroupmanager.php b/lib/public/igroupmanager.php index da80cfdd374..7eabc8a59b0 100644 --- a/lib/public/igroupmanager.php +++ b/lib/public/igroupmanager.php @@ -5,8 +5,9 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -52,7 +53,7 @@ interface IGroupManager { public function isBackendUsed($backendClass); /** - * @param \OCP\UserInterface $backend + * @param \OCP\GroupInterface $backend * @since 8.0.0 */ public function addBackend($backend); diff --git a/lib/public/ihelper.php b/lib/public/ihelper.php index 45a078b6cbc..4ad1d5704fd 100644 --- a/lib/public/ihelper.php +++ b/lib/public/ihelper.php @@ -4,7 +4,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iimage.php b/lib/public/iimage.php index 38db14db77c..db0ca0f93be 100644 --- a/lib/public/iimage.php +++ b/lib/public/iimage.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Olivier Paroz <github@oparoz.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/il10n.php b/lib/public/il10n.php index 67a6c2162de..f1954eeb4b9 100644 --- a/lib/public/il10n.php +++ b/lib/public/il10n.php @@ -5,9 +5,10 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/ilogger.php b/lib/public/ilogger.php index 27a5d63dfdb..2a727697a6a 100644 --- a/lib/public/ilogger.php +++ b/lib/public/ilogger.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -125,6 +125,14 @@ interface ILogger { /** * Logs an exception very detailed + * An additional message can we written to the log by adding it to the + * context. + * + * <code> + * $logger->logException($ex, [ + * 'message' => 'Exception during cron job execution' + * ]); + * </code> * * @param \Exception $exception * @param array $context diff --git a/lib/public/image.php b/lib/public/image.php index ebcae80f8e8..4a7ffe8bc9a 100644 --- a/lib/public/image.php +++ b/lib/public/image.php @@ -4,7 +4,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/imemcache.php b/lib/public/imemcache.php index 01c29903039..b5c0cef923d 100644 --- a/lib/public/imemcache.php +++ b/lib/public/imemcache.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/imemcachettl.php b/lib/public/imemcachettl.php index 3c2bfe8ad27..f2d03dcdf40 100644 --- a/lib/public/imemcachettl.php +++ b/lib/public/imemcachettl.php @@ -1,8 +1,9 @@ <?php /** + * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/inavigationmanager.php b/lib/public/inavigationmanager.php index fe2a4cfee27..243f6ea3eea 100644 --- a/lib/public/inavigationmanager.php +++ b/lib/public/inavigationmanager.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/ipreview.php b/lib/public/ipreview.php index fc81da976b9..cfcbebd8639 100644 --- a/lib/public/ipreview.php +++ b/lib/public/ipreview.php @@ -5,7 +5,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/irequest.php b/lib/public/irequest.php index acfc4f3f1d0..a0040aa464d 100644 --- a/lib/public/irequest.php +++ b/lib/public/irequest.php @@ -7,7 +7,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -91,6 +91,7 @@ interface IRequest { * Returns all params that were received, be it from the request * * (as GET or POST) or through the URL by the route + * * @return array the array with all parameters * @since 6.0.0 */ @@ -136,6 +137,7 @@ interface IRequest { /** * Checks if the CSRF check was correct + * * @return bool true if CSRF check passed * @since 6.0.0 */ @@ -144,6 +146,7 @@ interface IRequest { /** * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging * If `mod_unique_id` is installed this value will be taken. + * * @return string * @since 8.1.0 */ @@ -154,6 +157,7 @@ interface IRequest { * and `forwarded_for_headers` has been configured then the IP address * specified in this header will be returned instead. * Do always use this instead of $_SERVER['REMOTE_ADDR'] + * * @return string IP address * @since 8.1.0 */ @@ -162,6 +166,7 @@ interface IRequest { /** * Returns the server protocol. It respects reverse proxy servers and load * balancers. + * * @return string Server protocol (http or https) * @since 8.1.0 */ @@ -176,15 +181,17 @@ interface IRequest { public function getHttpProtocol(); /** - * Returns the request uri, even if the website uses one or more - * reverse proxies - * @return string + * Returns the request uri, even if the website uses one or more + * reverse proxies + * + * @return string * @since 8.1.0 - */ + */ public function getRequestUri(); /** * Get raw PathInfo from request (not urldecoded) + * * @throws \Exception * @return string Path info * @since 8.1.0 @@ -193,6 +200,7 @@ interface IRequest { /** * Get PathInfo from request + * * @throws \Exception * @return string|false Path info or false when not found * @since 8.1.0 @@ -202,6 +210,7 @@ interface IRequest { /** * Returns the script name, even if the website uses one or more * reverse proxies + * * @return string the script name * @since 8.1.0 */ @@ -209,6 +218,7 @@ interface IRequest { /** * Checks whether the user agent matches a given regex + * * @param array $agent array of agent names * @return bool true if at least one of the given agent matches, false otherwise * @since 8.1.0 @@ -218,6 +228,7 @@ interface IRequest { /** * Returns the unverified server host from the headers without checking * whether it is a trusted domain + * * @return string Server host * @since 8.1.0 */ @@ -226,6 +237,7 @@ interface IRequest { /** * Returns the server host from the headers, or the first configured * trusted domain if the host isn't in the trusted list + * * @return string Server host * @since 8.1.0 */ diff --git a/lib/public/isearch.php b/lib/public/isearch.php index f7a9b5fb55c..ec6673dabbd 100644 --- a/lib/public/isearch.php +++ b/lib/public/isearch.php @@ -6,7 +6,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 267e5dc4d31..e21c9fb8e4b 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -1,5 +1,6 @@ <?php /** + * @author Arthur Schiwon <blizzz@owncloud.com> * @author Bart Visscher <bartv@thisnet.nl> * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Björn Schießle <schiessle@owncloud.com> @@ -9,12 +10,13 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> + * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -179,6 +181,14 @@ interface IServerContainer { public function getSecureRandom(); /** + * Returns a CredentialsManager instance + * + * @return \OCP\Security\ICredentialsManager + * @since 9.0.0 + */ + public function getCredentialsManager(); + + /** * Returns an instance of the db facade * @deprecated 8.1.0 use getDatabaseConnection, will be removed in ownCloud 10 * @return \OCP\IDb @@ -326,7 +336,7 @@ interface IServerContainer { /** * Get the certificate manager for the user * - * @param string $userId (optional) if not specified the current loggedin user is used + * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in * @since 8.0.0 */ @@ -466,8 +476,8 @@ interface IServerContainer { /** * Get the Notification Manager * - * @return \OC\Notification\IManager - * @since 8.2.0 + * @return \OCP\Notification\IManager + * @since 9.0.0 */ public function getNotificationManager(); diff --git a/lib/public/isession.php b/lib/public/isession.php index 89a181ad0fd..25c76906d63 100644 --- a/lib/public/isession.php +++ b/lib/public/isession.php @@ -1,10 +1,11 @@ <?php /** + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/itagmanager.php b/lib/public/itagmanager.php index 5ed005548d3..e6d67ddd02c 100644 --- a/lib/public/itagmanager.php +++ b/lib/public/itagmanager.php @@ -5,7 +5,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/itags.php b/lib/public/itags.php index 12dbdc1522a..cbc178c37bf 100644 --- a/lib/public/itags.php +++ b/lib/public/itags.php @@ -5,7 +5,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/itempmanager.php b/lib/public/itempmanager.php index 73e21dd0aeb..025e43d8563 100644 --- a/lib/public/itempmanager.php +++ b/lib/public/itempmanager.php @@ -2,9 +2,9 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iurlgenerator.php b/lib/public/iurlgenerator.php index 3be27d87fa1..a702ca47bfc 100644 --- a/lib/public/iurlgenerator.php +++ b/lib/public/iurlgenerator.php @@ -5,7 +5,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iuser.php b/lib/public/iuser.php index 67e2b107e0b..454d45eae76 100644 --- a/lib/public/iuser.php +++ b/lib/public/iuser.php @@ -5,7 +5,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -169,4 +169,13 @@ interface IUser { * @since 9.0.0 */ public function getCloudId(); + + /** + * set the email address of the user + * + * @param string|null $mailAddress + * @return void + * @since 9.0.0 + */ + public function setEMailAddress($mailAddress); } diff --git a/lib/public/iuserbackend.php b/lib/public/iuserbackend.php index 2c472596b77..5cd7945dd7a 100644 --- a/lib/public/iuserbackend.php +++ b/lib/public/iuserbackend.php @@ -2,7 +2,7 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iusermanager.php b/lib/public/iusermanager.php index 3a0abaca7b7..057bd8e89fb 100644 --- a/lib/public/iusermanager.php +++ b/lib/public/iusermanager.php @@ -3,8 +3,9 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/iusersession.php b/lib/public/iusersession.php index 2dde25634d6..2196f2c8ce0 100644 --- a/lib/public/iusersession.php +++ b/lib/public/iusersession.php @@ -7,7 +7,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/json.php b/lib/public/json.php index ddb94dffdbe..fceffa0001e 100644 --- a/lib/public/json.php +++ b/lib/public/json.php @@ -8,7 +8,7 @@ * @author Thomas Tanghus <thomas@tanghus.net> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/l10n/ifactory.php b/lib/public/l10n/ifactory.php index b784505a68b..fa3f84fa2fd 100644 --- a/lib/public/l10n/ifactory.php +++ b/lib/public/l10n/ifactory.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/lock/ilockingprovider.php b/lib/public/lock/ilockingprovider.php index f1aa7956033..b4b579bbc7a 100644 --- a/lib/public/lock/ilockingprovider.php +++ b/lib/public/lock/ilockingprovider.php @@ -3,7 +3,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/lock/lockedexception.php b/lib/public/lock/lockedexception.php index e7071339618..d084046046e 100644 --- a/lib/public/lock/lockedexception.php +++ b/lib/public/lock/lockedexception.php @@ -4,7 +4,7 @@ * @author Robin Appelman <icewind@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/mail/imailer.php b/lib/public/mail/imailer.php index ac3fe9b0e49..61eb895752b 100644 --- a/lib/public/mail/imailer.php +++ b/lib/public/mail/imailer.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/private/notification/iaction.php b/lib/public/notification/iaction.php index f7366dd4388..1f4d1d5b7fe 100644 --- a/lib/private/notification/iaction.php +++ b/lib/public/notification/iaction.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -19,30 +19,26 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IAction * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IAction { /** * @param string $label * @return $this * @throws \InvalidArgumentException if the label is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLabel($label); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLabel(); @@ -50,13 +46,13 @@ interface IAction { * @param string $label * @return $this * @throws \InvalidArgumentException if the label is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedLabel($label); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedLabel(); @@ -79,31 +75,31 @@ interface IAction { * @param string $requestType * @return $this * @throws \InvalidArgumentException if the link is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLink($link, $requestType); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLink(); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getRequestType(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValid(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValidParsed(); } diff --git a/lib/private/notification/iapp.php b/lib/public/notification/iapp.php index eda66423f3a..98da265559b 100644 --- a/lib/private/notification/iapp.php +++ b/lib/public/notification/iapp.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -19,38 +19,34 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IApp * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IApp { /** * @param INotification $notification * @return null * @throws \InvalidArgumentException When the notification is not valid - * @since 8.2.0 + * @since 9.0.0 */ public function notify(INotification $notification); /** * @param INotification $notification * @return null - * @since 8.2.0 + * @since 9.0.0 */ public function markProcessed(INotification $notification); /** * @param INotification $notification * @return int - * @since 8.2.0 + * @since 9.0.0 */ public function getCount(INotification $notification); } diff --git a/lib/private/notification/imanager.php b/lib/public/notification/imanager.php index f4a5fb14e31..a18af747b10 100644 --- a/lib/private/notification/imanager.php +++ b/lib/public/notification/imanager.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -19,44 +19,48 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IManager * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IManager extends IApp, INotifier { /** * @param \Closure $service The service must implement IApp, otherwise a * \InvalidArgumentException is thrown later * @return null - * @since 8.2.0 + * @since 9.0.0 */ public function registerApp(\Closure $service); /** * @param \Closure $service The service must implement INotifier, otherwise a * \InvalidArgumentException is thrown later + * @param \Closure $info An array with the keys 'id' and 'name' containing + * the app id and the app name * @return null - * @since 8.2.0 + * @since 9.0.0 + */ + public function registerNotifier(\Closure $service, \Closure $info); + + /** + * @return array App ID => App Name + * @since 9.0.0 */ - public function registerNotifier(\Closure $service); + public function listNotifiers(); /** * @return INotification - * @since 8.2.0 + * @since 9.0.0 */ public function createNotification(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function hasNotifiers(); } diff --git a/lib/private/notification/inotification.php b/lib/public/notification/inotification.php index 0187abab152..2d8557ec64d 100644 --- a/lib/private/notification/inotification.php +++ b/lib/public/notification/inotification.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -19,30 +19,26 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface INotification * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface INotification { /** * @param string $app * @return $this * @throws \InvalidArgumentException if the app id are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setApp($app); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getApp(); @@ -50,13 +46,13 @@ interface INotification { * @param string $user * @return $this * @throws \InvalidArgumentException if the user id are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setUser($user); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getUser(); @@ -79,21 +75,19 @@ interface INotification { * @param string $id * @return $this * @throws \InvalidArgumentException if the object type or id is invalid - * @since 8.2.0 - * @changed 9.0.0 Type of $id changed to string + * @since 9.0.0 */ public function setObject($type, $id); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getObjectType(); /** * @return string - * @since 8.2.0 - * @changed 9.0.0 Return type changed to string + * @since 9.0.0 */ public function getObjectId(); @@ -102,19 +96,19 @@ interface INotification { * @param array $parameters * @return $this * @throws \InvalidArgumentException if the subject or parameters are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setSubject($subject, array $parameters = []); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getSubject(); /** * @return string[] - * @since 8.2.0 + * @since 9.0.0 */ public function getSubjectParameters(); @@ -122,13 +116,13 @@ interface INotification { * @param string $subject * @return $this * @throws \InvalidArgumentException if the subject are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedSubject($subject); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedSubject(); @@ -137,19 +131,19 @@ interface INotification { * @param array $parameters * @return $this * @throws \InvalidArgumentException if the message or parameters are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setMessage($message, array $parameters = []); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getMessage(); /** * @return string[] - * @since 8.2.0 + * @since 9.0.0 */ public function getMessageParameters(); @@ -157,13 +151,13 @@ interface INotification { * @param string $message * @return $this * @throws \InvalidArgumentException if the message are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedMessage($message); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedMessage(); @@ -171,19 +165,19 @@ interface INotification { * @param string $link * @return $this * @throws \InvalidArgumentException if the link are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLink($link); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLink(); /** * @return IAction - * @since 8.2.0 + * @since 9.0.0 */ public function createAction(); @@ -191,13 +185,13 @@ interface INotification { * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function addAction(IAction $action); /** * @return IAction[] - * @since 8.2.0 + * @since 9.0.0 */ public function getActions(); @@ -205,25 +199,25 @@ interface INotification { * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function addParsedAction(IAction $action); /** * @return IAction[] - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedActions(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValid(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValidParsed(); } diff --git a/lib/private/notification/inotifier.php b/lib/public/notification/inotifier.php index 22531229e3f..0d9cecc88b8 100644 --- a/lib/private/notification/inotifier.php +++ b/lib/public/notification/inotifier.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -19,17 +19,13 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface INotifier * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface INotifier { /** @@ -37,7 +33,7 @@ interface INotifier { * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException When the notification was not prepared by a notifier - * @since 8.2.0 + * @since 9.0.0 */ public function prepare(INotification $notification, $languageCode); } diff --git a/lib/public/preconditionnotmetexception.php b/lib/public/preconditionnotmetexception.php index 6f1b683526d..212efc08ded 100644 --- a/lib/public/preconditionnotmetexception.php +++ b/lib/public/preconditionnotmetexception.php @@ -2,7 +2,7 @@ /** * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/preview/iprovider.php b/lib/public/preview/iprovider.php index 821cdb32fa3..8231e90f000 100644 --- a/lib/public/preview/iprovider.php +++ b/lib/public/preview/iprovider.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/response.php b/lib/public/response.php index 953c797824c..ff0b4d8463a 100644 --- a/lib/public/response.php +++ b/lib/public/response.php @@ -9,7 +9,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/route/iroute.php b/lib/public/route/iroute.php index 4c9b4ca9b47..904cb81b0bd 100644 --- a/lib/public/route/iroute.php +++ b/lib/public/route/iroute.php @@ -3,9 +3,9 @@ * @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 Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/route/irouter.php b/lib/public/route/irouter.php index 63e7b9b6202..b4573fb39f2 100644 --- a/lib/public/route/irouter.php +++ b/lib/public/route/irouter.php @@ -2,10 +2,12 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @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 Roeland Jago Douma <rullzer@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/sabrepluginevent.php b/lib/public/sabrepluginevent.php index fed3237166d..b0c8257a4fb 100644 --- a/lib/public/sabrepluginevent.php +++ b/lib/public/sabrepluginevent.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -23,6 +23,7 @@ namespace OCP; use OCP\AppFramework\Http; +use Sabre\DAV\Server; use Symfony\Component\EventDispatcher\Event; /** @@ -36,12 +37,16 @@ class SabrePluginEvent extends Event { /** @var string */ protected $message; + /** @var Server */ + protected $server; + /** * @since 8.2.0 */ - public function __construct() { + public function __construct($server = null) { $this->message = ''; $this->statusCode = Http::STATUS_OK; + $this->server = $server; } /** @@ -79,4 +84,12 @@ class SabrePluginEvent extends Event { public function getMessage() { return $this->message; } + + /** + * @return null|Server + * @since 9.0.0 + */ + public function getServer() { + return $this->server; + } } diff --git a/lib/public/sabrepluginexception.php b/lib/public/sabrepluginexception.php index 5dba3b90a02..2c5a799c4f7 100644 --- a/lib/public/sabrepluginexception.php +++ b/lib/public/sabrepluginexception.php @@ -2,7 +2,7 @@ /** * @author Joas Schilling <nickvergessen@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/search/pagedprovider.php b/lib/public/search/pagedprovider.php index 7452bbd47bb..93289a1bde4 100644 --- a/lib/public/search/pagedprovider.php +++ b/lib/public/search/pagedprovider.php @@ -3,7 +3,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/search/provider.php b/lib/public/search/provider.php index 2f2cd03eb6a..9bcbe36ef7a 100644 --- a/lib/public/search/provider.php +++ b/lib/public/search/provider.php @@ -6,7 +6,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/search/result.php b/lib/public/search/result.php index 71c8b021a8e..e90c2619032 100644 --- a/lib/public/search/result.php +++ b/lib/public/search/result.php @@ -5,7 +5,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/security/icredentialsmanager.php b/lib/public/security/icredentialsmanager.php new file mode 100644 index 00000000000..d3d076f043e --- /dev/null +++ b/lib/public/security/icredentialsmanager.php @@ -0,0 +1,71 @@ +<?php +/** + * @author Robin McCorkell <rmccorkell@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 OCP\Security; + +/** + * Store and retrieve credentials for external services + * + * @package OCP\Security + * @since 8.2.0 + */ +interface ICredentialsManager { + + /** + * Store a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @param mixed $credentials + * @since 8.2.0 + */ + public function store($userId, $identifier, $credentials); + + /** + * Retrieve a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @return mixed + * @since 8.2.0 + */ + public function retrieve($userId, $identifier); + + /** + * Delete a set of credentials + * + * @param string|null $userId Null for system-wide credentials + * @param string $identifier + * @return int rows removed + * @since 8.2.0 + */ + public function delete($userId, $identifier); + + /** + * Erase all credentials stored for a user + * + * @param string $userId + * @return int rows removed + * @since 8.2.0 + */ + public function erase($userId); + +} diff --git a/lib/public/security/icrypto.php b/lib/public/security/icrypto.php index 167baab8233..62f27017ab7 100644 --- a/lib/public/security/icrypto.php +++ b/lib/public/security/icrypto.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/security/ihasher.php b/lib/public/security/ihasher.php index 14229ba99c1..39ba5094b12 100644 --- a/lib/public/security/ihasher.php +++ b/lib/public/security/ihasher.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/security/isecurerandom.php b/lib/public/security/isecurerandom.php index 8315d0f971a..9b346afe680 100644 --- a/lib/public/security/isecurerandom.php +++ b/lib/public/security/isecurerandom.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/security/stringutils.php b/lib/public/security/stringutils.php index 7cf12ea2702..ff1e290315a 100644 --- a/lib/public/security/stringutils.php +++ b/lib/public/security/stringutils.php @@ -3,7 +3,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/share.php b/lib/public/share.php index 86d1ffc9be2..e21d82bf62c 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -8,12 +8,12 @@ * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Michael Kuhn <suraia@ikkoku.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/share_backend.php b/lib/public/share_backend.php index 35ed650b173..110403c1f49 100644 --- a/lib/public/share_backend.php +++ b/lib/public/share_backend.php @@ -3,9 +3,9 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/share_backend_collection.php b/lib/public/share_backend_collection.php index 7378fd2a46d..185cf32ce3e 100644 --- a/lib/public/share_backend_collection.php +++ b/lib/public/share_backend_collection.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/share_backend_file_dependent.php b/lib/public/share_backend_file_dependent.php index b95e0bd84d2..64b3bf43319 100644 --- a/lib/public/share_backend_file_dependent.php +++ b/lib/public/share_backend_file_dependent.php @@ -3,7 +3,7 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/systemtag/isystemtag.php b/lib/public/systemtag/isystemtag.php index 26609fd8af7..02d02037293 100644 --- a/lib/public/systemtag/isystemtag.php +++ b/lib/public/systemtag/isystemtag.php @@ -2,7 +2,7 @@ /** * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/systemtag/isystemtagmanager.php b/lib/public/systemtag/isystemtagmanager.php index 6e8fed36dce..983bfd636ce 100644 --- a/lib/public/systemtag/isystemtagmanager.php +++ b/lib/public/systemtag/isystemtagmanager.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/systemtag/isystemtagmanagerfactory.php b/lib/public/systemtag/isystemtagmanagerfactory.php new file mode 100644 index 00000000000..ad7467633b1 --- /dev/null +++ b/lib/public/systemtag/isystemtagmanagerfactory.php @@ -0,0 +1,59 @@ +<?php +/** + * @author Vincent Petry <pvince81@owncloud.com> + * + * @copyright Copyright (c) 2016, 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 OCP\SystemTag; + +use OCP\IServerContainer; + +/** + * Interface ISystemTagManagerFactory + * + * Factory interface for system tag managers + * + * @package OCP\SystemTag + * @since 9.0.0 + */ +interface ISystemTagManagerFactory { + + /** + * Constructor for the system tag manager factory + * + * @param IServerContainer $serverContainer server container + * @since 9.0.0 + */ + public function __construct(IServerContainer $serverContainer); + + /** + * creates and returns an instance of the system tag manager + * + * @return ISystemTagManager + * @since 9.0.0 + */ + public function getManager(); + + /** + * creates and returns an instance of the system tag object + * mapper + * + * @return ISystemTagObjectMapper + * @since 9.0.0 + */ + public function getObjectMapper(); +} diff --git a/lib/public/systemtag/isystemtagobjectmapper.php b/lib/public/systemtag/isystemtagobjectmapper.php index e2ac1fab124..8db5cdd31aa 100644 --- a/lib/public/systemtag/isystemtagobjectmapper.php +++ b/lib/public/systemtag/isystemtagobjectmapper.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/systemtag/tagalreadyexistsexception.php b/lib/public/systemtag/tagalreadyexistsexception.php index d192b38e7bc..5c3d86ad642 100644 --- a/lib/public/systemtag/tagalreadyexistsexception.php +++ b/lib/public/systemtag/tagalreadyexistsexception.php @@ -2,7 +2,7 @@ /** * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/systemtag/tagnotfoundexception.php b/lib/public/systemtag/tagnotfoundexception.php index d0a35eb59e9..12feda8f58a 100644 --- a/lib/public/systemtag/tagnotfoundexception.php +++ b/lib/public/systemtag/tagnotfoundexception.php @@ -1,8 +1,9 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/template.php b/lib/public/template.php index b308240306d..7e46745c9d8 100644 --- a/lib/public/template.php +++ b/lib/public/template.php @@ -7,11 +7,11 @@ * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -45,7 +45,7 @@ namespace OCP; * @param string $image * @return string to the image * - * @see OC_Helper::imagePath + * @see \OCP\IURLGenerator::imagePath * @deprecated 8.0.0 Use \OCP\Template::image_path() instead */ function image_path( $app, $image ) { @@ -144,7 +144,7 @@ class Template extends \OC_Template { /** * Make OC_Helper::imagePath available as a simple function * - * @see OC_Helper::imagePath + * @see \OCP\IURLGenerator::imagePath * * @param string $app * @param string $image diff --git a/lib/public/user.php b/lib/public/user.php index 23f77c0a35f..825e77aef6d 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -8,10 +8,10 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify diff --git a/lib/public/userinterface.php b/lib/public/userinterface.php index cf91e519813..68831dcb503 100644 --- a/lib/public/userinterface.php +++ b/lib/public/userinterface.php @@ -4,7 +4,7 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Morris Jobke <hey@morrisjobke.de> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify @@ -32,9 +32,75 @@ namespace OCP; /** - * Interface UserInterface + * TODO actually this is a IUserBackend * * @package OCP * @since 4.5.0 */ -interface UserInterface extends \OC_User_Interface {} +interface UserInterface { + + /** + * Check if backend implements actions + * @param int $actions bitwise-or'ed actions + * @return boolean + * + * Returns the supported actions as int to be + * compared with \OC_User_Backend::CREATE_USER etc. + * @since 4.5.0 + */ + public function implementsActions($actions); + + /** + * delete a user + * @param string $uid The username of the user to delete + * @return bool + * @since 4.5.0 + */ + public function deleteUser($uid); + + /** + * Get a list of all users + * + * @param string $search + * @param null|int $limit + * @param null|int $offset + * @return string[] an array of all uids + * @since 4.5.0 + */ + public function getUsers($search = '', $limit = null, $offset = null); + + /** + * check if a user exists + * @param string $uid the username + * @return boolean + * @since 4.5.0 + */ + public function userExists($uid); + + /** + * get display name of the user + * @param string $uid user ID of the user + * @return string display name + * @since 4.5.0 + */ + public function getDisplayName($uid); + + /** + * Get a list of all display names and user ids. + * + * @param string $search + * @param string|null $limit + * @param string|null $offset + * @return array an array of all displayNames (value) and the corresponding uids (key) + * @since 4.5.0 + */ + public function getDisplayNames($search = '', $limit = null, $offset = null); + + /** + * Check if a user list is available or not + * @return boolean if users can be listed or not + * @since 4.5.0 + */ + public function hasUserListings(); + +} diff --git a/lib/public/util.php b/lib/public/util.php index 55bbd01eeaf..4762f595c2d 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -6,7 +6,6 @@ * @author Frank Karlitschek <frank@owncloud.org> * @author Georg Ehrke <georg@owncloud.com> * @author Individual IT Services <info@individual-it.net> - * @author itheiss <ingo.theiss@i-matrixx.de> * @author Jens-Christian Fischer <jens-christian.fischer@switch.ch> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> @@ -16,14 +15,15 @@ * @author Pellaeon Lin <nfsmwlin@gmail.com> * @author Randolph Carter <RandolphCarter@fantasymail.de> * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * - * @copyright Copyright (c) 2015, ownCloud, Inc. + * @copyright Copyright (c) 2016, ownCloud, Inc. * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify |