* @package be.bastelstu.chat * @subpackage data.suspension */ class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$className */ protected $className = '\chat\data\suspension\SuspensionEditor'; /** * Deletes expired suspensions. * * @return integer Number of deleted suspensions */ public function prune() { $sql = "SELECT ".call_user_func(array($this->className, 'getDatabaseTableIndexName'))." FROM ".call_user_func(array($this->className, 'getDatabaseTableName'))." WHERE expires < ?"; $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt->execute(array(TIME_NOW)); $objectIDs = array(); while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID; return call_user_func(array($this->className, 'deleteAll'), $objectIDs); } }