From fd1064b04428aa70fbb491a1baa8fadf911c7ea1 Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 17 May 2022 15:15:22 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03950=20-=20Deprecate=20old=20unreference?= =?UTF-8?q?d=20methods=20that=20are=20@deprecated=20-=20BulkUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 10 ----- core/cmdbobject.class.inc.php | 52 -------------------------- core/metamodel.class.php | 31 +-------------- 3 files changed, 2 insertions(+), 91 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 8718669c9..66115b22a 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -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 diff --git a/core/cmdbobject.class.inc.php b/core/cmdbobject.class.inc.php index e2b6b6a0f..e53cd8659 100644 --- a/core/cmdbobject.class.inc.php +++ b/core/cmdbobject.class.inc.php @@ -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 diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 3eadc3313..4d7d2f701 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -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