コード例 #1
0
 /**
  * @param uiConf $fromObject
  * @param uiConf $toObject
  */
 protected function uiConfCopied(uiConf $fromObject, uiConf $toObject)
 {
     $fileAssets = FileAssetPeer::retrieveByObject(FileAssetObjectType::UI_CONF, $fromObject->getId());
     foreach ($fileAssets as $fileAsset) {
         /* @var $fileAsset FileAsset */
         $newFileAssets = $fileAsset->copy();
         $newFileAssets->setObjectId($toObject->getId());
         $newFileAssets->incrementVersion();
         $newFileAssets->save();
         $syncKey = $fileAsset->getSyncKey(FileAsset::FILE_SYNC_ASSET);
         $newSyncKey = $newFileAssets->getSyncKey(FileAsset::FILE_SYNC_ASSET);
         if (kFileSyncUtils::fileSync_exists($syncKey)) {
             kFileSyncUtils::softCopy($syncKey, $newSyncKey);
         }
     }
 }
コード例 #2
0
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->partner_error = null;
     if (isset($_POST['partnerId']) && $_POST['partnerId'] !== null && $_POST['partnerId'] !== '') {
         $partner = PartnerPeer::retrieveByPK($_POST['partnerId']);
         if ($partner) {
             $uiConf = new uiConf();
             $uiConf->setPartnerId($_POST['partnerId']);
             $uiConf->setCreationMode(uiConf::UI_CONF_CREATION_MODE_ADVANCED);
             $uiConf->save();
             $this->redirect("system/editUiconf?id=" . $uiConf->getId());
         } else {
             $this->partner_error = 'Partner ID ' . $_POST['partnerId'] . ' not found !';
         }
     }
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->saved = false;
     $uiConfId = $this->getRequestParameter("id");
     if ($uiConfId) {
         $uiConf = uiConfPeer::retrieveByPK($uiConfId);
     } else {
         $uiConf = new uiConf();
     }
     if ($this->getRequest()->getMethodName() == "POST") {
         $uiConf->setPartnerId($this->getRequestParameter("partnerId"));
         $uiConf->setSubpId($uiConf->getPartnerId() * 100);
         $uiConf->setObjType($this->getRequestParameter("type"));
         $uiConf->setName($this->getRequestParameter("name"));
         $uiConf->setWidth($this->getRequestParameter("width"));
         $uiConf->setHeight($this->getRequestParameter("height"));
         $uiConf->setCreationMode($this->getRequestParameter("creationMode"));
         $uiConf->setSwfUrl($this->getRequestParameter("swfUrl"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $useCdn = $this->getRequestParameter("useCdn");
         $uiConf->setUseCdn($useCdn === "1" ? true : false);
         $uiConf->setDisplayInSearch($this->getRequestParameter("displayInSearch"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $uiConf->setTags($this->getRequestParameter("tags"));
         /* files: */
         if ($uiConf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_MANUAL) {
             $confFile = $this->getRequestParameter("uiconf_confFile");
             $confFileFeatures = $this->getRequestParameter("uiconf_confFileFeatures");
             if ($uiConf->getConfFile() != $confFile || $uiConf->getConfFileFeatures() != $confFileFeatures) {
                 $uiConf->setConfFile($confFile);
                 $uiConf->setConfFileFeatures($confFileFeatures);
             }
         }
         $uiConf->save();
         $this->saved = true;
     }
     // so script won't die when uiconf is missing
     if (!$uiConf) {
         $uiConf = new uiConf();
     }
     $partner = PartnerPeer::retrieveByPK($uiConf->getPartnerId());
     $types = $uiConf->getUiConfTypeMap();
     $c = new Criteria();
     $c->add(widgetPeer::UI_CONF_ID, $uiConf->getId());
     $c->setLimit(1000);
     $widgets = widgetPeer::doSelect($c);
     $widgetsPerPartner = array();
     $this->tooMuchWidgets = false;
     if (count($widgets) == 1000) {
         $this->tooMuchWidgets = true;
     } else {
         if ($widgets) {
             foreach ($widgets as $widget) {
                 if (!array_key_exists($widget->getPartnerId(), $widgetsPerPartner)) {
                     $widgetsPerPartner[$widget->getPartnerId()] = 0;
                 }
                 $widgetsPerPartner[$widget->getPartnerId()]++;
             }
         }
     }
     // find the FileSync
     $fileSyncs = array();
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA));
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES));
     foreach ($fileSyncs as &$fileSync) {
         $fileSync["fileSyncs"] = FileSyncPeer::retrieveAllByFileSyncKey($fileSync["key"]);
     }
     $this->fileSyncs = $fileSyncs;
     $this->widgetsPerPartner = $widgetsPerPartner;
     $this->directoryMap = $uiConf->getDirectoryMap();
     $this->swfNames = $uiConf->getSwfNames();
     $this->types = $types;
     $this->uiConf = $uiConf;
     $this->partner = $partner;
 }
