/** * Store in the cache blob infos. * * The info is an array of stdClasses, with hash, date, title and * author properties. * * @param array Blob infos */ public function store($infos) { foreach ($infos as $blob) { $cache = new IDF_Scm_Cache_Git(); $cache->project = $this->_project; $cache->githash = $blob->hash; $blob->title = IDF_Commit::toUTF8($blob->title); $cache->content = IDF_Commit::toUTF8($blob->date) . chr(31) . IDF_Commit::toUTF8($blob->author) . chr(31) . IDF_Commit::toUTF8($blob->title); $sql = new Pluf_SQL('project=%s AND githash=%s', array($this->_project->id, $blob->hash)); if (0 == Pluf::factory(__CLASS__)->getCount(array('filter' => $sql->gen()))) { $cache->create(); } } }
/** * Cache blob info. * * Given a series of blob info, cache them. * * @param array Blob info * @return bool Success */ public function cacheBlobInfo($info) { $cache = new IDF_Scm_Cache_Git(); $cache->_project = $this->project; return $cache->store($info); }