34 return $module->rootPath;
45 return $module->currentPath;
56 return $module->symlinkPath;
86 self::$rootPath = str_replace(
'\\',
'/', rtrim(
$rootPath,
'/\\'));
87 self::$corePath = str_replace(
'\\',
'/', rtrim(
$corePath,
'/\\'));
104 'windows_misses' => 0,
124 $cacheKey =
'w_' . $path;
125 if (isset(self::$pathFormatCache[$cacheKey])) {
126 self::$pathFormatStats[
'windows_hits']++;
127 return self::$pathFormatCache[$cacheKey];
130 self::$pathFormatStats[
'windows_misses']++;
132 $result = str_replace(
'/',
'\\', $path);
134 if (count(self::$pathFormatCache) < self::$pathFormatCacheMaxSize) {
135 self::$pathFormatCache[$cacheKey] =
$result;
137 $removeCount = (int)(self::$pathFormatCacheMaxSize * 0.1);
138 self::$pathFormatCache = array_slice(self::$pathFormatCache, $removeCount,
null,
true);
139 self::$pathFormatCache[$cacheKey] =
$result;
162 $cacheKey =
'u_' . $path;
163 if (isset(self::$pathFormatCache[$cacheKey])) {
164 self::$pathFormatStats[
'unix_hits']++;
165 return self::$pathFormatCache[$cacheKey];
168 self::$pathFormatStats[
'unix_misses']++;
170 $result = str_replace(
'\\',
'/', $path);
172 if (count(self::$pathFormatCache) < self::$pathFormatCacheMaxSize) {
173 self::$pathFormatCache[$cacheKey] =
$result;
175 $removeCount = (int)(self::$pathFormatCacheMaxSize * 0.1);
176 self::$pathFormatCache = array_slice(self::$pathFormatCache, $removeCount,
null,
true);
177 self::$pathFormatCache[$cacheKey] =
$result;
191 return self::$pathFormatStats;
206 'countChangedOcc' => 0,
207 'countChangedFiles' => 0
216 foreach ($filesToScan as $fileToScan) {
217 $tmpCountChangedOcc = 0;
218 $fileContentOr = file_get_contents($fileToScan);
220 if ($fileContentOr ===
false) {
221 Log::error(
"changePath(): Failed to read file: " . $fileToScan);
225 $fileContent = $fileContentOr;
228 if (stripos($fileContent, $unixOldPath) !==
false) {
229 $fileContent = str_ireplace($unixOldPath, $unixCurrentPath, $fileContent, $countChanged);
230 $tmpCountChangedOcc += $countChanged;
232 if (stripos($fileContent, $windowsOldPath) !==
false) {
233 $fileContent = str_ireplace($windowsOldPath, $windowsCurrentPath, $fileContent, $countChanged);
234 $tmpCountChangedOcc += $countChanged;
240 $tmpCountChangedOcc += $countChanged;
244 $tmpCountChangedOcc += $countChanged;
247 if ($fileContentOr != $fileContent) {
248 if (file_put_contents($fileToScan, $fileContent) !==
false) {
249 $result[
'countChangedOcc'] += $tmpCountChangedOcc;
250 $result[
'countChangedFiles'] += 1;
252 Log::error(
"changePath(): Failed to write to file: " . $fileToScan);
257 Log::debug(
'changePath() completed: ' .
$result[
'countChangedFiles'] .
' files changed, ' .
$result[
'countChangedOcc'] .
' total occurrences');
270 self::$pathFormatCache = [];
271 self::$pathFormatStats = [
275 'windows_misses' => 0,
286 return count(self::$pathFormatCache);
298 $path = str_replace(
$rootPath,
'', $path);
299 $path = ltrim(self::formatUnixPath($path),
'/');
300 return '%AeTrayMenuPath%' . $path;
410 $isHttps = (isset($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !==
'off');
411 $scheme = $isHttps ?
'https://' :
'http://';
412 $host = (isset($_SERVER[
'SERVER_NAME'])) ? $_SERVER[
'SERVER_NAME'] :
'localhost';
422 $portSuffix =
':' .
$port;
426 $portSuffix =
':' .
$port;
430 return $scheme . $host . $portSuffix . (!empty($request) ?
'/' . $request :
'');
604 public static function getLnExe($aetrayPath =
false)
681 if (isset($bearsamppTools)) {
682 if ($bearsamppTools->getComposer() && $bearsamppTools->getComposer()->isEnable()) {
686 if ($bearsamppTools->getGhostscript() && $bearsamppTools->getGhostscript()->isEnable()) {
689 if ($bearsamppTools->getGit() && $bearsamppTools->getGit()->isEnable()) {
692 if ($bearsamppTools->getNgrok() && $bearsamppTools->getNgrok()->isEnable()) {
695 if ($bearsamppTools->getPerl() && $bearsamppTools->getPerl()->isEnable()) {
700 if ($bearsamppTools->getPython() && $bearsamppTools->getPython()->isEnable()) {
703 if ($bearsamppTools->getRuby() && $bearsamppTools->getRuby()->isEnable()) {
784 if (is_dir(
'C:\Windows\System32\WindowsPowerShell')) {
785 return Util::findFile(
'C:\Windows\System32\WindowsPowerShell',
'powershell.exe');
832 return $startupPath ? $startupPath .
'/' .
APP_TITLE .
'.lnk' :
false;
1038 $isHttps = (isset($_SERVER[
'HTTPS']) && $_SERVER[
'HTTPS'] !==
'off');
1039 $scheme = $isHttps ?
'https://' :
'http://';
1040 $host = (isset($_SERVER[
'SERVER_NAME'])) ? $_SERVER[
'SERVER_NAME'] :
'localhost';
1050 $portSuffix =
':' .
$port;
1054 $portSuffix =
':' .
$port;
1058 return $scheme . $host . $portSuffix . (!empty($request) ?
'/' . $request :
'');
const PATH_LIN_PLACEHOLDER
const PATH_WIN_PLACEHOLDER
static debug($data, $file=null)
static error($data, $file=null)
static getHomepageFilePath($aetrayPath=false)
static getNssmPath($aetrayPath=false)
static getScriptsPath($aetrayPath=false)
static getExeFilePath($aetrayPath=false)
static getBatchLogFilePath($aetrayPath=false)
static getPathFormatCacheSize()
static getSslConfPath($aetrayPath=false)
static clearPathFormatCache()
static getHostsEditorExe($aetrayPath=false)
static getAjaxPath($aetrayPath=false)
static getCorePath($aetrayPath=false)
static getWebResourcesPath()
static getHomepagePath($aetrayPath=false)
static getAliasPath($aetrayPath=false)
static getPwgenPath($aetrayPath=false)
static getSslPath($aetrayPath=false)
static getRootPath($aetrayPath=false)
static getLogFilePath($aetrayPath=false)
static getStartupLogFilePath($aetrayPath=false)
static getIconsPath($aetrayPath=false)
static getWebImagesPath()
static init($rootPath, $corePath)
static getServicesLogFilePath($aetrayPath=false)
static getToolsPath($aetrayPath=false)
static getSetEnvExe($aetrayPath=false)
static getOpenSslExe($aetrayPath=false)
static getLogsPath($aetrayPath=false)
static getResourcesPath($aetrayPath=false)
static getConfigFilePath($aetrayPath=false)
static getWebResourcesUrl()
static getMkcertExe($aetrayPath=false)
static getLocalUrl($request=null)
static getWwwPath($aetrayPath=false)
static formatWindowsPath($path)
static changePath($filesToScan, $rootPath=null)
static getVhostsPath($aetrayPath=false)
static getOpenSslPath($aetrayPath=false)
static getMkcertPath($aetrayPath=false)
static getNssmLogFilePath($aetrayPath=false)
static formatUnixPath($path)
static $pathFormatCacheMaxSize
static getPhpExe($aetrayPath=false)
static getRegistryLogFilePath($aetrayPath=false)
static getHostsEditorPath($aetrayPath=false)
static getModuleSymlinkPath($module)
static getPathFormatStats()
static getisRootFilePath($aetrayPath=false)
static getOpenSslConf($aetrayPath=false)
static getBinPath($aetrayPath=false)
static getPwgenExe($aetrayPath=false)
static getTmpPath($aetrayPath=false)
static getLibsPath($aetrayPath=false)
static getLastPath($aetrayPath=false)
static getModuleCurrentPath($module)
static getHomepageLogFilePath($aetrayPath=false)
static getLnExe($aetrayPath=false)
static getLangsPath($aetrayPath=false)
static getSetEnvPath($aetrayPath=false)
static getModuleRootPath($module)
static getStartupLnkPath()
static getNssmExe($aetrayPath=false)
static getPhpPath($aetrayPath=false)
static getErrorLogFilePath($aetrayPath=false)
static getImagesPath($aetrayPath=false)
static getPowerShellPath()
static getAppsPath($aetrayPath=false)
static getMkcertRootCaName()
static getWinbinderLogFilePath($aetrayPath=false)
static getIniFilePath($aetrayPath=false)
static getLnPath($aetrayPath=false)
static findFile($startPath, $findFile)
static getSpecialFolderPath($folderName)