summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php11
-rw-r--r--lib/private/files/cache/scanner.php4
-rw-r--r--lib/private/files/utils/scanner.php7
-rw-r--r--lib/private/preview.php16
-rw-r--r--lib/private/preview/image.php6
-rw-r--r--lib/private/response.php2
-rw-r--r--lib/private/updater.php16
-rw-r--r--lib/public/appframework/http/contentsecuritypolicy.php1
-rw-r--r--lib/public/util.php6
9 files changed, 48 insertions, 21 deletions
diff --git a/lib/base.php b/lib/base.php
index 32b90cad1fa..889801f9653 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -237,7 +237,7 @@ class OC {
// Check if config is writable
$configFileWritable = is_writable($configFilePath);
if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled()
- || !$configFileWritable && \OCP\Util::needUpgrade()) {
+ || !$configFileWritable && self::checkUpgrade(false)) {
if (self::$CLI) {
echo $l->t('Cannot write into "config" directory!')."\n";
echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n";
@@ -678,7 +678,7 @@ class OC {
*/
public static function registerCacheHooks() {
//don't try to do this before we are properly setup
- if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) {
+ if (\OC::$server->getSystemConfig()->getValue('installed', false) && !self::checkUpgrade(false)) {
// NOTE: This will be replaced to use OCP
$userSession = self::$server->getUserSession();
@@ -714,7 +714,7 @@ class OC {
*/
public static function registerLogRotate() {
$systemConfig = \OC::$server->getSystemConfig();
- if ($systemConfig->getValue('installed', false) && $systemConfig->getValue('log_rotate_size', false) && !\OCP\Util::needUpgrade()) {
+ if ($systemConfig->getValue('installed', false) && $systemConfig->getValue('log_rotate_size', false) && !self::checkUpgrade(false)) {
//don't try to do this before we are properly setup
//use custom logfile path if defined, otherwise use default of owncloud.log in data directory
\OCP\BackgroundJob::registerJob('OC\Log\Rotate', $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', OC::$SERVERROOT . '/data') . '/owncloud.log'));
@@ -807,8 +807,7 @@ class OC {
// Load minimum set of apps
if (!self::checkUpgrade(false)
- && !$systemConfig->getValue('maintenance', false)
- && !\OCP\Util::needUpgrade()) {
+ && !$systemConfig->getValue('maintenance', false)) {
// For logged-in users: Load everything
if(OC_User::isLoggedIn()) {
OC_App::loadApps();
@@ -821,7 +820,7 @@ class OC {
if (!self::$CLI and (!isset($_GET["logout"]) or ($_GET["logout"] !== 'true'))) {
try {
- if (!$systemConfig->getValue('maintenance', false) && !\OCP\Util::needUpgrade()) {
+ if (!$systemConfig->getValue('maintenance', false) && !self::checkUpgrade(false)) {
OC_App::loadApps(array('filesystem', 'logging'));
OC_App::loadApps();
}
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index fb60ee5aa53..bfdab16b645 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -186,9 +186,9 @@ class Scanner extends BasicEmitter {
}
if (!empty($newData)) {
$data['fileid'] = $this->addToCache($file, $newData, $fileId);
- $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
- \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
}
+ $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
+ \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
} else {
$this->removeFromCache($file);
}
diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php
index c70f4beb31d..558a1fba028 100644
--- a/lib/private/files/utils/scanner.php
+++ b/lib/private/files/utils/scanner.php
@@ -99,7 +99,12 @@ class Scanner extends PublicEmitter {
$scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) {
$emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path));
});
-
+ $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) {
+ $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path));
+ });
+ $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) {
+ $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path));
+ });
// propagate etag and mtimes when files are changed or removed
$propagator = $this->propagator;
$propagatorListener = function ($path) use ($mount, $propagator) {
diff --git a/lib/private/preview.php b/lib/private/preview.php
index de964b72df2..1127048b7fd 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -837,6 +837,11 @@ class Preview {
$askedWidth = $this->getMaxX();
$askedHeight = $this->getMaxY();
+ if ($this->mode === self::MODE_COVER) {
+ list($askedWidth, $askedHeight) =
+ $this->applyCover($askedWidth, $askedHeight, $previewWidth, $previewHeight);
+ }
+
/**
* Phase 1: If required, adjust boundaries to keep aspect ratio
*/
@@ -845,20 +850,12 @@ class Preview {
$this->applyAspectRatio($askedWidth, $askedHeight, $previewWidth, $previewHeight);
}
- if ($this->mode === self::MODE_COVER) {
- list($scaleWidth, $scaleHeight) =
- $this->applyCover($askedWidth, $askedHeight, $previewWidth, $previewHeight);
- } else {
- $scaleWidth = $askedWidth;
- $scaleHeight = $askedHeight;
- }
-
/**
* Phase 2: Resizes preview to try and match requirements.
* Takes the scaling ratio into consideration
*/
list($newPreviewWidth, $newPreviewHeight) = $this->scale(
- $image, $scaleWidth, $scaleHeight, $previewWidth, $previewHeight
+ $image, $askedWidth, $askedHeight, $previewWidth, $previewHeight
);
// The preview has been resized and should now have the asked dimensions
@@ -890,6 +887,7 @@ class Preview {
return;
}
+
// The preview is smaller, but we can't touch it
$this->storePreview($fileId, $newPreviewWidth, $newPreviewHeight);
}
diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php
index f9c27e690f6..fd90b15eb0c 100644
--- a/lib/private/preview/image.php
+++ b/lib/private/preview/image.php
@@ -46,12 +46,16 @@ abstract class Image extends Provider {
$image = new \OC_Image();
- if ($fileInfo['encrypted'] === true) {
+ $useTempFile = $fileInfo->isEncrypted() || !$fileInfo->getStorage()->isLocal();
+ if ($useTempFile) {
$fileName = $fileview->toTmpFile($path);
} else {
$fileName = $fileview->getLocalFile($path);
}
$image->loadFromFile($fileName);
+ if ($useTempFile) {
+ unlink($fileName);
+ }
$image->fixOrientation();
if ($image->valid()) {
$image->scaleDownToFit($maxX, $maxY);
diff --git a/lib/private/response.php b/lib/private/response.php
index 14ee92972a9..2cd1d990e51 100644
--- a/lib/private/response.php
+++ b/lib/private/response.php
@@ -247,7 +247,7 @@ class OC_Response {
. 'script-src \'self\' \'unsafe-eval\'; '
. 'style-src \'self\' \'unsafe-inline\'; '
. 'frame-src *; '
- . 'img-src * data:; '
+ . 'img-src * data: blob:; '
. 'font-src \'self\' data:; '
. 'media-src *; '
. 'connect-src *';
diff --git a/lib/private/updater.php b/lib/private/updater.php
index b33180c3425..8aa8b0703d7 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -32,6 +32,7 @@
namespace OC;
+use OC\Core\Command\Log\Manage;
use OC\Hooks\BasicEmitter;
use OC_App;
use OC_Installer;
@@ -69,6 +70,14 @@ class Updater extends BasicEmitter {
/** @var bool */
private $skip3rdPartyAppsDisable;
+ private $logLevelNames = [
+ 0 => 'Debug',
+ 1 => 'Info',
+ 2 => 'Warning',
+ 3 => 'Error',
+ 4 => 'Fatal',
+ ];
+
/**
* @param HTTPHelper $httpHelper
* @param IConfig $config
@@ -177,6 +186,10 @@ class Updater extends BasicEmitter {
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade() {
+ $logLevel = $this->config->getSystemValue('loglevel', \OCP\Util::WARN);
+ $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
+ $this->config->setSystemValue('loglevel', \OCP\Util::DEBUG);
+
$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
if(!$wasMaintenanceModeEnabled) {
@@ -208,6 +221,9 @@ class Updater extends BasicEmitter {
$this->emit('\OC\Updater', 'maintenanceActive');
}
+ $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
+ $this->config->setSystemValue('loglevel', $logLevel);
+
return $success;
}
diff --git a/lib/public/appframework/http/contentsecuritypolicy.php b/lib/public/appframework/http/contentsecuritypolicy.php
index ee36f7aac17..07c76f2969c 100644
--- a/lib/public/appframework/http/contentsecuritypolicy.php
+++ b/lib/public/appframework/http/contentsecuritypolicy.php
@@ -64,6 +64,7 @@ class ContentSecurityPolicy {
private $allowedImageDomains = [
'\'self\'',
'data:',
+ 'blob:',
];
/** @var array Domains to which connections can be done */
private $allowedConnectDomains = [
diff --git a/lib/public/util.php b/lib/public/util.php
index 652df5192cf..1ba091d1952 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -654,6 +654,7 @@ class Util {
return \OC_Util::isDefaultExpireDateEnforced();
}
+ protected static $needUpgradeCache = null;
/**
* Checks whether the current version needs upgrade.
@@ -662,6 +663,9 @@ class Util {
* @since 7.0.0
*/
public static function needUpgrade() {
- return \OC_Util::needUpgrade(\OC::$server->getConfig());
+ if (!isset(self::$needUpgradeCache)) {
+ self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getConfig());
+ }
+ return self::$needUpgradeCache;
}
}