home
api
develop
badge
wallpaper
rhaco.org
PHP library & setup framework
lingr
bugs
jaja
arbo
rhaco_1_x
jaja rev. 261
branches/pond/library/CustomViews.php
lockしてみた
291: デバッグを残したままだった
290: google対応
266: diffの実装
263: DBの設計変更
262:
261: lockしてみた
260: うーん。。
259:
255: ソースビューに対応
251: google codeの別パターンに対応
248:
247: ソート順をorderingで定義するように修正
245: マルチレポに対応したレイアウトに修正
243: svnをマルチ対応に修正
241: 初期インポート。
read(new Repository(),new C(Q::order(Repository::columnSortOrder()))); } function rss(){ $rss = new Rss20(Rhaco::constant(VAR_TITLE),Rhaco::constant(VAR_DESCRIPTION),Rhaco::url()); $result = $this->dbUtil->select(new CommitLog(),new C(Q::fact(),Q::pager(20),Q::orderDesc(CommitLog::columnRev()))); foreach($result as $obj){ $rss->setItem($obj->toItem()); } Logger::disableDisplay(); $rss->output(); } function api($path=""){ $flow = new Flow(); if(Cache::isExpiry("rhaco_api_paths")){ $len = strlen(Rhaco::rhacopath()); foreach(FileUtil::find("/\.php$/",Rhaco::rhacopath(),true) as $file){ $dir = substr($file->getDirectory(),$len); $name = substr($file->getFullname(),$len); $paths[$dir] = str_replace(array("/"),array("."),$dir)."*"; $paths[$name] = str_replace(array("/",".php"),array(".",""),$name); } Cache::set("rhaco_api_paths",$paths); } $fpath = FileUtil::path(Rhaco::rhacopath(),$path); if(Cache::isExpiry("rhaco_api_doc_".$fpath)){ Cache::set("rhaco_api_doc_".$fpath,DocUtil::parse($fpath)); } $flow->setVariable("docs",Cache::get("rhaco_api_doc_".$fpath)); $flow->setVariable("paths",Cache::get("rhaco_api_paths")); $flow->setVariable("path",$path); return $flow->parser(); } function source($name,$rev,$url){ $repository = $this->dbUtil->get(new Repository(),new C(Q::eq(Repository::columnName(),$name))); if($repository !== null){ $source = $this->dbUtil->get(new Source(),new C( Q::eq(Source::columnRev(),$rev), Q::eq(Source::columnPath(),$url) )); if($source === null){ $svn = new SvnLogger($repository->getType(),$repository->getUrl(),$repository->getCmd()); $src = $svn->cat($url,$rev); if($src !== null){ $source = new Source(); $source->setPath($url); $source->setRev($rev); $source->setRepositoryId($repository->getId()); $source->setValue($src); $source = $source->save($this->dbUtil); } } if($source !== null){ $parser = $this->parser(); $parser->setVariable("source",$source); $parser->setVariable("repository",$repository); return $parser; } Header::redirect(Rhaco::url("svn/".$repository->getName()."?q=".$url)); } Header::redirect(Rhaco::url()); } function svn($name,$rev=null){ $repository = $this->dbUtil->get(new Repository(),new C(Q::eq(Repository::columnName(),$name))); if($repository !== null){ $criteria = new Criteria(); $criteria->q(Q::eq(CommitLog::columnRepositoryId(),$repository->getId())); if(!empty($rev)) $criteria->q(Q::lte(CommitLog::columnRev(),$rev)); $svn = new SvnLogger($repository->getType(),$repository->getUrl(),$repository->getCmd()); $lastObj = $this->dbUtil->get(new CommitLog(),new C( Q::orderDesc(CommitLog::columnRev()), Q::eq(CommitLog::columnRepositoryId(),$repository->getId()) )); if($lastObj == null || $lastObj->getCommited() < (DateUtil::addHour(time(),-1 * (Rhaco::constant(VAR_SVN_EXPIRY_TIME))))){ $last = $svn->last(); Logger::deep_debug("last rev: ".$last); $from = ($lastObj == null) ? 1 : $lastObj->getRev(); $limit = 5; if($last - $from > $limit) $last = $from + $limit; $count = $this->dbUtil->count(new CommitLog(),new C( Q::gt(CommitLog::columnRev(),$from), Q::lte(CommitLog::columnRev(),$last), Q::eq(CommitLog::columnRepositoryId(),$repository->getId()) )); if($count != ($last - $from)){ $maps = array(); $result = $this->dbUtil->select(new CommitLog(),new C( Q::gte(CommitLog::columnRev(),$from), Q::lte(CommitLog::columnRev(),$last), Q::eq(CommitLog::columnRepositoryId(),$repository->getId()) )); foreach($result as $obj){ $maps[$obj->getRev()] = $obj; } foreach($svn->revision($from,$last) as $model){ if(!isset($maps[$model->id])){ $obj = new CommitLog(); $obj->setRepositoryId($repository->getId()); $obj->copy($model); $obj = $this->dbUtil->get($obj,new C( Q::eq(CommitLog::columnRev(),$obj->getRev()), Q::eq(CommitLog::columnRepositoryId(),$repository->getId()), Q::goc(), Q::lock() )); $this->dbUtil->commit(); $maps[$obj->getRev()] = $obj; } } } } $parser = $this->read(new CommitLog(),$criteria); $parser->setVariable("repository",$repository); $parser->setVariable("description",$repository->getDescription()); return $parser; } Header::redirect(Rhaco::url()); } } ?>