public static function upload_usage_data($task, $data) { if (!pts_network::internet_support_available()) { return false; } switch ($task) { case 'test_install': list($test_install, $time_elapsed) = $data; $upload_data = array('test_identifier' => $test_install->test_profile->get_identifier(), 'test_version' => $test_install->test_profile->get_test_profile_version(), 'elapsed_time' => $time_elapsed); pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-install.php', $upload_data); break; case 'test_complete': list($test_result, $time_elapsed) = $data; $upload_data = array('test_identifier' => $test_result->test_profile->get_identifier(), 'test_version' => $test_result->test_profile->get_test_profile_version(), 'elapsed_time' => $time_elapsed); pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-completion.php', $upload_data); break; case 'test_install_failure': list($test_install, $error) = $data; $upload_data = array('test_identifier' => $test_install->test_profile->get_identifier(), 'error' => $error, 'os' => phodevi::read_property('system', 'vendor-identifier')); pts_network::http_upload_via_post(pts_openbenchmarking::openbenchmarking_host() . 'extern/statistics/report-test-install-failure.php', $upload_data); break; } }
public static function make_openbenchmarking_request($request, $post = array()) { $url = pts_openbenchmarking::openbenchmarking_host() . 'f/client.php'; $to_post = array_merge(array('r' => $request, 'client_version' => PTS_CORE_VERSION, 'gsid' => defined('PTS_GSID') ? PTS_GSID : null, 'gsid_e' => defined('PTS_GSID_E') ? PTS_GSID_E : null), $post); if (PTS_IS_CLIENT && ($account = pts_openbenchmarking_client::get_openbenchmarking_account()) && is_array($account)) { $to_post = array_merge($to_post, $account); } return pts_network::http_upload_via_post($url, $to_post); }