public static function createSymbolicLink($rootDir = null)
{
CML_IS_MULTI_MODULES || exit('please set is_multi_modules => true');
$deper = Request::isCli() ? PHP_EOL : '<br />';
echo "{$deper}**************************=create link start!*********************{$deper}";
echo '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
is_null($rootDir) && ($rootDir = CML_PROJECT_PATH . DIRECTORY_SEPARATOR . 'public');
is_dir($rootDir) || mkdir($rootDir, true, 0700);
//modules_static_path_name
// 递归遍历目录
$dirIterator = new \DirectoryIterator(CML_APP_MODULES_PATH);
foreach ($dirIterator as $file) {
if (!$file->isDot() && $file->isDir()) {
$resourceDir = $file->getPathName() . DIRECTORY_SEPARATOR . Config::get('modules_static_path_name');
if (is_dir($resourceDir)) {
$distDir = CML_PROJECT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . $file->getFilename();
$cmd = Request::operatingSystem() ? "mklink /d {$distDir} {$resourceDir}" : "ln -s {$resourceDir} {$distDir}";
exec($cmd, $result);
$tip = "create link Application [{$file->getFilename()}] result : [" . (is_dir($distDir) ? 'true' : 'false') . "]";
$tip = str_pad($tip, 64, ' ', STR_PAD_BOTH);
print_r($deper . '|' . $tip . '|');
}
}
}
echo $deper . '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
echo "{$deper}****************************create link end!**********************{$deper}";
}