/** * * 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"); } } } } }
$code[] = '$this->confs = UiConfPeer::doSelect($c);'; } $tags_search = array(); foreach ($sections as $section) { $sectionName = trim($section); $sectionBase = $sectionName . 's'; $baseSwfUrl = $confObj->{$sectionName}->{$sectionBase}->swfpath; $swfName = $confObj->{$sectionName}->{$sectionBase}->swfname; $objType = $confObj->{$sectionName}->{$sectionBase}->objtype; echo "creating uiconfs from section {$sectionBase} with default values ( {$baseSwfUrl} , {$swfName} , {$objType} )" . PHP_EOL; $num = 1; while (isset($confObj->{$sectionName}->{$sectionBase}->{$sectionName . $num})) { echo "{$sectionName}{$num} , {$baseSwfUrl} , {$swfName} , {$objType}" . PHP_EOL; $configObj = $confObj->{$sectionName}->{$sectionBase}->{$sectionName . $num}; $tags_search[$configObj->usage] = $configObj->usage; $uiconf = uiConfDeployment::populateUiconfFromConfig($configObj, $baseSwfUrl, $swfName, $objType, $arguments['disableUrlHashing']); if ($uiconf) { $uiconf_id = uiConfDeployment::addUiConf($kclient, $uiconf); if ($configObj->usage == 'uploadforkae' || $configObj->usage == 'uploadforkse') { $kcw_for_editors[$configObj->identifier] = $uiconf_id; } if ($configObj->usage == 'template_uiconf_for_appstudio') { $kdp_for_studio[$configObj->identifier] = $uiconf_id; } if ($configObj->features_replace_identifier == 'REPLACE_PLAYER_ID') { uiConfDeployment::updatePlayerIdInFeaturesFile($uiconf, $uiconf_id, '@@REPLACE_PLAYER_ID@@'); } } else { echo "failed to create uiconf object ({$sectionBase}: {$sectionName}{$num}) due to missing values. check your config.ini" . PHP_EOL; } $num++;