Example #1
0
 /**
  *
  * deploys the ui conf from the ini file
  * @param Zend_Config_Ini $confObj
  */
 public static function deploy(Zend_Config_Ini $confObj)
 {
     //Main Algorithm
     //Here we need to run on the entire config file
     //1. For each section in the config
     //	1.1. Fill all data like swf name, swf url and identifier.
     //	1.2. Foreach widget in this section
     //		1.2.1. Create the uiConf from the xml
     //		1.2.2. Foreach dependencies it has
     //			1.2.2.1. Find the uiCoinf id for this dependency and insert it in the right place
     //			1.2.2.2. save the new ui conf
     //Iterate through all sections (statics, general, kmc, kcw...)
     foreach ($confObj as $sectionName => $sectionValue) {
         //If we are in the widgets section (like kmc, kcw, kse)
         if ($sectionName != "general" && count($sectionValue->widgets)) {
             //Set section values
             $baseSwfUrl = $sectionValue->swfPath;
             $swfName = $sectionValue->swfName;
             $objectType = $sectionValue->objectType;
             //For each widget (in the section)
             foreach ($sectionValue->widgets as $widgetName => $widgetValue) {
                 //Set widget values
                 uiConfDeployment::$tags_search[$widgetValue->usage] = $widgetValue->usage;
                 $widgetIdentifier = $widgetValue->identifier;
                 //Create the ui conf from the xml
                 $uiConf = uiConfDeployment::populateUiconfFromConfig($widgetValue, $baseSwfUrl, $swfName, $objectType, uiConfDeployment::$arguments['disableUrlHashing']);
                 if ($uiConf) {
                     //Then we need to insert the ui conf to the DB (so we can get his id)
                     $uiconf_id = uiConfDeployment::addUiConfThroughPropel($uiConf);
                     KalturaLog::debug("creating uiconf [{$uiconf_id}] for widget {$widgetName} with default values ( {$baseSwfUrl} , {$swfName} , {$objectType} ) for partner " . self::$partnerId);
                     KalturaLog::debug("{$widgetName} , {$baseSwfUrl} , {$swfName} , {$objectType}");
                     if (isset($widgetValue->features)) {
                         uiConfDeployment::updateFeaturesFile($uiConf, $uiconf_id, $widgetValue->features_identifier);
                     }
                     //Add this id to the dependencies data array
                     $uiConfIds[$widgetIdentifier] = $uiconf_id;
                     //If the widget has dependencies
                     if (isset($widgetValue->dependencies)) {
                         //Then update him with the dependencies
                         foreach ($widgetValue->dependencies as $dependencyName => $dependencyValue) {
                             if (isset($uiConfIds[$dependencyValue])) {
                                 $dependUiConfValue = $uiConfIds[$dependencyValue];
                                 uiConfDeployment::updateUIConfFile($uiConf, $dependUiConfValue, "@@{$dependencyValue}@@");
                                 // set new value instead of the dependency
                                 uiConfDeployment::updateFeaturesFile($uiConf, $dependUiConfValue, "@@{$dependencyValue}@@");
                             } else {
                                 uiConfDeployment::updateFeaturesFile($uiConf, $dependencyValue, "@@{$dependencyName}@@");
                                 KalturaLog::debug("Missing dependency: {$dependencyName} = {$dependencyValue} for widget: {$widgetName}. Attempting to replace the token in uiconf features file");
                             }
                         }
                     }
                 } else {
                     KalturaLog::debug("failed to create uiconf object ({$widgetName}) due to missing values. check your config.ini");
                 }
             }
         }
     }
 }