mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
code style last test cleanup review + enhance UI output and display only failed module dependencies real life test cleanup review: add more tests + refacto code review: enhance algo and APIs review: renaming enhance test coverage refactoring renaming + reorder functions/tests compute GetDependencyResolutionFeedback in Module class review2 : renaming things fix rebase + code formatting fix code formatting review changes refactoring: code cleanup/standardization/remove all prototype stuffs refactoring: code cleanup/standardization/remove all prototype stuffs add deps validation to extension ci job fix ci fix ci: test broken when dir to scan did not exist like production-modules fix tests module dependency validation moved in a core folder + cleanup dedicated unit/integration tests forget dependency computation optimization seen as too risky + keep only user friendly sort in case of setup error rebase on develop + split new sort computation apart from modulediscovery revert to previous legacy order + gather new module computation classes in a dedicated folder make validation work (dirty way) + cleanup make setup deterministic: complete dependency order with alphabetical one when 2 module elements are at same position final deps validation bases on DM and PHP classes init in beforeclass + read defined classes/interfaces by module module discovery classes renaming to avoid collision with customer DM definitions read module file data apart from ModuleDiscovery cleanup cleanup fix inconsistent module dependencies fix integration check save tmp work before trying to fetch other wml deps fix module dependencies fix DM filename typo rename ModuleXXX classes by iTopCoreModuleXXX to reduce collisions with extensions add phpdoc + add more tests module dependency optimization - refacto + dependency new sort order module dependency optimization - stop computation when no new dependency is resolved enhance module dependency computation for optimization and admin feedback
103 lines
2.8 KiB
PHP
Executable File
103 lines
2.8 KiB
PHP
Executable File
<?php
|
|
|
|
SetupWebPage::AddModule(
|
|
__FILE__,
|
|
'itop-tickets/3.3.0',
|
|
[
|
|
// Identification
|
|
//
|
|
'label' => 'Tickets Management',
|
|
'category' => 'business',
|
|
|
|
// Setup
|
|
//
|
|
'dependencies' => [
|
|
'itop-structure/2.7.1',
|
|
'itop-portal/3.0.0', // module_design_itop_design->module_designs->itop-portal
|
|
],
|
|
'mandatory' => false,
|
|
'visible' => true,
|
|
'installer' => 'TicketsInstaller',
|
|
|
|
// Components
|
|
//
|
|
'datamodel' => [
|
|
'main.itop-tickets.php',
|
|
],
|
|
'data.struct' => [
|
|
// 'data.struct.ta-actions.xml',
|
|
],
|
|
'data.sample' => [
|
|
],
|
|
|
|
// Documentation
|
|
//
|
|
'doc.manual_setup' => '',
|
|
'doc.more_information' => '',
|
|
|
|
// Default settings
|
|
//
|
|
'settings' => [
|
|
],
|
|
]
|
|
);
|
|
|
|
// Module installation handler
|
|
//
|
|
class TicketsInstaller extends ModuleInstallerAPI
|
|
{
|
|
public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
|
|
{
|
|
// Delete all Triggers corresponding to a no more valid class
|
|
CMDBObject::SetTrackInfo('Uninstallation');
|
|
$oSearch = new DBObjectSearch('TriggerOnObject');
|
|
$oSet = new DBObjectSet($oSearch);
|
|
while ($oTrigger = $oSet->Fetch()) {
|
|
try {
|
|
if (!MetaModel::IsValidClass($oTrigger->Get('target_class'))) {
|
|
$oTrigger->DBDelete();
|
|
}
|
|
} catch (Exception $e) {
|
|
utils::EnrichRaisedException($oTrigger, $e);
|
|
}
|
|
}
|
|
// It's not very clear if it make sense to test a particular version,
|
|
// as the loading mechanism checks object existence using reconc_keys
|
|
// and do not recreate them, nor update existing.
|
|
// Without test, new entries added to the data files, would be automatically loaded
|
|
if (($sPreviousVersion === '') ||
|
|
(version_compare($sPreviousVersion, $sCurrentVersion, '<')
|
|
&& version_compare($sPreviousVersion, '3.0.0', '<'))) {
|
|
$oDataLoader = new XMLDataLoader();
|
|
|
|
CMDBObject::SetTrackInfo("Initialization TicketsInstaller");
|
|
$oMyChange = CMDBObject::GetCurrentChange();
|
|
|
|
$sLang = null;
|
|
// - Try to get app. language from configuration fil (app. upgrade)
|
|
$sConfigFileName = APPCONF.'production/'.ITOP_CONFIG_FILE;
|
|
if (file_exists($sConfigFileName)) {
|
|
$oFileConfig = new Config($sConfigFileName);
|
|
if (is_object($oFileConfig)) {
|
|
$sLang = str_replace(' ', '_', strtolower($oFileConfig->GetDefaultLanguage()));
|
|
}
|
|
}
|
|
|
|
// - I still no language, get the default one
|
|
if (null === $sLang) {
|
|
$sLang = str_replace(' ', '_', strtolower($oConfiguration->GetDefaultLanguage()));
|
|
}
|
|
|
|
$sFileName = dirname(__FILE__)."/data/{$sLang}.data.itop-tickets.xml";
|
|
SetupLog::Info("Searching file: $sFileName");
|
|
if (!file_exists($sFileName)) {
|
|
$sFileName = dirname(__FILE__)."/data/en_us.data.itop-tickets.xml";
|
|
}
|
|
SetupLog::Info("Loading file: $sFileName");
|
|
$oDataLoader->StartSession($oMyChange);
|
|
$oDataLoader->LoadFile($sFileName, false, true);
|
|
$oDataLoader->EndSession();
|
|
}
|
|
}
|
|
}
|