public function __construct($identifier = null)
 {
     $this->struct = array('external-dependencies' => array('name' => null, 'package_manager' => null, 'aliases' => array(), 'packages' => array()));
     if (PTS_IS_CLIENT) {
         $xml = PTS_EXDEP_PATH . 'xml/' . $identifier . '-packages.xml';
         $xml_parser = new nye_XmlReader($xml);
         $this->struct['external-dependencies']['name'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Name');
         $this->struct['external-dependencies']['package_manager'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/PackageManager');
         $generic_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
         $distro_package = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PackageName');
         $file_check = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
         $arch_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/ArchitectureSpecific');
         $os_version_specific = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/VersionSpecific');
         $os_version = phodevi::read_property('system', 'os-version');
         foreach (array_keys($generic_package) as $i) {
             if (empty($generic_package[$i])) {
                 continue;
             }
             $os_version_compliant = empty($os_version_specific[$i]) || in_array($os_version, pts_strings::comma_explode($os_version_specific[$i]));
             if ($os_version_compliant == false) {
                 continue;
             }
             $this->struct['external-dependencies']['packages'][$generic_package[$i]] = $this->get_package_format($distro_package[$i], $file_check[$i], $arch_specific[$i]);
         }
         $aliases = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Aliases');
         if ($aliases != null) {
             $aliases = pts_strings::trim_explode(',', $aliases);
             foreach ($aliases as $alias) {
                 if ($alias != null) {
                     $this->struct['external-dependencies']['aliases'][] = $alias;
                 }
             }
         }
     }
 }
 public function __construct()
 {
     $this->struct = array('external-dependencies' => array('generic-packages' => array()));
     if (PTS_IS_CLIENT) {
         $xml_parser = new nye_XmlReader(PTS_EXDEP_PATH . 'xml/generic-packages.xml');
         $generic_package_name = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
         $title = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/Title');
         $generic_file_check = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
         $possible_packages = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PossibleNames');
         foreach (array_keys($generic_package_name) as $i) {
             $this->struct['external-dependencies']['generic-packages'][$generic_package_name[$i]] = $this->get_package_format($title[$i], $generic_file_check[$i], $possible_packages[$i]);
         }
     }
 }
 public function getXMLArrayValues($xml_tag, $break_depth = -1)
 {
     if ($this->do_caching && isset($this->c[$xml_tag . $break_depth])) {
         return $this->c[$xml_tag . $break_depth];
     }
     $x = parent::getXMLArrayValues($xml_tag, $break_depth);
     if ($this->do_caching) {
         $this->c[$xml_tag . $break_depth] = $x;
     }
     return $x;
 }
Пример #4
0
 public static function read_all_options()
 {
     $module_name = self::module_name();
     $options = array();
     $module_config_parser = new nye_XmlReader(PTS_MODULE_DATA_PATH . $module_name . "/module-settings.xml");
     $option_identifier = $module_config_parser->getXMLArrayValues('PhoronixTestSuite/ModuleSettings/Option/Identifier');
     $option_value = $module_config_parser->getXMLArrayValues('PhoronixTestSuite/ModuleSettings/Option/Value');
     for ($i = 0; $i < count($option_identifier); $i++) {
         $options[$option_identifier[$i]] = $option_value[$i];
     }
     return $options;
 }