public function save($file, &$url, $type, $addons, $ext_name = "") { if ($type == 'public') { $group_id = constant("ECAE_SITE_NAME") . '-public'; } elseif ($type == 'private') { $group_id = constant("ECAE_SITE_NAME") . '-private'; } else { $group_id = constant("ECAE_SITE_NAME") . '-images'; } $filename = $this->_get_ident($file, $type, $addons, $url, $path, $ext_name); //$filename = basename($file) . $ext_name; $ident = ecae_file_save($group_id, $file, array('name' => $filename, "path" => $path)); if ($ident) { $url = ecae_file_url($ident); return $ident; } else { return false; } }
public function save_run($xhprof_data, $type, $run_id = null) { // Use PHP serialize function to store the XHProf's // raw profiler data. $xhprof_data = serialize($xhprof_data); if ($run_id === null) { $run_id = $this->gen_run_id($type); } $file_name = $this->file_name($run_id, $type); $file = fopen($file_name, 'w'); if ($file) { fwrite($file, $xhprof_data); fclose($file); } else { xhprof_error("Could not open {$file_name}\n"); } if (defined("ECAE_MODE") && constant("ECAE_MODE")) { // 如果是存放在ecae中返回的是ECAE S3存放id return ecae_file_save(constant("ECAE_SITE_NAME") . "-private", $file_name, array("path" => "xphrof", "name" => $run_id . ".txt")); } // echo "Saved run in {$file_name}.\nRun id = {$run_id}.\n"; return $run_id; }