aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-08-20 19:45:47 +0200
committerGitHub <noreply@github.com>2020-08-20 19:45:47 +0200
commit987f62117351a658dc8c0916e38cfb0b7ca60982 (patch)
tree71baa54377f3bc4daf0329f08fa568f3e51e16ea /apps
parented1f89ae1023cff43d50f0cf027337eed872a31e (diff)
parent590d46121097d8b7dcd6f722b95f9dc4bdee653e (diff)
downloadnextcloud-server-987f62117351a658dc8c0916e38cfb0b7ca60982.tar.gz
nextcloud-server-987f62117351a658dc8c0916e38cfb0b7ca60982.zip
Merge pull request #22331 from nextcloud/bugfix/noid/dont-use-deprecated-inigetwrapper
Don't use deprecated getIniWrapper() anymore
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/templates/public.php4
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php18
-rw-r--r--apps/settings/tests/Controller/CheckSetupControllerTest.php13
3 files changed, 23 insertions, 12 deletions
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 82544385dec..ffc449f9e63 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -23,8 +23,8 @@
<input type="hidden" name="hideDownload" value="<?php p($_['hideDownload'] ? 'true' : 'false'); ?>" id="hideDownload">
<input type="hidden" id="disclaimerText" value="<?php p($_['disclaimer']) ?>">
<?php
-$upload_max_filesize = OC::$server->getIniWrapper()->getBytes('upload_max_filesize');
-$post_max_size = OC::$server->getIniWrapper()->getBytes('post_max_size');
+$upload_max_filesize = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('upload_max_filesize');
+$post_max_size = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('post_max_size');
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
?>
<input type="hidden" name="maxFilesizeUpload" value="<?php p($maxUploadFilesize); ?>" id="maxFilesizeUpload">
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 476b58e564a..6d237e04c1c 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -98,6 +98,8 @@ class CheckSetupController extends Controller {
private $memoryInfo;
/** @var ISecureRandom */
private $secureRandom;
+ /** @var IniGetWrapper */
+ private $iniGetWrapper;
public function __construct($AppName,
IRequest $request,
@@ -112,7 +114,8 @@ class CheckSetupController extends Controller {
ILockingProvider $lockingProvider,
IDateTimeFormatter $dateTimeFormatter,
MemoryInfo $memoryInfo,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom,
+ IniGetWrapper $iniGetWrapper) {
parent::__construct($AppName, $request);
$this->config = $config;
$this->clientService = $clientService;
@@ -126,6 +129,7 @@ class CheckSetupController extends Controller {
$this->dateTimeFormatter = $dateTimeFormatter;
$this->memoryInfo = $memoryInfo;
$this->secureRandom = $secureRandom;
+ $this->iniGetWrapper = $iniGetWrapper;
}
/**
@@ -407,25 +411,23 @@ Raw output
* @return bool
*/
protected function isOpcacheProperlySetup() {
- $iniWrapper = new IniGetWrapper();
-
- if (!$iniWrapper->getBool('opcache.enable')) {
+ if (!$this->iniGetWrapper->getBool('opcache.enable')) {
return false;
}
- if (!$iniWrapper->getBool('opcache.save_comments')) {
+ if (!$this->iniGetWrapper->getBool('opcache.save_comments')) {
return false;
}
- if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) {
+ if ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') < 10000) {
return false;
}
- if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) {
+ if ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') < 128) {
return false;
}
- if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) {
+ if ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') < 8) {
return false;
}
diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php
index a1f7e8aa83f..0bfecd05b9a 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -35,6 +35,7 @@
namespace OCA\Settings\Tests\Controller;
+use bantu\IniGetWrapper\IniGetWrapper;
use OC;
use OC\DB\Connection;
use OC\IntegrityCheck\Checker;
@@ -93,6 +94,8 @@ class CheckSetupControllerTest extends TestCase {
private $memoryInfo;
/** @var SecureRandom|\PHPUnit\Framework\MockObject\MockObject */
private $secureRandom;
+ /** @var IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
+ private $iniGetWrapper;
/**
* Holds a list of directories created during tests.
@@ -132,6 +135,7 @@ class CheckSetupControllerTest extends TestCase {
->setMethods(['isMemoryLimitSufficient',])
->getMock();
$this->secureRandom = $this->getMockBuilder(SecureRandom::class)->getMock();
+ $this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)->getMock();
$this->checkSetupController = $this->getMockBuilder(CheckSetupController::class)
->setConstructorArgs([
'settings',
@@ -148,6 +152,7 @@ class CheckSetupControllerTest extends TestCase {
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods([
'isReadOnlyConfig',
@@ -618,6 +623,7 @@ class CheckSetupControllerTest extends TestCase {
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods(null)->getMock();
@@ -651,6 +657,7 @@ class CheckSetupControllerTest extends TestCase {
$this->dateTimeFormatter,
$this->memoryInfo,
$this->secureRandom,
+ $this->iniGetWrapper,
])
->setMethods(null)->getMock();
@@ -1418,7 +1425,8 @@ Array
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
- $this->secureRandom
+ $this->secureRandom,
+ $this->iniGetWrapper
);
$this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isMysqlUsedWithoutUTF8MB4'));
@@ -1466,7 +1474,8 @@ Array
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
- $this->secureRandom
+ $this->secureRandom,
+ $this->iniGetWrapper
);
$this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed'));