aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php4
-rw-r--r--lib/private/Accounts/AccountProperty.php24
-rw-r--r--lib/private/Files/Storage/Temporary.php8
-rw-r--r--lib/private/Installer.php7
-rw-r--r--lib/private/Repair/MoveUpdaterStepFile.php3
-rw-r--r--lib/private/TempManager.php3
-rw-r--r--lib/private/legacy/OC_Helper.php31
-rw-r--r--lib/public/Accounts/IAccountManager.php28
-rw-r--r--lib/public/Files.php36
9 files changed, 55 insertions, 89 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index d69e72a29de..e8b67311636 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -131,9 +131,7 @@ class AccountManager implements IAccountManager {
$property->setScope(self::SCOPE_LOCAL);
}
} else {
- // migrate scope values to the new format
- // invalid scopes are mapped to a default value
- $property->setScope(AccountProperty::mapScopeToV2($property->getScope()));
+ $property->setScope($property->getScope());
}
}
diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php
index 0c4ad568709..3a89e9bbc7a 100644
--- a/lib/private/Accounts/AccountProperty.php
+++ b/lib/private/Accounts/AccountProperty.php
@@ -55,16 +55,11 @@ class AccountProperty implements IAccountProperty {
* @since 15.0.0
*/
public function setScope(string $scope): IAccountProperty {
- $newScope = $this->mapScopeToV2($scope);
- if (!in_array($newScope, [
- IAccountManager::SCOPE_LOCAL,
- IAccountManager::SCOPE_FEDERATED,
- IAccountManager::SCOPE_PRIVATE,
- IAccountManager::SCOPE_PUBLISHED
- ])) {
+ if (!in_array($scope, IAccountManager::ALLOWED_SCOPES, )) {
throw new InvalidArgumentException('Invalid scope');
}
- $this->scope = $newScope;
+ /** @var IAccountManager::SCOPE_* $scope */
+ $this->scope = $scope;
return $this;
}
@@ -105,19 +100,6 @@ class AccountProperty implements IAccountProperty {
return $this->scope;
}
- public static function mapScopeToV2(string $scope): string {
- if (str_starts_with($scope, 'v2-')) {
- return $scope;
- }
-
- return match ($scope) {
- IAccountManager::VISIBILITY_PRIVATE, '' => IAccountManager::SCOPE_LOCAL,
- IAccountManager::VISIBILITY_CONTACTS_ONLY => IAccountManager::SCOPE_FEDERATED,
- IAccountManager::VISIBILITY_PUBLIC => IAccountManager::SCOPE_PUBLISHED,
- default => $scope,
- };
- }
-
/**
* Get the verification status of a property
*
diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php
index ff7a816930d..ecf8a1315a9 100644
--- a/lib/private/Files/Storage/Temporary.php
+++ b/lib/private/Files/Storage/Temporary.php
@@ -7,16 +7,20 @@
*/
namespace OC\Files\Storage;
+use OCP\Files;
+use OCP\ITempManager;
+use OCP\Server;
+
/**
* local storage backend in temporary folder for testing purpose
*/
class Temporary extends Local {
public function __construct(array $parameters = []) {
- parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]);
+ parent::__construct(['datadir' => Server::get(ITempManager::class)->getTemporaryFolder()]);
}
public function cleanUp(): void {
- \OC_Helper::rmdirr($this->datadir);
+ Files::rmdirr($this->datadir);
}
public function __destruct() {
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 00fdd84c1bc..a1d27c9255b 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -19,6 +19,7 @@ use OC\DB\MigrationService;
use OC_App;
use OC_Helper;
use OCP\App\IAppManager;
+use OCP\Files;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
@@ -324,14 +325,14 @@ class Installer {
$baseDir = OC_App::getInstallPath() . '/' . $appId;
// Remove old app with the ID if existent
- OC_Helper::rmdirr($baseDir);
+ Files::rmdirr($baseDir);
// Move to app folder
if (@mkdir($baseDir)) {
$extractDir .= '/' . $folders[0];
OC_Helper::copyr($extractDir, $baseDir);
}
OC_Helper::copyr($extractDir, $baseDir);
- OC_Helper::rmdirr($extractDir);
+ Files::rmdirr($extractDir);
return;
}
// Signature does not match
@@ -450,7 +451,7 @@ class Installer {
return false;
}
$appDir = OC_App::getInstallPath() . '/' . $appId;
- OC_Helper::rmdirr($appDir);
+ Files::rmdirr($appDir);
return true;
} else {
$this->logger->error('can\'t remove app ' . $appId . '. It is not installed.');
diff --git a/lib/private/Repair/MoveUpdaterStepFile.php b/lib/private/Repair/MoveUpdaterStepFile.php
index c9b51b308c4..eb9f78b0a39 100644
--- a/lib/private/Repair/MoveUpdaterStepFile.php
+++ b/lib/private/Repair/MoveUpdaterStepFile.php
@@ -5,6 +5,7 @@
*/
namespace OC\Repair;
+use OCP\Files;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
@@ -40,7 +41,7 @@ class MoveUpdaterStepFile implements IRepairStep {
// cleanup
if (file_exists($previousStepFile)) {
- if (\OC_Helper::rmdirr($previousStepFile)) {
+ if (Files::rmdirr($previousStepFile)) {
$output->info('.step-previous-update removed');
} else {
$output->info('.step-previous-update can\'t be removed - abort move of .step file');
diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php
index b7dccad3f95..4c0ffcf43d7 100644
--- a/lib/private/TempManager.php
+++ b/lib/private/TempManager.php
@@ -8,6 +8,7 @@
namespace OC;
use bantu\IniGetWrapper\IniGetWrapper;
+use OCP\Files;
use OCP\IConfig;
use OCP\ITempManager;
use OCP\Security\ISecureRandom;
@@ -99,7 +100,7 @@ class TempManager implements ITempManager {
foreach ($files as $file) {
if (file_exists($file)) {
try {
- \OC_Helper::rmdirr($file);
+ Files::rmdirr($file);
} catch (\UnexpectedValueException $ex) {
$this->log->warning(
'Error deleting temporary file/folder: {file} - Reason: {error}',
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index fd97e47c40a..172c865364c 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -95,37 +95,10 @@ class OC_Helper {
* @param string $dir path to the folder
* @param bool $deleteSelf if set to false only the content of the folder will be deleted
* @return bool
+ * @deprecated 5.0.0 use \OCP\Files::rmdirr instead
*/
public static function rmdirr($dir, $deleteSelf = true) {
- if (is_dir($dir)) {
- $files = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
- RecursiveIteratorIterator::CHILD_FIRST
- );
-
- foreach ($files as $fileInfo) {
- /** @var SplFileInfo $fileInfo */
- if ($fileInfo->isLink()) {
- unlink($fileInfo->getPathname());
- } elseif ($fileInfo->isDir()) {
- rmdir($fileInfo->getRealPath());
- } else {
- unlink($fileInfo->getRealPath());
- }
- }
- if ($deleteSelf) {
- rmdir($dir);
- }
- } elseif (file_exists($dir)) {
- if ($deleteSelf) {
- unlink($dir);
- }
- }
- if (!$deleteSelf) {
- return true;
- }
-
- return !file_exists($dir);
+ return \OCP\Files::rmdirr($dir, $deleteSelf);
}
/**
diff --git a/lib/public/Accounts/IAccountManager.php b/lib/public/Accounts/IAccountManager.php
index a15651eb5e6..92fc0002674 100644
--- a/lib/public/Accounts/IAccountManager.php
+++ b/lib/public/Accounts/IAccountManager.php
@@ -48,30 +48,6 @@ interface IAccountManager {
public const SCOPE_PUBLISHED = 'v2-published';
/**
- * Contact details only visible locally
- *
- * @since 15.0.0
- * @deprecated 21.0.1
- */
- public const VISIBILITY_PRIVATE = 'private';
-
- /**
- * Contact details visible on trusted federated servers.
- *
- * @since 15.0.0
- * @deprecated 21.0.1
- */
- public const VISIBILITY_CONTACTS_ONLY = 'contacts';
-
- /**
- * Contact details visible on trusted federated servers and in the public lookup server.
- *
- * @since 15.0.0
- * @deprecated 21.0.1
- */
- public const VISIBILITY_PUBLIC = 'public';
-
- /**
* The list of allowed scopes
*
* @since 25.0.0
@@ -81,9 +57,6 @@ interface IAccountManager {
self::SCOPE_LOCAL,
self::SCOPE_FEDERATED,
self::SCOPE_PUBLISHED,
- self::VISIBILITY_PRIVATE,
- self::VISIBILITY_CONTACTS_ONLY,
- self::VISIBILITY_PUBLIC,
];
/**
@@ -98,6 +71,7 @@ interface IAccountManager {
/**
* @since 27.0.0
+ * @deprecated 27.0.0 only added for backwards compatibility with provisioning_api UsersController::getCurrentUser
*/
public const PROPERTY_DISPLAYNAME_LEGACY = 'display-name';
diff --git a/lib/public/Files.php b/lib/public/Files.php
index 62c41c4ada1..fb03a4192fc 100644
--- a/lib/public/Files.php
+++ b/lib/public/Files.php
@@ -18,12 +18,44 @@ namespace OCP;
class Files {
/**
* Recursive deletion of folders
+ *
+ * @param string $dir path to the folder
+ * @param bool $deleteSelf if set to false only the content of the folder will be deleted
* @return bool
* @since 5.0.0
+ * @since 32.0.0 added the $deleteSelf parameter
* @deprecated 14.0.0
*/
- public static function rmdirr($dir) {
- return \OC_Helper::rmdirr($dir);
+ public static function rmdirr($dir, bool $deleteSelf = true) {
+ if (is_dir($dir)) {
+ $files = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
+
+ foreach ($files as $fileInfo) {
+ /** @var \SplFileInfo $fileInfo */
+ if ($fileInfo->isLink()) {
+ unlink($fileInfo->getPathname());
+ } elseif ($fileInfo->isDir()) {
+ rmdir($fileInfo->getRealPath());
+ } else {
+ unlink($fileInfo->getRealPath());
+ }
+ }
+ if ($deleteSelf) {
+ rmdir($dir);
+ }
+ } elseif (file_exists($dir)) {
+ if ($deleteSelf) {
+ unlink($dir);
+ }
+ }
+ if (!$deleteSelf) {
+ return true;
+ }
+
+ return !file_exists($dir);
}
/**