N°3950 - Deprecate old unreferenced methods that are @deprecated - BulkUpdate

This commit is contained in:
acognet
2022-05-17 15:15:22 +02:00
parent 6086131d3c
commit fd1064b044
3 changed files with 2 additions and 91 deletions

View File

@@ -4525,16 +4525,6 @@ HTML;
}
}
/*
* @deprecated since 3.1.0
* Not used and not working !
*/
protected static function BulkUpdateTracked_Internal(DBSearch $oFilter, array $aValues)
{
// Todo - invoke the extension
return parent::BulkUpdateTracked_Internal($oFilter, $aValues);
}
protected function DBDeleteTracked_Internal(&$oDeletionPlan = null)
{
// Invoke extensions before the deletion (the deletion will do some cleanup and we might loose some information

View File

@@ -681,58 +681,6 @@ abstract class CMDBObject extends DBObject
return $ret;
}
/*
* @deprecated since 3.1.0
* Not used and not working !
*/
public static function BulkUpdate(DBSearch $oFilter, array $aValues)
{
return static::BulkUpdateTracked_Internal($oFilter, $aValues);
}
/*
* @deprecated since 3.1.0
* Not used and not working !
*/
public static function BulkUpdateTracked(CMDBChange $oChange, DBSearch $oFilter, array $aValues)
{
self::SetCurrentChange($oChange);
static::BulkUpdateTracked_Internal($oFilter, $aValues);
}
/*
* @deprecated since 3.1.0
* Not used and not working because parent::BulkUpdate doesn't exist!
*/
protected static function BulkUpdateTracked_Internal(DBSearch $oFilter, array $aValues)
{
// $aValues is an array of $sAttCode => $value
// Get the list of objects to update (and load it before doing the change)
$oObjSet = new CMDBObjectSet($oFilter);
$oObjSet->Load();
// Keep track of the previous values (will be overwritten when the objects are synchronized with the DB)
$aOriginalValues = array();
$oObjSet->Rewind();
while ($oItem = $oObjSet->Fetch())
{
$aOriginalValues[$oItem->GetKey()] = $oItem->m_aOrigValues;
}
// Update in one single efficient query
$ret = parent::BulkUpdate($oFilter, $aValues);
// Record... in many queries !!!
$oObjSet->Rewind();
while ($oItem = $oObjSet->Fetch())
{
$aChangedValues = $oItem->ListChangedValues($aValues);
$oItem->RecordAttChanges($aChangedValues, $aOriginalValues[$oItem->GetKey()]);
}
return $ret;
}
public function DBArchive()
{
// Note: do the job anyway, so as to repair any DB discrepancy

View File

@@ -7080,38 +7080,11 @@ abstract class MetaModel
}
/**
* Deletion of records, bypassing {@link DBObject::DBDelete} !!!
* It is NOT recommended to use this shortcut
* In particular, it will not work
* - if the class is not a final class
* - if the class has a hierarchical key (need to rebuild the indexes)
* - if the class overload DBDelete !
* @internal
*
* @deprecated do not use : dead code, will be removed in the future
* @experimental
*
* @param \DBObjectSearch $oFilter
*
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @todo: protect it against forbidden usages (in such a case, delete objects one by one)
*
*/
public static function BulkDelete(DBObjectSearch $oFilter)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$sSQL = $oFilter->MakeDeleteQuery();
if (!self::DBIsReadOnly()) {
CMDBSource::Query($sSQL);
}
}
/**
* @param DBObjectSearch $oFilter
* @param array $aValues array of attcode => value
* @param DBObjectSearch $oFilter
*
* @deprecated do not use : dead code, will be removed in the future
* @experimental
* @return int Modified objects
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException