summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php28
-rw-r--r--lib/private/memcache/factory.php5
-rw-r--r--lib/private/share/share.php3
3 files changed, 24 insertions, 12 deletions
diff --git a/lib/base.php b/lib/base.php
index afa498e502e..6751f897dfc 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -475,16 +475,9 @@ class OC {
@ini_set('file_uploads', '50');
self::handleAuthHeaders();
-
self::initPaths();
- if (OC_Config::getValue('instanceid', false)) {
- // \OC\Memcache\Cache has a hidden dependency on
- // OC_Util::getInstanceId() for namespacing. See #5409.
- try {
- self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
- } catch (\Exception $ex) {
- }
- }
+ self::registerAutoloaderCache();
+
OC_Util::isSetLocaleWorking();
// setup 3rdparty autoloader
@@ -644,6 +637,23 @@ class OC {
}
}
+ protected static function registerAutoloaderCache() {
+ // The class loader takes an optional low-latency cache, which MUST be
+ // namespaced. The instanceid is used for namespacing, but might be
+ // unavailable at this point. Futhermore, it might not be possible to
+ // generate an instanceid via \OC_Util::getInstanceId() because the
+ // config file may not be writable. As such, we only register a class
+ // loader cache if instanceid is available without trying to create one.
+ $instanceId = OC_Config::getValue('instanceid', null);
+ if ($instanceId) {
+ try {
+ $memcacheFactory = new \OC\Memcache\Factory($instanceId);
+ self::$loader->setMemoryCache($memcacheFactory->createLowLatency('Autoloader'));
+ } catch (\Exception $ex) {
+ }
+ }
+ }
+
/**
* Handle the request
*/
diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php
index d60b157efe2..8e47a8899fc 100644
--- a/lib/private/memcache/factory.php
+++ b/lib/private/memcache/factory.php
@@ -59,7 +59,8 @@ class Factory implements ICacheFactory {
* @param string $prefix
* @return null|Cache
*/
- public static function createLowLatency($prefix = '') {
+ public function createLowLatency($prefix = '') {
+ $prefix = $this->globalPrefix . '/' . $prefix;
if (XCache::isAvailable()) {
return new XCache($prefix);
} elseif (APCu::isAvailable()) {
@@ -76,7 +77,7 @@ class Factory implements ICacheFactory {
*
* @return bool
*/
- public static function isAvailableLowLatency() {
+ public function isAvailableLowLatency() {
return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable();
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 0c42853302d..7fd5cd70e1d 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -595,6 +595,7 @@ class Share extends \OC\Share\Constants {
$shareWith['group'] = $group;
$shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner));
} else if ($shareType === self::SHARE_TYPE_LINK) {
+ $updateExistingShare = false;
if (\OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes') == 'yes') {
// when updating a link share
@@ -629,7 +630,7 @@ class Share extends \OC\Share\Constants {
throw new \Exception($message_t);
}
- if (!empty($updateExistingShare) &&
+ if ($updateExistingShare === false &&
self::isDefaultExpireDateEnabled() &&
empty($expirationDate)) {
$expirationDate = Helper::calcExpireDate();