N°4720 - Remove old unreferenced methods or pages that are @deprecated (#747)

* N°4720 - Remove old unreferenced methods that are @deprecated

* N°4720-Config addson getter/setter removal

* small deprecation removal

* revert @deprecation 3.3 removal: ResizeImageToFit

* small deprecation removal

* revert deprecation 3.3 removal: Config/GSetAddons
This commit is contained in:
odain-cbd
2025-09-11 15:52:00 +02:00
committed by GitHub
parent d728be119c
commit 696e2c9565
27 changed files with 126 additions and 1135 deletions

View File

@@ -3,7 +3,7 @@
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@@ -84,7 +84,7 @@ class DBRestore extends DBBackup
{
$this->LogError("mysql said: $sLine");
}
if (count($aOutput) == 1)
if (count($aOutput) == 1)
{
$sMoreInfo = trim($aOutput[0]);
}
@@ -96,18 +96,6 @@ class DBRestore extends DBBackup
}
}
/**
* @deprecated Use RestoreFromCompressedBackup instead
*
* @param $sZipFile
* @param string $sEnvironment
*/
public function RestoreFromZip($sZipFile, $sEnvironment = 'production')
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Use RestoreFromCompressedBackup instead');
$this->RestoreFromCompressedBackup($sZipFile, $sEnvironment);
}
/**
* <strong>Warning</strong> : can't be called with a loaded DataModel as we're compiling after restore
*
@@ -180,7 +168,7 @@ class DBRestore extends DBBackup
@chmod($sConfigFile, 0770); // Allow overwriting the file
rename($sDataDir.'/config-itop.php', $sConfigFile);
@chmod($sConfigFile, 0440); // Read-only
$aExtraFiles = $this->ListExtraFiles($sDataDir);
foreach($aExtraFiles as $sSourceFilePath => $sDestinationFilePath) {
SetupUtils::builddir(dirname($sDestinationFilePath));

View File

@@ -114,47 +114,6 @@ class ManageBrick extends PortalBrick
self::ENUM_TILE_MODE_TOP,
);
/** @var array $aPresentationData
* @deprecated since 3.2.1
*/
public static $aPresentationData = array(
self::ENUM_TILE_MODE_BADGE => array(
'decorationCssClass' => 'fas fa-id-card fa-2x',
'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-badge.html.twig',
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
'need_details' => true,
),
self::ENUM_TILE_MODE_TOP => array(
'decorationCssClass' => 'fas fa-signal fa-rotate-270 fa-2x',
'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-top-list.html.twig',
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
'need_details' => true,
),
self::ENUM_TILE_MODE_PIE => array(
'decorationCssClass' => 'fas fa-chart-pie fa-2x',
'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-chart.html.twig',
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART,
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_PIE,
'need_details' => false,
),
self::ENUM_TILE_MODE_BAR => array(
'decorationCssClass' => 'fas fa-chart-bar fa-2x',
'tileTemplate' => 'itop-portal-base/portal/templates/bricks/manage/tile-chart.html.twig',
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART,
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_BAR,
'need_details' => false,
),
self::ENUM_TILE_MODE_TEXT => array(
'decorationCssClass' => 'fas fa-pen-square fa-2x',
'tileTemplate' => self::DEFAULT_TILE_TEMPLATE_PATH,
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
'need_details' => true,
),
);
/** @var array $aDefaultTileData */
private static array $aDefaultTileData = [
self::ENUM_TILE_MODE_BADGE => [
@@ -261,31 +220,6 @@ class ManageBrick extends PortalBrick
$this->AddGrouping('areas', array('attribute' => 'finalclass'));
}
/**
* Returns true if the $sDisplayMode need objects details for rendering.
*
* @deprecated since 3.2.1
*
* @param string $sDisplayMode
*
* @return bool
*/
static public function AreDetailsNeededForDisplayMode($sDisplayMode)
{
$bNeedDetails = false;
foreach (static::$aPresentationData as $aData)
{
if ($aData['layoutDisplayMode'] === $sDisplayMode)
{
$bNeedDetails = $aData['need_details'];
break;
}
}
return $bNeedDetails;
}
/**
* Returns if the $sLayoutMode need objects details for rendering.
*
@@ -300,29 +234,6 @@ class ManageBrick extends PortalBrick
return static::$aDefaultLayoutData[$sLayoutMode]['need_details'];
}
/**
* Returns the page template path for the $sDisplayMode
*
* @deprecated since 3.2.1
*
* @param string $sDisplayMode
* @return string
*/
static public function GetPageTemplateFromDisplayMode($sDisplayMode)
{
$sTemplate = static::DEFAULT_PAGE_TEMPLATE_PATH;
foreach (static::$aPresentationData as $aData)
{
if ($aData['layoutDisplayMode'] === $sDisplayMode)
{
$sTemplate = $aData['layoutTemplate'];
break;
}
}
return $sTemplate;
}
/**
* Returns the page template path for the $sDisplayMode
*
@@ -450,14 +361,6 @@ class ManageBrick extends PortalBrick
return $this->sTileMode;
}
/**
* @deprecated since 3.2.1
*/
public function GetDecorationCssClass()
{
return static::$aPresentationData[$this->sTileMode]['decorationCssClass'];
}
/**
* @since 3.2.1
*
@@ -482,23 +385,6 @@ class ManageBrick extends PortalBrick
return $this;
}
/**
* @deprecated since 3.2.1
*
* @param string $sTileMode
*
* @return string[] parameters for specified type, default parameters if type is invalid
*/
public function GetPresentationDataForTileMode($sTileMode)
{
if (isset(static::$aPresentationData[$sTileMode]))
{
return static::$aPresentationData[$sTileMode];
}
return static::$aPresentationData[static::DEFAULT_TILE_MODE];
}
/**
* @return mixed
*/
@@ -587,7 +473,7 @@ class ManageBrick extends PortalBrick
/**
* Returns the default lists length to display
*
*
* @return int
*/
public function GetDefaultListLength()
@@ -597,9 +483,9 @@ class ManageBrick extends PortalBrick
/**
* Sets the default lists length to display
*
*
* @param int $iDefaultListLength
*
*
* @return $this
*/
public function SetDefaultListLength($iDefaultListLength) {

View File

@@ -86,8 +86,6 @@ abstract class PortalBrick extends AbstractBrick
protected $sDecorationClassHome;
/** @var string $sDecorationClassNavigationMenu */
protected $sDecorationClassNavigationMenu;
/** @var string $sTileTemplatePath @deprecated since 3.2.1 */
protected $sTileTemplatePath;
/** @var string|null $sTileControllerAction */
protected $sTileControllerAction;
/** @var string $sOpeningTarget */
@@ -136,9 +134,6 @@ abstract class PortalBrick extends AbstractBrick
$this->bVisibleNavigationMenu = static::DEFAULT_VISIBLE_NAVIGATION_MENU;
$this->sDecorationClassHome = static::DEFAULT_DECORATION_CLASS_HOME;
$this->sDecorationClassNavigationMenu = static::DEFAULT_DECORATION_CLASS_NAVIGATION_MENU;
// BEGIN cleaning 3.2.1 deprecated
$this->sTileTemplatePath = static::DEFAULT_TILE_TEMPLATE_PATH;
// END cleaning 3.2.1 deprecated
$this->sTileControllerAction = static::DEFAULT_TILE_CONTROLLER_ACTION;
$this->sOpeningTarget = static::DEFAULT_OPENING_TARGET;
}
@@ -263,18 +258,6 @@ abstract class PortalBrick extends AbstractBrick
return $this->sTileControllerAction;
}
/**
* Returns the brick tile template path
*
* @return string
*
* @deprecated since 3.2.1 use GetTemplatePath('tile') instead
*/
public function GetTileTemplatePath()
{
return $this->GetTemplatePath('tile');
}
/**
* Returns the brick's objects opening target (modal, new tab, current window)
*
@@ -439,23 +422,6 @@ abstract class PortalBrick extends AbstractBrick
return $this;
}
/**
* Sets the brick tile template path
*
* @param string $sTileTemplatePath
*
* @return \Combodo\iTop\Portal\Brick\PortalBrick
*
* @deprecated since 3.2.1 use SetTemplatePath('tile') instead
*/
public function SetTileTemplatePath($sTileTemplatePath)
{
$this->sTileTemplatePath = $sTileTemplatePath;
$this->SetTemplatePath('tile', $sTileTemplatePath);
return $this;
}
/**
* Sets the brick tile controller action
*

View File

@@ -49,45 +49,6 @@ class ApplicationHelper
/** @var bool FORM_DEFAULT_ALWAYS_SHOW_SUBMIT */
const FORM_DEFAULT_ALWAYS_SHOW_SUBMIT = false;
/**
* Loads classes from the base portal
*
* @param string $sScannedDir Directory to load the files from
* @param string $sFilePattern Pattern of files to load
* @param string $sType Type of files to load, used only in the Exception message, can be anything
*
* @throws \Exception
* @deprecated Since 2.7.0
*
*/
public static function LoadClasses($sScannedDir, $sFilePattern, $sType)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod();
@trigger_error(
sprintf(
'Usage of legacy LoadClasses is deprecated. You should rely on autoloading (and therefore follow PSR4).',
__FILE__
),
E_USER_DEPRECATED
);
// Loading classes from base portal
foreach (scandir($sScannedDir) as $sFile)
{
if (strpos($sFile, $sFilePattern) !== false && file_exists($sFilepath = $sScannedDir.'/'.$sFile))
{
try
{
require_once $sFilepath;
}
catch (Exception $e)
{
throw new Exception('Error while trying to load '.$sType.' '.$sFile);
}
}
}
}
/**
* Loads the brick's security from the OQL queries to profiles arrays
*

View File

@@ -105,22 +105,4 @@ class Kernel extends BaseKernel
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS);
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS);
}
/**
* Checks if a given class name belongs to an active bundle.
*
* @param string $class A class name
*
* @return void true if the class belongs to an active bundle, false otherwise
*
* @api
*
* @deprecated Deprecated since version 2.6, to be removed in 3.0.
*/
public function isClassInActiveBundle($class)
{
DeprecatedCallsLog::NotifyDeprecatedPhpMethod();
// TODO: Implement isClassInActiveBundle() method.
}
}