🔊 N°3731 Log calls to deprecated files / PHP methods

POC for the log API was added in #193
This commit is contained in:
Pierre Goiffon
2021-04-13 16:20:32 +02:00
parent a6d20ab648
commit 59678ef8c6
39 changed files with 248 additions and 145 deletions

View File

@@ -1060,6 +1060,7 @@ abstract class MetaModel
*/
final public static function GetFilterCodeOrigin($sClass, $sAttCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
self::_check_subclass($sClass);
return self::$m_aFilterOrigins[$sClass][$sAttCode];
@@ -1419,7 +1420,9 @@ abstract class MetaModel
*/
final public static function GetFiltersList($sClass)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
self::_check_subclass($sClass);
return array_keys(self::$m_aFilterDefs[$sClass]);
}
@@ -1526,6 +1529,7 @@ abstract class MetaModel
*/
final public static function IsValidFilterCode($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
if (!array_key_exists($sClass, self::$m_aFilterDefs)) {
return false;
}
@@ -1837,7 +1841,9 @@ abstract class MetaModel
*/
public static function GetClassFilterDefs($sClass)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
self::_check_subclass($sClass);
return self::$m_aFilterDefs[$sClass];
}
@@ -1852,6 +1858,7 @@ abstract class MetaModel
*/
final public static function GetClassFilterDef($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
self::_check_subclass($sClass);
if (!array_key_exists($sFilterCode, self::$m_aFilterDefs[$sClass])) {
throw new CoreException("Unknown filter code '$sFilterCode' for class '$sClass'");
@@ -1871,9 +1878,9 @@ abstract class MetaModel
*/
public static function GetFilterLabel($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$oFilter = self::GetClassFilterDef($sClass, $sFilterCode);
if ($oFilter)
{
if ($oFilter) {
return $oFilter->GetLabel();
}
@@ -1890,11 +1897,12 @@ abstract class MetaModel
*/
public static function GetFilterDescription($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$oFilter = self::GetClassFilterDef($sClass, $sFilterCode);
if ($oFilter)
{
if ($oFilter) {
return $oFilter->GetDescription();
}
return "";
}
@@ -1908,11 +1916,12 @@ abstract class MetaModel
*/
public static function GetFilterOperators($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$oFilter = self::GetClassFilterDef($sClass, $sFilterCode);
if ($oFilter)
{
if ($oFilter) {
return $oFilter->GetOperators();
}
return array();
}
@@ -1926,9 +1935,9 @@ abstract class MetaModel
*/
public static function GetFilterLooseOperator($sClass, $sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$oFilter = self::GetClassFilterDef($sClass, $sFilterCode);
if ($oFilter)
{
if ($oFilter) {
return $oFilter->GetLooseOperator();
}
@@ -1946,9 +1955,9 @@ abstract class MetaModel
*/
public static function GetFilterOpDescription($sClass, $sFilterCode, $sOpCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
$oFilter = self::GetClassFilterDef($sClass, $sFilterCode);
if ($oFilter)
{
if ($oFilter) {
return $oFilter->GetOpDescription($sOpCode);
}
@@ -1963,6 +1972,8 @@ abstract class MetaModel
*/
public static function GetFilterHTMLInput($sFilterCode)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
return "<INPUT name=\"$sFilterCode\">";
}
@@ -2137,24 +2148,21 @@ abstract class MetaModel
*/
public static function EnumRelations($sClass = '')
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Use EnumRelationsEx instead');
$aResult = array_keys(self::$m_aRelationInfos);
if (!empty($sClass))
{
if (!empty($sClass)) {
// Return only the relations that have a meaning (i.e. for which at least one query is defined)
// for the specified class
$aClassRelations = array();
foreach($aResult as $sRelCode)
{
foreach ($aResult as $sRelCode) {
$aQueriesDown = self::EnumRelationQueries($sClass, $sRelCode);
if (count($aQueriesDown) > 0)
{
if (count($aQueriesDown) > 0) {
$aClassRelations[] = $sRelCode;
}
// Temporary patch: until the impact analysis GUI gets rewritten,
// let's consider that "depends on" is equivalent to "impacts/up"
// The current patch has been implemented in DBObject and MetaModel
if ($sRelCode == 'impacts')
{
if ($sRelCode == 'impacts') {
$aQueriesUp = self::EnumRelationQueries($sClass, 'impacts', false);
if (count($aQueriesUp) > 0)
{
@@ -5893,6 +5901,7 @@ abstract class MetaModel
$aSugFix[$sClass]['*'][] = "DROP VIEW `$sView`";
}
}
return array($aErrors, $aSugFix);
}
@@ -7118,6 +7127,8 @@ abstract class MetaModel
*/
public static function GetNextKey($sClass)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use ItopCounter::incRootClass($sClass) instead');
return ItopCounter::IncClass($sClass);
}
@@ -7141,9 +7152,9 @@ abstract class MetaModel
*/
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())
{
if (!self::DBIsReadOnly()) {
CMDBSource::Query($sSQL);
}
}
@@ -7160,12 +7171,13 @@ abstract class MetaModel
*/
public static function BulkUpdate(DBObjectSearch $oFilter, array $aValues)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('do not use : dead code, will be removed in the future');
// $aValues is an array of $sAttCode => $value
$sSQL = $oFilter->MakeUpdateQuery($aValues);
if (!self::DBIsReadOnly())
{
if (!self::DBIsReadOnly()) {
CMDBSource::Query($sSQL);
}
return CMDBSource::AffectedRows();
}