Exemplo n.º 1
0
 function testIsInstallerStepCompleted()
 {
     $oStorage = OX_Admin_UI_Install_InstallUtils::getSessionStorage();
     $oStatus = $oStorage->set('installStatus', null);
     $aTask = array('name' => 'test', 'type' => 'testtype');
     $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask);
     $this->assertFalse($result);
     $this->assertEqual($aTask['errors'], array('Installation process not detected'));
     unset($aTask['errors']);
     Mock::generatePartial('OX_Admin_UI_Install_InstallStatus', 'OX_Admin_UI_Install_InstallStatusMock', array('isInstall', 'isUpgrade'));
     $oInstallStatus = new OX_Admin_UI_Install_InstallStatusMock($this);
     $oInstallStatus->setReturnValue('isInstall', true);
     $oInstallStatus->setReturnValue('isUpgrade', false);
     $oStatus = $oStorage->set('installStatus', $oInstallStatus);
     $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask);
     $this->assertFalse($result);
     $this->assertEqual($aTask['errors'], array('Invalid installation step detected'));
     unset($aTask['errors']);
     $oWizard = new OX_Admin_UI_Install_Wizard($oInstallStatus);
     $oWizard->markStepAsCompleted('database');
     $result = OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $aTask);
     $this->assertTrue($result);
     $this->assertTrue(empty($aTask['errors']));
     $oWizard->reset();
     $oStatus = $oStorage->set('installStatus', null);
 }
function validRequest(&$result)
{
    if (!isset($_REQUEST['task'])) {
        OX_Upgrade_Util_Job::logError($result, 'Bad arguments');
        return false;
    }
    $task = str_replace("", '', $_REQUEST['task']);
    if ($task != $_REQUEST['task'] || stristr($task, '../') || stristr($task, '..\\')) {
        OX_Upgrade_Util_Job::logError($result, 'Invalid task name');
        return false;
    }
    $result['name'] = $_REQUEST['task'];
    return OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $result);
}
Exemplo n.º 3
0
function validRequest(&$result)
{
    if (!isset($_REQUEST['plugin']) || !isset($_REQUEST['status'])) {
        OX_Upgrade_Util_Job::logError($result, 'Bad arguments');
        return false;
    }
    $result['name'] = $_REQUEST['plugin'];
    return OX_Upgrade_Util_Job::isInstallerStepCompleted('database', $result);
}