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/>");
	}
Esempio n. 2
0
 protected function buildFrom()
 {
     $this->_selectBuilder->from->add(Gpf_Db_Table_Gadgets::getName());
 }