• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/internals/updater.php
  • Класс: BitrixIntranetInternalsUpdater
  • Вызов: Updater::syncPersonal
protected function syncPersonal($wizard, array $params)
{
	foreach (CUtil::getSitesByWizard($wizard) as $site)
	{
		$siteDir = ($site['DIR'] <> '' ? $site['DIR'] : '/');
		$documentRoot = ($site['DOC_ROOT'] <> '' ? $site['DOC_ROOT'] : $this->documentRoot);

		foreach ($params as $from => $to)
		{
			$fromPath = preg_replace('#^install/+#', '', trim($from, '/'));

			if (!preg_match(sprintf('#^wizards/bitrix/%s#', preg_quote($wizard, '#')), $fromPath))
			{
				continue;
			}

			$toPath = is_callable($to) ? $to($site, $from) : $to;

			if (false === $toPath || is_null($toPath))
			{
				continue;
			}

			$fromPath = $this->kernelPath . '/' . trim($fromPath, '/');
			$toPath = $documentRoot . $siteDir . trim($toPath, '/');

			if (file_exists($fromPath))
			{
				CUpdateSystem::copyDirFiles($fromPath, $toPath, $error);

				require_once $this->kernelPath . '/modules/main/classes/general/wizard_util.php';

				if (is_dir($toPath))
				{
					CWizardUtil::replaceMacrosRecursive($toPath, array('SITE_DIR' => $siteDir));
				}
				else
				{
					CWizardUtil::replaceMacros($toPath, array('SITE_DIR' => $siteDir));
				}
			}
		}
	}
}