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 Util::logError(
'Removing . ' . $this->symlinkPath .
' file. It should not be a regular file');
96 } elseif (is_dir($dest)) {
97 if (!(
new \FilesystemIterator($dest))->valid()) {
100 Util::logError($this->symlinkPath .
' should be a symlink to ' . $this->currentPath .
'. Please remove this dir and restart bearsampp.');
125 $content = file_get_contents($this->bearsamppConf);
127 foreach ($params as $key => $value) {
128 $content = preg_replace(
'|' . $key .
' = .*|', $key .
' = ' .
'"' . $value.
'"', $content);
129 $this->bearsamppConfRaw[$key] = $value;
132 file_put_contents($this->bearsamppConf, $content);
141 public function update($sub = 0, $showWindow =
false) {
154 Util::logDebug(($sub > 0 ? str_repeat(
' ', 2 * $sub) :
'') .
'Update ' . $this->name .
' ' .
$version .
' config');
static removeSymlink($link)
static createSymlink($src, $dest)
reload($id=null, $type=null)
update($sub=0, $showWindow=false)
updateConfig($version=null, $sub=0, $showWindow=false)
static getVersionList($path)
static logError($data, $file=null)
static logDebug($data, $file=null)
static formatWindowsPath($path)