- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
- Класс: CUpdateSystem
- Вызов: CUpdateSystem::CheckUpdatability
static function CheckUpdatability($updates_dir, &$strError)
{
$strError_tmp = "";
$updates_dir_full = $_SERVER["DOCUMENT_ROOT"]."/bitrix/updates/".$updates_dir;
if (!file_exists($updates_dir_full) || !is_dir($updates_dir_full))
{
$strError_tmp .= "[UCU01] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_NO_TMP_CAT")).".
";
}
if ($strError_tmp == '')
{
if (!is_readable($updates_dir_full))
{
$strError_tmp .= "[UCU02] ".str_replace("#FILE#", $updates_dir_full, GetMessage("SUPP_CU_RD_TMP_CAT")).".
";
}
}
if ($handle = @opendir($updates_dir_full))
{
while (($file = readdir($handle)) !== false)
{
if ($file == "." || $file == "..") continue;
if (is_dir($updates_dir_full."/".$file))
{
CUpdateSystem::CheckUpdatability($updates_dir."/".$file, $strError_tmp);
}
elseif (is_file($updates_dir_full."/".$file))
{
$strRealPath = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".substr($updates_dir."/".$file, strpos($updates_dir."/".$file, "/"));
if (file_exists($strRealPath))
{
if (!is_writeable($strRealPath))
{
$strError_tmp .= "[UCU03] ".str_replace("#FILE#", $strRealPath, GetMessage("SUPP_CU_MAIN_ERR_FILE")).".
";
}
}
else
{
$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
$strRealPath = substr($strRealPath, 0, $p);
if (strlen($strRealPath)>1)
$strRealPath = rtrim($strRealPath, "/");
$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
while ($p > 0)
{
if (file_exists($strRealPath) && is_dir($strRealPath))
{
if (!is_writable($strRealPath))
$strError_tmp .= "[UCU04] ".str_replace("#FILE#", $strRealPath, GetMessage("SUPP_CU_MAIN_ERR_CAT")).".
";
break;
}
$strRealPath = substr($strRealPath, 0, $p);
$p = CUpdateSystem::bxstrrpos($strRealPath, "/");
}
}
}
}
@closedir($handle);
}
if ($strError_tmp <> '')
{
CUpdateSystem::AddMessage2Log($strError_tmp, "CUCU");
$strError .= $strError_tmp;
return false;
}
else
return true;
}