Created
July 16, 2017 10:28
-
-
Save dimitriipro/da2351e025dc9591c9e968eca4024007 to your computer and use it in GitHub Desktop.
Созданием символические ссылки для 1С-Битрикса (для папок bitrix, upload и если есть local)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
По мотивам https://dev.1c-bitrix.ru/community/blogs/howto/336.php добавил только папку local | |
2017 год | |
--> | |
<html> | |
<head><title>Создание ссылок на папки bitrix и upload</title></head> | |
<body> | |
<? | |
error_reporting(E_ALL & ~E_NOTICE); | |
@ini_set("display_errors",1); | |
if ($_POST['path']) | |
$path = rtrim($_POST['path'],"/\\"); | |
else | |
$path = '../site2/www'; | |
if ($_POST['create']) | |
{ | |
if (preg_match("#^/#",$path)) | |
$full_path = $path; | |
else | |
$full_path = realpath($_SERVER['DOCUMENT_ROOT'].'/'.$path); | |
if (file_exists($_SERVER['DOCUMENT_ROOT']."/bitrix")) | |
$strError = "В текущей папке уже существует папка bitrix"; | |
elseif (is_dir($full_path)) | |
{ | |
if (is_dir($full_path."/bitrix")) | |
{ | |
if (symlink($path."/bitrix",$_SERVER['DOCUMENT_ROOT']."/bitrix")) | |
{ | |
if(symlink($path."/upload",$_SERVER['DOCUMENT_ROOT']."/upload")) | |
echo "<font color=green>Символические ссылки удачно созданы</font>"; | |
else | |
$strError = 'Не удалось создать ссылку на папку upload, обратитесь к администратору сервера'; | |
} | |
else | |
$strError = 'Не удалось создать ссылку на папку bitrix, обратитесь к администратору сервера'; | |
} | |
else | |
$strError = 'Указанный путь не содержит папку bitrix'; | |
if (is_dir($full_path."/local")) | |
{ | |
if(symlink($path."/local",$_SERVER['DOCUMENT_ROOT']."/local")) | |
echo "<br><font color=green>Символическая ссылка на local удачно создана</font>"; | |
else | |
$strError = 'Не удалось создать ссылку на папку local, обратитесь к администратору сервера'; | |
} | |
else | |
$strError = 'Нет папки local, ссылка на нее не обязательна'; | |
} | |
else | |
$strError = 'Неверно указан путь или ошибка прав доступа'; | |
if ($strError) | |
echo '<font color=red>'.$strError.'</font><br>Исходный путь: '.$full_path; | |
} | |
?> | |
<form method=post> | |
Путь к папке, содержащей папки bitrix и upload: <input name=path value="<?=htmlspecialchars($path)?>"><br> | |
<input type=submit value='Создать' name=create> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment