Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 0 additions & 149 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}
81 changes: 0 additions & 81 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
}
}
24 changes: 0 additions & 24 deletions lib/private/legacy/OC_Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}
10 changes: 1 addition & 9 deletions lib/private/legacy/OC_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)) {
Expand Down
Loading
Loading