module.itop-config-mgmt.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. SetupWebPage::AddModule(
  3. __FILE__, // Path to the current file, all other file names are relative to the directory containing this file
  4. 'itop-config-mgmt/2.4.0',
  5. array(
  6. // Identification
  7. //
  8. 'label' => 'Configuration Management (CMDB)',
  9. 'category' => 'business',
  10. // Setup
  11. //
  12. 'dependencies' => array(
  13. ),
  14. 'mandatory' => true,
  15. 'visible' => true,
  16. 'installer' => 'ConfigMgmtInstaller',
  17. // Components
  18. //
  19. 'datamodel' => array(
  20. 'model.itop-config-mgmt.php',
  21. 'main.itop-config-mgmt.php',
  22. ),
  23. 'data.struct' => array(
  24. ),
  25. 'data.sample' => array(
  26. 'data.sample.organizations.xml',
  27. 'data.sample.brand.xml',
  28. 'data.sample.model.xml',
  29. 'data.sample.osfamily.xml',
  30. 'data.sample.osversion.xml',
  31. 'data.sample.networkdevicetype.xml',
  32. 'data.sample.contacttype.xml',
  33. 'data.sample.locations.xml',
  34. 'data.sample.persons.xml',
  35. 'data.sample.teams.xml',
  36. 'data.sample.contactteam.xml',
  37. 'data.sample.servers.xml',
  38. 'data.sample.nw-devices.xml',
  39. 'data.sample.software.xml',
  40. 'data.sample.dbserver.xml',
  41. 'data.sample.dbschema.xml',
  42. 'data.sample.webserver.xml',
  43. 'data.sample.webapp.xml',
  44. 'data.sample.applications.xml',
  45. 'data.sample.applicationsolutionci.xml',
  46. ),
  47. // Documentation
  48. //
  49. 'doc.manual_setup' => '',
  50. 'doc.more_information' => '',
  51. // Default settings
  52. //
  53. 'settings' => array(
  54. ),
  55. )
  56. );
  57. if (!class_exists('ConfigMgmtInstaller'))
  58. {
  59. // Module installation handler
  60. //
  61. class ConfigMgmtInstaller extends ModuleInstallerAPI
  62. {
  63. public static function BeforeWritingConfig(Config $oConfiguration)
  64. {
  65. // If you want to override/force some configuration values, do it here
  66. return $oConfiguration;
  67. }
  68. /**
  69. * Handler called before creating or upgrading the database schema
  70. * @param $oConfiguration Config The new configuration of the application
  71. * @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
  72. * @param $sCurrentVersion string Current version number of the module
  73. */
  74. public static function BeforeDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
  75. {
  76. if (strlen($sPreviousVersion) > 0)
  77. {
  78. // If you want to migrate data from one format to another, do it here
  79. self::RenameEnumValueInDB('Software', 'type', 'DBserver', 'DBServer');
  80. self::RenameEnumValueInDB('Software', 'type', 'Webserver', 'WebServer');
  81. self::RenameEnumValueInDB('Model', 'type', 'SANswitch', 'SANSwitch');
  82. self::RenameEnumValueInDB('Model', 'type', 'IpPhone', 'IPPhone');
  83. self::RenameEnumValueInDB('Model', 'type', 'Telephone', 'Phone');
  84. self::RenameClassInDB('DBserver', 'DBServer');
  85. self::RenameClassInDB('OSfamily', 'OSFamily');
  86. self::RenameClassInDB('OSversion', 'OSVersion');
  87. self::RenameClassInDB('Webserver', 'WebServer');
  88. self::RenameClassInDB('OSpatch', 'OSPatch');
  89. self::RenameClassInDB('lnkFunctionalCIToOSpatch', 'lnkFunctionalCIToOSPatch');
  90. self::RenameClassInDB('OsLicence', 'OSLicence');
  91. self::RenameClassInDB('IOSversion', 'IOSVersion');
  92. self::RenameClassInDB('IPinterface', 'IPInterface');
  93. }
  94. }
  95. /**
  96. * Handler called after the creation/update of the database schema
  97. * @param $oConfiguration Config The new configuration of the application
  98. * @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
  99. * @param $sCurrentVersion string Current version number of the module
  100. */
  101. public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
  102. {
  103. }
  104. }
  105. }
  106. ?>