diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 3 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 39 | ||||
-rw-r--r-- | lib/private/legacy/helper.php | 14 | ||||
-rw-r--r-- | lib/private/legacy/response.php | 1 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 18 |
5 files changed, 35 insertions, 40 deletions
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index 7b48e81f3eb..67268981e99 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -227,6 +227,9 @@ class DependencyAnalyzer { if (!is_array($libs)) { $libs = array($libs); } + if (isset($libs['@value'])) { + $libs = [$libs]; + } foreach ($libs as $lib) { $libName = $this->getValue($lib); $libVersion = $this->platform->getLibraryVersion($libName); diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 5e05884f5c0..d25534aa822 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -334,9 +334,16 @@ class OC_App { * This function set an app as enabled in appconfig. */ public static function enable($app, $groups = null) { - self::$enabledAppsCache = array(); // flush + self::$enabledAppsCache = []; // flush if (!Installer::isInstalled($app)) { $app = self::installApp($app); + } else { + // check for required dependencies + $config = \OC::$server->getConfig(); + $l = \OC::$server->getL10N('core'); + $info = self::getAppInfo($app); + + self::checkAppDependencies($config, $l, $info); } $appManager = \OC::$server->getAppManager(); @@ -1186,16 +1193,7 @@ class OC_App { } // check for required dependencies - $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); - $missing = $dependencyAnalyzer->analyze($info); - if (!empty($missing)) { - $missingMsg = join(PHP_EOL, $missing); - throw new \Exception( - $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', - array($info['name'], $missingMsg) - ) - ); - } + self::checkAppDependencies($config, $l, $info); $config->setAppValue($app, 'enabled', 'yes'); if (isset($appData['id'])) { @@ -1438,4 +1436,23 @@ class OC_App { return $data; } + + /** + * @param $config + * @param $l + * @param $info + * @throws Exception + */ + protected static function checkAppDependencies($config, $l, $info) { + $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l); + $missing = $dependencyAnalyzer->analyze($info); + if (!empty($missing)) { + $missingMsg = join(PHP_EOL, $missing); + throw new \Exception( + $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', + [$info['name'], $missingMsg] + ) + ); + } + } } diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index 65b4c0d8afe..9c4bc895fb9 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -254,16 +254,9 @@ class OC_Helper { if ($path === false) { $path = getenv("PATH"); } - // check method depends on operating system - if (!strncmp(PHP_OS, "WIN", 3)) { - // on Windows an appropriate COM or EXE file needs to exist - $exts = array(".exe", ".com"); - $check_fn = "file_exists"; - } else { - // anywhere else we look for an executable file of that name - $exts = array(""); - $check_fn = "is_executable"; - } + // we look for an executable file of that name + $exts = [""]; + $check_fn = "is_executable"; // Default check will be done with $path directories : $dirs = explode(PATH_SEPARATOR, $path); // WARNING : We have to check if open_basedir is enabled : @@ -498,7 +491,6 @@ class OC_Helper { /** * Try to find a program - * Note: currently windows is not supported * * @param string $program * @return null|string diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php index 0ec27251ba5..88725d5e30b 100644 --- a/lib/private/legacy/response.php +++ b/lib/private/legacy/response.php @@ -33,6 +33,7 @@ class OC_Response { const STATUS_NOT_MODIFIED = 304; const STATUS_TEMPORARY_REDIRECT = 307; const STATUS_BAD_REQUEST = 400; + const STATUS_FORBIDDEN = 403; const STATUS_NOT_FOUND = 404; const STATUS_INTERNAL_SERVER_ERROR = 500; const STATUS_SERVICE_UNAVAILABLE = 503; diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index b6c3b375396..42fd0ba7db3 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -667,15 +667,6 @@ class OC_Util { $webServerRestart = true; } - // Check if server running on Windows platform - if(OC_Util::runningOnWindows()) { - $errors[] = [ - 'error' => $l->t('Microsoft Windows Platform is not supported'), - 'hint' => $l->t('Running Nextcloud 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.') - ]; - } - // Check if config folder is writable. if(!OC_Helper::isReadOnlyConfigEnabled()) { if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { @@ -1268,15 +1259,6 @@ class OC_Util { } /** - * Checks whether the server is running on Windows - * - * @return bool true if running on Windows, false otherwise - */ - public static function runningOnWindows() { - return (substr(PHP_OS, 0, 3) === "WIN"); - } - - /** * Checks whether the server is running on Mac OS X * * @return bool true if running on Mac OS X, false otherwise |