Show warning when invalid user was passed

Sometimes there are bugs that cause setupFS() to be called for
non-existing users. Instead of failing hard and breaking the instance,
this fix simply logs a warning.
This commit is contained in:
Vincent Petry 2014-11-14 12:45:36 +01:00
parent 9368de5a8b
commit c941c3fa51

View file

@ -121,6 +121,14 @@ class OC_Mount_Config {
if ($data['user']) {
$user = \OC::$server->getUserManager()->get($data['user']);
if (!$user) {
\OC_Log::write(
'files_external',
'Cannot init external mount points for non-existant user "' . $data['user'] . '".',
\OC_Log::WARN
);
return;
}
$userView = new \OC\Files\View('/' . $user->getUID() . '/files');
$changePropagator = new \OC\Files\Cache\ChangePropagator($userView);
$etagPropagator = new \OCA\Files_External\EtagPropagator($user, $changePropagator, \OC::$server->getConfig());