예제 #1
0
 /**
  * Calling json_encode on the error stack should return a array with objects containing the message and the error code
  */
 public function testJson()
 {
     $errorStack = new ErrorStack();
     $errorStack->addError('Foo', 123);
     $errorStack->addError('Bar', 456);
     $this->assertEquals('[{"message":"Foo","code":123},{"message":"Bar","code":456}]', json_encode($errorStack));
 }
예제 #2
0
 function InstallerEngine($config)
 {
     if (!is_a($config, 'InstallerConfig')) {
         ErrorStack::addError("Invalid configuration object passed in!", ERRORSTACK_FATAL, 'InstallerEngine');
     }
     $this->config = $config;
     $this->phase = 0;
 }
예제 #3
0
 function DBVersionUnder($params)
 {
     parent::BaseTest($params);
     if (!is_array($this->params) || count($this->params) <= 0) {
         ErrorStack::addError("Invalid parameters, you need to provide the field names and version", ERRORSTACK_ERROR, 'DBVersionUnder');
         $this->result = INSTALLER_TEST_FAIL;
         return $this->result;
     }
 }
예제 #4
0
 function AdminPasswordConfirmed($params)
 {
     parent::BaseTest($params);
     if (!is_array($this->params) || count($this->params) <= 0) {
         ErrorStack::addError("Invalid parameters, you need to provide the password field names", ERRORSTACK_ERROR, 'AdminPasswordConfirmed');
         $this->result = INSTALLER_TEST_FAIL;
         return $this->result;
     }
 }
예제 #5
0
 function PHPVersionUnder($params)
 {
     parent::BaseTest($params);
     if (!is_array($this->params) || count($this->params) <= 0) {
         ErrorStack::addError("Invalid parameters, version to test against must be supplied as the only item in an array", ERRORSTACK_ERROR, 'PHPVersionUnder');
         $this->result = INSTALLER_TEST_FAIL;
         return $this->result;
     }
 }
예제 #6
0
 function WritableLocation($params)
 {
     parent::BaseTest($params);
     if (!is_array($this->params) || count($this->params) <= 0) {
         ErrorStack::addError("Invalid parameters, you must provide at least one location to test.", ERRORSTACK_ERROR, 'WritableLocation');
         $this->result = INSTALLER_TEST_FAIL;
         return $this->result;
     }
 }
예제 #7
0
 function toString()
 {
     $string = '';
     if (!empty($this->class_name)) {
         $string = ErrorStack::levelToString($this->level) . ": {$this->class_name}: {$this->message}";
     } else {
         $string = ErrorStack::levelToString($this->level) . ": {$this->message}";
     }
     return $string;
 }
예제 #8
0
 function PHPMagicQuotes($params)
 {
     parent::BaseTest($params);
     if (is_array($this->params) || count($this->params) < 0) {
         if ($params[0] != "On" && $params[0] != "Off") {
             ErrorStack::addError("Invalid parameters, must be On or Off", ERRORSTACK_ERROR, 'PHPMagicQuotes');
         }
         $this->result = INSTALLER_TEST_FAIL;
         return $this->result;
     }
 }
예제 #9
0
 function AcceptText($title, $params)
 {
     parent::BaseAction($title, $params);
     $this->interactive = true;
     $this->grouping = false;
     if (!is_array($params) || count($params) <= 0) {
         $this->result = INSTALLER_ACTION_FAIL;
         $this->result_message = "Invalid parameters passed to AcceptText action, filename is required.";
         ErrorStack::addError($this->result_message, ERRORSTACK_ERROR, 'AcceptText');
     } else {
         $this->file_name = $params[0];
     }
 }
예제 #10
0
 function getActionPath($class_name)
 {
     if (isset($GLOBALS['INSTALLER']['ACTION_DIRS']) && is_array($GLOBALS['INSTALLER']['ACTION_DIRS'])) {
         foreach ($GLOBALS['INSTALLER']['ACTION_DIRS'] as $dir) {
             if (file_exists($dir . '/' . $class_name . '.php')) {
                 return $dir . '/' . $class_name . '.php';
             }
         }
     }
     if (file_exists(INSTALLER_PATH . '/actions/' . $class_name . '.php')) {
         return INSTALLER_PATH . '/actions/' . $class_name . '.php';
     }
     ErrorStack::addError("Could not find file for Action class {$class_name}", ERRORSTACK_FATAL, 'Installer');
     return FALSE;
 }
예제 #11
0
 function parseVersionFile()
 {
     include $this->version_file_name;
     if (isset($versions)) {
         $this->settings['VERSION_SET'] =& $versions;
     } else {
         ErrorStack::addError("\$versions is not defined in the version file {$this->version_file_name}", ERRORSTACK_FATAL, 'InstallerConfig');
     }
 }