private $loopedcall = false;
private $config = null;
private $config_changed = true;
+ private $activeSession = null;
public function __construct($giturl, $workdir = null, $localdir = null) {
if(session_status() != PHP_SESSION_ACTIVE) {
preg_match("#([a-z0-9]{40})#", $gitret, $match);
$newest_version = $match[1];
+ $deleted_files = array();
if(($current_version = $this->getConfig('version_'.$branch))) {
+ echo $current_version . " == " . $newest_version;
if($current_version == $newest_version)
return;
else {
- //applying patch
- $difftxt = $this->gitcmd("diff", $current_version, $newest_version);
- echo $difftxt;
+ $override_all = true;
+ $delfiles = $this->gitcmd("diff", "--diff-filter=D", "--name-only", $current_version, $newest_version);
+ $delfiles = explode("\n", str_replace(array("\r"), array(""), $delfiles));
+ foreach($delfiles as $file) {
+ if(!$file)
+ continue;
+ $deleted_files[] = $file;
+ }
}
} else
$override_all = true;
shell_exec('rsync -avz --exclude ".git" '.escapeshellarg($this->workdir."repository/").' '.escapeshellarg($path));
else
shell_exec('tar -c --exclude ".git" -C '.escapeshellarg($this->workdir."repository").' . | tar -x -C '.escapeshellarg($path));
+
+ // remove deleted files
+ foreach($deleted_files as $file) {
+ unlink($path.$file);
+ }
}
$this->setConfig('version_'.$branch, $newest_version);
- //$this->saveConfig();
+ $this->saveConfig();
}
/* public function update()