db = $db; $this->initial = $db->getQueryCount(); } /** * Get the number of queries performed since the object was constructed * * @return int # of queries */ public function getDelta() { return $this->db->getQueryCount() - $this->initial; } /** * Create header X-ElggQueryDelta-* with the delta * * @see getDelta() * * @param string $key Key to add to HTTP header name * * @return void */ public function setDeltaHeader($key = 'Default') { $delta = $this->getDelta(); header("X-ElggQueryDelta-$key: $delta", true); } /** * Get SCRIPT element which sends the delta to console.log * * @see getDelta() * * @param string $key Key to display in console log * * @return string markup of SCRIPT element */ public function getDeltaScript($key = 'Default') { $delta = $this->getDelta(); $msg = json_encode("ElggQueryDelta-$key: $delta"); return ""; } }