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


PHP phodevi::set_device_cache方法代码示例

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


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

示例1: core_storage_init_process

 private static function core_storage_init_process()
 {
     $pso = pts_storage_object::recover_from_file(PTS_CORE_STORAGE);
     if ($pso == false) {
         $pso = new pts_storage_object(true, true);
     }
     // OpenBenchmarking.org - GSID
     $global_gsid = $pso->read_object('global_system_id');
     $global_gsid_e = $pso->read_object('global_system_id_e');
     $global_gsid_p = $pso->read_object('global_system_id_p');
     if (empty($global_gsid) || pts_openbenchmarking::is_valid_gsid_format($global_gsid) == false) {
         // Global System ID for anonymous uploads, etc
         $requested_gsid = true;
         $global_gsid = pts_openbenchmarking_client::request_gsid();
         if (is_array($global_gsid)) {
             $pso->add_object('global_system_id', $global_gsid['gsid']);
             // GSID
             $pso->add_object('global_system_id_p', $global_gsid['gsid_p']);
             // GSID_P
             $pso->add_object('global_system_id_e', $global_gsid['gsid_e']);
             // GSID_E
             pts_define('PTS_GSID', $global_gsid['gsid']);
             pts_define('PTS_GSID_E', $global_gsid['gsid_e']);
         }
     } else {
         if (pts_openbenchmarking::is_valid_gsid_e_format($global_gsid_e) == false || pts_openbenchmarking::is_valid_gsid_p_format($global_gsid_p) == false) {
             pts_define('PTS_GSID', $global_gsid);
             $requested_gsid = false;
             $global_gsid = pts_openbenchmarking_client::retrieve_gsid();
             if (is_array($global_gsid)) {
                 $pso->add_object('global_system_id_p', $global_gsid['gsid_p']);
                 // GSID_P
                 $pso->add_object('global_system_id_e', $global_gsid['gsid_e']);
                 // GSID_E
                 pts_define('PTS_GSID_E', $global_gsid['gsid_e']);
             }
         } else {
             pts_define('PTS_GSID', $global_gsid);
             pts_define('PTS_GSID_E', $global_gsid_e);
             $requested_gsid = false;
         }
     }
     $machine_self_id = $pso->read_object('machine_self_id');
     if (empty($machine_self_id)) {
         $ns = md5('phoronix-test-suite');
         $binary_ns = null;
         for ($i = 0; $i < strlen($ns); $i += 2) {
             $binary_ns .= chr(hexdec($ns[$i] . $ns[$i + 1]));
         }
         $msi_hash = sha1($binary_ns . uniqid(PTS_CORE_VERSION, true) . getenv('USERNAME') . getenv('USER') . getenv('HOSTNAME') . pts_network::get_local_ip());
         $machine_self_id = sprintf('%08s-%04s-%04x-%04x-%12s', substr($msi_hash, 0, 8), substr($msi_hash, 8, 4), hexdec(substr($msi_hash, 12, 4)) & 0xfff | 0x5000, hexdec(substr($msi_hash, 16, 4)) & 0x3fff | 0x8000, substr($msi_hash, 20, 12));
         // machine_self_id is self-generated unique name for Phoromatic/OB purposes in UUIDv5 format
         $pso->add_object('machine_self_id', $machine_self_id);
     }
     pts_define('PTS_MACHINE_SELF_ID', $machine_self_id);
     // Last Run Processing
     $last_core_version = $pso->read_object('last_core_version');
     pts_define('FIRST_RUN_ON_PTS_UPGRADE', $last_core_version != PTS_CORE_VERSION);
     if (FIRST_RUN_ON_PTS_UPGRADE || $pso->read_object('last_php_version') != PTS_PHP_VERSION) {
         // Report any missing/recommended extensions
         self::program_requirement_checks();
     }
     if (FIRST_RUN_ON_PTS_UPGRADE) {
         if ($requested_gsid == false) {
             pts_openbenchmarking_client::update_gsid();
         }
         pts_client::build_temp_cache();
     }
     $pso->add_object('last_core_version', PTS_CORE_VERSION);
     // PTS version last run
     $pso->add_object('last_php_version', PTS_PHP_VERSION);
     // PHP version last run
     //$last_pts_version = $pso->read_object('last_pts_version');
     // do something here with $last_pts_version if you want that information
     $pso->add_object('last_pts_version', PTS_VERSION);
     // PTS version last run
     // Last Run Processing
     $last_run = $pso->read_object('last_run_time');
     pts_define('IS_FIRST_RUN_TODAY', substr($last_run, 0, 10) != date('Y-m-d'));
     $pso->add_object('last_run_time', date('Y-m-d H:i:s'));
     // Time PTS was last run
     pts_define('TIME_SINCE_LAST_RUN', ceil((time() - strtotime($last_run)) / 60));
     // TIME_SINCE_LAST_RUN is in minutes
     // User Agreement Checking
     $agreement_cs = $pso->read_object('user_agreement_cs');
     $pso->add_object('user_agreement_cs', $agreement_cs);
     // User agreement check-sum
     // Phodevi Cache Handling
     $phodevi_cache = $pso->read_object('phodevi_smart_cache');
     if ($phodevi_cache instanceof phodevi_cache && pts_client::read_env('NO_PHODEVI_CACHE') == false) {
         $phodevi_cache = $phodevi_cache->restore_cache(PTS_USER_PATH, PTS_CORE_VERSION);
         phodevi::set_device_cache($phodevi_cache);
         if ($external_phodevi_cache = pts_client::read_env('EXTERNAL_PHODEVI_CACHE')) {
             if (is_dir($external_phodevi_cache) && is_file($external_phodevi_cache . '/core.pt2so')) {
                 $external_phodevi_cache .= '/core.pt2so';
             }
             if (is_file($external_phodevi_cache)) {
                 $external_phodevi_cache = pts_storage_object::force_recover_from_file($external_phodevi_cache);
                 if ($external_phodevi_cache != false) {
                     $external_phodevi_cache = $external_phodevi_cache->read_object('phodevi_smart_cache');
//.........这里部分代码省略.........
开发者ID:Grdflo,项目名称:phoronix-test-suite,代码行数:101,代码来源:pts_client.php


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