Skip to content

Commit

Permalink
Merge pull request #26855 from owncloud/obliterate-legacy-home-fallback
Browse files Browse the repository at this point in the history
Nuke the legacy storage fallback from orbit
  • Loading branch information
Vincent Petry authored Dec 21, 2016
2 parents 1efce85 + d29d2d6 commit f3c0373
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 51 deletions.
3 changes: 0 additions & 3 deletions lib/private/Files/Mount/LocalHomeMountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class LocalHomeMountProvider implements IHomeMountProvider {
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$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);
}
}
11 changes: 2 additions & 9 deletions lib/private/Files/Storage/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,12 @@ class Home extends Local implements \OCP\Files\IHomeStorage {
/**
* Construct a Home storage instance
* @param array $arguments array with "user" containing the
* storage owner and "legacy" containing "true" if the storage is
* a legacy storage with "local::" URL instead of the new "home::" one.
* storage owner
*/
public function __construct($arguments) {
$this->user = $arguments['user'];
$datadir = $this->user->getHome();
if (isset($arguments['legacy']) && $arguments['legacy']) {
// legacy home id (<= 5.0.12)
$this->id = 'local::' . $datadir . '/';
}
else {
$this->id = 'home::' . $this->user->getUID();
}
$this->id = 'home::' . $this->user->getUID();

parent::__construct(['datadir' => $datadir]);
}
Expand Down
31 changes: 0 additions & 31 deletions tests/lib/Files/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,37 +451,6 @@ public function testHomeMount() {
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(['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) {
$path = $arguments['path'];
$this->assertEquals($path, \OC\Files\Filesystem::normalizePath($path)); //the path passed to the hook should already be normalized
Expand Down
8 changes: 0 additions & 8 deletions tests/lib/Files/Storage/HomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ public function testId() {
$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(['user' => $this->user, 'legacy' => true]);
$this->assertEquals('local::' . $this->tmpDir . '/', $this->instance->getId());
}

/**
* Tests that getCache() returns an instance of HomeCache
*/
Expand Down

0 comments on commit f3c0373

Please sign in to comment.