Read-only mode relying successively on a DB property, and an application setting

SVN:trunk[972]
This commit is contained in:
Romain Quetiez
2010-11-24 16:52:55 +00:00
parent 7fbcdc407e
commit c63d25e223
2 changed files with 23 additions and 3 deletions

View File

@@ -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,

View File

@@ -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)