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 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 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();
 }
Esempio n. 4
0
    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 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();
    }
Esempio n. 6
0
 /**
  *
  * @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;
 }
Esempio n. 7
0
 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();
     }
 }
	private function deleteAffiliates() {
		Pap3Compatibility_Migration_OutputWriter::logOnce("&nbsp;&nbsp;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/>");
	}
	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;
    }
 protected function deleteData() {
 	$deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
 	$deleteBuilder->from->add(Pap_Db_Table_Banners::getName());
 	$deleteBuilder->execute();
 }
Esempio n. 13
0
 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();
 }
 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();
 }
 private function deletePayoutOptions() {
     $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
     $deleteBuilder->from->add(Pap_Db_Table_UserPayoutOptions::getName());
     $deleteBuilder->execute();
 }
    protected function deleteData() {
    	$this->logger->debug('Delete ' . self::CAMPAIGNS);
        $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
        $deleteBuilder->from->add(Pap_Db_Table_Campaigns::getName());
        $deleteBuilder->execute();

        $this->logger->debug('Delete ' . self::COMMISSIONS_TYPES);
        $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
        $deleteBuilder->from->add(Pap_Db_Table_CommissionTypes::getName());
        $deleteBuilder->execute();

        $this->logger->debug('Delete ' . self::COMMISSIONS_GROUPS);
        $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
        $deleteBuilder->from->add(Pap_Db_Table_CommissionGroups::getName());
        $deleteBuilder->execute();

        $this->logger->debug('Delete ' . self::COMMISSIONS);
        $deleteBuilder = new Gpf_SqlBuilder_DeleteBuilder();
        $deleteBuilder->from->add(Pap_Db_Table_Commissions::getName());
        $deleteBuilder->execute();
    }
Esempio n. 17
0
 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();
 }
Esempio n. 18
0
 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_PagePeelBanner_Handler::TYPE);
     $delete->execute();
 }
Esempio n. 19
0
	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();
	}
Esempio n. 20
0
 private function deleteObsolateNodes($type)
 {
     $delete = new Gpf_SqlBuilder_DeleteBuilder();
     $delete->from->add(Gpf_Db_Table_HierarchicalDataNodes::getName());
     $delete->where->add(Gpf_Db_Table_HierarchicalDataNodes::TYPE, '=', $type);
     $delete->execute();
 }
Esempio n. 21
0
 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();
 }
Esempio n. 22
0
 private function deleteAllCoupons() {
     $delete = new Gpf_SqlBuilder_DeleteBuilder();
     $delete->from->add(Pap_Db_Table_Coupons::getName());
     $delete->execute();
 }