<?php
- /**
+/**
* ownCloud
*
* @copyright (C) 2014 ownCloud, Inc.
public function __construct() {
$this->view = new \OC\Files\View();
+ $this->view->getUpdater()->disable();
$this->public_share_key_id = Helper::getPublicShareKeyId();
$this->recovery_key_id = Helper::getRecoveryKeyId();
}
$this->reorganizeFolderStructureForUser($user);
}
$offset += $limit;
- } while(count($users) >= $limit);
+ } while (count($users) >= $limit);
}
public function reorganizeSystemFolderStructure() {
$this->view->deleteAll('/owncloud_private_key');
$this->view->deleteAll('/files_encryption/share-keys');
$this->view->deleteAll('/files_encryption/keyfiles');
+ $storage = $this->view->getMount('')->getStorage();
+ $storage->getScanner()->scan('files_encryption');
+ $storage->getCache()->remove('owncloud_private_key');
+ $storage->getCache()->remove('public-keys');
}
}
// delete old folders
$this->deleteOldKeys($user);
+ $this->view->getMount('/' . $user)->getStorage()->getScanner()->scan('files_encryption');
}
}
while (($oldPublicKey = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($oldPublicKey)) {
$newPublicKey = substr($oldPublicKey, 0, strlen($oldPublicKey) - strlen('.public.key')) . '.publicKey';
- $this->view->rename('public-keys/' . $oldPublicKey , 'files_encryption/public_keys/' . $newPublicKey);
+ $this->view->rename('public-keys/' . $oldPublicKey, 'files_encryption/public_keys/' . $newPublicKey);
}
}
closedir($dh);
while (($oldPrivateKey = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($oldPrivateKey)) {
$newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
- $this->view->rename('owncloud_private_key/' . $oldPrivateKey , 'files_encryption/' . $newPrivateKey);
+ $this->view->rename('owncloud_private_key/' . $oldPrivateKey, 'files_encryption/' . $newPrivateKey);
}
}
closedir($dh);
}
private function renameUsersPrivateKey($user) {
- $oldPrivateKey = $user . '/files_encryption/' . $user . '.private.key';
- $newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
+ $oldPrivateKey = $user . '/files_encryption/' . $user . '.private.key';
+ $newPrivateKey = substr($oldPrivateKey, 0, strlen($oldPrivateKey) - strlen('.private.key')) . '.privateKey';
- $this->view->rename($oldPrivateKey, $newPrivateKey);
+ $this->view->rename($oldPrivateKey, $newPrivateKey);
}
private function getFileName($file, $trash) {
}
private function getFilePath($path, $user, $trash) {
- $offset = $trash ? strlen($user . '/files_trashbin/keyfiles') : strlen($user . '/files_encryption/keyfiles');
+ $offset = $trash ? strlen($user . '/files_trashbin/keyfiles') : strlen($user . '/files_encryption/keyfiles');
return substr($path, $offset);
}
if ($this->view->is_dir($oldShareKeyPath . '/' . $file)) {
continue;
} else {
- if (substr($file, 0, strlen($filename) +1) === $filename . '.') {
+ if (substr($file, 0, strlen($filename) + 1) === $filename . '.') {
$uid = $this->getUidFromShareKey($file, $filename, $trash);
$this->view->copy($oldShareKeyPath . '/' . $file, $target . '/' . $uid . '.shareKey');