diff options
Diffstat (limited to 'lib')
59 files changed, 338 insertions, 83 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php index b94ac6c5ee4..b91681946a5 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -2,6 +2,7 @@ /** * @author Andreas Fischer <bantu@owncloud.com> * @author Georg Ehrke <georg@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> * @author Markus Goetz <markus@woboq.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> diff --git a/lib/l10n/nb_NO.js b/lib/l10n/nb_NO.js index 7b80c23ec01..595d85efdfe 100644 --- a/lib/l10n/nb_NO.js +++ b/lib/l10n/nb_NO.js @@ -87,6 +87,7 @@ OC.L10N.register( "Sharing %s failed, because the backend does not allow shares from type %i" : "Deling av %s feilet, fordi serveren ikke tillater delinger fra type %i", "Sharing %s failed, because the file does not exist" : "Deling av %s feilet, fordi filen ikke eksisterer", "You are not allowed to share %s" : "Du har ikke lov til å dele %s", + "Sharing %s failed, because you can not share with yourself" : "Deling av %s feilet fordi du ikke kan dele med deg selv", "Sharing %s failed, because the user %s does not exist" : "Deling av %s feilet, fordi brukeren %s ikke finnes", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Deling av %s feilet, fordi brukeren %s ikke er medlem av noen grupper som %s er medlem av", "Sharing %s failed, because this item is already shared with %s" : "Deling av %s feilet, fordi dette elementet allerede er delt med %s", @@ -105,6 +106,7 @@ OC.L10N.register( "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Delings-server %s må implementere grensesnittet OCP\\Share_Backend", "Sharing backend %s not found" : "Delings-server %s ikke funnet", "Sharing backend for %s not found" : "Delings-server for %s ikke funnet", + "Sharing failed, because the user %s is the original sharer" : "Deling feilet fordi brukeren %s er den som delte opprinnelig", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Deling av %s feilet, fordi tillatelsene går utover tillatelsene som er gitt til %s", "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", diff --git a/lib/l10n/nb_NO.json b/lib/l10n/nb_NO.json index 04cb7e47e82..fdfe7defa8a 100644 --- a/lib/l10n/nb_NO.json +++ b/lib/l10n/nb_NO.json @@ -85,6 +85,7 @@ "Sharing %s failed, because the backend does not allow shares from type %i" : "Deling av %s feilet, fordi serveren ikke tillater delinger fra type %i", "Sharing %s failed, because the file does not exist" : "Deling av %s feilet, fordi filen ikke eksisterer", "You are not allowed to share %s" : "Du har ikke lov til å dele %s", + "Sharing %s failed, because you can not share with yourself" : "Deling av %s feilet fordi du ikke kan dele med deg selv", "Sharing %s failed, because the user %s does not exist" : "Deling av %s feilet, fordi brukeren %s ikke finnes", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Deling av %s feilet, fordi brukeren %s ikke er medlem av noen grupper som %s er medlem av", "Sharing %s failed, because this item is already shared with %s" : "Deling av %s feilet, fordi dette elementet allerede er delt med %s", @@ -103,6 +104,7 @@ "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Delings-server %s må implementere grensesnittet OCP\\Share_Backend", "Sharing backend %s not found" : "Delings-server %s ikke funnet", "Sharing backend for %s not found" : "Delings-server for %s ikke funnet", + "Sharing failed, because the user %s is the original sharer" : "Deling feilet fordi brukeren %s er den som delte opprinnelig", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Deling av %s feilet, fordi tillatelsene går utover tillatelsene som er gitt til %s", "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", diff --git a/lib/l10n/oc.js b/lib/l10n/oc.js index a4cdce5a417..26c0c438d6e 100644 --- a/lib/l10n/oc.js +++ b/lib/l10n/oc.js @@ -86,6 +86,7 @@ OC.L10N.register( "Sharing %s failed, because the backend does not allow shares from type %i" : "Lo partiment de %s a fracassat perque l’infrastructura autoriza pas los partiments de tipe %i", "Sharing %s failed, because the file does not exist" : "Lo partiment de %s a fracassat perque lo fichièr existís pas", "You are not allowed to share %s" : "Sètz pas autorizat a partejar %s", + "Sharing %s failed, because you can not share with yourself" : "Lo partiment de %s a fracassat perque podètz pas partejar amb vos-meteis", "Sharing %s failed, because the user %s does not exist" : "Lo partiment de %s a fracassat perque l'utilizaire %s existís pas", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Lo partiment de %s a fracassat perque l'utilizaire %s es pas membre de cap de grop al qual %s aparten", "Sharing %s failed, because this item is already shared with %s" : "Lo partiment de %s a fracassat perque aqueste objècte es ja partejat amb %s", @@ -104,6 +105,7 @@ OC.L10N.register( "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Lo servici de partiment %s deu implementar l'interfàcia OCP\\Share_Backend", "Sharing backend %s not found" : "Servici de partiment %s pas trobat", "Sharing backend for %s not found" : "Lo servici de partiment per %s es introbable", + "Sharing failed, because the user %s is the original sharer" : "Lo partiment a fracassat perque l'utilizaire %s es lo proprietari original", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Lo partiment de %s a fracassat perque las permissions depassan las que son acordadas a %s", "Sharing %s failed, because resharing is not allowed" : "Lo partiment de %s a fracassat perque lo repartatge es pas autorizat", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Lo partiment de %s a fracassat perque la font es pas estada trobada pel partiment %s.", diff --git a/lib/l10n/oc.json b/lib/l10n/oc.json index 253a1552079..506bc2d4a01 100644 --- a/lib/l10n/oc.json +++ b/lib/l10n/oc.json @@ -84,6 +84,7 @@ "Sharing %s failed, because the backend does not allow shares from type %i" : "Lo partiment de %s a fracassat perque l’infrastructura autoriza pas los partiments de tipe %i", "Sharing %s failed, because the file does not exist" : "Lo partiment de %s a fracassat perque lo fichièr existís pas", "You are not allowed to share %s" : "Sètz pas autorizat a partejar %s", + "Sharing %s failed, because you can not share with yourself" : "Lo partiment de %s a fracassat perque podètz pas partejar amb vos-meteis", "Sharing %s failed, because the user %s does not exist" : "Lo partiment de %s a fracassat perque l'utilizaire %s existís pas", "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Lo partiment de %s a fracassat perque l'utilizaire %s es pas membre de cap de grop al qual %s aparten", "Sharing %s failed, because this item is already shared with %s" : "Lo partiment de %s a fracassat perque aqueste objècte es ja partejat amb %s", @@ -102,6 +103,7 @@ "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Lo servici de partiment %s deu implementar l'interfàcia OCP\\Share_Backend", "Sharing backend %s not found" : "Servici de partiment %s pas trobat", "Sharing backend for %s not found" : "Lo servici de partiment per %s es introbable", + "Sharing failed, because the user %s is the original sharer" : "Lo partiment a fracassat perque l'utilizaire %s es lo proprietari original", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Lo partiment de %s a fracassat perque las permissions depassan las que son acordadas a %s", "Sharing %s failed, because resharing is not allowed" : "Lo partiment de %s a fracassat perque lo repartatge es pas autorizat", "Sharing %s failed, because the sharing backend for %s could not find its source" : "Lo partiment de %s a fracassat perque la font es pas estada trobada pel partiment %s.", diff --git a/lib/l10n/ru.js b/lib/l10n/ru.js index 073506c2453..650a7ac1d10 100644 --- a/lib/l10n/ru.js +++ b/lib/l10n/ru.js @@ -106,6 +106,7 @@ OC.L10N.register( "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Бэкенд общего доступа %s должен реализовывать интерфейс OCP\\Share_Backend", "Sharing backend %s not found" : "Бэкенд общего доступа %s не найден", "Sharing backend for %s not found" : "Бэкенд общего доступа для %s не найден", + "Sharing failed, because the user %s is the original sharer" : "Не удалось поделиться, потому что пользователь %s владелец этого элемента", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Не удалось поделиться %s, права превышают предоставленные права доступа %s", "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", diff --git a/lib/l10n/ru.json b/lib/l10n/ru.json index 732be6644ff..62628e02cd1 100644 --- a/lib/l10n/ru.json +++ b/lib/l10n/ru.json @@ -104,6 +104,7 @@ "Sharing backend %s must implement the interface OCP\\Share_Backend" : "Бэкенд общего доступа %s должен реализовывать интерфейс OCP\\Share_Backend", "Sharing backend %s not found" : "Бэкенд общего доступа %s не найден", "Sharing backend for %s not found" : "Бэкенд общего доступа для %s не найден", + "Sharing failed, because the user %s is the original sharer" : "Не удалось поделиться, потому что пользователь %s владелец этого элемента", "Sharing %s failed, because the permissions exceed permissions granted to %s" : "Не удалось поделиться %s, права превышают предоставленные права доступа %s", "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", diff --git a/lib/l10n/zh_TW.js b/lib/l10n/zh_TW.js index c379659e05f..76544dd43d1 100644 --- a/lib/l10n/zh_TW.js +++ b/lib/l10n/zh_TW.js @@ -8,24 +8,41 @@ OC.L10N.register( "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 天前"], "last month" : "上個月", "_%n month ago_::_%n months ago_" : ["%n 個月前"], "last year" : "去年", + "_%n year ago_::_%n years ago_" : ["%n 幾年前"], "_%n hour ago_::_%n hours ago_" : ["%n 小時前"], "_%n minute ago_::_%n minutes ago_" : ["%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" : "不允許空白的檔名", + "4-byte characters are not supported in file names" : "檔案名稱不支援4位元的字元", "File name contains at least one invalid character" : "檔案名稱含有不合法的字元", + "Can't read file" : "無法讀取檔案", "App directory already exists" : "應用程式目錄已經存在", "Can't create app folder. Please fix permissions. %s" : "無法建立應用程式目錄,請檢查權限:%s", "No source specified when installing app" : "沒有指定應用程式安裝來源", diff --git a/lib/l10n/zh_TW.json b/lib/l10n/zh_TW.json index 3b76e8a8638..20d43302bfb 100644 --- a/lib/l10n/zh_TW.json +++ b/lib/l10n/zh_TW.json @@ -6,24 +6,41 @@ "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 天前"], "last month" : "上個月", "_%n month ago_::_%n months ago_" : ["%n 個月前"], "last year" : "去年", + "_%n year ago_::_%n years ago_" : ["%n 幾年前"], "_%n hour ago_::_%n hours ago_" : ["%n 小時前"], "_%n minute ago_::_%n minutes ago_" : ["%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" : "不允許空白的檔名", + "4-byte characters are not supported in file names" : "檔案名稱不支援4位元的字元", "File name contains at least one invalid character" : "檔案名稱含有不合法的字元", + "Can't read file" : "無法讀取檔案", "App directory already exists" : "應用程式目錄已經存在", "Can't create app folder. Please fix permissions. %s" : "無法建立應用程式目錄,請檢查權限:%s", "No source specified when installing app" : "沒有指定應用程式安裝來源", diff --git a/lib/private/app.php b/lib/private/app.php index 718adcd25c1..d7e62dfd852 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -61,7 +61,6 @@ class OC_App { static private $appTypes = array(); static private $loadedApps = array(); static private $altLogin = array(); - private static $shippedApps = null; const officialApp = 200; /** @@ -223,18 +222,7 @@ class OC_App { * Check if an app that is installed is a shipped app or installed from the appstore. */ public static function isShipped($appId) { - if (is_null(self::$shippedApps)) { - $shippedJson = \OC::$SERVERROOT . '/core/shipped.json'; - if (file_exists($shippedJson)) { - self::$shippedApps = json_decode(file_get_contents($shippedJson), true); - self::$shippedApps = self::$shippedApps['shippedApps']; - } else { - self::$shippedApps = ['files', 'encryption', 'files_external', - 'files_sharing', 'files_trashbin', 'files_versions', 'provisioning_api', - 'user_ldap', 'user_webdavauth']; - } - } - return in_array($appId, self::$shippedApps); + return \OC::$server->getAppManager()->isShipped($appId); } /** @@ -285,9 +273,6 @@ class OC_App { * This function checks whether or not an app is enabled. */ public static function isEnabled($app) { - if ('files' == $app) { - return true; - } return \OC::$server->getAppManager()->isEnabledForUser($app); } @@ -368,9 +353,6 @@ class OC_App { $app = self::getInternalAppIdByOcs($app); } - if($app === 'files') { - throw new \Exception("files can't be disabled."); - } self::$enabledAppsCache = array(); // flush // check if app is a shipped app or not. if not delete \OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app)); @@ -786,12 +768,9 @@ class OC_App { if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { $apps[] = $file; - } - } } - } return $apps; @@ -811,7 +790,8 @@ class OC_App { //TODO which apps do we want to blacklist and how do we integrate // blacklisting with the multi apps folder feature? - $blacklist = array('files'); //we don't want to show configuration for these + //we don't want to show configuration for these + $blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps(); $appList = array(); $l = \OC::$server->getL10N('core'); diff --git a/lib/private/app/appmanager.php b/lib/private/app/appmanager.php index 8fb197e73ff..1f993d8538f 100644 --- a/lib/private/app/appmanager.php +++ b/lib/private/app/appmanager.php @@ -33,29 +33,28 @@ use OCP\IUser; use OCP\IUserSession; class AppManager implements IAppManager { - /** - * @var \OCP\IUserSession - */ + + /** @var \OCP\IUserSession */ private $userSession; - /** - * @var \OCP\IAppConfig - */ + /** @var \OCP\IAppConfig */ private $appConfig; - /** - * @var \OCP\IGroupManager - */ + /** @var \OCP\IGroupManager */ private $groupManager; /** @var \OCP\ICacheFactory */ private $memCacheFactory; - /** - * @var string[] $appId => $enabled - */ + /** @var string[] $appId => $enabled */ private $installedAppsCache; + /** @var string[] */ + private $shippedApps; + + /** @var string[] */ + private $alwaysEnabled; + /** * @param \OCP\IUserSession $userSession * @param \OCP\IAppConfig $appConfig @@ -117,6 +116,9 @@ class AppManager implements IAppManager { * @return bool */ public function isEnabledForUser($appId, $user = null) { + if ($this->isAlwaysEnabled($appId)) { + return true; + } if (is_null($user)) { $user = $this->userSession->getUser(); } @@ -195,8 +197,8 @@ class AppManager implements IAppManager { * @throws \Exception if app can't be disabled */ public function disableApp($appId) { - if ($appId === 'files') { - throw new \Exception("files can't be disabled."); + if ($this->isAlwaysEnabled($appId)) { + throw new \Exception("$appId can't be disabled."); } unset($this->installedAppsCache[$appId]); $this->appConfig->setValue($appId, 'enabled', 'no'); @@ -279,4 +281,36 @@ class AppManager implements IAppManager { return $incompatibleApps; } + /** + * @inheritdoc + */ + public function isShipped($appId) { + $this->loadShippedJson(); + return in_array($appId, $this->shippedApps); + } + + private function isAlwaysEnabled($appId) { + $alwaysEnabled = $this->getAlwaysEnabledApps(); + return in_array($appId, $alwaysEnabled); + } + + private function loadShippedJson() { + if (is_null($this->shippedApps)) { + $shippedJson = \OC::$SERVERROOT . '/core/shipped.json'; + if (!file_exists($shippedJson)) { + throw new \Exception("File not found: $shippedJson"); + } + $content = json_decode(file_get_contents($shippedJson), true); + $this->shippedApps = $content['shippedApps']; + $this->alwaysEnabled = $content['alwaysEnabled']; + } + } + + /** + * @inheritdoc + */ + public function getAlwaysEnabledApps() { + $this->loadShippedJson(); + return $this->alwaysEnabled; + } } diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index de8672bc4cd..b71ca71391d 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -5,7 +5,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php index f892ee7e5e3..89f6f70f4e7 100644 --- a/lib/private/appframework/http.php +++ b/lib/private/appframework/http.php @@ -3,7 +3,7 @@ * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/private/appframework/http/output.php b/lib/private/appframework/http/output.php index 01636d397b2..f4773ab1063 100644 --- a/lib/private/appframework/http/output.php +++ b/lib/private/appframework/http/output.php @@ -1,6 +1,7 @@ <?php /** * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author Lukas Reschke <lukas@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/archive/tar.php b/lib/private/archive/tar.php index 6dd6511598d..4448e56850d 100644 --- a/lib/private/archive/tar.php +++ b/lib/private/archive/tar.php @@ -48,7 +48,7 @@ class OC_Archive_TAR extends OC_Archive { * @param string $source */ function __construct($source) { - $types = array(null, 'gz', 'bz'); + $types = array(null, 'gz', 'bz2'); $this->path = $source; $this->tar = new Archive_Tar($source, $types[self::getTarType($source)]); } diff --git a/lib/private/avatar.php b/lib/private/avatar.php index 55c328b6778..baaccaa86e6 100644 --- a/lib/private/avatar.php +++ b/lib/private/avatar.php @@ -7,7 +7,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/avatarmanager.php b/lib/private/avatarmanager.php index 6b33e8d8e8b..143874b6be3 100644 --- a/lib/private/avatarmanager.php +++ b/lib/private/avatarmanager.php @@ -5,7 +5,7 @@ * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/capabilitiesmanager.php b/lib/private/capabilitiesmanager.php index 74154f2c631..c36a96af68b 100644 --- a/lib/private/capabilitiesmanager.php +++ b/lib/private/capabilitiesmanager.php @@ -1,6 +1,6 @@ <?php /** - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/console/application.php b/lib/private/console/application.php index 92d787f3d8a..55c817d497f 100644 --- a/lib/private/console/application.php +++ b/lib/private/console/application.php @@ -1,5 +1,6 @@ <?php /** + * @author Martin Mattel <martin.mattel@diemattels.at> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/private/files.php b/lib/private/files.php index 919ca4ba71c..9be5fc9a12f 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -7,7 +7,6 @@ * @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 Michael Gapczynski <GapczynskiM@gmail.com> * @author Nicolai Ehemann <en@enlightened.de> * @author Robin Appelman <icewind@owncloud.com> diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index b0890dcdc00..35043029dc3 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -1,6 +1,7 @@ <?php /** * @author Arthur Schiwon <blizzz@owncloud.com> + * @author Björn Schießle <schiessle@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Lukas Reschke <lukas@owncloud.com> * @author Martin Mattel <martin.mattel@diemattels.at> diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index c82ee33a1b1..85dcc8589de 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -1,6 +1,7 @@ <?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> diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 2f0c1e35b04..24b0ca4acac 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -3,6 +3,7 @@ * @author Björn Schießle <schiessle@owncloud.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> + * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index fd27d88eae6..c102e739e04 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -6,7 +6,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Tanghus <thomas@tanghus.net> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/files/view.php b/lib/private/files/view.php index e7328500ffb..a11df53705c 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -16,6 +16,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.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> diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php index 6905dd8f5f2..0f6ba7f24e0 100644 --- a/lib/private/group/manager.php +++ b/lib/private/group/manager.php @@ -9,7 +9,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author voxsim <Simon Vocella> * diff --git a/lib/private/helper.php b/lib/private/helper.php index ac91164dfb0..ee2f520fe2b 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -6,8 +6,8 @@ * @author Christopher Schäpers <kondou@ts.unde.re> * @author Fabian Henze <flyser42@gmx.de> * @author Felix Moeller <mail@felixmoeller.de> - * @author François Kubler <francois@kubler.org> * @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> @@ -22,7 +22,7 @@ * @author Pellaeon Lin <nfsmwlin@gmail.com> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @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> diff --git a/lib/private/hook.php b/lib/private/hook.php index 68621580b16..2ff045c8a66 100644 --- a/lib/private/hook.php +++ b/lib/private/hook.php @@ -2,6 +2,7 @@ /** * @author Bart Visscher <bartv@thisnet.nl> * @author Jakob Sack <mail@jakobsack.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> diff --git a/lib/private/image.php b/lib/private/image.php index fad0b53cb49..4ca9b811100 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -1,8 +1,8 @@ <?php /** * @author Andreas Fischer <bantu@owncloud.com> - * @author Bartek Przybylski <bart.p.pl@gmail.com> * @author Bart Visscher <bartv@thisnet.nl> + * @author Bartek Przybylski <bart.p.pl@gmail.com> * @author Björn Schießle <schiessle@owncloud.com> * @author Byron Marohn <combustible@live.com> * @author Christopher Schäpers <kondou@ts.unde.re> diff --git a/lib/private/installer.php b/lib/private/installer.php index b5ccc02abf3..86968a7c189 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -279,7 +279,7 @@ class OC_Installer{ //detect the archive type $mime=OC_Helper::getMimeType($path); - if ($mime !=='application/zip' && $mime !== 'application/x-gzip') { + if ($mime !=='application/zip' && $mime !== 'application/x-gzip' && $mime !== 'application/x-bzip2') { throw new \Exception($l->t("Archives of type %s are not supported", array($mime))); } diff --git a/lib/private/legacy/subadmin.php b/lib/private/legacy/subadmin.php index d10b6e90bb5..aa8e035ed3e 100644 --- a/lib/private/legacy/subadmin.php +++ b/lib/private/legacy/subadmin.php @@ -1,12 +1,6 @@ <?php /** - * @author Bart Visscher <bartv@thisnet.nl> - * @author Georg Ehrke <georg@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 Thomas Müller <thomas.mueller@tmit.eu> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index a167687e0ac..90657e6725f 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -1,6 +1,8 @@ <?php /** + * @author Björn Schießle <schiessle@owncloud.com> * @author Individual IT Services <info@individual-it.net> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Robin Appelman <icewind@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/private/log/syslog.php b/lib/private/log/syslog.php index 71debaffd33..cc4c5a29c39 100644 --- a/lib/private/log/syslog.php +++ b/lib/private/log/syslog.php @@ -3,6 +3,7 @@ * @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. * @license AGPL-3.0 diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php index 441e53400a3..0d93819b9e4 100644 --- a/lib/private/ocs/cloud.php +++ b/lib/private/ocs/cloud.php @@ -1,9 +1,7 @@ <?php /** - * @author Bart Visscher <bartv@thisnet.nl> * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tom Needham <tom@owncloud.com> * diff --git a/lib/private/ocs/corecapabilities.php b/lib/private/ocs/corecapabilities.php index 6b620ab0a84..0fba7bfd7d7 100644 --- a/lib/private/ocs/corecapabilities.php +++ b/lib/private/ocs/corecapabilities.php @@ -1,6 +1,6 @@ <?php /** - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/private/repair.php b/lib/private/repair.php index 20219e313fd..f6ac7ebe65b 100644 --- a/lib/private/repair.php +++ b/lib/private/repair.php @@ -34,6 +34,7 @@ use OC\Repair\AssetCache; use OC\Repair\CleanTags; use OC\Repair\Collation; use OC\Repair\DropOldJobs; +use OC\Repair\OldGroupMembershipShares; use OC\Repair\RemoveGetETagEntries; use OC\Repair\SqliteAutoincrement; use OC\Repair\DropOldTables; @@ -119,6 +120,18 @@ class Repair extends BasicEmitter { } /** + * Returns expensive repair steps to be run on the + * command line with a special option. + * + * @return array of RepairStep instances + */ + public static function getExpensiveRepairSteps() { + return [ + new OldGroupMembershipShares(\OC::$server->getDatabaseConnection(), \OC::$server->getGroupManager()), + ]; + } + + /** * Returns the repair steps to be run before an * upgrade. * diff --git a/lib/private/server.php b/lib/private/server.php index 15ee3454d85..ea5937dfea4 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -13,7 +13,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @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> diff --git a/lib/private/setup/oci.php b/lib/private/setup/oci.php index c3f03567165..e5634572d90 100644 --- a/lib/private/setup/oci.php +++ b/lib/private/setup/oci.php @@ -4,6 +4,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Morris Jobke <hey@morrisjobke.de> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 8056260bf17..2797e5ed99b 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -136,7 +136,7 @@ class MailNotifications { $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); - list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration); + list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal'); // send it out now try { @@ -210,20 +210,20 @@ class MailNotifications { * @param string $filename the shared file * @param string $link link to the shared file * @param int $expiration expiration date (timestamp) + * @param bool $prefix prefix of mail template files * @return array an array of the html mail body and the plain text mail body */ - private function createMailBody($filename, $link, $expiration) { - + private function createMailBody($filename, $link, $expiration, $prefix = '') { $formattedDate = $expiration ? $this->l->l('date', $expiration) : null; - $html = new \OC_Template("core", "mail", ""); + $html = new \OC_Template('core', $prefix . 'mail', ''); $html->assign ('link', $link); $html->assign ('user_displayname', $this->senderDisplayName); $html->assign ('filename', $filename); $html->assign('expiration', $formattedDate); $htmlMail = $html->fetchPage(); - $plainText = new \OC_Template("core", "altmail", ""); + $plainText = new \OC_Template('core', $prefix . 'altmail', ''); $plainText->assign ('link', $link); $plainText->assign ('user_displayname', $this->senderDisplayName); $plainText->assign ('filename', $filename); diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 097c5a14b9f..e79b2204a6f 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -8,12 +8,11 @@ * @author Daniel Hansson <enoch85@gmail.com> * @author Joas Schilling <nickvergessen@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Lukas Reschke <lukas@owncloud.com> * @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 Roeland Jago Douma <roeland@famdouma.nl> + * @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> diff --git a/lib/private/streamer.php b/lib/private/streamer.php index a08c8444f02..aa819c560a1 100644 --- a/lib/private/streamer.php +++ b/lib/private/streamer.php @@ -1,5 +1,6 @@ <?php /** + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * diff --git a/lib/private/subadmin.php b/lib/private/subadmin.php index 0e130a7700a..6bf960661b5 100644 --- a/lib/private/subadmin.php +++ b/lib/private/subadmin.php @@ -4,7 +4,7 @@ * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. @@ -116,6 +116,7 @@ class SubAdmin extends PublicEmitter { while($row = $result->fetch()) { $groups[] = $this->groupManager->get($row['gid']); } + $result->closeCursor(); return $groups; } @@ -137,6 +138,7 @@ class SubAdmin extends PublicEmitter { while($row = $result->fetch()) { $users[] = $this->userManager->get($row['uid']); } + $result->closeCursor(); return $users; } @@ -159,6 +161,8 @@ class SubAdmin extends PublicEmitter { 'group' => $this->groupManager->get($row['gid']) ]; } + $result->closeCursor(); + return $subadmins; } @@ -171,13 +175,20 @@ class SubAdmin extends PublicEmitter { public function isSubAdminofGroup(IUser $user, IGroup $group) { $qb = $this->dbConn->getQueryBuilder(); + /* + * Primary key is ('gid', 'uid') so max 1 result possible here + */ $result = $qb->select('*') ->from('group_admin') ->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID()))) ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) ->execute(); - return !empty($result->fetch()) ? true : false; + $fetch = $result->fetch(); + $result->closeCursor(); + $result = !empty($fetch) ? true : false; + + return $result; } /** @@ -197,10 +208,14 @@ class SubAdmin extends PublicEmitter { ->from('group_admin') ->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) ->setMaxResults(1) - ->execute() - ->fetch(); + ->execute(); + + $isSubAdmin = $result->fetch(); + $result->closeCursor(); + + $result = $isSubAdmin === false ? false : true; - return $result === false ? false : true; + return $result; } /** diff --git a/lib/private/template.php b/lib/private/template.php index 0deb26d8f19..5a08e15d95b 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -8,6 +8,7 @@ * @author Frank Karlitschek <frank@owncloud.org> * @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> diff --git a/lib/private/updater.php b/lib/private/updater.php index 1e4421c39d7..1ff80863737 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -4,6 +4,7 @@ * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <schiessle@owncloud.com> * @author Frank Karlitschek <frank@owncloud.org> + * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> diff --git a/lib/private/user.php b/lib/private/user.php index 86b1385f15d..74441d9175a 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -3,8 +3,8 @@ * @author Aldo "xoen" Giambelluca <xoen@xoen.org> * @author Andreas Fischer <bantu@owncloud.com> * @author Arthur Schiwon <blizzz@owncloud.com> - * @author Bartek Przybylski <bart.p.pl@gmail.com> * @author Bart Visscher <bartv@thisnet.nl> + * @author Bartek Przybylski <bart.p.pl@gmail.com> * @author Björn Schießle <schiessle@owncloud.com> * @author Dominik Schmidt <dev@dominik-schmidt.de> * @author Florian Preinstorfer <nblock@archlinux.us> diff --git a/lib/private/util.php b/lib/private/util.php index e51edaf0ee3..0b6cfb099d1 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -29,7 +29,6 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com> * @author Stefan Rado <owncloud@sradonia.net> * @author Thomas Müller <thomas.mueller@tmit.eu> diff --git a/lib/public/app/iappmanager.php b/lib/public/app/iappmanager.php index d8f261660c1..09b6bd3f2b9 100644 --- a/lib/public/app/iappmanager.php +++ b/lib/public/app/iappmanager.php @@ -98,4 +98,17 @@ interface IAppManager { * @since 8.1.0 */ public function clearAppsCache(); + + /** + * @param string $appId + * @return boolean + * @since 9.0.0 + */ + public function isShipped($appId); + + /** + * @return string[] + * @since 9.0.0 + */ + public function getAlwaysEnabledApps(); } diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 5c7292cd130..6e2ceff93e8 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -6,6 +6,7 @@ * @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. * @license AGPL-3.0 diff --git a/lib/public/appframework/http/datadisplayresponse.php b/lib/public/appframework/http/datadisplayresponse.php index 31b4c83ff3c..2691091347a 100644 --- a/lib/public/appframework/http/datadisplayresponse.php +++ b/lib/public/appframework/http/datadisplayresponse.php @@ -1,7 +1,7 @@ <?php /** * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/public/appframework/http/ioutput.php b/lib/public/appframework/http/ioutput.php index 185bc589f22..9a4047fe30c 100644 --- a/lib/public/appframework/http/ioutput.php +++ b/lib/public/appframework/http/ioutput.php @@ -1,6 +1,7 @@ <?php /** * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php index c92146124e2..1cc0daf68ad 100644 --- a/lib/public/appframework/iappcontainer.php +++ b/lib/public/appframework/iappcontainer.php @@ -3,7 +3,7 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2015, ownCloud, Inc. diff --git a/lib/public/capabilities/icapability.php b/lib/public/capabilities/icapability.php index 71a56128d26..b43387aad7e 100644 --- a/lib/public/capabilities/icapability.php +++ b/lib/public/capabilities/icapability.php @@ -1,6 +1,6 @@ <?php /** - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/public/files/imimetypedetector.php b/lib/public/files/imimetypedetector.php index 79ed8a4fac9..b2b80d4570c 100644 --- a/lib/public/files/imimetypedetector.php +++ b/lib/public/files/imimetypedetector.php @@ -1,6 +1,6 @@ <?php /** - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php index 7931a683ae1..1c520026777 100644 --- a/lib/public/files/storage.php +++ b/lib/public/files/storage.php @@ -1,5 +1,6 @@ <?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> diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 56afae95a40..d85f812b2e7 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -10,7 +10,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Tanghus <thomas@tanghus.net> * diff --git a/lib/public/share.php b/lib/public/share.php index 4fcc7d81d16..68f278005ed 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -9,7 +9,7 @@ * @author Michael Kuhn <suraia@ikkoku.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <rmccorkell@karoshi.org.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Sam Tuke <mail@samtuke.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * diff --git a/lib/repair/oldgroupmembershipshares.php b/lib/repair/oldgroupmembershipshares.php new file mode 100644 index 00000000000..2d701ac9fb7 --- /dev/null +++ b/lib/repair/oldgroupmembershipshares.php @@ -0,0 +1,117 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\Repair; + + +use OC\Hooks\BasicEmitter; +use OC\RepairStep; +use OCP\IDBConnection; +use OCP\IGroupManager; +use OCP\Share; + +class OldGroupMembershipShares extends BasicEmitter implements RepairStep { + + /** @var \OCP\IDBConnection */ + protected $connection; + + /** @var \OCP\IGroupManager */ + protected $groupManager; + + /** + * @var array [gid => [uid => (bool)]] + */ + protected $memberships; + + /** + * @param IDBConnection $connection + * @param IGroupManager $groupManager + */ + public function __construct(IDBConnection $connection, IGroupManager $groupManager) { + $this->connection = $connection; + $this->groupManager = $groupManager; + } + + /** + * Returns the step's name + * + * @return string + */ + public function getName() { + return 'Remove shares of old group memberships'; + } + + /** + * Run repair step. + * Must throw exception on error. + * + * @throws \Exception in case of failure + */ + public function run() { + $deletedEntries = 0; + + $query = $this->connection->getQueryBuilder(); + $query->select(['s1.id', $query->createFunction('s1.`share_with` AS `user`'), $query->createFunction('s2.`share_with` AS `group`')]) + ->from('share', 's1') + ->where($query->expr()->isNotNull('s1.parent')) + // \OC\Share\Constant::$shareTypeGroupUserUnique === 2 + ->andWhere($query->expr()->eq('s1.share_type', $query->expr()->literal(2))) + ->andWhere($query->expr()->isNotNull('s2.id')) + ->andWhere($query->expr()->eq('s2.share_type', $query->expr()->literal(Share::SHARE_TYPE_GROUP))) + ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')); + + $deleteQuery = $this->connection->getQueryBuilder(); + $deleteQuery->delete('share') + ->where($query->expr()->eq('id', $deleteQuery->createParameter('share'))); + + $result = $query->execute(); + while ($row = $result->fetch()) { + if (!$this->isMember($row['group'], $row['user'])) { + $deletedEntries += $deleteQuery->setParameter('share', (int) $row['id']) + ->execute(); + } + } + $result->closeCursor(); + + if ($deletedEntries) { + $this->emit('\OC\Repair', 'info', array('Removed ' . $deletedEntries . ' shares where user is not a member of the group anymore')); + } + } + + /** + * @param string $gid + * @param string $uid + * @return bool + */ + protected function isMember($gid, $uid) { + if (isset($this->memberships[$gid][$uid])) { + return $this->memberships[$gid][$uid]; + } + + $isMember = $this->groupManager->isInGroup($uid, $gid); + if (!isset($this->memberships[$gid])) { + $this->memberships[$gid] = []; + } + $this->memberships[$gid][$uid] = $isMember; + + return $isMember; + } +} diff --git a/lib/repair/repairinvalidshares.php b/lib/repair/repairinvalidshares.php index 4b0aeb70c12..5a4cb445ce9 100644 --- a/lib/repair/repairinvalidshares.php +++ b/lib/repair/repairinvalidshares.php @@ -70,11 +70,43 @@ class RepairInvalidShares extends BasicEmitter implements \OC\RepairStep { } } + /** + * Remove shares where the parent share does not exist anymore + */ + private function removeSharesNonExistingParent() { + $deletedEntries = 0; + + $query = $this->connection->getQueryBuilder(); + $query->select('s1.parent') + ->from('share', 's1') + ->where($query->expr()->isNotNull('s1.parent')) + ->andWhere($query->expr()->isNull('s2.id')) + ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id')) + ->groupBy('s1.parent'); + + $deleteQuery = $this->connection->getQueryBuilder(); + $deleteQuery->delete('share') + ->where($query->expr()->eq('parent', $deleteQuery->createParameter('parent'))); + + $result = $query->execute(); + while ($row = $result->fetch()) { + $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent']) + ->execute(); + } + $result->closeCursor(); + + if ($deletedEntries) { + $this->emit('\OC\Repair', 'info', array('Removed ' . $deletedEntries . ' shares where the parent did not exist')); + } + } + public function run() { $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); if (version_compare($ocVersionFromBeforeUpdate, '8.2.0.7', '<')) { // this situation was only possible before 8.2 $this->removeExpirationDateFromNonLinkShares(); } + + $this->removeSharesNonExistingParent(); } } diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index 3ea9e45816e..e687dbde688 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -4,7 +4,7 @@ * @author Morris Jobke <hey@morrisjobke.de> * @author Normal Ra <normalraw@gmail.com> * @author Olivier Paroz <github@oparoz.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Roeland Jago Douma <rullzer@owncloud.com> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * |