/** * Removes an existing permission from the system, i.e. directly from the database. * @param string $name Unique name of the permission. * @return boolean Whether the permission was successfully removed. */ public static function remove($name) { self::$db->pushState()->bind('s', $name)->query('DELETE FROM sys_perms WHERE name=?'); $result = self::$db->found(); self::$db->popState(); return $result; }
/** * Refreshes the cache entry with the given name by the provided life time. * Note: the life time starts from the time of the call to this method. * @param string $id Unique of this cache entry * @param integer $lifetime New lifetime of this cache entry * @return boolean Whether the cache entry could be updated. */ public static function refresh($id, $lifetime = 0) { if ($lifetime <= 0) { $lifetime = intval(Config::main()->get('DEFAULT_CACHE_LIFETIME')); } self::$db->pushState()->select('sys_cache')->fields('expires')->filter('name=?')->bind('s', $id)->replace(round(microtime(true) + $lifetime)); $result = self::$db->found(); self::$db->popState(); if (!$result) { logMsg("Cache: failed to refresh cache entry {$id}", 2, 5); } return $result; }