diff --git a/core/config.class.inc.php b/core/config.class.inc.php index c1205d964..bdefc6940 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -135,7 +135,7 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), - 'read_only' => array( + 'database_read_only' => array( 'type' => 'bool', 'description' => 'Freeze the data for administration purposes - administrators can still do anything... in appearance!', 'default' => false, diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 26c8f6089..a91f4605e 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -2536,10 +2536,30 @@ abstract class MetaModel return $aDataDump; } - // Temporary - investigate the cost of such a limitation + /* + * Determines wether the target DB is frozen or not + * 1 - consider the DB property 'status' + * 2 - check the setting 'database_read_only' + */ public static function DBIsReadOnly() { - return self::$m_oConfig->Get('read_only'); + $sStatus = DBProperty::GetProperty('status', null); + if (!is_null($sStatus)) + { + switch (strtolower(trim($sStatus))) + { + case 'fullaccess': + $ret = false; + break; + default: + $ret = true; + } + } + else + { + $ret = self::$m_oConfig->Get('database_read_only'); + } + return $ret; } protected static function MakeDictEntry($sKey, $sValueFromOldSystem, $sDefaultValue, &$bNotInDico)