Remove external shares if the share is invalid

This commit is contained in:
Robin Appelman 2014-07-01 14:58:07 +02:00
parent 1c43081d38
commit 8061a4ccc0
2 changed files with 10 additions and 1 deletions

View file

@ -108,7 +108,9 @@ class Manager {
* @return Mount
*/
protected function mountShare($data) {
$data['manager'] = $this;
$mountPoint = '/' . $this->userSession->getUser()->getUID() . '/files' . $data['mountpoint'];
$data['mountpoint'] = $mountPoint;
$mount = new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader);
$this->mountManager->addMount($mount);
return $mount;

View file

@ -39,7 +39,13 @@ class Storage extends DAV implements ISharedStorage {
private $updateChecked = false;
/**
* @var \OCA\Files_Sharing\External\Manager
*/
private $manager;
public function __construct($options) {
$this->manager = $options['manager'];
$this->remote = $options['remote'];
$this->remoteUser = $options['owner'];
list($protocol, $remote) = explode('://', $this->remote);
@ -134,7 +140,8 @@ class Storage extends DAV implements ISharedStorage {
if ($this->testRemote()) {
// valid ownCloud instance means that the public share no longer exists
// since this is permanent (re-sharing the file will create a new token)
// we mark the storage as invalid
// we remove the invalid storage
$this->manager->removeShare($this->mountPoint);
throw new StorageInvalidException();
} else {
// ownCloud instance is gone, likely to be a temporary server configuration error