use wcf\data\AbstractDatabaseObjectAction;
use wcf\data\ISortableAction;
use wcf\data\IToggleAction;
+use wcf\system\condition\ConditionHandler;
use wcf\system\exception\UserInputException;
use wcf\system\WCF;
return new Ad($ad->adID);
}
+ /**
+ * @see \wcf\data\IDeleteAction::delete()
+ */
+ public function delete() {
+ ConditionHandler::getInstance()->deleteConditions('com.woltlab.wcf.condition.ad', $this->objectIDs);
+
+ return parent::delete();
+ }
+
/**
* @see \wcf\data\IToggleAction::toggle()
*/
use wcf\data\AbstractDatabaseObjectAction;
use wcf\data\ISortableAction;
use wcf\data\IToggleAction;
+use wcf\system\condition\ConditionHandler;
use wcf\system\exception\UserInputException;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
return new Notice($notice->noticeID);
}
+ /**
+ * @see \wcf\data\IDeleteAction::delete()
+ */
+ public function delete() {
+ ConditionHandler::getInstance()->deleteConditions('com.woltlab.wcf.condition.notice', $this->objectIDs);
+
+ return parent::delete();
+ }
+
/**
* Dismisses a certain notice.
*
namespace wcf\data\user\group\assignment;
use wcf\data\AbstractDatabaseObjectAction;
use wcf\data\IToggleAction;
+use wcf\system\condition\ConditionHandler;
/**
* Executes user group assignment-related actions.
*/
protected $requireACP = array('create', 'delete', 'toggle', 'update');
+ /**
+ * @see \wcf\data\IDeleteAction::delete()
+ */
+ public function delete() {
+ ConditionHandler::getInstance()->deleteConditions('com.woltlab.wcf.condition.userGroupAssignment', $this->objectIDs);
+
+ return parent::delete();
+ }
+
/**
* @see \wcf\data\IToggleAction::toggle()
*/
<?php
namespace wcf\system\condition;
use wcf\data\condition\ConditionAction;
+use wcf\data\condition\ConditionList;
use wcf\data\object\type\ObjectTypeCache;
use wcf\system\cache\builder\ConditionCacheBuilder;
use wcf\system\exception\SystemException;
}
}
+ /**
+ * Deletes all conditions of the objects with the given ids.
+ *
+ * @param string $definitionName
+ * @param array<integer> $objectID
+ */
+ public function deleteConditions($definitionName, array $objectID) {
+ if (empty($objectID)) return;
+
+ $definition = ObjectTypeCache::getInstance()->getDefinitionByName($definitionName);
+ if ($definition === null) {
+ throw new SystemException("Unknown object type definition with name '".$definitionName."'");
+ }
+
+ $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes($definitionName);
+ $objectTypeIDs = array();
+ foreach ($objectTypes as $objectType) {
+ $objectTypeIDs[] = $objectType->objectTypeID;
+ }
+
+ if (empty($objectTypeIDs)) return;
+
+ $conditionList = new ConditionList();
+ $conditionList->getConditionBuilder()->add('objectTypeID IN (?)', array($objectTypeIDs));
+ $conditionList->getConditionBuilder()->add('objectID IN (?)', array($objectID));
+ $conditionList->readObjects();
+
+ if (count($conditionList)) {
+ $conditionAction = new ConditionAction($conditionList->getObjects(), 'delete');
+ $conditionAction->executeAction();
+ }
+ }
+
/**
* Returns the conditions for the conditioned object with the given condition
* object type definition and object id.