Read-only mode - draft

SVN:trunk[961]
This commit is contained in:
Romain Quetiez
2010-11-22 14:13:49 +00:00
parent b30d6c4888
commit d0f168adbb
5 changed files with 79 additions and 7 deletions

View File

@@ -1401,6 +1401,7 @@ abstract class MetaModel
public static function Init_OverloadStateAttribute($sStateCode, $sAttCode, $iFlags)
{
// Warning: this is not sufficient: the flags have to be copied to the states that are inheriting from this state
$sTargetClass = self::GetCallersPHPClass("Init");
self::$m_aStates[$sTargetClass][$sStateCode]['attribute_list'][$sAttCode] = $iFlags;
}
@@ -2535,6 +2536,12 @@ abstract class MetaModel
return $aDataDump;
}
// Temporary - investigate the cost of such a limitation
public static function DBIsReadOnly()
{
return self::$m_oConfig->Get('read_only');
}
protected static function MakeDictEntry($sKey, $sValueFromOldSystem, $sDefaultValue, &$bNotInDico)
{
$sValue = Dict::S($sKey, 'x-no-nothing');
@@ -3505,14 +3512,20 @@ abstract class MetaModel
public static function BulkDelete(DBObjectSearch $oFilter)
{
$sSQL = self::MakeDeleteQuery($oFilter);
CMDBSource::Query($sSQL);
if (!self::DBIsReadOnly())
{
CMDBSource::Query($sSQL);
}
}
public static function BulkUpdate(DBObjectSearch $oFilter, array $aValues)
{
// $aValues is an array of $sAttCode => $value
$sSQL = self::MakeUpdateQuery($oFilter, $aValues);
CMDBSource::Query($sSQL);
if (!self::DBIsReadOnly())
{
CMDBSource::Query($sSQL);
}
}
// Links