49 $this->
id = empty(
$id) ? $this->id :
$id;
50 $this->type = empty(
$type) ? $this->type :
$type;
53 switch ($this->type) {
65 $this->rootPath = $mainPath .
'/' .
$this->id;
66 $this->currentPath = $this->rootPath .
'/' . $this->
id .
$this->version;
67 $this->symlinkPath = $this->rootPath .
'/current';
68 $this->enable = is_dir($this->currentPath);
69 $this->bearsamppConf = $this->currentPath .
'/bearsampp.conf';
70 $this->bearsamppConfRaw = @parse_ini_file($this->bearsamppConf);
86 if(file_exists($dest)) {
88 $target = readlink($dest);
89 if ($target == $src) {
93 } elseif (is_file($dest)) {
94 Log::error(
'Removing . ' . $this->symlinkPath .
' file. It should not be a regular file');
96 } elseif (is_dir($dest)) {
99 $it = new \FilesystemIterator($dest);
103 Log::error($this->symlinkPath .
' should be a symlink to ' . $this->currentPath .
'. Please remove this dir and restart bearsampp.');
128 $content = file_get_contents($this->bearsamppConf);
130 foreach ($params as $key => $value) {
131 $content = preg_replace(
'|' . $key .
' = .*|', $key .
' = ' .
'"' . $value.
'"', $content);
132 $this->bearsamppConfRaw[$key] = $value;
135 file_put_contents($this->bearsamppConf, $content);
144 public function update($sub = 0, $showWindow =
false) {
157 Log::debug(($sub > 0 ? str_repeat(
' ', 2 * $sub) :
'') .
'Update ' . $this->name .
' ' .
$version .
' config');
static removeSymlink($link)
static createSymlink($src, $dest)
static debug($data, $file=null)
static error($data, $file=null)
update($sub=0, $showWindow=false)
updateConfig($version=null, $sub=0, $showWindow=false)
reload($id=null, $type=null)
static getVersionList($path)
static formatWindowsPath($path)