Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose the mount manager in the public api #17291

Merged
merged 3 commits into from
Jul 3, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions lib/private/files/filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static public function init($user, $root) {
self::$defaultInstance = new View($root);

if (!self::$mounts) {
self::$mounts = new Mount\Manager();
self::$mounts = \OC::$server->getMountManager();
}

//load custom mount config
Expand All @@ -356,7 +356,7 @@ static public function init($user, $root) {

static public function initMountManager() {
if (!self::$mounts) {
self::$mounts = new Mount\Manager();
self::$mounts = \OC::$server->getMountManager();
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/private/files/mount/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
namespace OC\Files\Mount;

use \OC\Files\Filesystem;
use OCP\Files\Mount\IMountManager;

class Manager {
class Manager implements IMountManager {
/**
* @var MountPoint[]
*/
Expand Down
10 changes: 10 additions & 0 deletions lib/private/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ public function __construct($webRoot) {
}
return new NoopLockingProvider();
});
$this->registerService('MountManager', function () {
return new \OC\Files\Mount\Manager();
});
}

/**
Expand Down Expand Up @@ -939,4 +942,11 @@ public function getTrustedDomainHelper() {
public function getLockingProvider() {
return $this->query('LockingProvider');
}

/**
* @return \OCP\Files\Mount\IMountManager
**/
function getMountManager() {
return $this->query('MountManager');
}
}
83 changes: 83 additions & 0 deletions lib/public/files/mount/imountmanager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* @author Robin Appelman <[email protected]>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

namespace OCP\Files\Mount;

interface IMountManager {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc that explains what it is ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add @since 8.2.0


/**
* @param \OCP\Files\Mount\IMountPoint $mount
*/
public function addMount(IMountPoint $mount);

/**
* @param string $mountPoint
*/
public function removeMount($mountPoint);

/**
* @param string $mountPoint
* @param string $target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPDoc

*/
public function moveMount($mountPoint, $target);

/**
* Find the mount for $path
*
* @param string $path
* @return \OCP\Files\Mount\IMountPoint
*/
public function find($path);

/**
* Find all mounts in $path
*
* @param string $path
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function findIn($path);

/**
* Remove all registered mounts
*/
public function clear();

/**
* Find mounts by storage id
*
* @param string $id
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function findByStorageId($id);

/**
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getAll();

/**
* Find mounts by numeric storage id
*
* @param int $id
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function findByNumericId($id);
}
6 changes: 6 additions & 0 deletions lib/public/iservercontainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,10 @@ public function getMailer();
* @since 8.1.0
*/
public function getLockingProvider();

/**
* @return \OCP\Files\Mount\IMountManager
* @since 8.2.0
*/
public function getMountManager();
}