Example #1
0
 public function clearMemory()
 {
     accessControlPeer::clearInstancePool();
     BatchJobPeer::clearInstancePool();
     BulkUploadResultPeer::clearInstancePool();
     categoryPeer::clearInstancePool();
     EmailIngestionProfilePeer::clearInstancePool();
     entryPeer::clearInstancePool();
     FileSyncPeer::clearInstancePool();
     flavorAssetPeer::clearInstancePool();
     flavorParamsConversionProfilePeer::clearInstancePool();
     flavorParamsOutputPeer::clearInstancePool();
     flavorParamsPeer::clearInstancePool();
     kshowPeer::clearInstancePool();
     mediaInfoPeer::clearInstancePool();
     moderationFlagPeer::clearInstancePool();
     moderationPeer::clearInstancePool();
     notificationPeer::clearInstancePool();
     roughcutEntryPeer::clearInstancePool();
     SchedulerConfigPeer::clearInstancePool();
     SchedulerPeer::clearInstancePool();
     SchedulerStatusPeer::clearInstancePool();
     SchedulerWorkerPeer::clearInstancePool();
     StorageProfilePeer::clearInstancePool();
     syndicationFeedPeer::clearInstancePool();
     TrackEntryPeer::clearInstancePool();
     uiConfPeer::clearInstancePool();
     UploadTokenPeer::clearInstancePool();
     // TODO clear default filters
     // TODO call all memory cleaner plugins
     if (function_exists('gc_collect_cycles')) {
         // php 5.3 and above
         gc_collect_cycles();
     }
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // TODO -  verify permissions for viewing lists
     //		$detailed = $this->getP ( "detailed" , false );
     $limit = $this->getP("page_size", 10);
     if ($limit > 30) {
         $limit = 30;
     }
     $page = $this->getP("page", 1);
     //$order_by = int( $this->getP ( "order_by" , -1 ) );
     $offset = ($page - 1) * $limit;
     //		kuserPeer::setUseCriteriaFilter( false );
     $c = new Criteria();
     // filter
     $filter = new notificationFilter();
     $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
     $filter->attachToCriteria($c);
     //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
     $count = notificationPeer::doCount($c);
     $offset = ($page - 1) * $limit;
     $c->setLimit($limit);
     if ($offset > 0) {
         $c->setOffset($offset);
     }
     $list = notificationPeer::doSelect($c);
     $level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     $wrapper = objectWrapperBase::getWrapperClass($list, $level);
     $this->addMsg("notifications", $wrapper);
 }
 /**
  * Will investigate a single entry
  */
 public function execute()
 {
     $this->forceSystemAuthentication();
     $notification_id = @$_REQUEST["notification_id"];
     $entry_id = @$_REQUEST["entry_id"];
     $not = notificationPeer::retrieveByPK($notification_id);
     if ($not) {
         $not->setStatus(BatchJob::BATCHJOB_STATUS_PENDING);
         $not->setNumberOfAttempts(0);
         $not->save();
     }
     $this->redirect("/system/investigate?entry_id={$entry_id}");
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->addMsg("done", "1");
     $notification_ids = $this->getPM("notification_ids");
     $detailed = $this->getP("detailed", false);
     $separator = $this->getP("separator", ",");
     $retriesCount = $this->getP("retriesCount", 0);
     $retriesTotal = $this->getP("retriesTotal", 0);
     $id_arr = explode($separator, $notification_ids);
     $limit = min(50, count($id_arr));
     $id_arr = array_splice($id_arr, 0, $limit);
     $c = new Criteria();
     $c->add(notificationPeer::ID, $id_arr, Criteria::IN);
     $c->add(notificationPeer::STATUS, BatchJob::BATCHJOB_STATUS_FINISHED);
     $sentCount = notificationPeer::doCount($c);
     if ($retriesTotal && $retriesCount + 1 >= $retriesTotal) {
         $done = 1;
     } else {
         $done = $sentCount == $limit;
     }
     $this->addMsg("done", $done ? "1" : "0");
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $notifications_updated = 0;
     $notifications = array();
     for ($i = 0; $i <= 50; ++$i) {
         $index = $i === 0 ? "" : $i;
         // the first notification can be with no index
         $prefix = "notification{$index}";
         $notification_id = $this->getP("{$prefix}_id");
         if ($i >= 1 && empty($notification_id)) {
             break;
         }
         $target_notification = notificationPeer::retrieveByPK($notification_id);
         if (!$target_notification) {
             $this->addError(APIErrors::INVALID_NOTIFICATION_ID, $notification_id);
             continue;
         }
         $notification_update_data = new notification();
         $obj_wrapper = objectWrapperBase::getWrapperClass($notification_update_data, 0);
         $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $notification_update_data, "{$prefix}_", $obj_wrapper->getUpdateableFields());
         if (count($fields_modified) > 0) {
             if ($notification_update_data) {
                 baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $notification_update_data, $target_notification, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
             }
             $target_notification->save();
         }
         //	$this->addMsg ( "{$prefix}" , objectWrapperBase::getWrapperClass( $target_notification , objectWrapperBase::DETAIL_LEVEL_DETAILED) );
         $notifications[] = $target_notification;
         $notifications_updated++;
     }
     $this->addMsg("notifications", objectWrapperBase::getWrapperClass($notifications, objectWrapperBase::DETAIL_LEVEL_DETAILED));
     if ($notifications_updated == 0) {
         $this->addError(APIErrors::NO_NOTIFICATIONS_UPDATED);
     } else {
         $this->addDebug("notifications_updated", $notifications_updated);
     }
 }
Example #6
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = notificationPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPartnerId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setPuserId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setType($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setObjectId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setStatus($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setNotificationData($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setNumberOfAttempts($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setCreatedAt($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setUpdatedAt($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setNotificationResult($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setObjectType($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setSchedulerId($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setWorkerId($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setBatchIndex($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setProcessorExpiration($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setExecutionAttempts($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setLockVersion($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setDc($arr[$keys[18]]);
     }
 }
 /**
  * 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(notificationPeer::DATABASE_NAME);
         $criteria->add(notificationPeer::ID, $pks, Criteria::IN);
         $objs = notificationPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(notificationPeer::DATABASE_NAME);
     $criteria->add(notificationPeer::ID, $this->id);
     if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(notificationPeer::UPDATED_AT)) {
         $theModifiedColumn = null;
         foreach ($this->modifiedColumns as $modifiedColumn) {
             if ($modifiedColumn != notificationPeer::UPDATED_AT) {
                 $theModifiedColumn = $modifiedColumn;
             }
         }
         $atomicColumns = notificationPeer::getAtomicColumns();
         if (in_array($theModifiedColumn, $atomicColumns)) {
             $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
         }
     }
     return $criteria;
 }
 public function getNotifications()
 {
     return notificationPeer::retrieveByEntryId($this->getId());
 }
 public function getFieldNameFromPeer($field_name)
 {
     $res = notificationPeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
     return $res;
 }