/** * 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); }
/** * use the xml parser to parse the upgrade package * * @param string $input_file * @return array */ function _parseUpgradePackageFile($input_file) { $this->aPackage = array(); $this->aDBPackages = array(); $this->oParser->aPackage = array('db_pkgs' => array()); $this->oParser->DBPkg_version = ''; $this->oParser->DBPkg_stamp = ''; $this->oParser->DBPkg_schema = ''; $this->oParser->DBPkg_prescript = ''; $this->oParser->DBPkg_postscript = ''; $this->oParser->aDBPkgs = array('files' => array()); $this->oParser->aSchemas = array(); $this->oParser->aFiles = array(); $this->oParser->elements = array(); $this->oParser->element = ''; $this->oParser->count = 0; $this->oParser->error = ''; if ($input_file != '') { $result = $this->oParser->setInputFile($input_file); if (PEAR::isError($result)) { return $result; } $result = $this->oParser->parse(); if (PEAR::isError($result)) { $this->oLogger->logError('problem parsing the package file: ' . $result->getMessage()); return false; } if (PEAR::isError($this->oParser->error)) { $this->oLogger->logError('problem parsing the package file: ' . $this->oParser->error); return false; } $this->aPackage = $this->oParser->aPackage; $this->aDBPackages = $this->aPackage['db_pkgs']; $this->aPackage['versionFrom'] = $this->aPackage['versionFrom'] ? $this->aPackage['versionFrom'] : $this->versionInitialApplication; } else { // an actual package for this version does not exist so fake it $this->aPackage['versionTo'] = OA_VERSION; $this->aPackage['versionFrom'] = $this->versionInitialApplication; $this->aPackage['prescript'] = ''; $this->aPackage['postscript'] = ''; $this->aDBPackages = array(); } return true; }
/** * Log error message * * @param string $message */ public function logError($message) { $this->aErrors[] = $message; $this->oUpgradeLogger->logError($message); }