function delete($useWhere = false, $cascadeDelete = true, $parentid = null) { // delete also all permissions linked to this account/user $doAccount_user_permission_assoc = OA_Dal::factoryDO('account_user_permission_assoc'); $doAccount_user_permission_assoc->user_id = $this->user_id; $doAccount_user_permission_assoc->account_id = $this->account_id; if ($useWhere) { $doAccount_user_permission_assoc->_query['condition'] = $this->_query['condition']; } $doAccount_user_permission_assoc->delete($useWhere, false, $parentid); return parent::delete($useWhere, $cascadeDelete, $parentid); }
function delete($useWhere = false, $cascade = true, $parentid = null) { $doBanner = clone $this; $doBanner->find(); while ($doBanner->fetch()) { $this->deleteBannerFile($doBanner->storagetype, $doBanner->filename); } return parent::delete($useWhere, $cascade, $parentid); }
/** * ON DELETE CASCADE is handled by parent class but we have * to also make sure here that we are handling here: * - zone chaining * - zone appending * * @param boolean $useWhere * @param boolean $cascadeDelete * @return boolean * @see DB_DataObjectCommon::delete() */ function delete($useWhere = false, $cascadeDelete = true, $parentid = null) { // Handle all "appended" zones $doZones = $this->factory('zones'); $doZones->init(); $doZones->appendtype = phpAds_ZoneAppendZone; $doZones->whereAdd("append LIKE '%zone:" . $this->zoneid . "%'"); $doZones->find(); while ($doZones->fetch()) { $doZoneUpdate = clone $doZones; $doZoneUpdate->appendtype = phpAds_ZoneAppendRaw; $doZoneUpdate->append = ''; $doZoneUpdate->update(); } // Handle all "chained" zones $doZones = $this->factory('zones'); $doZones->init(); $doZones->chain = 'zone:' . $this->zoneid; $doZones->find(); while ($doZones->fetch()) { $doZoneUpdate = clone $doZones; $doZoneUpdate->chain = ''; $doZoneUpdate->update(); } return parent::delete($useWhere, $cascadeDelete, $parentid); }
/** * Handle all necessary operations when a trafficker is deleted * * @see DB_DataObject::delete() */ function delete($useWhere = false, $cascade = true, $parentid = null) { $result = parent::delete($useWhere, $cascade, $parentid); if ($result) { $this->deleteAccount(); } return $result; }
/** * Overwrite DB_DataObjectCommon::delete() method * * @param boolean $useWhere * @param boolean $cascadeDelete If true it deletes also referenced tables * if this behavior is set in DataObject. * With this parameter it's possible to turn off default behavior * @see DB_DataObjectCommon:onDeleteCascade * @param boolean $parentid The audit ID of the parent object causing the cascade. * @return boolean * @access protected */ function delete($useWhere = false, $cascadeDelete = true, $parentid = null) { // Contents cause problems in pgsql when retrieving current values for auditing $this->contents = null; parent::delete($useWhere, $cascadeDelete, $parentid); }
function delete($useWhere = false, $cascade = true, $parentid = null) { // Find acls which use this channels $dalAcls = OA_Dal::factoryDAL('acls'); $rsChannel = $dalAcls->getAclsByDataValueType($this->channelid, 'Site:Channel'); $rsChannel->reset(); while ($rsChannel->next()) { // Get the IDs of the banner that's using this channel $bannerId = $rsChannel->get('bannerid'); // Get the remaining channels the banner will use, if any $aChannelIds = explode(',', $rsChannel->get('data')); $aChannelIds = array_diff($aChannelIds, array($this->channelid)); // Prepare to update the banner's limitations in the "acls" table $doAcls = DB_DataObject::factory('acls'); $doAcls->init(); $doAcls->bannerid = $bannerId; $doAcls->executionorder = $rsChannel->get('executionorder'); if (!empty($aChannelIds)) { $doAcls->data = implode(',', $aChannelIds); $doAcls->update(); } else { $doAcls->delete(); } // Re-compile the banner's limitations $aAcls = array(); $doAcls = DB_DataObject::factory('acls'); $doAcls->init(); $doAcls->bannerid = $bannerId; $doAcls->orderBy('executionorder'); $doAcls->find(); while ($doAcls->fetch()) { $aData = $doAcls->toArray(); $deliveryLimitationPlugin = OX_Component::factoryByComponentIdentifier('deliveryLimitations:' . $aData['type']); if ($deliveryLimitationPlugin) { $deliveryLimitationPlugin->init($aData); if ($deliveryLimitationPlugin->isAllowed($page)) { $aAcls[$aData['executionorder']] = $aData; } } } $sLimitation = MAX_AclGetCompiled($aAcls, $page); // TODO: it should be done inside plugins instead, there is no need to slash the data $sLimitation = !get_magic_quotes_runtime() ? stripslashes($sLimitation) : $sLimitation; $doBanners = OA_Dal::factoryDO('banners'); $doBanners->bannerid = $bannerId; $doBanners->find(); $doBanners->fetch(); $doBanners->acl_plugins = MAX_AclGetPlugins($aAcls); $doBanners->acls_updated = OA::getNow(); $doBanners->compiledlimitation = $sLimitation; $doBanners->update(); } return parent::delete($useWhere, $cascade, $parentid); }