Exemplo n.º 1
0
<?php

$module_id = "sprint.migration";
global $APPLICATION;
$MODULE_RIGHT = $APPLICATION->GetGroupRight($module_id);
if (!($MODULE_RIGHT >= "R")) {
    $APPLICATION->AuthForm("ACCESS_DENIED");
}
CModule::IncludeModule($module_id);
$upgradeManager = new \Sprint\Migration\UpgradeManager(true);
if ($_SERVER['REQUEST_METHOD'] == "POST" && check_bitrix_sessid()) {
    if (!empty($_REQUEST["upgrade_reload"])) {
        $upgradeManager->upgradeReload();
    }
}
?>

<form method="post" action="<?php 
echo $APPLICATION->GetCurPage();
?>
?mid=<?php 
echo urlencode($module_id);
?>
&amp;lang=<?php 
echo LANGUAGE_ID;
?>
">
    <p><?php 
echo GetMessage('SPRINT_MIGRATION_UPGRADE_VERSION');
?>
: <?php 
Exemplo n.º 2
0
<?php

//autoload psr-0
spl_autoload_register(function ($className) {
    $includeNamespace = 'Sprint\\Migration';
    $includePath = __DIR__ . '/classes';
    if ($includeNamespace . '\\' === substr($className, 0, strlen($includeNamespace . '\\'))) {
        $fileName = '';
        if (false !== ($lastNsPos = strripos($className, '\\'))) {
            $namespace = substr($className, 0, $lastNsPos);
            $className = substr($className, $lastNsPos + 1);
            $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
        }
        $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
        $fileName = ($includePath !== null ? $includePath . DIRECTORY_SEPARATOR : '') . $fileName;
        if (is_readable($fileName)) {
            /** @noinspection PhpIncludeInspection */
            require $fileName;
        }
    }
});
\CModule::IncludeModule('iblock');
include __DIR__ . '/locale/ru.php';
$upgradeManager = new \Sprint\Migration\UpgradeManager();
$upgradeManager->upgradeIfNeed();