public static function deleteAll($gadgetId) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(self::getName()); $delete->where->add(self::GADGETID, '=', $gadgetId); $delete->execute(); }
private function deleteUserInCommissionGroups($commissionGroupId, $userId) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_UserInCommissionGroup::getName()); $delete->where->add(Pap_Db_Table_UserInCommissionGroup::COMMISSION_GROUP_ID, '=', $commissionGroupId); $delete->where->add(Pap_Db_Table_UserInCommissionGroup::USER_ID, '=', $userId); $delete->execute(); }
/** * Delete all privileges for current role * * @param string $roleId */ public function deleteAllPrivileges($roleId) { $select = new Gpf_SqlBuilder_DeleteBuilder(); $select->from->add(self::getName()); $select->where->add(self::ROLE_ID, "=", $roleId); $select->delete(); }
public function deleteAll($logId) { $deleteBulider = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBulider->from->add(self::getName()); $deleteBulider->where->add(self::ID, '=', $logId); $this->createDatabase()->execute($deleteBulider->toString()); }
private function deleteTable($tableName) { Pap3Compatibility_Migration_OutputWriter::logOnce(" Deleting data from table ".$tableName."....."); $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add($tableName); $sql->execute(); Pap3Compatibility_Migration_OutputWriter::log("DONE<br/>"); }
private function deleteLoginshistory() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Gpf_Db_Table_LoginsHistory::getName()); $delete->where->add(Gpf_Db_Table_LoginsHistory::LAST_REQUEST, '<', $this->getLastDate(Gpf_Settings::get(Gpf_Settings_Gpf::AUTO_DELETE_LOGINSHISTORY))->toDateTime()); $delete->limit->set('', Gpf_Log_DeleteTaskBase::DELETE_LIMIT); return $delete->delete(); }
private function deleteEvents() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Gpf_Db_Table_Logs::getName()); $delete->where->add(Gpf_Db_Table_Logs::CREATED, '<', $this->getLastDate(Gpf_Settings::get(Gpf_Settings_Gpf::AUTO_DELETE_EVENTS))->toDateTime()); $delete->limit->set('', Gpf_Log_DeleteTaskBase::DELETE_LIMIT); return $delete->delete(); }
public function deleteAll($templateId) { $deleteBulider = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBulider->from->add(self::getName()); $deleteBulider->where->add(self::ID, '=', $templateId); $this->createDatabase()->execute($deleteBulider->toString()); $deleteAttachments = Gpf_Db_Table_MailTemplateAttachments::getInstance(); $deleteAttachments->deleteAll($templateId); }
public function deleteAll($fileId) { $content = Gpf_Db_Table_FileContents::getInstance(); $content->deleteAll($fileId); $deleteBulider = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBulider->from->add(self::getName()); $deleteBulider->where->add('fileid', '=', $fileId); $this->createDatabase()->execute($deleteBulider->toString()); }
private function deleteVisitorAffiliates() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_VisitorAffiliates::getName()); $delete->where->add(Pap_Db_Table_VisitorAffiliates::VALIDTO,'<',Gpf_Common_DateUtils::now()); $delete->where->add(Pap_Db_Table_VisitorAffiliates::VALIDTO,'!=',null); $delete->limit->set('',$this->deleteLimit); $statement = $delete->delete(); return $statement->affectedRows()>0; }
private function deleteRawClicks() { if (Gpf_Settings::get(Pap_Settings::AUTO_DELETE_RAWCLICKS) <= 0) { return; } $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_RawClicks::getName()); $delete->where->add(Pap_Db_Table_RawClicks::RSTATUS, '=', 'P'); $delete->where->add(Pap_Db_Table_RawClicks::DATETIME, '<', $this->getLastDate(Gpf_Settings::get(Pap_Settings::AUTO_DELETE_RAWCLICKS))->toDateTime()); $delete->delete(); }
private function removeCommissionGroups() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->delete->add('cg'); $delete->from->add(Pap_Db_Table_UserInCommissionGroup::getName(), 'ucg'); $delete->from->addRightJoin(Pap_Db_Table_CommissionGroups::getName(), 'cg', 'ucg.'.Pap_Db_Table_UserInCommissionGroup::COMMISSION_GROUP_ID.'=cg.'.Pap_Db_Table_CommissionGroups::ID); $delete->from->addInnerJoin(Pap_Db_Table_Campaigns::getName(), 'c', 'cg.'.Pap_Db_Table_CommissionGroups::CAMPAIGN_ID.'=c.'.Pap_Db_Table_Campaigns::ID); $delete->where->add('cg.'.Pap_Db_Table_CommissionGroups::IS_DEFAULT, '=', Gpf::NO); $delete->delete(); }
private function deleteUnusedCategories($activeList) { //TODO: do this with delte constraints $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_BannersCategories::getName()); $delete->where->add(Pap_Db_Table_BannersCategories::CATEGORYID, 'not in', $activeList); $delete->execute(); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_BannersCategories::getName()); $delete->where->add(Pap_Db_Table_BannersCategories::CATEGORYID, 'not in', $activeList); $delete->execute(); }
public function deleteAll($templateId = false, $fileId = false) { $deleteBulider = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBulider->from->add(self::getName()); if ($templateId) { $deleteBulider->where->add('templateid', '=', $templateId); } if ($fileId) { $deleteBulider->where->add('fileid', '=', $fileId); } $this->createDatabase()->execute($deleteBulider->toString()); }
public static function removeUserFromCampaignGroups($userId, $campaignId) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->delete->add('ucg'); $delete->from->add(self::getName(), 'ucg'); $delete->from->addInnerJoin(Pap_Db_Table_CommissionGroups::getName(), 'cg', 'ucg.'.self::COMMISSION_GROUP_ID.'=cg.'.Pap_Db_Table_CommissionGroups::ID); $delete->where->add('ucg.'.self::USER_ID, '=', $userId); $delete->where->add('cg.'.Pap_Db_Table_CommissionGroups::CAMPAIGN_ID, '=', $campaignId); $delete->execute(); }
/** * * @service log delete * @param none * @return Gpf_Rpc_Action */ public function deleteDebugEvents(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $action->setInfoMessage($this->_("Debug event(s) are deleted")); $action->setErrorMessage($this->_("No debug event(s) to delete")); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Gpf_Db_Table_Logs::getName()); $delete->where->add(Gpf_Db_Table_Logs::LEVEL, "=", self::LOG_DEBUG); try { $delete->execute(); $action->addOk(); } catch (Gpf_DbEngine_NoRowException $e) { $action->addError(); } return $action; }
private function deleteNewEntries($tableName, Gpf_DateTime $fromDate) { $updateBuilder = new Gpf_SqlBuilder_UpdateBuilder(); for ($i = $fromDate->getDay(); $i<=31; $i++) { $updateBuilder->set->add("raw_$i", 0); $updateBuilder->set->add("unique_$i", 0); if (strstr($tableName, 'click')) { $updateBuilder->set->add("declined_$i", 0); } } $updateBuilder->from->add($tableName); $updateBuilder->where->add('month', '=', $fromDate->getMonthStart()->toDate()); $updateBuilder->execute(); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add($tableName); $delete->where->add('month', '>', $fromDate->toDate()); $delete->execute(); }
public function execute(Gpf_DbEngine_Row $dbRow) { if (count($this->foreignDbRow->getTable()->getDeleteConstraints()) == 0) { $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBuilder->from->add($this->foreignDbRow->getTable()->name()); for ($i = 0; $i < count($this->selfColumns); $i++) { $deleteBuilder->where->add($this->foreignColumns[$i], "=", $dbRow->get($this->selfColumns[$i])); } $deleteBuilder->execute(); return; } for ($i = 0; $i < count($this->selfColumns); $i++) { $this->foreignDbRow->set($this->foreignColumns[$i], $dbRow->get($this->selfColumns[$i])); } $rowCollection = $this->foreignDbRow->loadCollection($this->foreignColumns); foreach ($rowCollection as $row) { $row->delete(); } }
/** * * @service click delete * @param ids, status * @return Gpf_Rpc_Action */ public function deleteClicks(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $date = array(); switch ($action->getParam("status")) { case self::DATE_ONE_WEEK: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L7D")); $date = $filter->addDateValueToArray($date); $olderThan = "one week"; break; case self::DATE_TWO_WEEKS: $dateFrom = Gpf_DbEngine_Database::getDateString( Gpf_Common_DateUtils::getServerTime( mktime(0,0,0,date("m"), date("d") - 14, date("Y")))); $date = array("dateFrom" => $dateFrom); $olderThan = "two weeks"; break; case self::DATE_ONE_MONTH: $filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L30D")); $date = $filter->addDateValueToArray($date); $olderThan = "one month"; break; } $action->setInfoMessage($this->_("Raw clicks older than %s are deleted", $olderThan)); $action->setErrorMessage($this->_("Failed to delete raw clicks")); $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_RawClicks::getName()); $delete->where->add(Pap_Db_Table_RawClicks::DATETIME, "<", $date["dateFrom"]); try { $delete->delete(); $action->addOk(); } catch(Gpf_DbEngine_NoRowException $e) { $action->addError(); } return $action; }
protected function deleteData() { $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBuilder->from->add(Pap_Db_Table_Banners::getName()); $deleteBuilder->execute(); }
public function onDeactivate() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_Banners::getName()); $delete->where->add(Pap_Db_Table_Banners::TYPE, '=', Pap_Features_RebrandPdfBanner_Config::TYPE); $delete->execute(); }
/** * deletes tier commission * if deleteType == exact, it will delete only given tier * if deleteType == above, it will delete given tier and all above * * @param unknown_type $fromTier * @param unknown_type $subType * @param unknown_type $commGroupId * @param unknown_type $commTypeId * @param unknown_type $deleteType */ public function deleteUnusedCommissions($fromTier, $subType, $commGroupId, $commTypeId, $deleteType = 'extact') { $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBuilder->from->add(Pap_Db_Table_Commissions::getName()); $deleteBuilder->where->add('subtype', '=', $subType); if($deleteType == 'above') { $deleteBuilder->where->add('tier', '>', $fromTier); } else { $deleteBuilder->where->add('tier', '=', $fromTier); } $deleteBuilder->where->add('commtypeid', '=', $commTypeId); $deleteBuilder->where->add('commissiongroupid', '=', $commGroupId); $deleteBuilder->delete(); }
public static function deleteCachedBannersForBanner($bannerid) { if ($bannerid == '' || $bannerid == null) { return; } $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(self::getName()); $delete->where->add(self::BANNERID, '=', $bannerid, 'OR'); $delete->where->add(self::PARENTBANNERID, '=', $bannerid, 'OR'); $delete->execute(); }
public function onDeactivate() { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_Banners::getName()); $delete->where->add(Pap_Db_Table_Banners::TYPE, '=', Pap_Features_SiteReplication_Config::BannerTypeSite); $delete->execute(); }
private function deleteAffiliates() { Pap3Compatibility_Migration_OutputWriter::logOnce(" Deleting affiliates ....."); // pap users $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add(Pap_Db_Table_Users::getName()); $sql->where->add('rtype', '=', 'A'); $sql->execute(); // g_users $inSelect = new Gpf_SqlBuilder_SelectBuilder(); $inSelect->select->add(Pap_Db_Table_Users::ACCOUNTUSERID); $inSelect->from->add(Pap_Db_Table_Users::getName()); $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add(Gpf_Db_Table_Users::getName()); $sql->where->add('accountuserid', 'NOT IN', $inSelect, 'AND', false); $sql->execute(); // g_authusers $inSelect = new Gpf_SqlBuilder_SelectBuilder(); $inSelect->select->add(Gpf_Db_Table_Users::AUTHID); $inSelect->from->add(Gpf_Db_Table_Users::getName()); $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add(Gpf_Db_Table_AuthUsers::getName()); $sql->where->add('authid', 'NOT IN', $inSelect, 'AND', false); $sql->execute(); // g_userattributes $inSelect = new Gpf_SqlBuilder_SelectBuilder(); $inSelect->select->add(Gpf_Db_Table_Users::ID); $inSelect->from->add(Gpf_Db_Table_Users::getName()); $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add(Gpf_Db_Table_UserAttributes::getName()); $sql->where->add('accountuserid', 'NOT IN', $inSelect, 'AND', false); $sql->execute(); // g_gadgets $inSelect = new Gpf_SqlBuilder_SelectBuilder(); $inSelect->select->add(Gpf_Db_Table_Users::ID); $inSelect->from->add(Gpf_Db_Table_Users::getName()); $sql = new Gpf_SqlBuilder_DeleteBuilder(); $sql->from->add(Gpf_Db_Table_Gadgets::getName()); $sql->where->add('accountuserid', 'NOT IN', $inSelect, 'AND', false); $sql->execute(); Pap3Compatibility_Migration_OutputWriter::log("DONE<br/>"); }
/** * Deletes row. Primary key value must be set before this function is called */ public function delete() { if ($this->isPrimaryKeyEmpty()) { throw new Gpf_Exception("Could not delete Row. Primary key values are empty"); } foreach ($this->table->getDeleteConstraints() as $deleteConstraint) { $deleteConstraint->execute($this); } $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBuilder->from->add($this->table->name()); $deleteBuilder->where = $this->getPrimaryWhereClause(); $deleteBuilder->deleteOne(); }
private function deleteVisitorAffiliatesFromDb() { if (count($this->removeVisitorAffiliateIds) == 0) { return; } $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder(); $deleteBuilder->from->add(Pap_Db_Table_VisitorAffiliates::getName()); foreach ($this->removeVisitorAffiliateIds as $id) { $deleteBuilder->where->add(Pap_Db_Table_VisitorAffiliates::ID, '=', $id, 'OR'); } $deleteBuilder->execute(); }
/** * @service campaign write * @return Gpf_Rpc_Serializable */ public function saveCategories(Gpf_Rpc_Params $params) { $action = new Gpf_Rpc_Action($params); $campaignId = $action->getParam('campaignid'); $fields = $action->getParam('fields'); for ($i=1; $i<count($fields); $i++) { $field = $fields[$i]; $catgoryId = $field[0]; $selected = $field[2]; if ($selected == Gpf::YES) { $campaignInCateogry = new Pap_Db_CampaignInCategory(); $campaignInCateogry->setCampaignId($campaignId); $campaignInCateogry->setCategoryId($catgoryId); $campaignInCateogry->insert(); } else if ($selected == Gpf::NO) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_CampaignsInCategory::getName()); $delete->where->add(Pap_Db_Table_CampaignsInCategory::CAMPAIGNID, '=', $campaignId); $delete->where->add(Pap_Db_Table_CampaignsInCategory::CATEGORYID, '=', $catgoryId); $delete->execute(); } } $action->setInfoMessage('Cateogries saved'); return $action; }
public function deleteAllSubtypeCommissions($subType) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Pap_Db_Table_Commissions::getName()); $delete->where->add(Pap_Db_Table_Commissions::SUBTYPE, "=", $subType); $delete->execute(); }
private function deleteFinishedTasks($inclusion_type, $inclusion_tasks) { $delete = new Gpf_SqlBuilder_DeleteBuilder(); $delete->from->add(Gpf_Db_Table_Tasks::getName()); $delete->where->add(Gpf_Db_Table_Tasks::DATEFINISHED, 'IS NOT', 'NULL', 'AND', false); if ($inclusion_type == self::INCLUDE_TASKS) { $delete->where->add(Gpf_Db_Table_Tasks::CLASSNAME, 'IN', $inclusion_tasks); } else { if ($inclusion_type == self::EXCLUDE_TASKS) { $delete->where->add(Gpf_Db_Table_Tasks::CLASSNAME, 'NOT IN', $inclusion_tasks); } } $delete->execute(); }