Skip to content
Snippets Groups Projects
Commit 5f1bb42c authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

Merge pull request #2846 from nextcloud/downstream-obliterate-legacy-home-fallback

Downstream obliterate legacy home fallback
parents 91c87d3a 7ca65614
No related branches found
No related tags found
No related merge requests found
...@@ -39,9 +39,6 @@ class LocalHomeMountProvider implements IHomeMountProvider { ...@@ -39,9 +39,6 @@ class LocalHomeMountProvider implements IHomeMountProvider {
*/ */
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$arguments = ['user' => $user]; $arguments = ['user' => $user];
if (\OC\Files\Cache\Storage::exists('local::' . $user->getHome() . '/')) {
$arguments['legacy'] = true;
}
return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader); return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader);
} }
} }
...@@ -44,19 +44,12 @@ class Home extends Local implements \OCP\Files\IHomeStorage { ...@@ -44,19 +44,12 @@ class Home extends Local implements \OCP\Files\IHomeStorage {
/** /**
* Construct a Home storage instance * Construct a Home storage instance
* @param array $arguments array with "user" containing the * @param array $arguments array with "user" containing the
* storage owner and "legacy" containing "true" if the storage is * storage owner
* a legacy storage with "local::" URL instead of the new "home::" one.
*/ */
public function __construct($arguments) { public function __construct($arguments) {
$this->user = $arguments['user']; $this->user = $arguments['user'];
$datadir = $this->user->getHome(); $datadir = $this->user->getHome();
if (isset($arguments['legacy']) && $arguments['legacy']) { $this->id = 'home::' . $this->user->getUID();
// legacy home id (<= 5.0.12)
$this->id = 'local::' . $datadir . '/';
}
else {
$this->id = 'home::' . $this->user->getUID();
}
parent::__construct(array('datadir' => $datadir)); parent::__construct(array('datadir' => $datadir));
} }
......
...@@ -426,37 +426,6 @@ class FilesystemTest extends \Test\TestCase { ...@@ -426,37 +426,6 @@ class FilesystemTest extends \Test\TestCase {
if ($user !== null) { $user->delete(); } if ($user !== null) { $user->delete(); }
} }
/**
* Tests that the home storage is used in legacy mode
* for the user's mount point
*/
public function testLegacyHomeMount() {
if (getenv('RUN_OBJECTSTORE_TESTS')) {
$this->markTestSkipped('legacy storage unrelated to objectstore environments');
}
$datadir = \OC::$server->getConfig()->getSystemValue("datadirectory", \OC::$SERVERROOT . "/data");
$userId = $this->getUniqueID('user_');
// insert storage into DB by constructing it
// to make initMountsPoint find its existence
$localStorage = new \OC\Files\Storage\Local(array('datadir' => $datadir . '/' . $userId . '/'));
// this will trigger the insert
$cache = $localStorage->getCache();
\OC::$server->getUserManager()->createUser($userId, $userId);
\OC\Files\Filesystem::initMountPoints($userId);
$homeMount = \OC\Files\Filesystem::getStorage('/' . $userId . '/');
$this->assertTrue($homeMount->instanceOfStorage('\OC\Files\Storage\Home'));
$this->assertEquals('local::' . $datadir . '/' . $userId . '/', $homeMount->getId());
$user = \OC::$server->getUserManager()->get($userId);
if ($user !== null) { $user->delete(); }
// delete storage entry
$cache->clear();
}
public function dummyHook($arguments) { public function dummyHook($arguments) {
$path = $arguments['path']; $path = $arguments['path'];
$this->assertEquals($path, \OC\Files\Filesystem::normalizePath($path)); //the path passed to the hook should already be normalized $this->assertEquals($path, \OC\Files\Filesystem::normalizePath($path)); //the path passed to the hook should already be normalized
......
...@@ -88,14 +88,6 @@ class HomeTest extends Storage { ...@@ -88,14 +88,6 @@ class HomeTest extends Storage {
$this->assertEquals('home::' . $this->userId, $this->instance->getId()); $this->assertEquals('home::' . $this->userId, $this->instance->getId());
} }
/**
* Tests that the legacy home id is in the format local::/path/to/datadir/user1/
*/
public function testLegacyId() {
$this->instance = new \OC\Files\Storage\Home(array('user' => $this->user, 'legacy' => true));
$this->assertEquals('local::' . $this->tmpDir . '/', $this->instance->getId());
}
/** /**
* Tests that getCache() returns an instance of HomeCache * Tests that getCache() returns an instance of HomeCache
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment