owncloud/core — pull request #3635 by icewind1991 (2013-06-07 15:58:43+00:00)
Title: Give apps the option to wrap storage backends

This gives apps the option to modify behavior of storage backends and serves as replacement for the fileproxy system currently in use by encryption and quota.

This gives more control to the apps to modify filesystem behavior and is cleaner in the implementation then the proxy system. And allow control over what storage is effected, i.e. encryption could be configured to only encrypt the root storage for each user and leave the mounted SMB share alone.

And example (pseudocode) implementation for encryption would be something like:

class EncryptionWrapper extends Wrapper{
public function file_put_contents($path, $data){
$data=encryptData($data);
$this->storage->file_put_contents($path, $data);
}
}

\OC\Files\Filesystem::getLoader()->addStorageWrapper(function($mountPoint, $storage){
if (storageShouldBeEncrypted($mountPoint, $storage) {
return new Wrapper(array('storage' => $storage));
} else {
return $storage;
}
})

The quota stuff will be moved to the system in a different PR and I plan to remove the old proxy system in the future.

@FlorinPeter @schiesbn this affects the integration of encryption in the filesystem

@schiesbn This might also be usable for a better way of handeling the trashbin (overwriting the unlink/rmdir behaviour)

cc @karlitschek @MTGap @DeepDiver1975