コード例 #4
0
ファイル: BaseuiConfPeer.php プロジェクト: DBezemer/server
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      uiConf $value A uiConf object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(uiConf $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('uiConfPeer');
         }
     }
 }
コード例 #5
0
ファイル: deploy_v2.php プロジェクト: DBezemer/server
 /**
  *
  * Add a new uiConf to the DB using propel
  * @param uiConf $pe_conf
  */
 public static function addUiConfThroughPropel(uiConf $pe_conf)
 {
     global $skipAddUiconf;
     if ($skipAddUiconf) {
         return rand(1000, 1200);
     }
     // return just any number if the no-create flag is on
     $pe_conf->save();
     if ($pe_conf->getConfFile()) {
         $sync_key = $pe_conf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA);
         $localPath = kFileSyncUtils::getLocalFilePathForKey($sync_key);
         $localPath = str_replace(array('/', '\\'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $localPath);
         $ret = null;
         chmod($localPath, 0640);
         if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
             return $pe_conf->getId();
         }
         $user_group = uiConfDeployment::$arguments['user'] . ':' . uiConfDeployment::$arguments['group'];
         passthru("chown {$user_group} {$localPath}", $ret);
         if ($ret !== 0 && $ret !== 127) {
             KalturaLog::debug("chown [{$user_group}] failed on path [{$localPath}] returned value [{$ret}]");
             exit(1);
         }
     }
     return $pe_conf->getId();
 }
コード例 #6
0
 /**
  * 
  * Add a new uiConf to the DB using propel
  * @param uiConf $pe_conf
  */
 public static function addUiConfThroughPropel(uiConf $pe_conf)
 {
     global $skipAddUiconf;
     if ($skipAddUiconf) {
         return rand(1000, 1200);
     }
     // return just any number if the no-create flag is on
     try {
         $pe_conf->save();
         // chmod parent directory to 777 to allow changes by the apache user
         $sync_key = $pe_conf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA);
         $localPath = kFileSyncUtils::getLocalFilePathForKey($sync_key);
         @system('chmod 777 -R ' . dirname($localPath));
     } catch (Exception $ex) {
         echo 'Exiting on ERROR: ' . $ex->getMessage() . PHP_EOL;
         exit(1);
     }
     return $pe_conf->getId();
 }
コード例 #7
0
 /**
  * @param uiConf $uiConf
  */
 protected function uiConfDeleted(uiConf $uiConf)
 {
     $this->syncableDeleted($uiConf->getId(), FileSyncObjectType::UICONF);
 }
コード例 #8
0
ファイル: BaseuiConfPeer.php プロジェクト: richhl/kalturaCE
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      uiConf $value A uiConf object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(uiConf $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #9
0
ファイル: Basewidget.php プロジェクト: DBezemer/server
 /**
  * Declares an association between this object and a uiConf object.
  *
  * @param      uiConf $v
  * @return     widget The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setuiConf(uiConf $v = null)
 {
     if ($v === null) {
         $this->setUiConfId(NULL);
     } else {
         $this->setUiConfId($v->getId());
     }
     $this->auiConf = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the uiConf object, it will not be re-added.
     if ($v !== null) {
         $v->addwidget($this);
     }
     return $this;
 }