Beispiel #1
0
 /**
  * Log errors to error log
  *
  * @param string $result result array (should contains name, type, status and errors fields)
  * @param string $message error message
  */
 public static function logError(&$result, $message)
 {
     if (!isset(self::$oLogger)) {
         self::$oLogger = new OA_UpgradeLogger();
     }
     $result['errors'][] = $message;
     self::$oLogger->logError($result['name'] . '(' . $result['type'] . '): ' . $message);
 }
 function testLogError()
 {
     Mock::generatePartial('OA_UpgradeLogger', 'OA_UpgradeLoggerMock', array('logError'));
     $oLogger = new OA_UpgradeLoggerMock($this);
     $oLogger->expectOnce('logError', array('test(testtype): test error'));
     $aTask = array('name' => 'test', 'type' => 'testtype');
     OX_Upgrade_Util_JobMock::setLogger($oLogger);
     OX_Upgrade_Util_Job::logError($aTask, 'test error');
     $this->assertEqual($aTask['errors'], array('test error'));
 }
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);
}
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);
}