summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/appinfo/routes.php17
-rwxr-xr-xapps/files_external/lib/config.php16
-rw-r--r--apps/files_sharing/lib/external/scanner.php12
-rw-r--r--core/command/user/resetpassword.php10
-rw-r--r--lib/private/files/objectstore/swift.php9
-rw-r--r--lib/private/helper.php16
6 files changed, 66 insertions, 14 deletions
diff --git a/apps/files_external/appinfo/routes.php b/apps/files_external/appinfo/routes.php
index cb950364e5d..0a1e261a189 100644
--- a/apps/files_external/appinfo/routes.php
+++ b/apps/files_external/appinfo/routes.php
@@ -20,6 +20,23 @@
*
*/
+/** @var $this OC\Route\Router */
+
+$this->create('files_external_add_mountpoint', 'ajax/addMountPoint.php')
+ ->actionInclude('files_external/ajax/addMountPoint.php');
+$this->create('files_external_remove_mountpoint', 'ajax/removeMountPoint.php')
+ ->actionInclude('files_external/ajax/removeMountPoint.php');
+
+$this->create('files_external_add_root_certificate', 'ajax/addRootCertificate.php')
+ ->actionInclude('files_external/ajax/addRootCertificate.php');
+$this->create('files_external_remove_root_certificate', 'ajax/removeRootCertificate.php')
+ ->actionInclude('files_external/ajax/removeRootCertificate.php');
+
+$this->create('files_external_dropbox', 'ajax/dropbox.php')
+ ->actionInclude('files_external/ajax/dropbox.php');
+$this->create('files_external_google', 'ajax/google.php')
+ ->actionInclude('files_external/ajax/google.php');
+
OC_API::register('get',
'/apps/files_external/api/v1/mounts',
array('\OCA\Files\External\Api', 'getUserMounts'),
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 934f9a69032..c71132d0a5a 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -238,17 +238,21 @@ class OC_Mount_Config {
}
}
+ $personalBackends = self::getPersonalBackends();
+
// Load personal mount points
$mountConfig = self::readData($user);
if (isset($mountConfig[self::MOUNT_TYPE_USER][$user])) {
foreach ($mountConfig[self::MOUNT_TYPE_USER][$user] as $mountPoint => $options) {
- $options['personal'] = true;
- $options['options'] = self::decryptPasswords($options['options']);
+ if (isset($personalBackends[$options['class']])) {
+ $options['personal'] = true;
+ $options['options'] = self::decryptPasswords($options['options']);
- // Always override previous config
- $options['priority_type'] = self::MOUNT_TYPE_PERSONAL;
- $options['backend'] = $backends[$options['class']]['backend'];
- $mountPoints[$mountPoint] = $options;
+ // Always override previous config
+ $options['priority_type'] = self::MOUNT_TYPE_PERSONAL;
+ $options['backend'] = $backends[$options['class']]['backend'];
+ $mountPoints[$mountPoint] = $options;
+ }
}
}
diff --git a/apps/files_sharing/lib/external/scanner.php b/apps/files_sharing/lib/external/scanner.php
index 4dc5d4be9d8..4e61e0c4ccb 100644
--- a/apps/files_sharing/lib/external/scanner.php
+++ b/apps/files_sharing/lib/external/scanner.php
@@ -28,11 +28,21 @@ class Scanner extends \OC\Files\Cache\Scanner {
}
private function addResult($data, $path) {
- $this->cache->put($path, $data);
+ $id = $this->cache->put($path, $data);
if (isset($data['children'])) {
+ $children = array();
foreach ($data['children'] as $child) {
+ $children[$child['name']] = true;
$this->addResult($child, ltrim($path . '/' . $child['name'], '/'));
}
+
+ $existingCache = $this->cache->getFolderContentsById($id);
+ foreach ($existingCache as $existingChild) {
+ // if an existing child is not in the new data, remove it
+ if (!isset($children[$existingChild['name']])) {
+ $this->cache->remove(ltrim($path . '/' . $existingChild['name'], '/'));
+ }
+ }
}
}
}
diff --git a/core/command/user/resetpassword.php b/core/command/user/resetpassword.php
index d7893c291e4..10a21960849 100644
--- a/core/command/user/resetpassword.php
+++ b/core/command/user/resetpassword.php
@@ -48,6 +48,16 @@ class ResetPassword extends Command {
if ($input->isInteractive()) {
/** @var $dialog \Symfony\Component\Console\Helper\DialogHelper */
$dialog = $this->getHelperSet()->get('dialog');
+
+ if (\OCP\App::isEnabled('files_encryption')) {
+ $output->writeln(
+ '<error>Warning: Resetting the password when using encryption will result in data loss!</error>'
+ );
+ if (!$dialog->askConfirmation($output, '<question>Do you want to continue?</question>', true)) {
+ return 1;
+ }
+ }
+
$password = $dialog->askHiddenResponse(
$output,
'<question>Enter a new password: </question>',
diff --git a/lib/private/files/objectstore/swift.php b/lib/private/files/objectstore/swift.php
index 3378fd7b86f..1e8dd6a7401 100644
--- a/lib/private/files/objectstore/swift.php
+++ b/lib/private/files/objectstore/swift.php
@@ -120,12 +120,11 @@ class Swift implements IObjectStore {
$objectContent = $object->getContent();
$objectContent->rewind();
- // directly returning the object stream does not work because the GC seems to collect it, so we need a copy
- $tmpStream = fopen('php://temp', 'r+');
- stream_copy_to_stream($objectContent->getStream(), $tmpStream);
- rewind($tmpStream);
+ $stream = $objectContent->getStream();
+ // save the object content in the context of the stream to prevent it being gc'd until the stream is closed
+ stream_context_set_option($stream, 'swift','content', $objectContent);
- return $tmpStream;
+ return $stream;
}
/**
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 17d3840a3ea..7c1edd1b058 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -579,8 +579,20 @@ class OC_Helper {
public static function tmpFile($postfix = '') {
$file = get_temp_dir() . '/' . md5(time() . rand()) . $postfix;
$fh = fopen($file, 'w');
- fclose($fh);
- self::$tmpFiles[] = $file;
+ if ($fh!==false){
+ fclose($fh);
+ self::$tmpFiles[] = $file;
+ } else {
+ OC_Log::write(
+ 'OC_Helper',
+ sprintf(
+ 'Can not create a temporary file in directory %s. Check it exists and has correct permissions',
+ get_temp_dir()
+ ),
+ OC_Log::WARN
+ );
+ $file = false;
+ }
return $file;
}