- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
- Класс: CUpdater
- Вызов: CUpdater::InstallComponent
function InstallComponent($componentName, $arDeleteFiles = array())
{
if (!in_array("KERNEL", $this->callType))
return true;
CUpdateSystem::AddMessage2Log("Run updater '".$this->updater."': InstallComponent(".$componentName.")", "CRUPDIC1");
$errorMessage = "";
$componentPath = $this->__MakeComponentPath($componentName);
if ($componentPath == '')
{
CUpdateSystem::AddMessage2Log("Wrong component name", "CRUPDIC2");
return false;
}
if (!file_exists($_SERVER["DOCUMENT_ROOT"].$this->curModulePath."/install/components".$componentPath))
{
CUpdateSystem::AddMessage2Log("Component is not found", "CRUPDIC3");
return false;
}
if (!empty($arDeleteFiles))
{
for ($i = 0, $cnt = count($arDeleteFiles); $i < $cnt; $i++)
{
$path2Modules = $_SERVER["DOCUMENT_ROOT"].US_SHARED_KERNEL_PATH."/modules/".$this->moduleID."/install/components".$componentPath;
$path2Components = $_SERVER["DOCUMENT_ROOT"].US_SHARED_KERNEL_PATH."/components/".$componentPath;
if (file_exists($path2Modules.$arDeleteFiles[$i]))
@unlink($path2Modules.$arDeleteFiles[$i]);
if (file_exists($path2Components.$arDeleteFiles[$i]))
@unlink($path2Components.$arDeleteFiles[$i]);
}
}
return $this->CopyDirFiles($this->curModulePath."/install/components".$componentPath, US_SHARED_KERNEL_PATH."/components".$componentPath);
}