Browse Source

Make it possible to overload RestUtils (static methods called with static:: instead of self::) - iTop NOW REQUIRES PHP 5.3: we have verified, there are very installations of iTop made on PHP 5.2. It is worth to note that PHP 5.3 is already end of life (5.4 will become end of life in 8 months)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3584 a333f486-631f-4898-b8df-5754b55c2be0
romainq 10 years ago
parent
commit
22e3f8fd29
2 changed files with 9 additions and 9 deletions
  1. 8 8
      application/applicationextension.inc.php
  2. 1 1
      setup/setuputils.class.inc.php

+ 8 - 8
application/applicationextension.inc.php

@@ -1,5 +1,5 @@
 <?php
 <?php
-// Copyright (C) 2010-2012 Combodo SARL
+// Copyright (C) 2010-2015 Combodo SARL
 //
 //
 //   This file is part of iTop.
 //   This file is part of iTop.
 //
 //
@@ -781,7 +781,7 @@ class RestUtils
 		$oSearch = new DBObjectSearch($sClass);
 		$oSearch = new DBObjectSearch($sClass);
 		foreach ($oCriteria as $sAttCode => $value)
 		foreach ($oCriteria as $sAttCode => $value)
 		{
 		{
-			$realValue = self::MakeValue($sClass, $sAttCode, $value);
+			$realValue = static::MakeValue($sClass, $sAttCode, $value);
 			$oSearch->AddCondition($sAttCode, $realValue, '=');
 			$oSearch->AddCondition($sAttCode, $realValue, '=');
 			if (is_object($value) || is_array($value))
 			if (is_object($value) || is_array($value))
 			{
 			{
@@ -818,7 +818,7 @@ class RestUtils
 	{
 	{
 		if (is_object($key))
 		if (is_object($key))
 		{
 		{
-			$res = self::FindObjectFromCriteria($sClass, $key);
+			$res = static::FindObjectFromCriteria($sClass, $key);
 		}
 		}
 		elseif (is_numeric($key))
 		elseif (is_numeric($key))
 		{
 		{
@@ -882,7 +882,7 @@ class RestUtils
 			$oSearch = new DBObjectSearch($sClass);
 			$oSearch = new DBObjectSearch($sClass);
 			foreach ($key as $sAttCode => $value)
 			foreach ($key as $sAttCode => $value)
 			{
 			{
-				$realValue = self::MakeValue($sClass, $sAttCode, $value);
+				$realValue = static::MakeValue($sClass, $sAttCode, $value);
 				$oSearch->AddCondition($sAttCode, $realValue, '=');
 				$oSearch->AddCondition($sAttCode, $realValue, '=');
 			}
 			}
 		}
 		}
@@ -926,7 +926,7 @@ class RestUtils
 			$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
 			$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
 			if ($oAttDef instanceof AttributeExternalKey)
 			if ($oAttDef instanceof AttributeExternalKey)
 			{
 			{
-				$oExtKeyObject = self::FindObjectFromKey($oAttDef->GetTargetClass(), $value, true /* allow null */);
+				$oExtKeyObject = static::FindObjectFromKey($oAttDef->GetTargetClass(), $value, true /* allow null */);
 				$value = ($oExtKeyObject != null) ? $oExtKeyObject->GetKey() : 0;
 				$value = ($oExtKeyObject != null) ? $oExtKeyObject->GetKey() : 0;
 			}
 			}
 			elseif ($oAttDef instanceof AttributeLinkedSet)
 			elseif ($oAttDef instanceof AttributeLinkedSet)
@@ -939,7 +939,7 @@ class RestUtils
 				$aLinks = array();
 				$aLinks = array();
 				foreach($value as $oValues)
 				foreach($value as $oValues)
 				{
 				{
-					$oLnk = self::MakeObjectFromFields($sLnkClass, $oValues);
+					$oLnk = static::MakeObjectFromFields($sLnkClass, $oValues);
 					$aLinks[] = $oLnk;
 					$aLinks[] = $oLnk;
 				}
 				}
 				$value = DBObjectSet::FromArray($sLnkClass, $aLinks);
 				$value = DBObjectSet::FromArray($sLnkClass, $aLinks);
@@ -970,7 +970,7 @@ class RestUtils
 		$oObject = MetaModel::NewObject($sClass);
 		$oObject = MetaModel::NewObject($sClass);
 		foreach ($aFields as $sAttCode => $value)
 		foreach ($aFields as $sAttCode => $value)
 		{
 		{
-			$realValue = self::MakeValue($sClass, $sAttCode, $value);
+			$realValue = static::MakeValue($sClass, $sAttCode, $value);
 			try
 			try
 			{
 			{
 				$oObject->Set($sAttCode, $realValue);
 				$oObject->Set($sAttCode, $realValue);
@@ -997,7 +997,7 @@ class RestUtils
 		$sClass = get_class($oObject);
 		$sClass = get_class($oObject);
 		foreach ($aFields as $sAttCode => $value)
 		foreach ($aFields as $sAttCode => $value)
 		{
 		{
-			$realValue = self::MakeValue($sClass, $sAttCode, $value);
+			$realValue = static::MakeValue($sClass, $sAttCode, $value);
 			try
 			try
 			{
 			{
 				$oObject->Set($sAttCode, $realValue);
 				$oObject->Set($sAttCode, $realValue);

+ 1 - 1
setup/setuputils.class.inc.php

@@ -50,7 +50,7 @@ class CheckResult
 
 
 class SetupUtils
 class SetupUtils
 {
 {
-	const PHP_MIN_VERSION = '5.2.0';
+	const PHP_MIN_VERSION = '5.3.0';
 	const MYSQL_MIN_VERSION = '5.0.0';
 	const MYSQL_MIN_VERSION = '5.0.0';
 	const MIN_MEMORY_LIMIT = 33554432; // = 32*1024*1024 Beware: Computations are not allowed in defining constants
 	const MIN_MEMORY_LIMIT = 33554432; // = 32*1024*1024 Beware: Computations are not allowed in defining constants
 	const SUHOSIN_GET_MAX_VALUE_LENGTH = 2048;
 	const SUHOSIN_GET_MAX_VALUE_LENGTH = 2048;