aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php6
-rw-r--r--apps/settings/composer/composer/autoload_classmap.php1
-rw-r--r--apps/settings/composer/composer/autoload_static.php1
-rw-r--r--apps/settings/lib/AppInfo/Application.php2
-rw-r--r--apps/settings/lib/SetupChecks/PhpMaxFileSize.php80
-rw-r--r--lib/private/AllConfig.php2
-rw-r--r--version.php2
7 files changed, 91 insertions, 3 deletions
diff --git a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
index 072a4feacc6..fab61d56fd6 100644
--- a/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
+++ b/apps/dav/lib/Migration/BuildSocialSearchIndexBackgroundJob.php
@@ -71,7 +71,11 @@ class BuildSocialSearchIndexBackgroundJob extends QueuedJob {
// refresh identified contacts in order to re-index
foreach ($social_cards as $contact) {
$offset = $contact['id'];
- $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $contact['carddata']);
+ $cardData = $contact['carddata'];
+ if (is_resource($cardData) && (get_resource_type($cardData) === 'stream')) {
+ $cardData = stream_get_contents($cardData);
+ }
+ $this->davBackend->updateCard($contact['addressbookid'], $contact['uri'], $cardData);
// stop after 15sec (to be continued with next chunk)
if (($this->time->getTime() - $startTime) > 15) {
diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php
index 79ea28b66d0..968953f52ee 100644
--- a/apps/settings/composer/composer/autoload_classmap.php
+++ b/apps/settings/composer/composer/autoload_classmap.php
@@ -115,6 +115,7 @@ return array(
'OCA\\Settings\\SetupChecks\\PhpDisabledFunctions' => $baseDir . '/../lib/SetupChecks/PhpDisabledFunctions.php',
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => $baseDir . '/../lib/SetupChecks/PhpFreetypeSupport.php',
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => $baseDir . '/../lib/SetupChecks/PhpGetEnv.php',
+ 'OCA\\Settings\\SetupChecks\\PhpMaxFileSize' => $baseDir . '/../lib/SetupChecks/PhpMaxFileSize.php',
'OCA\\Settings\\SetupChecks\\PhpMemoryLimit' => $baseDir . '/../lib/SetupChecks/PhpMemoryLimit.php',
'OCA\\Settings\\SetupChecks\\PhpModules' => $baseDir . '/../lib/SetupChecks/PhpModules.php',
'OCA\\Settings\\SetupChecks\\PhpOpcacheSetup' => $baseDir . '/../lib/SetupChecks/PhpOpcacheSetup.php',
diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php
index c7e06f2e359..24a99a86381 100644
--- a/apps/settings/composer/composer/autoload_static.php
+++ b/apps/settings/composer/composer/autoload_static.php
@@ -130,6 +130,7 @@ class ComposerStaticInitSettings
'OCA\\Settings\\SetupChecks\\PhpDisabledFunctions' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpDisabledFunctions.php',
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpFreetypeSupport.php',
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpGetEnv.php',
+ 'OCA\\Settings\\SetupChecks\\PhpMaxFileSize' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpMaxFileSize.php',
'OCA\\Settings\\SetupChecks\\PhpMemoryLimit' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpMemoryLimit.php',
'OCA\\Settings\\SetupChecks\\PhpModules' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpModules.php',
'OCA\\Settings\\SetupChecks\\PhpOpcacheSetup' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOpcacheSetup.php',
diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php
index 688e6ebbed5..124915efe7f 100644
--- a/apps/settings/lib/AppInfo/Application.php
+++ b/apps/settings/lib/AppInfo/Application.php
@@ -58,6 +58,7 @@ use OCA\Settings\SetupChecks\PhpDefaultCharset;
use OCA\Settings\SetupChecks\PhpDisabledFunctions;
use OCA\Settings\SetupChecks\PhpFreetypeSupport;
use OCA\Settings\SetupChecks\PhpGetEnv;
+use OCA\Settings\SetupChecks\PhpMaxFileSize;
use OCA\Settings\SetupChecks\PhpMemoryLimit;
use OCA\Settings\SetupChecks\PhpModules;
use OCA\Settings\SetupChecks\PhpOpcacheSetup;
@@ -203,6 +204,7 @@ class Application extends App implements IBootstrap {
$context->registerSetupCheck(PhpFreetypeSupport::class);
$context->registerSetupCheck(PhpApcuConfig::class);
$context->registerSetupCheck(PhpGetEnv::class);
+ $context->registerSetupCheck(PhpMaxFileSize::class);
$context->registerSetupCheck(PhpMemoryLimit::class);
$context->registerSetupCheck(PhpModules::class);
$context->registerSetupCheck(PhpOpcacheSetup::class);
diff --git a/apps/settings/lib/SetupChecks/PhpMaxFileSize.php b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php
new file mode 100644
index 00000000000..942a8408e81
--- /dev/null
+++ b/apps/settings/lib/SetupChecks/PhpMaxFileSize.php
@@ -0,0 +1,80 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\Settings\SetupChecks;
+
+use bantu\IniGetWrapper\IniGetWrapper;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use OCP\SetupCheck\ISetupCheck;
+use OCP\SetupCheck\SetupResult;
+use OCP\Util;
+
+class PhpMaxFileSize implements ISetupCheck {
+ public function __construct(
+ private IL10N $l10n,
+ private IURLGenerator $urlGenerator,
+ private IniGetWrapper $iniGetWrapper,
+ ) {
+ }
+
+ public function getCategory(): string {
+ return 'php';
+ }
+
+ public function getName(): string {
+ return $this->l10n->t('PHP file size upload limit');
+ }
+
+ public function run(): SetupResult {
+ $upload_max_filesize = Util::computerFileSize((string)$this->iniGetWrapper->getString('upload_max_filesize'));
+ $post_max_size = Util::computerFileSize((string)$this->iniGetWrapper->getString('post_max_size'));
+ $max_input_time = (int)$this->iniGetWrapper->getString('max_input_time');
+ $max_execution_time = (int)$this->iniGetWrapper->getString('max_execution_time');
+
+ $warnings = [];
+ $recommendedSize = 16 * 1024 * 1024 * 1024;
+ $recommendedTime = 3600;
+
+ // Check if the PHP upload limit is too low
+ if ($upload_max_filesize < $recommendedSize) {
+ $warnings[] = $this->l10n->t('The PHP upload_max_filesize is too low. A size of at least %1$s is recommended. Current value: %2$s.', [
+ Util::humanFileSize($recommendedSize),
+ Util::humanFileSize($upload_max_filesize),
+ ]);
+ }
+ if ($post_max_size < $recommendedSize) {
+ $warnings[] = $this->l10n->t('The PHP post_max_size is too low. A size of at least %1$s is recommended. Current value: %2$s.', [
+ Util::humanFileSize($recommendedSize),
+ Util::humanFileSize($post_max_size),
+ ]);
+ }
+
+ // Check if the PHP execution time is too low
+ if ($max_input_time < $recommendedTime && $max_input_time !== -1) {
+ $warnings[] = $this->l10n->t('The PHP max_input_time is too low. A time of at least %1$s is recommended. Current value: %2$s.', [
+ $recommendedTime,
+ $max_input_time,
+ ]);
+ }
+
+ if ($max_execution_time < $recommendedTime && $max_execution_time !== -1) {
+ $warnings[] = $this->l10n->t('The PHP max_execution_time is too low. A time of at least %1$s is recommended. Current value: %2$s.', [
+ $recommendedTime,
+ $max_execution_time,
+ ]);
+ }
+
+ if (!empty($warnings)) {
+ return SetupResult::warning(join(' ', $warnings), $this->urlGenerator->linkToDocs('admin-big-file-upload'));
+ }
+
+ return SetupResult::success();
+ }
+}
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index bb15adf31b4..72af6c960a5 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -246,7 +246,7 @@ class AllConfig implements IConfig {
$userPreferences = \OCP\Server::get(IUserConfig::class);
if ($preCondition !== null) {
try {
- if ($userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
+ if ($userPreferences->hasKey($userId, $appName, $key) && $userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
throw new PreConditionNotMetException();
}
} catch (TypeConflictException) {
diff --git a/version.php b/version.php
index 86f352a3a7d..1b1c154f4a6 100644
--- a/version.php
+++ b/version.php
@@ -9,7 +9,7 @@
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patch level
// when updating major/minor version number.
-$OC_Version = [31, 0, 0, 4];
+$OC_Version = [31, 0, 0, 5];
// The human-readable string
$OC_VersionString = '31.0.0 dev';