* add the feature of restart svn sync.

This commit is contained in:
wangchunsheng
2011-10-19 02:57:26 +00:00
parent 0cbe68607a
commit f9985a2222
2 changed files with 59 additions and 24 deletions

View File

@@ -31,6 +31,8 @@ tgz:
# create my.min.js
rm zentaopms/www/js/my.min.js
java -jar ~/bin/yuicompressor/build/yuicompressor-2.4.6.jar www/js/my.full.js > zentaopms/www/js/my.in.js
# create the restart file for svn.
touch zentaopms/module/svn/restart
# touch the front.class.php to make it's mtime to new.
touch zentaopms/lib/front/front.class.php
# delee the unused files.

View File

@@ -37,6 +37,14 @@ class svnModel extends model
*/
public $logRoot = '';
/**
* The restart file.
*
* @var string
* @access public
*/
public $restartFile = '';
/**
* The root path of a repo
*
@@ -53,30 +61,6 @@ class svnModel extends model
*/
public $users = array();
/**
* Set the repos.
*
* @access public
* @return void
*/
public function setRepos()
{
if(!$this->config->svn->repos) die("You must set one svn repo.\n");
$this->repos = $this->config->svn->repos;
}
/**
* Set the log root.
*
* @access public
* @return void
*/
public function setLogRoot()
{
$this->logRoot = $this->app->getTmpRoot() . 'svn/';
if(!is_dir($this->logRoot)) mkdir($this->logRoot);
}
/**
* Run.
*
@@ -87,6 +71,7 @@ class svnModel extends model
{
$this->setRepos();
$this->setLogRoot();
$this->setRestartFile();
$this->loadModel('action');
foreach($this->repos as $name => $repo)
@@ -130,10 +115,57 @@ class svnModel extends model
}
$this->saveLastRevision($savedRevision);
$this->printLog("save revision $savedRevision");
$this->deleteRestartFile();
$this->printLog("\n\nrepo $name finished");
}
}
/**
* Set the log root.
*
* @access public
* @return void
*/
public function setLogRoot()
{
$this->logRoot = $this->app->getTmpRoot() . 'svn/';
if(!is_dir($this->logRoot)) mkdir($this->logRoot);
}
/**
* Set the restart file.
*
* @access public
* @return void
*/
public function setRestartFile()
{
$this->restartFile = dirname(__FILE__) . '/restart';
}
/**
* Delete the restart file.
*
* @access public
* @return void
*/
public function deleteRestartFile()
{
if(is_file($this->restartFile)) unlink($this->restartFile);
}
/**
* Set the repos.
*
* @access public
* @return void
*/
public function setRepos()
{
if(!$this->config->svn->repos) die("You must set one svn repo.\n");
$this->repos = $this->config->svn->repos;
}
/**
* Set repo.
*
@@ -524,6 +556,7 @@ class svnModel extends model
public function getSavedRevision()
{
if(!file_exists($this->logFile)) return 0;
if(file_exists($this->restartFile)) return 0;
return (int)trim(file_get_contents($this->logFile));
}