/** * {@inheritDoc} */ public function gc($max_lifetime) { global $CONFIG; $life = time() - $max_lifetime; $query = "DELETE FROM {$CONFIG->dbprefix}users_sessions WHERE ts < '{$life}'"; return (bool) $this->db->deleteData($query); }
/** * Get subscription records from the database * * Records are an object with two vars: guid and methods with the latter * being a comma-separated list of subscription relationship names. * * @param int $container_guid The GUID of the subscription target * @return array */ protected function getSubscriptionRecords($container_guid) { $container_guid = $this->db->sanitizeInt($container_guid); // create IN clause $rels = $this->getMethodRelationships(); if (!$rels) { return array(); } array_walk($rels, array($this->db, 'sanitizeString')); $methods_string = "'" . implode("','", $rels) . "'"; $db_prefix = $this->db->getTablePrefix(); $query = "SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods\n\t\t\tFROM {$db_prefix}entity_relationships\n\t\t\tWHERE guid_two = {$container_guid} AND\n\t\t\t\t\trelationship IN ({$methods_string}) GROUP BY guid_one"; return $this->db->getData($query); }
/** * Get the number of queries performed since the object was constructed * * @return int # of queries */ public function getDelta() { return $this->db->getQueryCount() - $this->initial; }
/** * {@inheritDoc} */ public function gc($max_lifetime) { $life = time() - $max_lifetime; $query = "DELETE FROM {$this->db->getTablePrefix()}users_sessions WHERE ts < '{$life}'"; return (bool) $this->db->deleteData($query); }