/** * Update the DB based on previously recorded changes */ function dbupdate() { global $DB; $DB->begin(); parent::dbupdate(); if (isset($this->CollectionSettings)) { $this->CollectionSettings->dbupdate(); } $DB->commit(); }
/** * Update the DB based on previously recorded changes */ function dbupdate() { global $DB, $Plugins, $servertimenow; $DB->begin(); parent::dbupdate(); // if this blog settings was modified we need to invalidate this blog's page caches // this way all existing cached page on this blog will be regenerated during next display // TODO: Ideally we want to detect if the changes are minor/irrelevant to caching and not invalidate the page cache if not necessary. // In case of doubt (and for unknown changes), it's better to invalidate. $this->set_setting('last_invalidation_timestamp', $servertimenow); if (isset($this->CollectionSettings)) { $this->CollectionSettings->dbupdate(); } $Plugins->trigger_event('AfterCollectionUpdate', $params = array('Blog' => &$this)); $DB->commit(); // Thick grained invalidation: // This collection has been modified, cached content depending on it should be invalidated: BlockCache::invalidate_key('coll_ID', $this->ID); // Fine grained invalidation: // EXPERIMENTAL: Below are more granular invalidation dates: BlockCache::invalidate_key('set_coll_ID', $this->ID); // Settings have changed BlockCache::invalidate_key('set_coll_ID', 'any'); // Settings of a have changed (for widgets tracking a change on ANY blog) // cont_coll_ID // Content has not changed }