Example #1
0
 function installFiles()
 {
     copyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/abtest/install/admin', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin', true, true);
     copyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/abtest/install/images', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/images', true, true);
     copyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/abtest/install/themes', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/themes', true, true);
     return true;
 }
Example #2
0
         $source = Bitrix\ABTest\AdminHelper::getRealPath($site, $source);
         if (empty($source)) {
             $error = getMessage('ABTEST_UNKNOWN_PAGE');
         }
         if ($error === false) {
             $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
             $source = new Bitrix\Main\IO\File($docRoot . $source);
             $k = 0;
             do {
                 $targetPath = BX_ROOT . '/abtest/' . date('Ymd') . '/' . sprintf('%u', crc32(rand() . time())) . $source->getName();
                 $target = new Bitrix\Main\IO\File($docRoot . $targetPath);
             } while ($target->isExists() && $k++ < 10);
             if ($target->isExists()) {
                 $error = getMessage('ABTEST_AJAX_ERROR');
             } else {
                 $success = copyDirFiles($source->getPath(), $target->getPath(), false, false, false);
                 if ($success) {
                     $result = $targetPath;
                 } else {
                     $error = getMessage('ABTEST_AJAX_ERROR');
                 }
             }
         }
     }
     break;
 case 'check':
     $site = isset($_REQUEST['site']) ? $_REQUEST['site'] : null;
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
     $value = isset($_REQUEST['value']) ? $_REQUEST['value'] : null;
     if (empty($site) || empty($type) || empty($value)) {
         $error = getMessage('ABTEST_AJAX_ERROR');