<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">
private $memoryInfo;
/** @var ISecureRandom */
private $secureRandom;
+ /** @var IniGetWrapper */
+ private $iniGetWrapper;
public function __construct($AppName,
IRequest $request,
ILockingProvider $lockingProvider,
IDateTimeFormatter $dateTimeFormatter,
MemoryInfo $memoryInfo,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom,
+ IniGetWrapper $iniGetWrapper) {
parent::__construct($AppName, $request);
$this->config = $config;
$this->clientService = $clientService;
$this->dateTimeFormatter = $dateTimeFormatter;
$this->memoryInfo = $memoryInfo;
$this->secureRandom = $secureRandom;
+ $this->iniGetWrapper = $iniGetWrapper;
}
/**
* @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;
}
namespace OC\Core\Command\Maintenance;
+use bantu\IniGetWrapper\IniGetWrapper;
use InvalidArgumentException;
use OC\Installer;
use OC\Setup;
class Install extends Command {
- /**
- * @var SystemConfig
- */
+ /** @var SystemConfig */
private $config;
+ /** @var IniGetWrapper */
+ private $iniGetWrapper;
- public function __construct(SystemConfig $config) {
+ public function __construct(SystemConfig $config, IniGetWrapper $iniGetWrapper) {
parent::__construct();
$this->config = $config;
+ $this->iniGetWrapper = $iniGetWrapper;
}
protected function configure() {
$server = \OC::$server;
$setupHelper = new Setup(
$this->config,
- $server->getIniWrapper(),
+ $this->iniGetWrapper,
$server->getL10N('lib'),
$server->query(Defaults::class),
$server->getLogger(),
\OC::$server->getSession()->clear();
$setupHelper = new OC\Setup(
$systemConfig,
- \OC::$server->getIniWrapper(),
+ \OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class),
\OC::$server->getL10N('lib'),
\OC::$server->query(\OCP\Defaults::class),
\OC::$server->getLogger(),
namespace OC;
+use bantu\IniGetWrapper\IniGetWrapper;
+
/**
* Helper class for large files on 32-bit platforms.
*/
* null on failure.
*/
public function getFileSizeViaCurl($fileName) {
- if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') {
+ if (\OC::$server->get(IniGetWrapper::class)->getString('open_basedir') === '') {
$encodedFileName = rawurlencode($fileName);
$ch = curl_init("file:///$encodedFileName");
curl_setopt($ch, CURLOPT_NOBODY, true);
namespace OC\Memcache;
+use bantu\IniGetWrapper\IniGetWrapper;
use OCP\IMemcache;
class APCu extends Cache implements IMemcache {
public static function isAvailable() {
if (!extension_loaded('apcu')) {
return false;
- } elseif (!\OC::$server->getIniWrapper()->getBool('apc.enabled')) {
+ } elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enabled')) {
return false;
- } elseif (!\OC::$server->getIniWrapper()->getBool('apc.enable_cli') && \OC::$CLI) {
+ } elseif (!\OC::$server->get(IniGetWrapper::class)->getBool('apc.enable_cli') && \OC::$CLI) {
return false;
} elseif (
version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 &&
return $factory->getLDAPProvider();
});
$this->registerService(ILockingProvider::class, function (Server $c) {
- $ini = $c->getIniWrapper();
+ $ini = $c->get(IniGetWrapper::class);
$config = $c->getConfig();
$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
* @deprecated
*/
public function getIniWrapper() {
- return $this->query('IniWrapper');
+ return $this->query(IniGetWrapper::class);
}
/**
$setupHelper = new \OC\Setup(
$config,
- \OC::$server->getIniWrapper(),
+ \OC::$server->get(IniGetWrapper::class),
\OC::$server->getL10N('lib'),
\OC::$server->query(Defaults::class),
\OC::$server->getLogger(),
namespace OC;
+use bantu\IniGetWrapper\IniGetWrapper;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\ITempManager;
+use Psr\Log\LoggerInterface;
class TempManager implements ITempManager {
/** @var string[] Current temporary files and folders, used for cleanup */
protected $current = [];
/** @var string i.e. /tmp on linux systems */
protected $tmpBaseDir;
- /** @var ILogger */
+ /** @var LoggerInterface */
protected $log;
/** @var IConfig */
protected $config;
+ /** @var IniGetWrapper */
+ protected $iniGetWrapper;
/** Prefix */
public const TMP_PREFIX = 'oc_tmp_';
- /**
- * @param \OCP\ILogger $logger
- * @param \OCP\IConfig $config
- */
- public function __construct(ILogger $logger, IConfig $config) {
+ public function __construct(LoggerInterface $logger, IConfig $config, IniGetWrapper $iniGetWrapper) {
$this->log = $logger;
$this->config = $config;
+ $this->iniGetWrapper = $iniGetWrapper;
$this->tmpBaseDir = $this->getTempBaseDir();
}
if ($temp = $this->config->getSystemValue('tempdirectory', null)) {
$directories[] = $temp;
}
- if ($temp = \OC::$server->getIniWrapper()->get('upload_tmp_dir')) {
+ if ($temp = $this->iniGetWrapper->get('upload_tmp_dir')) {
$directories[] = $temp;
}
if ($temp = getenv('TMP')) {
namespace OC;
+use bantu\IniGetWrapper\IniGetWrapper;
use OC\Search\SearchQuery;
use OC\Template\JSCombiner;
use OC\Template\JSConfigHelper;
\OC::$server->getUserSession()->getUser(),
$this->config,
\OC::$server->getGroupManager(),
- \OC::$server->getIniWrapper(),
+ \OC::$server->get(IniGetWrapper::class),
\OC::$server->getURLGenerator(),
\OC::$server->getCapabilitiesManager(),
\OC::$server->query(IInitialStateService::class)
}
}
}
-
+
$this->assign('initialStates', $this->initialState->getInitialStates());
}
*
*/
+use bantu\IniGetWrapper\IniGetWrapper;
use OC\Files\View;
use OC\Streamer;
use OCP\Lock\ILockingProvider;
OC_Util::obEnd();
$streamer->sendHeaders($name);
- $executionTime = (int)OC::$server->getIniWrapper()->getNumeric('max_execution_time');
+ $executionTime = (int)OC::$server->get(IniGetWrapper::class)->getNumeric('max_execution_time');
if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit(0);
}
*
*/
+use bantu\IniGetWrapper\IniGetWrapper;
use Symfony\Component\Process\ExecutableFinder;
/**
// Default check will be done with $path directories :
$dirs = explode(PATH_SEPARATOR, $path);
// WARNING : We have to check if open_basedir is enabled :
- $obd = OC::$server->getIniWrapper()->getString('open_basedir');
+ $obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir');
if ($obd != "none") {
$obd_values = explode(PATH_SEPARATOR, $obd);
if (count($obd_values) > 0 and $obd_values[0]) {
* @return int PHP upload file size limit
*/
public static function uploadLimit() {
- $ini = \OC::$server->getIniWrapper();
+ $ini = \OC::$server->get(IniGetWrapper::class);
$upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size'));
if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
if (!function_exists($function_name)) {
return false;
}
- $ini = \OC::$server->getIniWrapper();
+ $ini = \OC::$server->get(IniGetWrapper::class);
$disabled = explode(',', $ini->get('disable_functions') ?: '');
$disabled = array_map('trim', $disabled);
if (in_array($function_name, $disabled)) {
*
*/
+use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppFramework\Http\Request;
use OC\Files\Storage\LocalRootStorage;
use OCP\IConfig;
$webServerRestart = false;
$setup = new \OC\Setup(
$config,
- \OC::$server->getIniWrapper(),
+ \OC::$server->get(IniGetWrapper::class),
\OC::$server->getL10N('lib'),
\OC::$server->query(\OCP\Defaults::class),
\OC::$server->getLogger(),
$missingDependencies = [];
$invalidIniSettings = [];
- $iniWrapper = \OC::$server->getIniWrapper();
+ $iniWrapper = \OC::$server->get(IniGetWrapper::class);
foreach ($dependencies['classes'] as $class => $module) {
if (!class_exists($class)) {
$missingDependencies[] = $module;
namespace Test;
+use bantu\IniGetWrapper\IniGetWrapper;
+
/**
* Tests whether LargeFileHelper is able to determine file size at all.
* Large files are not considered yet.
'The PHP curl extension is required for this test.'
);
}
- if (\OC::$server->getIniWrapper()->getString('open_basedir') !== '') {
+ if (\OC::$server->get(IniGetWrapper::class)->getString('open_basedir') !== '') {
$this->markTestSkipped(
'The PHP curl extension does not work with the file:// protocol when open_basedir is enabled.'
);