Skip to content

Commit

Permalink
add exclude logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xsir317 committed Dec 3, 2014
1 parent 3cc1ad7 commit e51f826
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions publisher/app/lib/TaskHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,17 @@ private function _runRsync($task)
$server = \Server::find($task->server_id);
$pj_dir = \Project::getTempDir($server->project_id);
chdir($pj_dir);
//目前就记录个日志就得了
$rsync_cmd = sprintf("rsync -az --delete %s %s::%s",'.',$server->ip,$server->rsync_name);
//file_put_contents(app_path()."/storage/rsync.log",$rsync_cmd."\n",FILE_APPEND);
$excludes = '';
$exclude_files = explode("\n",$server->project->ignore_files);
foreach ($exclude_files as $_file) {
$_file = trim($_file);
if($_file)
{
$excludes .= ' --exclude '.escapeshellarg($_file);
}
}
$rsync_cmd = sprintf("rsync -az --delete %s . %s::%s",$excludes,$server->ip,$server->rsync_name);
file_put_contents(app_path()."/storage/rsync.log",$rsync_cmd."\n",FILE_APPEND);
exec($rsync_cmd,$output,$return_var);
if($return_var == 0)
{
Expand Down

0 comments on commit e51f826

Please sign in to comment.