diff options
21 files changed, 132 insertions, 206 deletions
diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php index 17e4731a2d6..6208ac0da07 100644 --- a/apps/files_external/lib/Command/Create.php +++ b/apps/files_external/lib/Command/Create.php @@ -134,7 +134,7 @@ class Create extends Base { $config = []; foreach ($configInput as $configOption) { - if (!strpos($configOption, '=')) { + if (!str_contains($configOption, '=')) { $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); return 1; } diff --git a/apps/files_external/lib/Lib/Storage/FtpConnection.php b/apps/files_external/lib/Lib/Storage/FtpConnection.php index f183a5a52de..cca03ddda65 100644 --- a/apps/files_external/lib/Lib/Storage/FtpConnection.php +++ b/apps/files_external/lib/Lib/Storage/FtpConnection.php @@ -110,7 +110,7 @@ class FtpConnection { public function nlist(string $path) { $files = @ftp_nlist($this->connection, $path); return array_map(function ($name) { - if (strpos($name, '/') !== false) { + if (str_contains($name, '/')) { $name = basename($name); } return $name; @@ -122,7 +122,7 @@ class FtpConnection { if ($files !== false) { return array_map(function ($file) { - if (strpos($file['name'], '/') !== false) { + if (str_contains($file['name'], '/')) { $file['name'] = basename($file['name']); } return $file; diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index d5926008f62..ba7ae1c36a9 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -60,7 +60,7 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag $host = substr($host, 0, $hostSlashPos); } - if (substr($contextPath, -1) !== '/') { + if (!str_ends_with($contextPath, '/')) { $contextPath .= '/'; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index e46f60d0be4..532c50808db 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -63,7 +63,7 @@ class SFTP extends \OC\Files\Storage\Common { */ private function splitHost($host) { $input = $host; - if (strpos($host, '://') === false) { + if (!str_contains($host, '://')) { // add a protocol to fix parse_url behavior with ipv6 $host = 'http://' . $host; } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index e0e4659e668..66319d66770 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -139,13 +139,13 @@ class SMB extends Common implements INotifyStorage { } private function splitUser($user) { - if (strpos($user, '/')) { + if (str_contains($user, '/')) { return explode('/', $user, 2); - } elseif (strpos($user, '\\')) { + } elseif (str_contains($user, '\\')) { return explode('\\', $user); - } else { - return [null, $user]; } + + return [null, $user]; } /** diff --git a/config/config.sample.php b/config/config.sample.php index 366b6fbbc75..94b8a5d0552 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -2155,6 +2155,11 @@ $CONFIG = [ 'upgrade.disable-web' => false, /** + * Allows to modify the cli-upgrade link in order to link to a different documentation + */ +'upgrade.cli-upgrade-link' => '', + +/** * Set this Nextcloud instance to debugging mode * * Only enable this for local development and not in production environments diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php index 3f254f03370..90020330ea1 100644 --- a/core/Controller/AppPasswordController.php +++ b/core/Controller/AppPasswordController.php @@ -42,26 +42,16 @@ use OCP\ISession; use OCP\Security\ISecureRandom; class AppPasswordController extends \OCP\AppFramework\OCSController { - private ISession $session; - private ISecureRandom $random; - private IProvider $tokenProvider; - private IStore $credentialStore; - private IEventDispatcher $eventDispatcher; - - public function __construct(string $appName, - IRequest $request, - ISession $session, - ISecureRandom $random, - IProvider $tokenProvider, - IStore $credentialStore, - IEventDispatcher $eventDispatcher) { + public function __construct( + string $appName, + IRequest $request, + private ISession $session, + private ISecureRandom $random, + private IProvider $tokenProvider, + private IStore $credentialStore, + private IEventDispatcher $eventDispatcher, + ) { parent::__construct($appName, $request); - - $this->session = $session; - $this->random = $random; - $this->tokenProvider = $tokenProvider; - $this->credentialStore = $credentialStore; - $this->eventDispatcher = $eventDispatcher; } /** diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index b23b519621e..29a0788ad57 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -40,20 +40,14 @@ use OCP\IRequest; use OCP\Share\IShare; class AutoCompleteController extends OCSController { - private ISearch $collaboratorSearch; - private IManager $autoCompleteManager; - private IEventDispatcher $dispatcher; - - public function __construct(string $appName, - IRequest $request, - ISearch $collaboratorSearch, - IManager $autoCompleteManager, - IEventDispatcher $dispatcher) { + public function __construct( + string $appName, + IRequest $request, + private ISearch $collaboratorSearch, + private IManager $autoCompleteManager, + private IEventDispatcher $dispatcher, + ) { parent::__construct($appName, $request); - - $this->collaboratorSearch = $collaboratorSearch; - $this->autoCompleteManager = $autoCompleteManager; - $this->dispatcher = $dispatcher; } /** diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index c6567b33209..ba1792af708 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -43,7 +43,6 @@ use OCP\ICache; use OCP\IL10N; use OCP\IRequest; use OCP\IUserManager; -use OCP\IUserSession; use Psr\Log\LoggerInterface; /** @@ -52,36 +51,19 @@ use Psr\Log\LoggerInterface; * @package OC\Core\Controller */ class AvatarController extends Controller { - protected IAvatarManager $avatarManager; - protected ICache $cache; - protected IL10N $l; - protected IUserManager $userManager; - protected IUserSession $userSession; - protected IRootFolder $rootFolder; - protected LoggerInterface $logger; - protected ?string $userId; - protected TimeFactory $timeFactory; - - public function __construct(string $appName, - IRequest $request, - IAvatarManager $avatarManager, - ICache $cache, - IL10N $l10n, - IUserManager $userManager, - IRootFolder $rootFolder, - LoggerInterface $logger, - ?string $userId, - TimeFactory $timeFactory) { + public function __construct( + string $appName, + IRequest $request, + protected IAvatarManager $avatarManager, + protected ICache $cache, + protected IL10N $l10n, + protected IUserManager $userManager, + protected IRootFolder $rootFolder, + protected LoggerInterface $logger, + protected ?string $userId, + protected TimeFactory $timeFactory, + ) { parent::__construct($appName, $request); - - $this->avatarManager = $avatarManager; - $this->cache = $cache; - $this->l = $l10n; - $this->userManager = $userManager; - $this->rootFolder = $rootFolder; - $this->logger = $logger; - $this->userId = $userId; - $this->timeFactory = $timeFactory; } /** @@ -173,18 +155,18 @@ class AvatarController extends Controller { /** @var File $node */ $node = $userFolder->get($path); if (!($node instanceof File)) { - return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]); + return new JSONResponse(['data' => ['message' => $this->l10n->t('Please select a file.')]]); } if ($node->getSize() > 20 * 1024 * 1024) { return new JSONResponse( - ['data' => ['message' => $this->l->t('File is too big')]], + ['data' => ['message' => $this->l10n->t('File is too big')]], Http::STATUS_BAD_REQUEST ); } if ($node->getMimeType() !== 'image/jpeg' && $node->getMimeType() !== 'image/png') { return new JSONResponse( - ['data' => ['message' => $this->l->t('The selected file is not an image.')]], + ['data' => ['message' => $this->l10n->t('The selected file is not an image.')]], Http::STATUS_BAD_REQUEST ); } @@ -193,7 +175,7 @@ class AvatarController extends Controller { $content = $node->getContent(); } catch (\OCP\Files\NotPermittedException $e) { return new JSONResponse( - ['data' => ['message' => $this->l->t('The selected file cannot be read.')]], + ['data' => ['message' => $this->l10n->t('The selected file cannot be read.')]], Http::STATUS_BAD_REQUEST ); } @@ -205,7 +187,7 @@ class AvatarController extends Controller { ) { if ($files['size'][0] > 20 * 1024 * 1024) { return new JSONResponse( - ['data' => ['message' => $this->l->t('File is too big')]], + ['data' => ['message' => $this->l10n->t('File is too big')]], Http::STATUS_BAD_REQUEST ); } @@ -214,16 +196,16 @@ class AvatarController extends Controller { unlink($files['tmp_name'][0]); } else { $phpFileUploadErrors = [ - UPLOAD_ERR_OK => $this->l->t('The file was uploaded'), - UPLOAD_ERR_INI_SIZE => $this->l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'), - UPLOAD_ERR_FORM_SIZE => $this->l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), - UPLOAD_ERR_PARTIAL => $this->l->t('The file was only partially uploaded'), - UPLOAD_ERR_NO_FILE => $this->l->t('No file was uploaded'), - UPLOAD_ERR_NO_TMP_DIR => $this->l->t('Missing a temporary folder'), - UPLOAD_ERR_CANT_WRITE => $this->l->t('Could not write file to disk'), - UPLOAD_ERR_EXTENSION => $this->l->t('A PHP extension stopped the file upload'), + UPLOAD_ERR_OK => $this->l10n->t('The file was uploaded'), + UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'), + UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), + UPLOAD_ERR_PARTIAL => $this->l10n->t('The file was only partially uploaded'), + UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'), + UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'), + UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Could not write file to disk'), + UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'), ]; - $message = $phpFileUploadErrors[$files['error'][0]] ?? $this->l->t('Invalid file provided'); + $message = $phpFileUploadErrors[$files['error'][0]] ?? $this->l10n->t('Invalid file provided'); $this->logger->warning($message, ['app' => 'core']); return new JSONResponse( ['data' => ['message' => $message]], @@ -233,7 +215,7 @@ class AvatarController extends Controller { } else { //Add imgfile return new JSONResponse( - ['data' => ['message' => $this->l->t('No image or file provided')]], + ['data' => ['message' => $this->l10n->t('No image or file provided')]], Http::STATUS_BAD_REQUEST ); } @@ -248,7 +230,7 @@ class AvatarController extends Controller { $mimeType = $image->mimeType(); if ($mimeType !== 'image/jpeg' && $mimeType !== 'image/png') { return new JSONResponse( - ['data' => ['message' => $this->l->t('Unknown filetype')]], + ['data' => ['message' => $this->l10n->t('Unknown filetype')]], Http::STATUS_OK ); } @@ -262,7 +244,7 @@ class AvatarController extends Controller { return new JSONResponse(['status' => 'success']); } catch (\Throwable $e) { $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); - return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); + return new JSONResponse(['data' => ['message' => $this->l10n->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); } } @@ -273,13 +255,13 @@ class AvatarController extends Controller { ); } else { return new JSONResponse( - ['data' => ['message' => $this->l->t('Invalid image')]], + ['data' => ['message' => $this->l10n->t('Invalid image')]], Http::STATUS_OK ); } } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); - return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK); + return new JSONResponse(['data' => ['message' => $this->l10n->t('An error occurred. Please contact your admin.')]], Http::STATUS_OK); } } @@ -293,7 +275,7 @@ class AvatarController extends Controller { return new JSONResponse(); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); - return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); + return new JSONResponse(['data' => ['message' => $this->l10n->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); } } @@ -306,7 +288,7 @@ class AvatarController extends Controller { $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t("No temporary profile picture available, try again") ]], Http::STATUS_NOT_FOUND); } @@ -330,19 +312,19 @@ class AvatarController extends Controller { */ public function postCroppedAvatar(?array $crop = null): JSONResponse { if (is_null($crop)) { - return new JSONResponse(['data' => ['message' => $this->l->t("No crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t("No crop data provided")]], Http::STATUS_BAD_REQUEST); } if (!isset($crop['x'], $crop['y'], $crop['w'], $crop['h'])) { - return new JSONResponse(['data' => ['message' => $this->l->t("No valid crop data provided")]], + return new JSONResponse(['data' => ['message' => $this->l10n->t("No valid crop data provided")]], Http::STATUS_BAD_REQUEST); } $tmpAvatar = $this->cache->get('tmpAvatar'); if (is_null($tmpAvatar)) { return new JSONResponse(['data' => [ - 'message' => $this->l->t("No temporary profile picture available, try again") + 'message' => $this->l10n->t("No temporary profile picture available, try again") ]], Http::STATUS_BAD_REQUEST); } @@ -357,11 +339,11 @@ class AvatarController extends Controller { $this->cache->remove('tmpAvatar'); return new JSONResponse(['status' => 'success']); } catch (\OC\NotSquareException $e) { - return new JSONResponse(['data' => ['message' => $this->l->t('Crop is not square')]], + return new JSONResponse(['data' => ['message' => $this->l10n->t('Crop is not square')]], Http::STATUS_BAD_REQUEST); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'core']); - return new JSONResponse(['data' => ['message' => $this->l->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); + return new JSONResponse(['data' => ['message' => $this->l10n->t('An error occurred. Please contact your admin.')]], Http::STATUS_BAD_REQUEST); } } } diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index 16288a8b318..95e67371b5d 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -33,12 +33,12 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; class CSRFTokenController extends Controller { - private CsrfTokenManager $tokenManager; - - public function __construct(string $appName, IRequest $request, - CsrfTokenManager $tokenManager) { + public function __construct( + string $appName, + IRequest $request, + private CsrfTokenManager $tokenManager, + ) { parent::__construct($appName, $request); - $this->tokenManager = $tokenManager; } /** diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 2876621c97b..082d5b3f92e 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -57,45 +57,24 @@ use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; class ClientFlowLoginController extends Controller { - private IUserSession $userSession; - private IL10N $l10n; - private Defaults $defaults; - private ISession $session; - private IProvider $tokenProvider; - private ISecureRandom $random; - private IURLGenerator $urlGenerator; - private ClientMapper $clientMapper; - private AccessTokenMapper $accessTokenMapper; - private ICrypto $crypto; - private IEventDispatcher $eventDispatcher; - public const STATE_NAME = 'client.flow.state.token'; - public function __construct(string $appName, - IRequest $request, - IUserSession $userSession, - IL10N $l10n, - Defaults $defaults, - ISession $session, - IProvider $tokenProvider, - ISecureRandom $random, - IURLGenerator $urlGenerator, - ClientMapper $clientMapper, - AccessTokenMapper $accessTokenMapper, - ICrypto $crypto, - IEventDispatcher $eventDispatcher) { + public function __construct( + string $appName, + IRequest $request, + private IUserSession $userSession, + private IL10N $l10n, + private Defaults $defaults, + private ISession $session, + private IProvider $tokenProvider, + private ISecureRandom $random, + private IURLGenerator $urlGenerator, + private ClientMapper $clientMapper, + private AccessTokenMapper $accessTokenMapper, + private ICrypto $crypto, + private IEventDispatcher $eventDispatcher, + ) { parent::__construct($appName, $request); - $this->userSession = $userSession; - $this->l10n = $l10n; - $this->defaults = $defaults; - $this->session = $session; - $this->tokenProvider = $tokenProvider; - $this->random = $random; - $this->urlGenerator = $urlGenerator; - $this->clientMapper = $clientMapper; - $this->accessTokenMapper = $accessTokenMapper; - $this->crypto = $crypto; - $this->eventDispatcher = $eventDispatcher; } private function getClientName(): string { diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index 0c12f1a612f..8a21148f589 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -51,34 +51,19 @@ class ClientFlowLoginV2Controller extends Controller { public const TOKEN_NAME = 'client.flow.v2.login.token'; public const STATE_NAME = 'client.flow.v2.state.token'; - private LoginFlowV2Service $loginFlowV2Service; - private IURLGenerator $urlGenerator; - private IUserSession $userSession; - private ISession $session; - private ISecureRandom $random; - private Defaults $defaults; - private ?string $userId; - private IL10N $l10n; - - public function __construct(string $appName, - IRequest $request, - LoginFlowV2Service $loginFlowV2Service, - IURLGenerator $urlGenerator, - ISession $session, - IUserSession $userSession, - ISecureRandom $random, - Defaults $defaults, - ?string $userId, - IL10N $l10n) { + public function __construct( + string $appName, + IRequest $request, + private LoginFlowV2Service $loginFlowV2Service, + private IURLGenerator $urlGenerator, + private ISession $session, + private IUserSession $userSession, + private ISecureRandom $random, + private Defaults $defaults, + private ?string $userId, + private IL10N $l10n, + ) { parent::__construct($appName, $request); - $this->loginFlowV2Service = $loginFlowV2Service; - $this->urlGenerator = $urlGenerator; - $this->session = $session; - $this->userSession = $userSession; - $this->random = $random; - $this->defaults = $defaults; - $this->userId = $userId; - $this->l10n = $l10n; } /** diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 659ff32baee..da90f27c9ef 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -25,6 +25,7 @@ declare(strict_types=1); * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ + namespace OC\Core\Controller; use Exception; @@ -41,22 +42,14 @@ use OCP\IUserSession; use Psr\Log\LoggerInterface; class CollaborationResourcesController extends OCSController { - private IManager $manager; - private IUserSession $userSession; - private LoggerInterface $logger; - public function __construct( string $appName, IRequest $request, - IManager $manager, - IUserSession $userSession, - LoggerInterface $logger + private IManager $manager, + private IUserSession $userSession, + private LoggerInterface $logger, ) { parent::__construct($appName, $request); - - $this->manager = $manager; - $this->userSession = $userSession; - $this->logger = $logger; } /** diff --git a/core/Controller/ContactsMenuController.php b/core/Controller/ContactsMenuController.php index 87ed02362aa..7b8f2e50aa5 100644 --- a/core/Controller/ContactsMenuController.php +++ b/core/Controller/ContactsMenuController.php @@ -33,13 +33,12 @@ use OCP\IRequest; use OCP\IUserSession; class ContactsMenuController extends Controller { - private Manager $manager; - private IUserSession $userSession; - - public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { + public function __construct( + IRequest $request, + private IUserSession $userSession, + private Manager $manager, + ) { parent::__construct('core', $request); - $this->userSession = $userSession; - $this->manager = $manager; } /** diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index 792be71f9e1..7aec5850aea 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -45,16 +45,16 @@ use OCP\IRequest; class CssController extends Controller { protected IAppData $appData; - protected ITimeFactory $timeFactory; - public function __construct(string $appName, - IRequest $request, - Factory $appDataFactory, - ITimeFactory $timeFactory) { + public function __construct( + string $appName, + IRequest $request, + Factory $appDataFactory, + protected ITimeFactory $timeFactory, + ) { parent::__construct($appName, $request); $this->appData = $appDataFactory->get('css'); - $this->timeFactory = $timeFactory; } /** diff --git a/core/Controller/GuestAvatarController.php b/core/Controller/GuestAvatarController.php index dc4f81bd643..6f06451b796 100644 --- a/core/Controller/GuestAvatarController.php +++ b/core/Controller/GuestAvatarController.php @@ -33,21 +33,16 @@ use Psr\Log\LoggerInterface; * This controller handles guest avatar requests. */ class GuestAvatarController extends Controller { - private LoggerInterface $logger; - private IAvatarManager $avatarManager; - /** * GuestAvatarController constructor. */ public function __construct( string $appName, IRequest $request, - IAvatarManager $avatarManager, - LoggerInterface $logger + private IAvatarManager $avatarManager, + private LoggerInterface $logger, ) { parent::__construct($appName, $request); - $this->avatarManager = $avatarManager; - $this->logger = $logger; } /** diff --git a/core/Controller/HoverCardController.php b/core/Controller/HoverCardController.php index 632cdd0d02f..cfe95be0431 100644 --- a/core/Controller/HoverCardController.php +++ b/core/Controller/HoverCardController.php @@ -33,13 +33,12 @@ use OCP\IUserSession; use OCP\Share\IShare; class HoverCardController extends \OCP\AppFramework\OCSController { - private Manager $manager; - private IUserSession $userSession; - - public function __construct(IRequest $request, IUserSession $userSession, Manager $manager) { + public function __construct( + IRequest $request, + private IUserSession $userSession, + private Manager $manager, + ) { parent::__construct('core', $request); - $this->userSession = $userSession; - $this->manager = $manager; } /** diff --git a/core/ajax/update.php b/core/ajax/update.php index c28f2cdcd7c..2348e205283 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -103,7 +103,7 @@ class FeedBackHandler { if (\OCP\Util::needUpgrade()) { $config = \OC::$server->getSystemConfig(); if ($config->getValue('upgrade.disable-web', false)) { - $eventSource->send('failure', $l->t('Please use the command line updater because updating via the browser is disabled in your config.php.')); + $eventSource->send('failure', $l->t('Please use the command line updater because updating via browser is disabled in your config.php.')); $eventSource->close(); exit(); } diff --git a/core/templates/update.use-cli.php b/core/templates/update.use-cli.php index 403de7feadc..ae82436d2f1 100644 --- a/core/templates/update.use-cli.php +++ b/core/templates/update.use-cli.php @@ -5,10 +5,14 @@ <?php if ($_['tooBig']) { p($l->t('Please use the command line updater because you have a big instance with more than 50 users.')); } else { - p($l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); + p($l->t('Please use the command line updater because updating via browser is disabled in your config.php.')); } ?><br><br> - <?php - print_unescaped($l->t('For help, see the <a target="_blank" rel="noreferrer noopener" href="%s">documentation</a>.', [link_to_docs('admin-cli-upgrade')])); ?> + <?php if (is_string($_['cliUpgradeLink']) && $_['cliUpgradeLink'] !== '') { + $cliUpgradeLink = $_['cliUpgradeLink']; + } else { + $cliUpgradeLink = link_to_docs('admin-cli-upgrade'); + } + print_unescaped($l->t('For help, see the <a target="_blank" rel="noreferrer noopener" href="%s">documentation</a>.', [$cliUpgradeLink])); ?> </div> </div> diff --git a/lib/base.php b/lib/base.php index 83f97963c4d..09ec5be441b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -312,6 +312,7 @@ class OC { * Prints the upgrade page */ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void { + $cliUpgradeLink = $systemConfig->getValue('upgrade.cli-upgrade-link', ''); $disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false); $tooBig = false; if (!$disableWebUpdater) { @@ -358,6 +359,7 @@ class OC { $template->assign('productName', 'nextcloud'); // for now $template->assign('version', OC_Util::getVersionString()); $template->assign('tooBig', $tooBig); + $template->assign('cliUpgradeLink', $cliUpgradeLink); $template->printPage(); die(); diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index 23843cd21d1..48097674fdf 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -203,7 +203,6 @@ class TemplateResponse extends Response { $renderAs = $this->renderAs; } - \OCP\Util::addHeader('meta', ['name' => 'robots', 'content' => 'noindex, nofollow']); $template = new \OCP\Template($this->appName, $this->templateName, $renderAs); foreach ($this->params as $key => $value) { |