public function execute() { $this->forceSystemAuthentication(); myDbHelper::$use_alternative_con = null; $partnerId = $this->getRequestParameter("partnerId", null); if ($partnerId !== null) { $partnerId = (int) $partnerId; } $c = new Criteria(); $c->add(uiConfPeer::PARTNER_ID, $partnerId); $c->addDescendingOrderByColumn(uiConfPeer::CREATED_AT); $this->uiconfs = uiConfPeer::doSelect($c); $partner = PartnerPeer::retrieveByPK($partnerId); $this->partner = $partner; $this->partnerId = $partnerId; }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $this->applyPartnerFilterForClass('uiConf', $partner_id); $detailed = $this->getP("detailed", false); $detailed_fields = $this->getP("detailed_fields"); $limit = $this->getP("page_size", 10); $limit = $this->maxPageSize($limit); $page = $this->getP("page", 1); $offset = ($page - 1) * $limit; $c = new Criteria(); // filter $filter = new uiConfFilter(); $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null); $this->setExtraFilters($filter); $filter->attachToCriteria($c); $count = uiConfPeer::doCount($c); if ($count > 0) { $offset = ($page - 1) * $limit; $c->setLimit($limit); if ($offset > 0) { $c->setOffset($offset); } $list = uiConfPeer::doSelect($c); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; } else { // no need to query the data - there is none ! $list = array(); $level = objectWrapperBase::DETAIL_LEVEL_REGULAR; } $this->addMsg("count", $count); $this->addMsg("page_size", $limit); $this->addMsg("page", $page); foreach ($list as $listed_uiConf) { if (!$listed_uiConf->isValid()) { $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$listed_uiConf->getId()}] is not valid"); return; } } if ($detailed_fields) { $extra_fields = explode(",", $detailed_fields); $wrapper = objectWrapperBase::getWrapperClass($list, $level, objectWrapperBase::DETAIL_VELOCITY_DEFAULT, 0, $extra_fields); } else { $wrapper = objectWrapperBase::getWrapperClass($list, $level); } $this->addMsg($this->getObjectPrefix(), $wrapper); }
/** * Retrieve a list of available UIConfs with no partner limitation * * @action list * @param KalturaUiConfFilter $filter * @param KalturaFilterPager $pager * @return KalturaUiConfAdminListResponse */ function listAction(KalturaUiConfFilter $filter = null, KalturaFilterPager $pager = null) { myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2; if (!$filter) { $filter = new KalturaUiConfFilter(); } $uiConfFilter = new uiConfFilter(); $filter->toObject($uiConfFilter); $c = new Criteria(); $uiConfFilter->attachToCriteria($c); $count = uiConfPeer::doCount($c); if ($pager) { $pager->attachToCriteria($c); } $list = uiConfPeer::doSelect($c); $newList = KalturaUiConfAdminArray::fromUiConfAdminArray($list); $response = new KalturaUiConfAdminListResponse(); $response->objects = $newList; $response->totalCount = $count; return $response; }
<?php ini_set("memory_limit", "256M"); require_once __DIR__ . '/bootstrap.php'; if (!$argc) { die('pleas provide partner id as input' . PHP_EOL . 'to run script: ' . basename(__FILE__) . ' X' . PHP_EOL . 'whereas X is partner id' . PHP_EOL); } $partnerId = $argv[0]; $dbConf = kConf::getDB(); DbManager::setConfig($dbConf); DbManager::initialize(); $c = new Criteria(); $c->add(uiConfPeer::SWF_URL, "%kcw%", Criteria::LIKE); $c->add(uiConfPeer::OBJ_TYPE, uiConf::UI_CONF_TYPE_CW, Criteria::EQUAL); $c->add(uiConfPeer::PARTNER_ID, $partnerId, Criteria::EQUAL); $kcwUiconfs = uiConfPeer::doSelect($c); if (!count($kcwUiconfs)) { exit; } $fileName = "/manual_uiconfs_paths.log"; $flog = fopen($fileName, 'a+'); //Run a loop for each uiConf to get its filesync key, thus acquiring its confile foreach ($kcwUiconfs as $kcwUiconf) { /* @var $kcwUiconf uiConf */ $kcwUiconfFilesyncKey = $kcwUiconf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA); $kcwConfile = kFileSyncUtils::file_get_contents($kcwUiconfFilesyncKey, false, false); if (!$kcwConfile) { continue; } $kcwConfileXML = new SimpleXMLElement($kcwConfile); $path = '//provider[@id="kaltura" or @name="kaltura"]'; $nodesToRemove = $kcwConfileXML->xpath($path);
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(uiConfPeer::DATABASE_NAME); $criteria->add(uiConfPeer::ID, $pks, Criteria::IN); $objs = uiConfPeer::doSelect($criteria, $con); } return $objs; }
public static function copyUiConfsByType(Partner $fromPartner, Partner $toPartner, $uiConfType) { KalturaLog::log("Copying uiconfs from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "] with type [" . $uiConfType . "]"); uiConfPeer::setUseCriteriaFilter(false); $c = new Criteria(); $c->addAnd(uiConfPeer::PARTNER_ID, $fromPartner->getId()); $c->addAnd(uiConfPeer::OBJ_TYPE, $uiConfType); $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY); $uiConfs = uiConfPeer::doSelect($c); uiConfPeer::setUseCriteriaFilter(true); foreach ($uiConfs as $uiConf) { // create a new uiConf, set its partner Id (so that upcoming file_sync will have the new partner's id) // and clone fileds from current uiConf $newUiConf = new uiConf(); $newUiConf->setPartnerId($toPartner->getId()); $newUiConf = $uiConf->cloneToNew($newUiConf); $newUiConf->save(); KalturaLog::log("UIConf [" . $newUiConf->getId() . "] was created"); } }
private function getUiconfList($tag = 'player') { $template_partner_id = isset($this->templatePartnerId) ? $this->templatePartnerId : 0; $c = new Criteria(); $crit_partner = $c->getNewCriterion(uiConfPeer::PARTNER_ID, $this->partner_id); $crit_default = $c->getNewCriterion(uiConfPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK, Criteria::GREATER_EQUAL); $crit_default_partner_id = $c->getNewCriterion(uiConfPeer::PARTNER_ID, $template_partner_id); $crit_default_swf_url = $c->getNewCriterion(uiConfPeer::SWF_URL, '%/kdp3/%kdp3.swf', Criteria::LIKE); $crit_default->addAnd($crit_default_partner_id); $crit_default->addAnd($crit_default_swf_url); $crit_partner->addOr($crit_default); $c->add($crit_partner); $c->addAnd(uiConfPeer::OBJ_TYPE, array(uiConf::UI_CONF_TYPE_WIDGET, uiConf::UI_CONF_TYPE_KDP3), Criteria::IN); $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY); $c->addAnd(uiConfPeer::TAGS, '%' . $tag . '%', Criteria::LIKE); $c->addAnd(uiConfPeer::TAGS, '%jw' . $tag . '%', Criteria::NOT_LIKE); $c->addAnd(uiConfPeer::ID, array(48120, 48121, 48130, 48131, 48132, 48133, 48134, 48135), Criteria::NOT_IN); $order_by = "(" . uiConfPeer::PARTNER_ID . "=" . intval($this->partner_id) . ")"; $c->addAscendingOrderByColumn($order_by); $c->addDescendingOrderByColumn(uiConfPeer::CREATED_AT); $confs = uiConfPeer::doSelect($c); return $confs; }
/** * * Gets all the kmc ui confs * @param string $module_tag * @param string $module_version * @param int $template_partner_id */ public static function getAllKMCUiconfs($module_tag, $module_version, $template_partner_id) { $c = new Criteria(); $c->addAnd(uiConfPeer::PARTNER_ID, $template_partner_id); // $c->addAnd(uiConfPeer::TAGS, "%".$module_tag."\_".$module_version."%", Criteria::LIKE); // no need to check for the kmc version $c->addAnd(uiConfPeer::TAGS, "%autodeploy%", Criteria::LIKE); return uiConfPeer::doSelect($c); }
public static function getSilverLightPlayerUiConfs($tag) { $confs = array(); // implement query to get uiconfs from DB $c = new Criteria(); $c->addAnd(uiConfPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK, Criteria::GREATER_EQUAL); $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY); $c->addAnd(uiConfPeer::OBJ_TYPE, uiConf::UI_CONF_TYPE_SLP); $c->addAnd(uiConfPeer::TAGS, $tag, Criteria::LIKE); $c->addAscendingOrderByColumn(uiConfPeer::ID); $slPlayers = uiConfPeer::doSelect($c); $conf_players = array(); foreach ($slPlayers as $conf) { $minRuntimeVersion = ''; $custom_data = unserialize($conf->getCustomData()); if ($custom_data) { $minRuntimeVersion = $custom_data['minRuntimeVersion']; } $conf_players[] = array('id' => $conf->getId(), 'name' => $conf->getName(), 'width' => $conf->getWidth() ? $conf->getWidth() : 470, 'height' => $conf->getHeight() ? $conf->getHeight() : 600, 'minRuntimeVersion' => $minRuntimeVersion, 'swfUrlVersion' => self::getSlpUrlVersion($conf)); } return $conf_players; }