Procházet zdrojové kódy

Adaptations to potentially run the setup from the CLI

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2181 a333f486-631f-4898-b8df-5754b55c2be0
dflaven před 12 roky
rodič
revize
a20a749587
1 změnil soubory, kde provedl 20 přidání a 17 odebrání
  1. 20 17
      datamodel/itop-tickets-1.0.0/module.itop-tickets.php

+ 20 - 17
datamodel/itop-tickets-1.0.0/module.itop-tickets.php

@@ -43,29 +43,32 @@ SetupWebPage::AddModule(
 	)
 );
 
-// Module installation handler
-//
-class TicketsInstaller extends ModuleInstallerAPI
+if (!class_exists('TicketsInstaller'))
 {
-	public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
+	// Module installation handler
+	//
+	class TicketsInstaller extends ModuleInstallerAPI
 	{
-		// Delete all Triggers corresponding to a no more valid class
-		$oSearch = new DBObjectSearch('TriggerOnObject');
-		$oSet = new DBObjectSet($oSearch);
-		$oChange = null;
-		while($oTrigger = $oSet->Fetch())
+		public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
 		{
-			if (!MetaModel::IsValidClass($oTrigger->Get('target_class')))
+			// Delete all Triggers corresponding to a no more valid class
+			$oSearch = new DBObjectSearch('TriggerOnObject');
+			$oSet = new DBObjectSet($oSearch);
+			$oChange = null;
+			while($oTrigger = $oSet->Fetch())
 			{
-				if ($oChange == null)
+				if (!MetaModel::IsValidClass($oTrigger->Get('target_class')))
 				{
-					// Create the change for its first use
-					$oChange = new CMDBChange;
-					$oChange->Set("date", time());
-					$oChange->Set("userinfo", "Uninstallation");
-					$oChange->DBInsert();
+					if ($oChange == null)
+					{
+						// Create the change for its first use
+						$oChange = new CMDBChange;
+						$oChange->Set("date", time());
+						$oChange->Set("userinfo", "Uninstallation");
+						$oChange->DBInsert();
+					}
+					$oTrigger->DBDeleteTracked($oChange);
 				}
-				$oTrigger->DBDeleteTracked($oChange);
 			}
 		}
 	}