当前位置: 首页>>代码示例>>PHP>>正文


PHP pts_file_io::glob方法代码示例

本文整理汇总了PHP中pts_file_io::glob方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_file_io::glob方法的具体用法?PHP pts_file_io::glob怎么用?PHP pts_file_io::glob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts_file_io的用法示例。


在下文中一共展示了pts_file_io::glob方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: client_commands_array

 public static function client_commands_array()
 {
     $options = array('Test Installation' => array(), 'Testing' => array(), 'Batch Testing' => array(), 'OpenBenchmarking.org' => array(), 'System' => array(), 'Information' => array(), 'Asset Creation' => array(), 'Result Management' => array(), 'Result Analytics' => array(), 'Other' => array());
     foreach (pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php_file) {
         $option_php = basename($option_php_file, '.php');
         $name = str_replace('_', '-', $option_php);
         if (!in_array(pts_strings::first_in_string($name, '-'), array('dump', 'task'))) {
             include_once $option_php_file;
             $reflect = new ReflectionClass($option_php);
             $constants = $reflect->getConstants();
             $doc_description = isset($constants['doc_description']) ? constant($option_php . '::doc_description') : 'No summary is available.';
             $doc_section = isset($constants['doc_section']) ? constant($option_php . '::doc_section') : 'Other';
             $name = isset($constants['doc_use_alias']) ? constant($option_php . '::doc_use_alias') : $name;
             $skip = isset($constants['doc_skip']) ? constant($option_php . '::doc_skip') : false;
             $doc_args = array();
             if ($skip) {
                 continue;
             }
             if (method_exists($option_php, 'argument_checks')) {
                 $doc_args = call_user_func(array($option_php, 'argument_checks'));
             }
             if (!empty($doc_section) && !isset($options[$doc_section])) {
                 $options[$doc_section] = array();
             }
             array_push($options[$doc_section], array($name, $doc_args, $doc_description));
         }
     }
     return $options;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:29,代码来源:pts_documentation.php

示例2: run

 public static function run($r)
 {
     pts_client::$display->generic_heading('Available Tests');
     $test_count = 0;
     foreach (pts_openbenchmarking::available_tests(false) as $identifier) {
         $repo = substr($identifier, 0, strpos($identifier, '/'));
         $id = substr($identifier, strlen($repo) + 1);
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         if (!in_array(phodevi::operating_system(), $repo_index['tests'][$id]['supported_platforms']) || empty($repo_index['tests'][$id]['title'])) {
             // Don't show unsupported tests
             continue;
         }
         echo sprintf('%-30ls - %-35ls %-9ls', $identifier, $repo_index['tests'][$id]['title'], $repo_index['tests'][$id]['test_type']) . PHP_EOL;
         $test_count++;
     }
     foreach (pts_file_io::glob(PTS_TEST_PROFILE_PATH . 'local/*/test-definition.xml') as $path) {
         $test_profile = new pts_test_profile('local/' . basename(dirname($path)));
         if ($test_profile->get_title() != null && $test_profile->is_supported(false)) {
             echo sprintf('%-30ls - %-35ls %-9ls', $test_profile->get_identifier(), $test_profile->get_title(), $test_profile->get_test_hardware_type()) . PHP_EOL;
             $test_count++;
         }
     }
     if ($test_count == 0) {
         echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:26,代码来源:list_available_tests.php

示例3: render_page_process

 public static function render_page_process($PATH)
 {
     $suite_dir = phoromatic_server::phoromatic_account_suite_path($_SESSION['AccountID']);
     $main = '<h1>Local Suites</h1><p>These are test suites created by you or another account within your group. Suites are an easy collection of test profiles. New suits can be trivially made via the <a href="/?build_suite">build suite</a> page.</p>';
     $suite_count = 0;
     foreach (pts_file_io::glob($suite_dir . '*/suite-definition.xml') as $xml_path) {
         $suite_count++;
         $id = basename(dirname($xml_path));
         $test_suite = new pts_test_suite($xml_path);
         $main .= '<a name="' . $id . '"></a><h1>' . $test_suite->get_title() . ' [' . $id . ']</h1>';
         $main .= '<p><strong>' . $test_suite->get_maintainer() . '</strong></p>';
         $main .= '<p><em>' . $test_suite->get_description() . '</em></p>';
         $main .= '<div style="max-height: 200px; overflow-y: scroll;">';
         foreach ($test_suite->get_contained_test_result_objects() as $tro) {
             $main .= '<h3>' . $tro->test_profile->get_title() . ' [' . $tro->test_profile->get_identifier() . ']</h3>';
             $main .= '<p>' . $tro->get_arguments_description() . '</p>';
         }
         $main .= '</div>';
         $main .= '<hr />';
     }
     if ($suite_count == 0) {
         $main .= '<h1>No Test Suites Found</h1>';
     }
     echo phoromatic_webui_header_logged_in();
     echo '<div id="pts_phoromatic_main_area">' . $main . '</div>';
     echo phoromatic_webui_footer();
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:27,代码来源:phoromatic_local_suites.php

示例4: get_real_path

 protected function get_real_path($path, &$pass_arguments = null)
 {
     if ($path == "\$LOG_FILE") {
         return $this->environmental_variables["LOG_FILE"];
     }
     $this->parse_variables_in_string($path, $pass_arguments);
     if (substr($path, 0, 1) == '~') {
         $path = $this->environmental_variables["HOME"] . substr($path, 2);
     }
     if (strpos($path, '*') !== false) {
         $grep_dir = pts_strings::add_trailing_slash(str_replace('"', null, $this->var_current_directory));
         // needed for phodevi::is_windows() specviewperf10
         $glob = pts_file_io::glob($grep_dir . $path);
         return count($glob) > 0 ? array_shift($glob) : $this->var_current_directory;
     } else {
         if (is_file($path)) {
             return $path;
         } else {
             if (is_file($this->var_current_directory . $path)) {
                 return $this->var_current_directory . $path;
             } else {
                 return pts_strings::add_trailing_slash($this->var_current_directory . $path);
             }
         }
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:26,代码来源:pts_phoroscript_interpreter.php

示例5: delete

 public static function delete($object, $ignore_files = null, $remove_root_directory = false)
 {
     // Delete files and/or directories
     if ($object == false) {
         return false;
     }
     if (is_dir($object)) {
         $object = pts_strings::add_trailing_slash($object);
     }
     foreach (pts_file_io::glob($object . '*') as $to_remove) {
         if (is_file($to_remove) || is_link($to_remove)) {
             if (is_array($ignore_files) && in_array(basename($to_remove), $ignore_files)) {
                 continue;
                 // Don't remove the file
             } else {
                 unlink($to_remove);
             }
         } else {
             if (is_dir($to_remove)) {
                 self::delete($to_remove, $ignore_files, true);
             }
         }
     }
     if ($remove_root_directory && is_dir($object) && count(pts_file_io::glob($object . '/*')) == 0) {
         rmdir($object);
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:27,代码来源:pts_file_io.php

示例6: get_vendors_list

 public function get_vendors_list()
 {
     $package_files = pts_file_io::glob(PTS_EXDEP_PATH . 'xml/*-packages.xml');
     foreach ($package_files as &$file) {
         $file = basename(substr($file, 0, strpos($file, '-packages.xml')));
     }
     return $package_files;
 }
开发者ID:ptzafrir,项目名称:phoronix-test-suite,代码行数:8,代码来源:pts_exdep_generic_parser.php

示例7: run

 public static function run($r)
 {
     $identifier = $r[0];
     $test_xml_files = pts_file_io::glob(PTS_SAVE_RESULTS_PATH . $identifier . '/test-*.xml');
     if (count($test_xml_files) == 0) {
         echo PHP_EOL . 'No test XML data was found.' . PHP_EOL;
         return false;
     }
     pts_client::save_test_result($identifier . '/composite.xml', pts_merge::merge_test_results_array($test_xml_files));
     pts_client::regenerate_graphs($identifier, 'The ' . $identifier . ' result file XML has been rebuilt.');
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:11,代码来源:rebuild_composite_xml.php

示例8: run

 public static function run($r)
 {
     $options = array();
     foreach (pts_file_io::glob(PTS_COMMAND_PATH . '*.php') as $option_php) {
         $name = str_replace('_', '-', basename($option_php, '.php'));
         if (!in_array(pts_strings::first_in_string($name, '-'), array('dump', 'debug', 'task'))) {
             array_push($options, $name);
         }
     }
     $is_true = isset($r[0]) && $r[0] == 'TRUE';
     echo implode($is_true ? ' ' : PHP_EOL, $options) . ($is_true ? null : PHP_EOL);
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:12,代码来源:dump_possible_options.php

示例9: get_supported_devices

 public static function get_supported_devices()
 {
     if (phodevi::is_linux()) {
         $blockdev_dir = '/sys/block/';
         $glob_regex = '{[shvm]d*,nvme*,mmcblk*}';
         $disk_array = pts_file_io::glob($blockdev_dir . $glob_regex, GLOB_BRACE);
         $supported = array();
         foreach ($disk_array as $check_disk) {
             $stat_path = $check_disk . '/stat';
             if (is_file($stat_path) && pts_file_io::file_get_contents($stat_path) != null) {
                 array_push($supported, basename($check_disk));
             }
         }
         return $supported;
     }
     return NULL;
 }
开发者ID:numerant,项目名称:phoronix-test-suite,代码行数:17,代码来源:hdd_read_speed.php

示例10: audio_processor_string

 public static function audio_processor_string()
 {
     $audio = null;
     if (phodevi::is_macosx()) {
         // TODO: implement
     } else {
         if (phodevi::is_bsd()) {
             foreach (array('dev.hdac.0.%desc') as $dev) {
                 $dev = phodevi_bsd_parser::read_sysctl($dev);
                 if (!empty($dev)) {
                     $audio = $dev;
                 }
             }
         } else {
             if (phodevi::is_windows()) {
                 // TODO: implement
             } else {
                 if (phodevi::is_linux()) {
                     foreach (pts_file_io::glob('/sys/class/sound/card*/hwC0D*/vendor_name') as $vendor_name) {
                         $card_dir = dirname($vendor_name) . '/';
                         if (!is_readable($card_dir . 'chip_name')) {
                             continue;
                         }
                         $vendor_name = pts_file_io::file_get_contents($vendor_name);
                         $chip_name = pts_file_io::file_get_contents($card_dir . 'chip_name');
                         $audio = $vendor_name . ' ' . $chip_name;
                         if (strpos($chip_name, 'HDMI') !== false || strpos($chip_name, 'DP') !== false) {
                             // If HDMI is in the audio string, likely the GPU-provided audio, so try to find the mainboard otherwise
                             $audio = null;
                         } else {
                             break;
                         }
                     }
                     if ($audio == null) {
                         $audio = phodevi_linux_parser::read_pci('Multimedia audio controller');
                     }
                     if ($audio == null) {
                         $audio = phodevi_linux_parser::read_pci('Audio device');
                     }
                 }
             }
         }
     }
     return $audio;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:45,代码来源:phodevi_audio.php

示例11: read_sensor

 public static function read_sensor()
 {
     // speed in MB/s
     $speed = -1;
     if (phodevi::is_linux()) {
         static $sys_disk = null;
         if ($sys_disk == null) {
             foreach (pts_file_io::glob('/sys/class/block/sd*/stat') as $check_disk) {
                 if (pts_file_io::file_get_contents($check_disk) != null) {
                     $sys_disk = $check_disk;
                     break;
                 }
             }
         }
         $speed = phodevi_linux_parser::read_sys_disk_speed($sys_disk, 'READ');
     }
     return $speed;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:18,代码来源:hdd_read_speed.php

示例12: read_sensor

 public static function read_sensor()
 {
     // Report graphics processor temperature
     $temp_c = -1;
     if (phodevi::is_nvidia_graphics()) {
         $temp_c = phodevi_parser::read_nvidia_extension('GPUCoreTemp');
     } else {
         if (phodevi::is_ati_graphics() && phodevi::is_linux()) {
             $temp_c = phodevi_linux_parser::read_ati_overdrive('Temperature');
         } else {
             foreach (array_merge(array('/sys/class/drm/card0/device/temp1_input'), pts_file_io::glob('/sys/class/drm/card0/device/hwmon/hwmon*/temp1_input')) as $temp_input) {
                 // This works for at least Nouveau driver with Linux 2.6.37 era DRM
                 if (is_readable($temp_input) == false) {
                     continue;
                 }
                 $temp_input = pts_file_io::file_get_contents($temp_input);
                 if (is_numeric($temp_input)) {
                     if ($temp_input > 1000) {
                         $temp_input /= 1000;
                     }
                     $temp_c = $temp_input;
                     break;
                 }
             }
             if ($temp_c == -1 && is_readable('/sys/kernel/debug/dri/0/i915_emon_status')) {
                 // Intel thermal
                 $i915_emon_status = file_get_contents('/sys/kernel/debug/dri/0/i915_emon_status');
                 $temp = strpos($i915_emon_status, 'GMCH temp: ');
                 if ($temp !== false) {
                     $temp = substr($i915_emon_status, $temp + 11);
                     $temp = substr($temp, 0, strpos($temp, PHP_EOL));
                     if (is_numeric($temp) && $temp > 0) {
                         $temp_c = $temp;
                     }
                 }
             }
         }
     }
     if ($temp_c > 1000 || $temp_c < 9) {
         // Invalid data
         return -1;
     }
     return $temp_c;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:44,代码来源:gpu_temp.php

示例13: run

 public static function run($r)
 {
     if (pts_openbenchmarking_client::user_name() == false) {
         echo PHP_EOL . 'You must first be logged into an OpenBenchmarking.org account.' . PHP_EOL;
         echo PHP_EOL . 'Create An Account: http://openbenchmarking.org/';
         echo PHP_EOL . 'Log-In Command: phoronix-test-suite openbenchmarking-setup' . PHP_EOL . PHP_EOL;
         return false;
     }
     foreach (pts_types::identifiers_to_test_profile_objects($r, true, true) as $test_profile) {
         // validate_test_profile
         if (pts_validation::validate_test_profile($test_profile)) {
             pts_client::$display->generic_heading($test_profile);
             $zip_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $test_profile->get_identifier_base_name() . '-' . $test_profile->get_test_profile_version() . '.zip';
             $zip_created = pts_compression::zip_archive_create($zip_file, pts_file_io::glob($test_profile->get_resource_dir() . '*'));
             if ($zip_created == false) {
                 echo PHP_EOL . 'Failed to create zip file.' . PHP_EOL;
                 return false;
             }
             if (filesize($zip_file) > 104857) {
                 echo PHP_EOL . 'The test profile package is too big.' . PHP_EOL;
                 return false;
             }
             $commit_description = pts_user_io::prompt_user_input('Enter a test commit description', false);
             echo PHP_EOL;
             $server_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_profile', array('tp_identifier' => $test_profile->get_identifier_base_name(), 'tp_sha1' => sha1_file($zip_file), 'tp_zip' => base64_encode(file_get_contents($zip_file)), 'tp_zip_name' => basename($zip_file), 'commit_description' => $commit_description));
             echo PHP_EOL;
             $json = json_decode($server_response, true);
             if (isset($json['openbenchmarking']['upload']['error']) && !empty($json['openbenchmarking']['upload']['error'])) {
                 echo 'ERROR: ' . $json['openbenchmarking']['upload']['error'] . PHP_EOL;
             }
             if (isset($json['openbenchmarking']['upload']['id']) && !empty($json['openbenchmarking']['upload']['id'])) {
                 echo 'Command: phoronix-test-suite benchmark ' . $json['openbenchmarking']['upload']['id'] . PHP_EOL;
             }
             if (isset($json['openbenchmarking']['upload']['url']) && !empty($json['openbenchmarking']['upload']['url'])) {
                 pts_openbenchmarking::refresh_repository_lists(null, true);
                 echo 'URL: ' . $json['openbenchmarking']['upload']['url'] . PHP_EOL;
             }
             echo PHP_EOL;
             // TODO: chmod +x the .sh files, appropriate permissions elsewhere
             unlink($zip_file);
         }
     }
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:43,代码来源:upload_test_profile.php

示例14: render_page_process

    public static function render_page_process($PATH)
    {
        echo phoromatic_webui_header_logged_in();
        $main = '<h1>Cache Settings</h1>
				<h2>Test Profile Download Cache</h2>
				<p>Below are a list of files for verification/debugging purposes that are currently cached by the Phoromatic Server and available for Phoronix Test Suite client systems to download. These are files that are needed by various test profiles in the Phoronix Test Suite. To add more data to this Phoromatic Server cache, from the server run <strong>phoronix-test-suite make-download-cache</strong> while passing the names of any tests/suites you wish to have download and generate a cache for so they can be made available to the Phoronix Test Suite clients on your network.</p>';
        $dc = pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
        $dc_exists = is_file($dc . 'pts-download-cache.json');
        if ($dc_exists) {
            $cache_json = file_get_contents($dc . 'pts-download-cache.json');
            $cache_json = json_decode($cache_json, true);
        }
        if (is_file($dc . 'pts-download-cache.json')) {
            if ($cache_json && isset($cache_json['phoronix-test-suite']['download-cache'])) {
                $total_file_size = 0;
                $main .= '<table style="margin: 0 auto;"><tr><th>File</th><th>Size</th></tr>';
                foreach ($cache_json['phoronix-test-suite']['download-cache'] as $file_name => $inf) {
                    $total_file_size += $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'];
                    $main .= '<tr><td>' . $file_name . '</td><td>' . round(max(0.1, $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'] / 1000000), 1) . 'MB</td></tr>';
                }
                $main .= '</table>';
                $main .= '<p><strong>' . count($cache_json['phoronix-test-suite']['download-cache']) . ' Files / ' . round($total_file_size / 1000000) . ' MB Cache Size</strong></p>';
            }
        } else {
            $main .= '<h3>No download cache file could be found; on the Phoromatic Server you should run <strong>phoronix-test-suite make-download-cache</strong>.</h3>';
            // TODO XXX implement from the GUI
        }
        $main .= '<hr /><h2>OpenBenchmarking.org Cache Data</h2>';
        $main .= '<p>Below is information pertaining to the OpenBenchmarking.org cache present on the Phoromatic Server. To update this cache, run <strong>phoronix-test-suite make-openbenchmarking-cache</strong> from the server.</p>';
        $index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
        $main .= '<table style="margin: 0 auto;"><tr><th>Repository</th><th>Last Updated</th></tr>';
        foreach ($index_files as $index_file) {
            $index_data = json_decode(file_get_contents($index_file), true);
            $main .= '<tr><td>' . basename($index_file, '.index') . '</td><td>' . date('d F Y H:i', $index_data['main']['generated']) . '</td></tr>';
        }
        $main .= '</table>';
        echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
        echo phoromatic_webui_footer();
    }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:39,代码来源:phoromatic_caches.php

示例15: search_local_test_suites

 protected static function search_local_test_suites($q)
 {
     $ret = null;
     $suite_dir = phoromatic_server::phoromatic_account_suite_path($_SESSION['AccountID']);
     foreach (pts_file_io::glob($suite_dir . '*/suite-definition.xml') as $xml_path) {
         $id = basename(dirname($xml_path));
         $test_suite = new pts_test_suite($xml_path);
         $match = false;
         if (stripos($test_suite->get_title(), $q) === 0 || stripos($test_suite->get_description(), $q) !== false) {
             $match = true;
         } else {
             foreach ($test_suite->get_contained_test_result_objects() as $tro) {
                 if (stripos($tro->test_profile->get_identifier(), $q) !== false || stripos($tro->test_profile->get_title(), $q) === 0) {
                     $match = true;
                 }
             }
         }
         if ($match) {
             $ret .= '<h3>' . $test_suite->get_title() . '</h3><p>' . $test_suite->get_description() . '<br /><a href="/?local_suites#' . $id . '">More Details</a></p>';
         }
     }
     return $ret;
 }
开发者ID:ShaolongHu,项目名称:phoronix-test-suite,代码行数:23,代码来源:phoromatic_search.php


注:本文中的pts_file_io::glob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。