registry =& $viewsvn; } // ################################################################### /** * Sets the hash so we know what table we're dealing with * * @access public */ function set_hash() { $this->hash = md5($this->registry->repos->fetch_path($this->registry->paths->repos)); } // ################################################################### /** * Checks to see if it's necessary to rebuild the cacheV table for the * current repository. This is done by making sure $count > 0. If not, * then rebuild() is run. * * @access public */ function exec_rebuild() { $result = $this->registry->db->query_first("SELECT COUNT(*) AS count FROM {$this->hash}"); if ($result['count'] > 0) { return; } $this->rebuild(); } // ################################################################### /** * Rebuilds the entire cacheV table from scratch. This is used on new * repositories by checking $count. Be careful as this is a very * expensive operation to run. * * @access public */ function rebuild() { $start = microtime(); $output = $this->registry->svn->svn('log --xml -v ' . $this->registry->repos->fetch_path($this->registry->paths->repos)); $output = implode("\n", $output); $this->registry->load('xml', 'xml', true); $tree = $this->registry->xml->parse($output); foreach ($tree['log']['logentry'] AS $log) { if (isset($log['paths'][0])) { $files = $log['paths']['path']; } else { $files = array($log['paths']['path']); } $inserts[] = "($log[revision], '{$log['author']['value']}', '{$log['date']['value']}', '" . $this->registry->escape($log['msg']['value']) . "', '" . $this->registry->escape(serialize($files)) . "')"; } $this->registry->db->query(" INSERT INTO {$this->hash} (revision, author, dateline, message, files) VALUES " . implode(",\n", $inserts) ); $this->registry->debug("TIME TO REBUILD: " . $this->registry->funct->fetch_microtime_diff($start)); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>