Skip to content

Commit

Permalink
take the etag of child mounts into account for the folder etag
Browse files Browse the repository at this point in the history
this replaces shared etag propagation
  • Loading branch information
icewind1991 committed Nov 10, 2015
1 parent 0c16153 commit 34ed522
Show file tree
Hide file tree
Showing 21 changed files with 235 additions and 815 deletions.
1 change: 0 additions & 1 deletion apps/files_sharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

$application = new Application();
$application->registerMountProviders();
$application->setupPropagation();

\OCP\App::registerAdmin('files_sharing', 'settings-admin');
\OCP\App::registerPersonal('files_sharing', 'settings-personal');
Expand Down
31 changes: 1 addition & 30 deletions apps/files_sharing/appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

use OCA\Files_Sharing\Helper;
use OCA\Files_Sharing\MountProvider;
use OCA\Files_Sharing\Propagation\PropagationManager;
use OCA\Files_Sharing\Propagation\GroupPropagationManager;
use OCP\AppFramework\App;
use OC\AppFramework\Utility\SimpleContainer;
use OCA\Files_Sharing\Controllers\ExternalSharesController;
Expand Down Expand Up @@ -116,8 +114,7 @@ public function __construct(array $urlParams = array()) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new MountProvider(
$server->getConfig(),
$c->query('PropagationManager')
$server->getConfig()
);
});

Expand All @@ -132,25 +129,6 @@ function() use ($c) {
);
});

$container->registerService('PropagationManager', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new PropagationManager(
$server->getUserSession(),
$server->getConfig()
);
});

$container->registerService('GroupPropagationManager', function (IContainer $c) {
/** @var \OCP\IServerContainer $server */
$server = $c->query('ServerContainer');
return new GroupPropagationManager(
$server->getUserSession(),
$server->getGroupManager(),
$c->query('PropagationManager')
);
});

/*
* Register capabilities
*/
Expand All @@ -164,11 +142,4 @@ public function registerMountProviders() {
$mountProviderCollection->registerProvider($this->getContainer()->query('MountProvider'));
$mountProviderCollection->registerProvider($this->getContainer()->query('ExternalMountProvider'));
}

public function setupPropagation() {
$propagationManager = $this->getContainer()->query('PropagationManager');
\OCP\Util::connectHook('OC_Filesystem', 'setup', $propagationManager, 'globalSetup');

$this->getContainer()->query('GroupPropagationManager')->globalSetup();
}
}
16 changes: 1 addition & 15 deletions apps/files_sharing/lib/mountprovider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use OC\Files\Filesystem;
use OC\User\NoUserException;
use OCA\Files_Sharing\Propagation\PropagationManager;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
Expand All @@ -36,18 +35,11 @@ class MountProvider implements IMountProvider {
*/
protected $config;

/**
* @var \OCA\Files_Sharing\Propagation\PropagationManager
*/
protected $propagationManager;

/**
* @param \OCP\IConfig $config
* @param \OCA\Files_Sharing\Propagation\PropagationManager $propagationManager
*/
public function __construct(IConfig $config, PropagationManager $propagationManager) {
public function __construct(IConfig $config) {
$this->config = $config;
$this->propagationManager = $propagationManager;
}


Expand All @@ -60,21 +52,15 @@ public function __construct(IConfig $config, PropagationManager $propagationMana
*/
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
$shares = \OCP\Share::getItemsSharedWithUser('file', $user->getUID());
$propagator = $this->propagationManager->getSharePropagator($user->getUID());
$propagator->propagateDirtyMountPoints($shares);
$shares = array_filter($shares, function ($share) {
return $share['permissions'] > 0;
});
$shares = array_map(function ($share) use ($user, $storageFactory) {
// for updating etags for the share owner when we make changes to this share.
$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);

return new SharedMount(
'\OC\Files\Storage\Shared',
'/' . $user->getUID() . '/' . $share['file_target'],
array(
'propagationManager' => $this->propagationManager,
'propagator' => $ownerPropagator,
'share' => $share,
'user' => $user->getUID()
),
Expand Down
110 changes: 0 additions & 110 deletions apps/files_sharing/lib/propagation/changewatcher.php

This file was deleted.

133 changes: 0 additions & 133 deletions apps/files_sharing/lib/propagation/grouppropagationmanager.php

This file was deleted.

Loading

0 comments on commit 34ed522

Please sign in to comment.