mirror of
https://github.com/nextcloud/server.git
synced 2026-04-08 18:46:28 -04:00
fix: change config-warning to const per @come-nc request in the PR.
Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <es-github@rosenberg.org.il>
This commit is contained in:
parent
52d092da64
commit
3f539d78e3
2 changed files with 30 additions and 114 deletions
|
|
@ -16,6 +16,23 @@ use OCP\Util;
|
|||
*/
|
||||
class Config {
|
||||
public const ENV_PREFIX = 'NC_';
|
||||
public const CONF_WARNING = "
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
";
|
||||
|
||||
protected array $cache = [];
|
||||
protected array $envCache = [];
|
||||
|
|
@ -268,25 +285,9 @@ class Config {
|
|||
}
|
||||
|
||||
// Create a php file ...
|
||||
$content = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
\$CONFIG = ";
|
||||
$content = "<?php\n";
|
||||
$content .= self::CONF_WARNING;
|
||||
$content .= '$CONFIG = ';
|
||||
$content .= var_export(self::trustSystemConfig($this->cache), true);
|
||||
$content .= ";\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -97,25 +97,8 @@ class ConfigTest extends TestCase {
|
|||
$this->assertSame('moo', $config->getValue('foo'));
|
||||
|
||||
$content = file_get_contents($this->configFile);
|
||||
$expected = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
";
|
||||
$expected = "<?php\n";
|
||||
$expected .= \OC\Config::CONF_WARNING;
|
||||
$expected .= "\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n "
|
||||
. " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
|
||||
$this->assertEquals($expected, $content);
|
||||
|
|
@ -127,25 +110,8 @@ class ConfigTest extends TestCase {
|
|||
|
||||
$content = file_get_contents($this->configFile);
|
||||
|
||||
$expected = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
";
|
||||
$expected = "<?php\n";
|
||||
$expected .= \OC\Config::CONF_WARNING;
|
||||
$expected .= "\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n "
|
||||
. " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'bar' => 'red',\n 'apps' => \n "
|
||||
. " array (\n 0 => 'files',\n 1 => 'gallery',\n ),\n);\n";
|
||||
|
|
@ -177,25 +143,8 @@ class ConfigTest extends TestCase {
|
|||
$this->assertSame(null, $config->getValue('not_exists'));
|
||||
|
||||
$content = file_get_contents($this->configFile);
|
||||
$expected = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
";
|
||||
$expected = "<?php\n";
|
||||
$expected .= \OC\Config::CONF_WARNING;
|
||||
$expected .= "\$CONFIG = array (\n 'foo' => 'moo',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n "
|
||||
. " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n);\n";
|
||||
$this->assertEquals($expected, $content);
|
||||
|
|
@ -207,25 +156,8 @@ class ConfigTest extends TestCase {
|
|||
$this->assertSame('this_was_clearly_not_set_before', $config->getValue('foo', 'this_was_clearly_not_set_before'));
|
||||
$content = file_get_contents($this->configFile);
|
||||
|
||||
$expected = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
";
|
||||
$expected = "<?php\n";
|
||||
$expected .= \OC\Config::CONF_WARNING;
|
||||
$expected .= "\$CONFIG = array (\n 'beers' => \n array (\n 0 => 'Appenzeller',\n "
|
||||
. " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n);\n";
|
||||
$this->assertEquals($expected, $content);
|
||||
|
|
@ -246,25 +178,8 @@ class ConfigTest extends TestCase {
|
|||
|
||||
// Write a new value to the config
|
||||
$config->setValue('CoolWebsites', ['demo.owncloud.org', 'owncloud.org', 'owncloud.com']);
|
||||
$expected = "<?php
|
||||
|
||||
/*
|
||||
* WARNING
|
||||
*
|
||||
* This file gets modified by automatic processes and all lines that are not
|
||||
* active code (ie. comments) are lost during that process.
|
||||
*
|
||||
* If you want to document things with comments or use constants add your settings
|
||||
* in a '<NAME>.config.php' file which will be included and rendered into this file.
|
||||
*
|
||||
* Example:
|
||||
* <?php
|
||||
* \$CONFIG = [];
|
||||
*
|
||||
* See also: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#multiple-merged-configuration-files
|
||||
*/
|
||||
|
||||
";
|
||||
$expected = "<?php\n";
|
||||
$expected .= \OC\Config::CONF_WARNING;
|
||||
$expected .= "\$CONFIG = array (\n 'foo' => 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n "
|
||||
. " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'php53' => 'totallyOutdated',\n 'CoolWebsites' => \n array (\n "
|
||||
. " 0 => 'demo.owncloud.org',\n 1 => 'owncloud.org',\n 2 => 'owncloud.com',\n ),\n);\n";
|
||||
|
|
|
|||
Loading…
Reference in a new issue