From 096ce35bf9c9d7edc52bccc095792d5c2b1c9aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 14 Oct 2026 10:47:02 +0200 Subject: [PATCH 1/6] chore: Remove unused methods from legacy OC_App MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These methods are not used by core or any app in the appstore. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_App.php | 149 ---------------------------------- 1 file changed, 149 deletions(-) diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 2d15edad2ff3d..621eeb74687d3 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -10,17 +10,13 @@ use OC\App\AppManager; use OC\Installer; -use OC\NeedsUpdateException; use OC\SystemConfig; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; -use OCP\BackgroundJob\IJobList; use OCP\IAppConfig; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; -use OCP\IL10N; -use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUserSession; use OCP\L10N\IFactory; @@ -44,20 +40,6 @@ class OC_App { */ public const officialApp = 200; - /** - * clean the appId - * - * @psalm-taint-escape file - * @psalm-taint-escape include - * @psalm-taint-escape html - * @psalm-taint-escape has_quotes - * - * @deprecated 31.0.0 use IAppManager::cleanAppId - */ - public static function cleanAppId(string $app): string { - return str_replace(['<', '>', '"', "'", '\0', '/', '\\', '..'], '', $app); - } - /** * Check if an app is loaded * @@ -98,15 +80,6 @@ public static function loadApp(string $app): void { Server::get(IAppManager::class)->loadApp($app); } - /** - * Check if an app is of a specific type - * - * @deprecated 27.0.0 use IAppManager::isType - */ - public static function isType(string $app, array $types): bool { - return Server::get(IAppManager::class)->isType($app, $types); - } - /** * Returns apps enabled for the current user. * @@ -179,72 +152,6 @@ public function enable(string $appId, array $groups = []): void { } } - /** - * Find the apps root for an app id. - * - * If multiple copies are found, the apps root the latest version is returned. - * - * @param bool $ignoreCache ignore cache and rebuild it - * @return false|array{path: string, url: string} the apps root shape - * @deprecated 32.0.0 internal, use getAppPath or getAppWebPath - */ - public static function findAppInDirectories(string $appId, bool $ignoreCache = false) { - return Server::get(AppManager::class)->findAppInDirectories($appId, $ignoreCache); - } - - /** - * get app's version based on it's path - * - * @deprecated 32.0.0 use Server::get(IAppManager)->getAppInfoByPath() with the path to info.xml directly - */ - public static function getAppVersionByPath(string $path): string { - $infoFile = $path . '/appinfo/info.xml'; - $appData = Server::get(IAppManager::class)->getAppInfoByPath($infoFile); - return $appData['version'] ?? ''; - } - - /** - * get the id of loaded app - * @deprecated 34.0.0 Don’t do that - */ - public static function getCurrentApp(): string { - if (\OC::$CLI) { - return ''; - } - - $request = Server::get(IRequest::class); - $script = substr($request->getScriptName(), strlen(OC::$WEBROOT) + 1); - $topFolder = substr($script, 0, strpos($script, '/') ?: 0); - if (empty($topFolder)) { - try { - $path_info = $request->getPathInfo(); - } catch (Exception $e) { - // Can happen from unit tests because the script name is `./vendor/bin/phpunit` or something a like then. - Server::get(LoggerInterface::class)->error('Failed to detect current app from script path', ['exception' => $e]); - return ''; - } - if ($path_info) { - $topFolder = substr($path_info, 1, strpos($path_info, '/', 1) - 1); - } - } - if ($topFolder === 'apps') { - $length = strlen($topFolder); - return substr($script, $length + 1, strpos($script, '/', $length + 1) - $length - 1) ?: ''; - } else { - return $topFolder; - } - } - - /** - * get a list of all apps in the apps folder - * - * @return string[] an array of app names (string IDs) - * @deprecated 31.0.0 Use IAppManager::getAllAppsInAppsFolders instead - */ - public static function getAllApps(): array { - return Server::get(IAppManager::class)->getAllAppsInAppsFolders(); - } - /** * List all supported apps * @@ -335,34 +242,6 @@ public function listAllApps(): array { return $appList; } - /** - * @deprecated 32.0.0 Use IAppManager::isUpgradeRequired instead - */ - public static function shouldUpgrade(string $app): bool { - return Server::get(IAppManager::class)->isUpgradeRequired($app); - } - - /** - * Check whether the current Nextcloud version matches the given - * application's version requirements. - * - * The comparison is made based on the number of parts that the - * app info version has. For example for ownCloud 6.0.3 if the - * app info version is expecting version 6.0, the comparison is - * made on the first two parts of the ownCloud version. - * This means that it's possible to specify "requiremin" => 6 - * and "requiremax" => 6 and it will still match ownCloud 6.0.3. - * - * @param string $ocVersion Nextcloud version to check against - * @param array $appInfo app info (from xml) - * - * @return bool true if compatible, otherwise false - * @deprecated 32.0.0 Use IAppManager::isAppCompatible instead - */ - public static function isAppCompatible(string $ocVersion, array $appInfo, bool $ignoreMax = false): bool { - return Server::get(IAppManager::class)->isAppCompatible($ocVersion, $appInfo, $ignoreMax); - } - /** * get the installed version of all apps * @deprecated 32.0.0 Use IAppManager::getAppInstalledVersions or IAppConfig::getAppInstalledVersions instead @@ -383,32 +262,4 @@ public static function updateApp(string $appId): bool { return false; } } - - /** - * @param string $appId - * @param string[] $steps - * @throws NeedsUpdateException - * @deprecated 34.0.0 Use {@see \OC\App\AppManager::executeRepairSteps} - */ - public static function executeRepairSteps(string $appId, array $steps) { - Server::get(AppManager::class)->executeRepairSteps($appId, $steps); - } - - /** - * @deprecated 32.0.0 Use the IJobList directly instead - */ - public static function setupBackgroundJobs(array $jobs): void { - $queue = Server::get(IJobList::class); - foreach ($jobs as $job) { - $queue->add($job); - } - } - - /** - * @throws \Exception - * @deprecated 34.0.0 Use {@see \OC\App\AppManager::checkAppDependencies} instead - */ - public static function checkAppDependencies(IConfig $config, IL10N $l, array $info, bool $ignoreMax): void { - Server::get(AppManager::class)->checkAppDependencies($info['id'], $ignoreMax); - } } From ed7afced61281be14a755589bf2025d8745f0cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 14 Oct 2026 10:51:48 +0200 Subject: [PATCH 2/6] chore: Remove unused methods from legacy OC_Helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These methods are not used by core or any app in the appstore. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Helper.php | 81 -------------------------------- 1 file changed, 81 deletions(-) diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 4c67fc2b2de8d..33e5794c09bbb 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -5,8 +5,6 @@ * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ -use bantu\IniGetWrapper\IniGetWrapper; -use OC\Files\FilenameValidator; use OC\Files\Filesystem; use OC\Files\ObjectStore\HomeObjectStoreStorage; use OC\Files\Storage\Home; @@ -52,76 +50,6 @@ public static function reset(): void { self::$quotaIncludeExternalStorage = null; } - /** - * Recursive copying of folders - * @param string $src source folder - * @param string $dest target folder - * @return void - * @deprecated 32.0.0 - use \OCP\Files\Folder::copy - */ - public static function copyr($src, $dest) { - if (!file_exists($src)) { - return; - } - - if (is_dir($src)) { - if (!is_dir($dest)) { - mkdir($dest); - } - $files = scandir($src); - foreach ($files as $file) { - if ($file !== '.' && $file !== '..') { - self::copyr("$src/$file", "$dest/$file"); - } - } - } else { - $validator = Server::get(FilenameValidator::class); - if (!$validator->isForbidden($src)) { - copy($src, $dest); - } - } - } - - /** - * detect if a given program is found in the search PATH - * - * @param string $name - * @param bool $path - * @internal param string $program name - * @internal param string $optional search path, defaults to $PATH - * @return bool true if executable program found in path - * @deprecated 32.0.0 use the \OCP\IBinaryFinder - */ - public static function canExecute($name, $path = false) { - // path defaults to PATH from environment if not set - if ($path === false) { - $path = getenv('PATH'); - } - // 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, (string)$path); - // WARNING : We have to check if open_basedir is enabled : - $obd = Server::get(IniGetWrapper::class)->getString('open_basedir'); - if ($obd !== 'none') { - $obd_values = explode(PATH_SEPARATOR, $obd); - if (count($obd_values) > 0 && $obd_values[0]) { - // open_basedir is in effect ! - // We need to check if the program is in one of these dirs : - $dirs = $obd_values; - } - } - foreach ($dirs as $dir) { - foreach ($exts as $ext) { - if ($check_fn("$dir/$name" . $ext)) { - return true; - } - } - } - return false; - } - /** * Calculate the disc space for the given path * @@ -341,13 +269,4 @@ public static function clearStorageInfo(string $absolutePath): void { $memcache->remove($cacheKeyPrefix . 'include'); $memcache->remove($cacheKeyPrefix . 'exclude'); } - - /** - * Returns whether the config file is set manually to read-only - * @return bool - * @deprecated 32.0.0 use the `config_is_read_only` system config directly - */ - public static function isReadOnlyConfigEnabled() { - return Server::get(IConfig::class)->getSystemValueBool('config_is_read_only', false); - } } From 4c6287fb150e94166b26fdb16927531656b43bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 14 Oct 2026 10:56:37 +0200 Subject: [PATCH 3/6] chore: Remove unused methods from legacy OC_Template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These methods are not used by core or any app in the appstore. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Template.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 5ddcce2db0625..57dc49acf6649 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -14,19 +14,6 @@ * @deprecated 32.0.0 Use \OCP\Template\ITemplateManager instead */ class OC_Template extends Template { - /** - * Shortcut to print a simple page for guests - * @param string $application The application we render the template for - * @param string $name Name of the template - * @param array $parameters Parameters for the template - * @return bool - * @deprecated 32.0.0 Use \OCP\Template\ITemplateManager instead - */ - public static function printGuestPage($application, $name, $parameters = []) { - Server::get(ITemplateManager::class)->printGuestPage($application, $name, $parameters); - return true; - } - /** * Print a fatal error page and terminates the script * @param string $error_msg The error message to show @@ -38,15 +25,4 @@ public static function printGuestPage($application, $name, $parameters = []) { public static function printErrorPage($error_msg, $hint = '', $statusCode = 500) { Server::get(ITemplateManager::class)->printErrorPage($error_msg, $hint, $statusCode); } - - /** - * print error page using Exception details - * @param Exception|Throwable $exception - * @param int $statusCode - * @return never - * @deprecated 32.0.0 Use \OCP\Template\ITemplateManager instead - */ - public static function printExceptionErrorPage($exception, $statusCode = 503) { - Server::get(ITemplateManager::class)->printExceptionErrorPage($exception, $statusCode); - } } From 6f2379ffd2adf9a4d961dfb8aadf2df0d4fbf301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 14 Oct 2026 11:00:36 +0200 Subject: [PATCH 4/6] chore: Remove unused methods from legacy OC_User MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These methods are not used by core or any app in the appstore. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_User.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index d388a88fd0a74..864f056b49a20 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -84,14 +84,6 @@ public static function useBackend($backend = 'database') { return true; } - /** - * remove all used backends - * @deprecated 32.0.0 Use IUserManager::clearBackends instead - */ - public static function clearBackends() { - Server::get(IUserManager::class)->clearBackends(); - } - /** * setup the configured backends in config.php * @suppress PhanDeprecatedFunction @@ -103,7 +95,7 @@ public static function setupBackends() { $backends = Server::get(SystemConfig::class)->getValue('user_backends', []); if (isset($backends['default']) && !$backends['default']) { // clear default backends - self::clearBackends(); + Server::get(IUserManager::class)->clearBackends(); } foreach ($backends as $i => $config) { if (!is_array($config)) { From f423d259dd3f9ef9ae55589bd2d9d5d827191bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 14 Oct 2026 11:16:51 +0200 Subject: [PATCH 5/6] chore: Remove unused methods from legacy OC_Util MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These methods are not used by core or any app in the appstore. Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Util.php | 96 ++-------------------------------- lib/public/Util.php | 6 ++- 2 files changed, 7 insertions(+), 95 deletions(-) diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 5fa1301278525..662a6271a1f9e 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -18,17 +18,14 @@ use OCP\Files\NotPermittedException; use OCP\HintException; use OCP\IConfig; -use OCP\IGroupManager; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; -use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\Security\ISecureRandom; use OCP\Server; -use OCP\Share\IManager; use OCP\Util; use Psr\Log\LoggerInterface; @@ -67,46 +64,6 @@ public static function setupFS(?string $user = '') { return true; } - /** - * Check if a password is required for each public link - * - * @param bool $checkGroupMembership Check group membership exclusion - * @return bool - * @deprecated 32.0.0 use OCP\Share\IManager's shareApiLinkEnforcePassword directly - */ - public static function isPublicLinkPasswordRequired(bool $checkGroupMembership = true) { - /** @var IManager $shareManager */ - $shareManager = Server::get(IManager::class); - return $shareManager->shareApiLinkEnforcePassword($checkGroupMembership); - } - - /** - * check if sharing is disabled for the current user - * @param IConfig $config - * @param IGroupManager $groupManager - * @param IUser|null $user - * @return bool - * @deprecated 32.0.0 use OCP\Share\IManager's sharingDisabledForUser directly - */ - public static function isSharingDisabledForUser(IConfig $config, IGroupManager $groupManager, $user) { - /** @var IManager $shareManager */ - $shareManager = Server::get(IManager::class); - $userId = $user ? $user->getUID() : null; - return $shareManager->sharingDisabledForUser($userId); - } - - /** - * check if share API enforces a default expire date - * - * @return bool - * @deprecated 32.0.0 use OCP\Share\IManager's shareApiLinkDefaultExpireDateEnforced directly - */ - public static function isDefaultExpireDateEnforced() { - /** @var IManager $shareManager */ - $shareManager = Server::get(IManager::class); - return $shareManager->shareApiLinkDefaultExpireDateEnforced(); - } - /** * copies the skeleton to the users /files * @@ -120,44 +77,6 @@ public static function copySkeleton($userId, Folder $userDirectory) { Server::get(TemplateManager::class)->copySkeleton($userId); } - /** - * copies a directory recursively by using streams - * - * @param string $source - * @param Folder $target - * @return void - * @deprecated 34.0.0 Unused, if you really need this functionality, open an issue on GitHub - */ - public static function copyr($source, Folder $target) { - $logger = Server::get(LoggerInterface::class); - - // Verify if folder exists - $dir = opendir($source); - if ($dir === false) { - $logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']); - return; - } - - // Copy the files - while (false !== ($file = readdir($dir))) { - if (!Filesystem::isIgnoredDir($file)) { - if (is_dir($source . '/' . $file)) { - $child = $target->newFolder($file); - self::copyr($source . '/' . $file, $child); - } else { - $sourceStream = fopen($source . '/' . $file, 'r'); - if ($sourceStream === false) { - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); - closedir($dir); - return; - } - $target->newFile($file, $sourceStream); - } - } - } - closedir($dir); - } - /** * @deprecated 32.0.0 Use {@see \OCP\Files\ISetupManager::tearDown()} instead. */ @@ -459,7 +378,7 @@ public static function checkServer(SystemConfig $config) { * @return array arrays with error messages and hints * @internal */ - public static function checkDataDirectoryPermissions($dataDirectory) { + private static function checkDataDirectoryPermissions($dataDirectory) { if (!Server::get(IConfig::class)->getSystemValueBool('check_data_directory_permissions', true)) { return []; } @@ -488,7 +407,7 @@ public static function checkDataDirectoryPermissions($dataDirectory) { * @return array errors found * @internal */ - public static function checkDataDirectoryValidity($dataDirectory) { + private static function checkDataDirectoryValidity($dataDirectory) { $l = Server::get(IFactory::class)->get('lib'); $errors = []; if ($dataDirectory[0] !== '/') { @@ -588,7 +507,7 @@ public static function isSetLocaleWorking(): bool { * * @internal */ - public static function isAnnotationsWorking(): bool { + private static function isAnnotationsWorking(): bool { if (PHP_VERSION_ID >= 80300) { /** @psalm-suppress UndefinedMethod */ $reflection = \ReflectionMethod::createFromMethodName(__METHOD__); @@ -600,15 +519,6 @@ public static function isAnnotationsWorking(): bool { return (is_string($docs) && strlen($docs) > 50); } - /** - * Check if the PHP module fileinfo is loaded. - * - * @internal - */ - public static function fileInfoLoaded(): bool { - return function_exists('finfo_open'); - } - /** * clear all levels of output buffering * diff --git a/lib/public/Util.php b/lib/public/Util.php index ad0a7e5322da2..3858a1c23a8fb 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -572,7 +572,8 @@ public static function naturalSortCompare($a, $b) { * @deprecated 34.0.0 use OCP\Share\IManager's shareApiLinkEnforcePassword directly */ public static function isPublicLinkPasswordRequired(bool $checkGroupMembership = true) { - return \OC_Util::isPublicLinkPasswordRequired($checkGroupMembership); + $shareManager = Server::get(\OCP\Share\IManager::class); + return $shareManager->shareApiLinkEnforcePassword($checkGroupMembership); } /** @@ -583,7 +584,8 @@ public static function isPublicLinkPasswordRequired(bool $checkGroupMembership = * @deprecated 34.0.0 use OCP\Share\IManager's shareApiLinkDefaultExpireDateEnforced directly */ public static function isDefaultExpireDateEnforced() { - return \OC_Util::isDefaultExpireDateEnforced(); + $shareManager = Server::get(\OCP\Share\IManager::class); + return $shareManager->shareApiLinkDefaultExpireDateEnforced(); } /** From 86466e73d2e58918ded1263acc0d93cb182f199e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 15 Oct 2026 09:47:02 +0200 Subject: [PATCH 6/6] chore: Remove calls to removed methods in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/lib/InstallerTest.php | 12 +++++++++--- tests/lib/TestCase.php | 2 +- tests/lib/UtilCheckServerTest.php | 4 ++-- tests/lib/UtilTest.php | 11 +++-------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index c7b8a533b0ece..cfdc4f3a6055c 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -54,6 +54,12 @@ protected function setUp(): void { $installer->removeApp(self::$appid); } + private static function getAppVersionByPath(string $path): string { + $infoFile = $path . '/appinfo/info.xml'; + $appData = Server::get(IAppManager::class)->getAppInfoByPath($infoFile); + return $appData['version'] ?? ''; + } + protected function getInstaller() { return new Installer( $this->appFetcher, @@ -585,7 +591,7 @@ public function testDownloadAppSuccessful(): void { $installer->downloadApp('testapp'); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); - $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); + $this->assertEquals('0.9', self::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); } public function testDownloadAppWithDowngrade(): void { @@ -674,7 +680,7 @@ public function testDownloadAppWithDowngrade(): void { ->method('newClient') ->willReturn($client); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); - $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); + $this->assertEquals('0.9', self::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); $this->appManager ->expects($this->once()) @@ -684,6 +690,6 @@ public function testDownloadAppWithDowngrade(): void { $installer = $this->getInstaller(); $installer->downloadApp('testapp'); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); - $this->assertEquals('0.8', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); + $this->assertEquals('0.8', self::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); } } diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 0018540fdaf59..47bc78767b943 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -397,7 +397,7 @@ protected static function invokePrivate($object, $methodName, array $parameters if ($reflection->hasMethod($methodName)) { $method = $reflection->getMethod($methodName); - return $method->invokeArgs($object, $parameters); + return $method->invokeArgs((is_string($object) ? null : $object), $parameters); } elseif ($reflection->hasProperty($methodName)) { $property = $reflection->getProperty($methodName); diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index 712235f559996..7b354b3f61750 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -116,7 +116,7 @@ public function testCheckServerSkipDataDirValidityOnUpgrade(): void { * when ".ncdata" is present. */ public function testCheckDataDirValidity(): void { - $result = \OC_Util::checkDataDirectoryValidity($this->datadir); + $result = $this->invokePrivate('OC_Util', 'checkDataDirectoryValidity', [$this->datadir]); $this->assertEmpty($result); } @@ -126,7 +126,7 @@ public function testCheckDataDirValidity(): void { */ public function testCheckDataDirValidityWhenFileMissing(): void { unlink($this->datadir . '/.ncdata'); - $result = \OC_Util::checkDataDirectoryValidity($this->datadir); + $result = $this->invokePrivate('OC_Util', 'checkDataDirectoryValidity', [$this->datadir]); $this->assertEquals(1, count($result)); $result = \OC_Util::checkServer($this->getConfig([ diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index aba50c774ab32..56b011a52bf6d 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -76,11 +76,6 @@ public function testIsNonUTF8Locale(): void { setlocale(LC_CTYPE, $locale); } - public function testFileInfoLoaded(): void { - $expected = function_exists('finfo_open'); - $this->assertEquals($expected, \OC_Util::fileInfoLoaded()); - } - /** * Host is "localhost" this is a valid for emails, * but not for default strict email verification that requires a top level domain. @@ -154,17 +149,17 @@ public function testNeedUpgradeCore(): void { public function testCheckDataDirectoryValidity(): void { $dataDir = Server::get(ITempManager::class)->getTemporaryFolder(); touch($dataDir . '/.ncdata'); - $errors = \OC_Util::checkDataDirectoryValidity($dataDir); + $errors = $this->invokePrivate('OC_Util', 'checkDataDirectoryValidity', [$dataDir]); $this->assertEmpty($errors); Files::rmdirr($dataDir); $dataDir = Server::get(ITempManager::class)->getTemporaryFolder(); // no touch - $errors = \OC_Util::checkDataDirectoryValidity($dataDir); + $errors = $this->invokePrivate('OC_Util', 'checkDataDirectoryValidity', [$dataDir]); $this->assertNotEmpty($errors); Files::rmdirr($dataDir); - $errors = \OC_Util::checkDataDirectoryValidity('relative/path'); + $errors = $this->invokePrivate('OC_Util', 'checkDataDirectoryValidity', ['relative/path']); $this->assertNotEmpty($errors); }