Allow read-only configuration
Workaround required for IIS setups running ownCloud to prevent dataloss. Long-term solution would be to move some configuration settings to the database
This commit is contained in:
parent
553188273c
commit
fc116f563f
|
@ -434,6 +434,15 @@ $CONFIG = array(
|
||||||
*/
|
*/
|
||||||
'check_for_working_htaccess' => true,
|
'check_for_working_htaccess' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In certain environments it is desired to have a read-only config file.
|
||||||
|
* When this switch is set to ``true`` ownCloud will not verify whether the
|
||||||
|
* configuration is writable. However, it will not be possible to configure
|
||||||
|
* all options via the web-interface. Furthermore, when updating ownCloud
|
||||||
|
* it is required to make the config file writable again for the update
|
||||||
|
* process.
|
||||||
|
*/
|
||||||
|
'config_is_read_only' => false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging
|
* Logging
|
||||||
|
|
|
@ -194,9 +194,9 @@ class OC {
|
||||||
|
|
||||||
public static function checkConfig() {
|
public static function checkConfig() {
|
||||||
$l = \OC::$server->getL10N('lib');
|
$l = \OC::$server->getL10N('lib');
|
||||||
if (file_exists(self::$configDir . "/config.php")
|
$configFileWritable = file_exists(self::$configDir . "/config.php") && is_writable(self::$configDir . "/config.php");
|
||||||
and !is_writable(self::$configDir . "/config.php")
|
if (!$configFileWritable && !OC_Helper::isReadOnlyConfigEnabled()
|
||||||
) {
|
|| !$configFileWritable && \OCP\Util::needUpgrade()) {
|
||||||
if (self::$CLI) {
|
if (self::$CLI) {
|
||||||
echo $l->t('Cannot write into "config" directory!')."\n";
|
echo $l->t('Cannot write into "config" directory!')."\n";
|
||||||
echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n";
|
echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n";
|
||||||
|
|
|
@ -974,4 +974,12 @@ class OC_Helper {
|
||||||
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
|
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the config file is set manually to read-only
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isReadOnlyConfigEnabled() {
|
||||||
|
return \OC::$server->getConfig()->getSystemValue('config_is_read_only', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ $template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppasswor
|
||||||
$template->assign('entries', $entries);
|
$template->assign('entries', $entries);
|
||||||
$template->assign('entriesremain', $entriesRemaining);
|
$template->assign('entriesremain', $entriesRemaining);
|
||||||
$template->assign('htaccessworking', $htAccessWorking);
|
$template->assign('htaccessworking', $htAccessWorking);
|
||||||
|
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
|
||||||
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
|
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
|
||||||
$template->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8());
|
$template->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8());
|
||||||
$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
|
$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
|
||||||
|
|
|
@ -86,14 +86,28 @@ if (!$_['isConnectedViaHTTPS']) {
|
||||||
// is htaccess working ?
|
// is htaccess working ?
|
||||||
if (!$_['htaccessworking']) {
|
if (!$_['htaccessworking']) {
|
||||||
?>
|
?>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2><?php p($l->t('Security Warning'));?></h2>
|
<h2><?php p($l->t('Security Warning')); ?></h2>
|
||||||
|
|
||||||
<span class="securitywarning">
|
<span class="securitywarning">
|
||||||
<?php p($l->t('Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.')); ?>
|
<?php p($l->t('Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.')); ?>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
// is read only config enabled
|
||||||
|
if ($_['readOnlyConfigEnabled']) {
|
||||||
|
?>
|
||||||
|
<div class="section">
|
||||||
|
<h2><?php p($l->t('Read-Only config enabled'));?></h2>
|
||||||
|
|
||||||
|
<span class="securitywarning">
|
||||||
|
<?php p($l->t('The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); ?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
// Are doc blocks accessible?
|
// Are doc blocks accessible?
|
||||||
|
|
Loading…
Reference in New Issue