From 4f3931e828b0e0710e25b433be7fb1978c6faccb Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 8 Jul 2020 10:33:15 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02370=20-=20Remove=20MySQL=20views=20in?= =?UTF-8?q?=20iTop,=20moved=20to=20"combodo-views"=20extension?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/metamodel.class.php | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 3e100cacd..8a0661ea1 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -5646,32 +5646,9 @@ abstract class MetaModel $sView = self::DBGetView($sClass); if (CMDBSource::IsTable($sView)) { - // Check that the view is complete - // - // Note: checking the list of attributes is not enough because the columns can be stable while the SELECT is not stable - // Example: new way to compute the friendly name - // The correct comparison algorithm is to compare the queries, - // by using "SHOW CREATE VIEW" (MySQL 5.0.1 required) or to look into INFORMATION_SCHEMA/views - // both requiring some privileges - // Decision: to simplify, let's consider the views as being wrong anytime - // Rework the view - // - $oFilter = new DBObjectSearch($sClass, ''); - $oFilter->AllowAllData(); - $sSQL = $oFilter->MakeSelectQuery(); - $aErrors[$sClass]['*'][] = "Redeclare view '$sView' (systematic - to support an eventual change in the friendly name computation)"; - $aSugFix[$sClass]['*'][] = "ALTER VIEW `$sView` AS $sSQL"; - } - else - { - // Create the view - // - $oFilter = new DBObjectSearch($sClass, ''); - $oFilter->AllowAllData(); - $sSQL = $oFilter->MakeSelectQuery(); - $aErrors[$sClass]['*'][] = "Missing view for class: $sClass"; - $aSugFix[$sClass]['*'][] = "DROP VIEW IF EXISTS `$sView`"; - $aSugFix[$sClass]['*'][] = "CREATE VIEW `$sView` AS $sSQL"; + // Remove deprecated views + $aErrors[$sClass]['*'][] = "Remove view '$sView' (deprecated, consider installing combodo-views if needed)"; + $aSugFix[$sClass]['*'][] = "DROP VIEW `$sView`"; } } return array($aErrors, $aSugFix);