Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions apps/files_external/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@

use OCA\Files_External\Config\ConfigAdapter;

OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';

require_once __DIR__ . '/../3rdparty/autoload.php';

// register Application object singleton
\OC_Mount_Config::$app = \OC::$server->query(\OCA\Files_External\AppInfo\Application::class);
\OC_Mount_Config::$app->registerListeners();
\OCA\Files_External\MountConfig::$app = \OC::$server->query(\OCA\Files_External\AppInfo\Application::class);
\OCA\Files_External\MountConfig::$app->registerListeners();

$appContainer = \OC_Mount_Config::$app->getContainer();
$appContainer = \OCA\Files_External\MountConfig::$app->getContainer();

\OCA\Files\App::getNavigationManager()->add(function () {
$l = \OC::$server->getL10N('files_external');
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* @var $this \OCP\Route\IRouter
**/
\OC_Mount_Config::$app->registerRoutes(
\OCA\Files_External\MountConfig::$app->registerRoutes(
$this,
[
'resources' => [
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var StorageConfig = function(id) {
this.id = id;
this.backendOptions = {};
};
// Keep this in sync with \OC_Mount_Config::STATUS_*
// Keep this in sync with \OCA\Files_External\MountConfig::STATUS_*
StorageConfig.Status = {
IN_PROGRESS: -1,
SUCCESS: 0,
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Command/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private function updateStorageStatus(StorageConfig &$storage, $configInput, Outp
$backend = $storage->getBackend();
// update status (can be time-consuming)
$storage->setStatus(
\OC_Mount_Config::getBackendStatus(
\OCA\Files_External\MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Config/ConfigAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(
*/
private function prepareStorageConfig(StorageConfig &$storage, IUser $user) {
foreach ($storage->getBackendOptions() as $option => $value) {
$storage->setBackendOption($option, \OC_Mount_Config::substitutePlaceholdersInConfig($value, $user->getUID()));
$storage->setBackendOption($option, \OCA\Files_External\MountConfig::substitutePlaceholdersInConfig($value, $user->getUID()));
}

$objectStore = $storage->getBackendOption('objectstore');
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getUserMounts(): DataResponse {
$entries = [];
$user = $this->userSession->getUser()->getUID();

$mounts = \OC_Mount_Config::getAbsoluteMountPoints($user);
$mounts = \OCA\Files_External\MountConfig::getAbsoluteMountPoints($user);
foreach ($mounts as $mountPoint => $mount) {
$entries[] = $this->formatMount($mountPoint, $mount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true
$backend = $storage->getBackend();
// update status (can be time-consuming)
$storage->setStatus(
\OC_Mount_Config::getBackendStatus(
\OCA\Files_External\MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false,
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Backend/LegacyBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use OCA\Files_External\Lib\MissingDependency;

/**
* Legacy compatibility for OC_Mount_Config::registerBackend()
* Legacy compatibility for OCA\Files_External\MountConfig::registerBackend()
*/
class LegacyBackend extends Backend {
use LegacyDependencyCheckPolyfill {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
*
*/

namespace OCA\Files_External;

use OCA\Files_External\AppInfo\Application;
use OCA\Files_External\Config\IConfigHandler;
use OCA\Files_External\Config\UserContext;
Expand All @@ -57,7 +59,7 @@
/**
* Class to configure mount.json globally and for users
*/
class OC_Mount_Config {
class MountConfig {
// TODO: make this class non-static and give it a proper namespace

public const MOUNT_TYPE_GLOBAL = 'global';
Expand Down Expand Up @@ -325,7 +327,7 @@ public static function dependencyMessage($backends) {
$backends = implode(', ', array_map(function ($backend) {
return '"' . $backend->getText() . '"';
}, $dependants));
$message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>';
$message .= '<p>' . MountConfig::getSingleDependencyMessage($l, $module, $backends) . '</p>';
}

return $message;
Expand Down
18 changes: 9 additions & 9 deletions apps/files_external/lib/Service/GlobalStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function triggerHooks(StorageConfig $storage, $signal) {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
['all']
);
return;
Expand All @@ -60,13 +60,13 @@ protected function triggerHooks(StorageConfig $storage, $signal) {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
$applicableUsers
);
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_GROUP,
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
$applicableGroups
);
}
Expand Down Expand Up @@ -100,7 +100,7 @@ protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
['all']
);
}
Expand All @@ -109,31 +109,31 @@ protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
$userDeletions
);

// trigger delete for removed groups
$this->triggerApplicableHooks(
Filesystem::signal_delete_mount,
$oldStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_GROUP,
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
$groupDeletions
);

// and now add the new users
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
$userAdditions
);

// and now add the new groups
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_GROUP,
\OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP,
$groupAdditions
);

Expand All @@ -145,7 +145,7 @@ protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $
$this->triggerApplicableHooks(
Filesystem::signal_create_mount,
$newStorage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
['all']
);
}
Expand Down
8 changes: 4 additions & 4 deletions apps/files_external/lib/Service/LegacyStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ protected function populateStorageConfigWithLegacyOptions(
$storageOptions['priority'] = $backend->getPriority();
}
$storageConfig->setPriority($storageOptions['priority']);
if ($mountType === \OC_Mount_Config::MOUNT_TYPE_USER) {
if ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_USER) {
$applicableUsers = $storageConfig->getApplicableUsers();
if ($applicable !== 'all') {
$applicableUsers[] = $applicable;
$storageConfig->setApplicableUsers($applicableUsers);
}
} elseif ($mountType === \OC_Mount_Config::MOUNT_TYPE_GROUP) {
} elseif ($mountType === \OCA\Files_External\MountConfig::MOUNT_TYPE_GROUP) {
$applicableGroups = $storageConfig->getApplicableGroups();
$applicableGroups[] = $applicable;
$storageConfig->setApplicableGroups($applicableGroups);
Expand Down Expand Up @@ -150,7 +150,7 @@ public function getAllStorages() {
$relativeMountPath = rtrim($parts[2], '/');
// note: we cannot do this after the loop because the decrypted config
// options might be needed for the config hash
$storageOptions['options'] = \OC_Mount_Config::decryptPasswords($storageOptions['options']);
$storageOptions['options'] = \OCA\Files_External\MountConfig::decryptPasswords($storageOptions['options']);
if (!isset($storageOptions['backend'])) {
$storageOptions['backend'] = $storageOptions['class']; // legacy compat
}
Expand All @@ -168,7 +168,7 @@ public function getAllStorages() {
// but at this point we don't know the max-id, so use
// first group it by config hash
$storageOptions['mountpoint'] = $rootMountPath;
$configId = \OC_Mount_Config::makeConfigHash($storageOptions);
$configId = \OCA\Files_External\MountConfig::makeConfigHash($storageOptions);
if (isset($storagesWithConfigHash[$configId])) {
$currentStorage = $storagesWithConfigHash[$configId];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public function __construct(BackendService $backendService, IUserSession $userSe
protected function readLegacyConfig() {
// read user config
$user = $this->userSession->getUser()->getUID();
return \OC_Mount_Config::readData($user);
return \OCA\Files_External\MountConfig::readData($user);
}
}
2 changes: 1 addition & 1 deletion apps/files_external/lib/Service/UserStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected function triggerHooks(StorageConfig $storage, $signal) {
$this->triggerApplicableHooks(
$signal,
$storage->getMountPoint(),
\OC_Mount_Config::MOUNT_TYPE_USER,
\OCA\Files_External\MountConfig::MOUNT_TYPE_USER,
[$user]
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getForm() {
'storages' => $this->globalStoragesService->getStorages(),
'backends' => $this->backendService->getAvailableBackends(),
'authMechanisms' => $this->backendService->getAuthMechanisms(),
'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()),
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
'globalCredentials' => $this->globalAuth->getAuth(''),
'globalCredentialsUid' => '',
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getForm() {
'storages' => $this->userGlobalStoragesService->getStorages(),
'backends' => $this->backendService->getAvailableBackends(),
'authMechanisms' => $this->backendService->getAuthMechanisms(),
'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()),
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
'globalCredentials' => $this->globalAuth->getAuth($uid),
'globalCredentialsUid' => $uid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ abstract class StoragesControllerTest extends \Test\TestCase {
protected $service;

protected function setUp(): void {
\OC_Mount_Config::$skipTest = true;
\OCA\Files_External\MountConfig::$skipTest = true;
}

protected function tearDown(): void {
\OC_Mount_Config::$skipTest = false;
\OCA\Files_External\MountConfig::$skipTest = false;
}

/**
Expand Down
Loading