/** * Change file permissions * * @param String $path * @param String $chmodValue * @param Boolean $recursive * @param String $nodeType "both", "file", "dir" * @param $changedFiles * @return void */ public function chmod($path, $chmodValue, $recursive, $nodeType, &$changedFiles) { $realValue = octdec(ltrim($chmodValue, "0")); if (is_file($this->urlBase . $path)) { if ($nodeType == "both" || $nodeType == "file") { AJXP_MetaStreamWrapper::changeMode($this->urlBase . $path, $realValue); $changedFiles[] = $path; } } else { if ($nodeType == "both" || $nodeType == "dir") { AJXP_MetaStreamWrapper::changeMode($this->urlBase . $path, $realValue); $changedFiles[] = $path; } if ($recursive) { $handler = opendir($this->urlBase . $path); while ($child = readdir($handler)) { if ($child == "." || $child == "..") { continue; } // do not pass realValue or it will be re-decoded. $this->chmod($path . "/" . $child, $chmodValue, $recursive, $nodeType, $changedFiles); } closedir($handler); } } }
/** * @param $filePath * @param $repoData */ protected function changeMode($filePath, $repoData) { $chmodValue = $repoData["chmod"]; if (isset($chmodValue) && $chmodValue != "") { $chmodValue = octdec(ltrim($chmodValue, "0")); AJXP_MetaStreamWrapper::changeMode($filePath, $chmodValue); } }