diff --git a/application/controllers/information.php b/application/controllers/information.php
index 2be69f90..9e5c1811 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -1,826 +1,827 @@
-permission->is_admin();
- //$this->output->enable_profiler(TRUE);
- $this->load->model('Area_model');
- $this->load->model('Information_model');
- $this->load->model('InfoContents_model');
- $this->load->model('InfoStructures_model');
- $this->load->model('Landscape_model');
- $this->load->model('Operator_model');
- $this->load->model('Logs_model');
- $this->load->model('InfoMetas_model');
- $this->load->model('Infoauthors_model');
- $this->load->model('InfoSMS_model');
- $this->load->library('Amplib'); //加载AMP处理类
- }
-
- public function index()
- {
- echo '信息首页';
- }
-
- public function add($is_parent_id)
- {
- //添加空内容.
- $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', '');
- $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id);
- if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) {
- $is_id = $this->InfoStructures_model->insert_id;
- $InfoStructures = $this->InfoStructures_model->Detail($is_id);
- $InfoStructures->is_id = $is_id;
- $data[] = array('name' => 'ok', 'value' => $InfoStructures);
- $this->Logs_model->add($this->InfoStructures_model->insert_id);
- } else {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
- }
- echo json_encode($data);
- return TRUE;
- }
-
- //移动结构顺序
- public function move()
- {
- //网站会提交一个同级节点id列表字符串,按照这个去排序
- $parent_id = $this->input->post('pid');
- $idsStr = $this->input->post('ids');
- $idsArray = explode(',', $idsStr);
- foreach ($idsArray as $key => $value) {
- if ($value) {
- //设置排序
- $this->InfoStructures_model->set_sort($value, $key);
- //设置path
- $this->InfoStructures_model->set_path($parent_id, $value);
- }
- }
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
- echo json_encode($data);
- $this->Logs_model->move($idsStr);
- return TRUE;
- }
-
- //把文章移动到任意板块文章下
- //is_id 信息结构ID,is_parent_id即将转移到的信息结构id
- public function move_by_is_id()
- {
- $data = array();
- $is_id = $this->input->post('is_id');
- $is_parent_id = $this->input->post('is_parent_id');
- if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) {
- return false;
- }
- //即将移动到文章结构信息
- $Structure = $this->InfoStructures_model->Detail($is_id);
- //目标文章结构信息
- $Structure_parent = $this->InfoStructures_model->Detail($is_parent_id);
- //只能移动到本站点下
- if ($Structure->is_sitecode == $Structure_parent->is_sitecode) {
- //不能搬迁到自己的子节点下
- if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) {
- $this->InfoStructures_model->set_path($is_parent_id, $is_id);
- }
- //信息的区域类型和id也要修改 todo
- }
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
- echo json_encode($data);
- $this->Logs_model->move($is_id);
- return TRUE;
- }
-
- public function delete($is_id)
- {
- //查询结构信息
- $Structure = $this->InfoStructures_model->Detail($is_id);
- if ($Structure == FALSE) {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
- echo json_encode($data);
- return false;
- }
- if ($this->InfoStructures_model->HasChild($Structure->is_id)) {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild'));
- echo json_encode($data);
- return false;
- } else {
- $info_detail = $this->Information_model->Detail($is_id);
-
- //删除前,备份amp的meta标签-isid。
- $meta_value = $this->InfoMetas_model->get($info_detail->ic_id, 'AMP_JSON');
- if ($meta_value) {
- $this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_'.$is_id);
- }
-
- $this->Logs_model->delete($is_id, $info_detail->ic_content);
- if (!empty($info_detail->ic_summary)) {
- $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary);
- }
- $this->InfoStructures_model->Delete($Structure->is_id);
- $this->InfoContents_model->Delete($Structure->is_ic_id);
- //如果是已经发布的页面,删除静态文件
- if ($info_detail->ic_status == 1) {
- $this->update_cache($info_detail->ic_url, true);
- }
- //删除成功后返回一个上级链接给用户
- $drumpurl = site_url('information/edit/' . $Structure->is_parent_id);
- if ($Structure->is_parent_id == 0)
- $drumpurl = site_url('/');
- $data[] = array('name' => 'ok', 'value' => $drumpurl);
- echo json_encode($data);
- return true;
- }
- }
-
- //移动优先的编辑
- public function edit_mobile($is_id){
- //查询结构信息
- $Structure = $this->InfoStructures_model->Detail($is_id);
- if ($Structure == FALSE) {
- show_404();
- }
- //查询结构根节点
- $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
- //没有根节点就从它本身开始查询
- if ($rootStructure == false) {
- $rootStructure_ID = $Structure->is_id;
- } else {
- $rootStructure_ID = $rootStructure->is_id;
- }
-
- //查询结构列表信息
- $data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
-
- //信息内容
- $data['information'] = $this->Information_model->Detail($is_id);
-
- $this->load->view('bootstrap3/header', $data);
- $this->load->view('mobile_first/editor');
- $this->load->view('bootstrap3/footer');
-
- }
-
- public function edit($is_id)
- {
- set_time_limit(30);
- //$this->output->enable_profiler(true);
- //查询结构信息
- $Structure = $this->InfoStructures_model->Detail($is_id);
- if ($Structure == FALSE) {
- show_404();
- }
- //查询结构根节点
- $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
- //没有根节点就从它本身开始查询
- if ($rootStructure == false) {
- $rootStructure_ID = $Structure->is_id;
- } else {
- $rootStructure_ID = $rootStructure->is_id;
- }
-
- //查询结构列表信息
- $data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
-
- //增加一项,属于这个区域,但是结构数据层次不准确的也要列出来
- //todo:
- //信息内容
- $data['information'] = $this->Information_model->Detail($is_id);
-
- //检查该信息是否已收录
- $data['embody'] = 1;
- if (isset($data['information']->ic_id)) {
- $embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody');
- if ($embody && $embody != '1') {
- $data['embody'] = 0;
- }
- //设置该信息所有未读消息为已读
- $this->InfoSMS_model->readed_for_info($data['information']->ic_id);
- }
-
- //主节点信息
- $data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID);
- //获取未绑定的景点,只有城市有,无视其它区域类型
- $data['unlink_landscape_list'] = array();
-
- //可选的展示模板
- if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
- $this->config->set_item('templates', $this->config->item('templates_i'));
- }
-
- if (in_array($this->config->item('site_code'), array('ah'))) {
- $this->config->set_item('templates', $this->config->item('templates_ah'));
- }
- if (in_array($this->config->item('site_code'), array('pgr'))) {
- $this->config->set_item('templates', $this->config->item('templates_pgr'));
- }
- if (in_array($this->config->item('site_code'), array('ts'))) {
- $this->config->set_item('templates', $this->config->item('templates_ts'));
- }
- if (in_array($this->config->item('site_code'), array('cht'))) {
- $this->config->set_item('templates', $this->config->item('templates_cht'));
- }
- if (in_array($this->config->item('site_code'), array('gm'))) {
- $this->config->set_item('templates', $this->config->item('templates_gm'));
- }
-
-
-
- if ($Structure->is_sitecode == 'ct') {
- $data['infoTypeList'] = $this->config->item('InfoType_ct');
- } elseif ($Structure->is_sitecode == 'ah') {
- $data['infoTypeList'] = $this->config->item('InfoType_ah');
- } else {
- switch ($data['rootInformation']->ic_ht_area_type) {
- case 'c': //城市
- $data['infoTypeList'] = $this->config->item('InfoType_city');
- $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id);
- break;
- case 'p': //省份
- $data['infoTypeList'] = $this->config->item('InfoType_province');
- break;
- case 'n': //国家
- $data['infoTypeList'] = $this->config->item('InfoType_country');
- break;
- case 't': //特殊区域
- $data['infoTypeList'] = $this->config->item('InfoType_special');
- break;
- case 'e': //大洲
- $data['infoTypeList'] = array();
- break;
- case 'z': //公民游
- $data['infoTypeList'] = $this->config->item('InfoType_citizen');
- break;
- case 'v': //视频
- $data['infoTypeList'] = $this->config->item('InfoType_video');
- break;
- case 'f': //节庆
- $data['infoTypeList'] = $this->config->item('InfoType_festival');
- break;
- case 'pd': //产品管理
- $data['infoTypeList'] = $this->config->item('InfoType_product');
- //LMR 2016-7-14
- if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
- $this->config->set_item('templates', $this->config->item('templates_product_i'));
- } else {
- $this->config->set_item('templates', $this->config->item('templates_product'));
- }
- break;
- default:
- $data['infoTypeList'] = array('不设置' => 'none', '首页' => 'root');
- break;
- }
- }
-
-
-
- $data['templateList'] = $this->config->item('templates');
- //翰特产品类型
- $data['productTypeList'] = $this->config->item('ProductType_HT');
- //获取绑定的产品名称
- switch ($data['information']->ic_ht_product_type) {
- case 't':
- $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id);
- break;
- default:
- $data['product_title'] = '';
- break;
- }
- //获取最后更新者信息
- $data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id);
-
- //编辑列表
- $sites = $this->config->item('site');
- $data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code'));
- //获取作者列表
- $data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code'));
-
- //获取备份信息记录
- $data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id);
-
- //所属导航栏目
- $data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
-
- $data['my_tags'] = array();
- $data['all_tags'] = array();
- if (is_series_site()) {
- //信息标签
- //$this->InfoTags_model->ic_id = null;
- //$data['all_tags'] = $this->InfoTags_model->list_tag();
- //$this->InfoTags_model->ic_id = $data['information']->ic_id;
- //$data['my_tags'] = $this->InfoTags_model->list_tag();
- //差集
- foreach ($data['all_tags'] as &$it) {
- foreach ($data['my_tags'] as $it2) {
- if ($it->it_id == $it2->icit_it_id) {
- $it = null;
- break;
- }
- }
- }
- $data['all_tags'] = array_filter($data['all_tags']);
- }
-
- //获取移动优先的模板,如果有的话
- $mobile_first_template_path='mobile_first/'.$this->config->item('site_code');
- if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){
- $data['mobile_first_template']=$this->load->view($mobile_first_template_path, '', TRUE);
- }else{
- $data['mobile_first_template']='没有找到移动模板';
- }
-
- $this->load->view('bootstrap3/header', $data);
- $this->load->view('bootstrap3/information_edit');
- $this->load->view('bootstrap3/footer');
- }
-
- /**
- public function redirect($jumpUrl){
-
- header('HTTP/1.1 301 Moved Permanently');
-
- header($jumpUrl);// 301 跳转到设置的 url
-
- exit();
-
- } */
- public function test_proxy($url = false)
- {
- $curl = curl_init();
- //curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com");
- //curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/');
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
- curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333");
- $request = curl_exec($curl);
- curl_close($curl);
- return $request;
- //echo $request;
- }
-
- // 分享数 lzq
- public function statistical_sharing()
- {
-
- //$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
- $info_ic = $this->Information_model->get_ic_url();
- $ic_id = $info_ic->ic_id;
- $ic_url = $info_ic->ic_url;
- $ic_sitecode = $info_ic->ic_sitecode;
- $site = $this->config->item('site');
-
- if (!empty($ic_url)) {
-
- $result = $this->Information_model->update_ic_date_by_code($ic_id);
- //var_dump($site['mbj']['site_url']);
- //$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url;
- $complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url;
- //echo $wz_url;
- $api_return = $this->test_proxy($complete_url);
- $api_return = json_decode($api_return);
- if (empty($api_return->shares)) {
- var_dump($api_return);
- $shares = 0;
- } else {
- var_dump($api_return);
- $shares = $api_return->shares;
- }
-
- //echo $asd->shares;
- $result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares);
- }
-
- //$sstt = $this->config->item('site');
- //foreach($infolist as $k=>$v){
- // $aabb[] = $v->ic_sitecode;
- //}
- //$url_count = $this->Information_model->get_count_by_code('mbj');
- //$surl = site_url('/information/fengxiangshu');
- //redirect($surl,'refresh',301);
-
- $this->load->view('bootstrap3/header');
- $this->load->view('bootstrap3/statistical_sharing');
- }
-
- public function edit_save()
- {
- header('Cache-Control: no-cache');
- $information = $this->Information_model->Detail($this->input->post('is_id'));
- if ($information === false) {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
- echo json_encode($data);
- return false;
- }
-
- $this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required');
- $this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required');
- $this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required');
- $this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check');
- //这里比较特别,检测两次ic_url,ci会冲掉第一个ic_url的规则,所以需要在下面也加上callback_ic_url_check
- $this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format');
-
- if ($this->input->post('ignore_seo_check') === false) {
- $this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required');
- $this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]');
- }
- if ($this->form_validation->run() == FALSE) {
- $data = array();
- foreach ($this->form_validation->_error_array as $key => $value) {
- $data[] = array('name' => $key, 'value' => $value);
- }
- echo json_encode($data);
- } else {
- $this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author'));
-
- //AMP更新和生成 beign
- $auto_update_amp = $this->input->get_post('auto_update_amp');
- if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) {
- $amp_result = $this->amplib->auto_create($information->ic_id);
- if (!empty($amp_result)) {
- $amp_result = json_decode($amp_result);
- if ($amp_result->result == 'ok') {
- $amp_save_result = $this->amplib->edit_save($information->ic_id, $amp_result->data->amp, '1');
- if (!empty($amp_save_result)) {
- $amp_save_result = json_decode($amp_save_result);
- if ($amp_save_result->name == 'no') {
- echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误,请重新进入AMP编辑器检查'));
- return;
- }
- }
- }
- }
- }
- //AMP更新和生成 end
- //为新闻添加默认发布时间
- $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate');
- if (empty($meta_news_createdate)) {
- add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time()));
- }
-
- //如果URL有修改也删除静态文件
- if ($this->input->post('ic_url') != $information->ic_url) {
- $this->update_cache($information->ic_url, true);
- }
-
- //如果信息不发布则删除静态文件
- if ($this->input->post('ic_status') == '0') {
- $this->update_cache($this->input->post('ic_url'), true);
- }
-
- //德语站FAQ版块需要删除原来的文件才能更新静态
- $site_code = $this->config->item('site_code');
- $ic_url = $this->input->post('ic_url');
- $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
-
- if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) {
- $update_info_log = $this->update_cache($ic_url, true);
- }else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) {
- //读取模板生成PC和移动优先文件
- $this->make_mobile_html();
- } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
- $update_info_log = $this->update_cache($ic_url);
- } else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
- $update_info_log = $this->update_cache($ic_url);
- } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0 && strcasecmp($site_code, "ah") != 0) { //非cht站点并且非GM并且非AH
- $update_info_log = $this->update_cache($ic_url);
- }else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) {
- $update_info_log = $this->update_cache($ic_url);
- }
-
- if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) {
- $update_info_log = 'not found update info log';
- }
-
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log);
- $this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
- $this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary'));
-
- //作者个人页面更新
- if ($this->config->item('site_code') == 'cht') {
- $author_pages = array(
- 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/',
- 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/',
- 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/',
- 'PKL' => 'http://www.chinahighlights.com/author/kelly/',
- '210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/',
- '202000027' => 'http://www.chinahighlights.com/author/margaux/',
- '202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/',
- '210000018' => 'http://www.chinahighlights.com/author/connie/',
- '210000016' => 'http://www.chinahighlights.com/author/ben/',
- '200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/',
- '210000019' => 'http://www.chinahighlights.com/author/oscar/',
- '210000021' => 'http://www.chinahighlights.com/author/matthew/',
- '200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/',
- '202000018' => 'http://www.chinahighlights.com/author/klaus-capra/',
- '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/'
- );
- $key = $this->input->post('ic_author');
- if (isset($author_pages[$key])) {
- $this->update_cache($author_pages[$key]);
- }
- }
-
- echo json_encode($data);
- }
- }
-
- //URL不重复检查
- function ic_url_check()
- {
- if ($this->input->post('ignore_url_check')) {
- return true;
- }
-
- $url = $this->input->post('ic_url');
- if ($url === '') {
- return true;
- }
- $is_id = $this->input->post('is_id');
- return $this->Information_model->URLcheck($is_id, $url);
- }
-
- //URL格式检查,不能包含大小写、空格等特殊字符
- function ic_url_format($url)
- {
- if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) {
- return false;
- }
- return true;
- }
-
- function make_mobile_html(){
- //获取移动优先的模板,如果有的话
- $mobile_first_template_path='mobile_first/'.$this->config->item('site_code');
- if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){
- $mobile_template=$this->load->view($mobile_first_template_path, '', TRUE);
- }else{
- return false;
- }
- $mobile_template=str_replace('', $this->input->post('ic_seo_title'), $mobile_template);
- $mobile_template=str_replace('', $this->input->post('ic_seo_description'), $mobile_template);
- $mobile_template=str_replace('', $this->input->post('ic_seo_keywords'), $mobile_template);
- $mobile_template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $mobile_template);
- $mobile_template=str_replace('', $this->input->post('ic_title'), $mobile_template);
- $mobile_template=str_replace('', $this->input->post('ic_content'), $mobile_template);
-
- // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
- $mobile_html=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url');
- $mobile_html=str_replace("\\", "/", $mobile_html);
- if(substr($mobile_html, -1, 1)== '/'){
- $mobile_html=$mobile_html.'index.htm';
- }
- create_folder_by_path(dirname($mobile_html));
- file_put_contents($mobile_html, $mobile_template, LOCK_EX);
- }
-
- //更新静态文件
- //不用参数提交的原因是可能url带有特殊字符,CI会报错
- public function update_cache($static_html_url = false, $delete_only = false)
- {
- $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url');
- $url = str_replace($this->config->item('site_url'), '', $url);
- $original_url = $url; //原始链接
- $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only');
-
- switch ($this->config->item('site_code')) {
- case 'cht':
- $search_list = $this->Information_model->search_url($url);
- $amp_request = FALSE;
- foreach ($search_list as $key => $req_url) {
- $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS');
- if ($meta_amp_status) {
- $amp_request = TRUE;
- }
- }
- if ($amp_request) {
- $url = 'http://169.54.167.189:22224/ampreq' . $url;
- } else {
- $url = 'http://169.54.167.189:22224' . $url;
- }
- break;
- case 'ah':
- if ($delete_only === true) {
- $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
- } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
- $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
- }
- break;
-
- case 'gm':
- //GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台
- //if ($delete_only) {
- // $url = "http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url);
- //} else {
- //先删除再生成,部分页面没有在信息平台中
- GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url));
- $url = "http://144.76.185.44:8029/gm.php/information/detail/?static_html_url=" . $url;
- //}
- break;
-
- case 'vac': //国际站
- case 'vc':
- case 'it':
- case 'ru':
- case 'jp':
- $information = $this->Information_model->Detail($url);
- if ($delete_only || !$information || $information->ic_ht_area_type === 'q') {
- //只删除操作,在url修改和不发布信息的时候使用
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
- } else {
- $tmp = $url;
- //判断是否是更新信息
- // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
- if (!empty($information->ic_content)) {
- $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
- } else {
- //先尝试删除静态文件。
- //$try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
- //file_get_contents($try_del);
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
- }
- if (isset($information->ic_type) && $information->ic_type == 'product') {
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
- }
- //int return direct
- $cache_url = $this->input->post('cache_url');
- if ($url && !$cache_url) {
- /*
- ignore_user_abort(true);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_TIMEOUT, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容
- curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD
- curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_exec($ch);
- curl_close($ch);
- */
- $data['async_update'] = $url;
- $data[] = array('name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url);
- //如果是外部调用就返回结果,内部就不返回了
- if ($cache_url) {
- echo json_encode($data);
- }
- return $data;
- }
- }
- break;
-
- case 'ct': //子站点使用
- $url = 'http://50.97.246.187:22223' . $url;
- break;
- case 'sht':
- case 'gl':
- case 'mbj':
- case 'yz':
- $url = $this->config->item('site_url') . $url . '@cache@refresh';
- break;
- default:
- return false;
- break;
- }
-
- $content = GET_HTTP($url);
- if ($content === false) {
- $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
- } else {
- //手动更新的话,接着更新CDN缓存
- $msg = $this->lang->line('update_cache_success');
-
- if ($this->input->post('updatecdn') == 1) {
- $notice = $this->update_cdn();
- if ($notice == 200) {
- $msg .= $this->lang->line('update_cdn_success');
- } else {
- $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice;
- }
- }
- $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
- }
- //如果是外部调用就返回结果,内部就不返回了
- if ($this->input->post('cache_url')) {
- echo json_encode($data);
- }
- return $data;
- }
-
- //更新CDN缓存
- public function update_cdn($static_html_url = false)
- {
- $flag = false; //false:不更新,true:更新
- $update_site = array('jp', 'ru'); //需要更新CDN的站点
- //需要更新的url
- $url = $static_html_url;
- if (empty($url))
- $url = $this->input->post('cache_url');
-
- //如果传递进来的url是带有域名,则对域名进行判断
- $tempu = parse_url($url);
- if (isset($tempu['host'])) {
- $url = isset($tempu['path']) ? $tempu['path'] : '/';
- $pad = $tempu['host'];
- $flag = true;
- }
- //如果传递进来的url没有域名,则使用当前站点的信息进行判断
- else {
- $url = str_replace($this->config->item('site_url'), '', $url);
- $pad = str_replace('http://', '', $this->config->item('site_url'));
- if (in_array($this->config->item('site_code'), $update_site))
- $flag = TRUE;
- }
-
- //默认更新成功,如果不成功,则返回错误提示信息
- $notice = 200;
- if ($flag) {
- $result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json');
- $result = json_decode($result, true);
- if ($result['resultCode'] != 200)
- $notice = $result['notice'] . $result['details'];
- }
- return $notice;
- }
-
- //获取产品信息,提供给用户选择进行绑定
- function get_products()
- {
- $HT_productType = $this->input->post('product_type');
- $HT_productName = $this->input->post('product_name');
- //产品类型
- switch ($HT_productType) {
- case 't':
- $data['productList'] = $this->Landscape_model->search_list($HT_productName);
- break;
- default:
- $data['productList'] = array();
- break;
- }
- $data['product_type'] = $HT_productType;
- $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true);
- $data = array();
- $data[] = array('name' => 'ok', 'value' => $product_list_page);
- echo json_encode($data);
- return true;
- }
-
- //显示备份的内容
- function backup_content($log_id)
- {
- $data['log_info'] = $this->Logs_model->read($log_id);
- if($data['log_info']->log_action == 'backup_amp'){
- $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id,true);
- }else{
- $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id);
- }
- $this->load->view('bootstrap/header', $data);
- $this->load->view('bootstrap/information_backup_content');
- $this->load->view('bootstrap/footer');
- }
-
- //保存自定义配置
- function save_meta()
- {
- $im_ic_id = $this->input->post('im_ic_id');
- $im_key = $this->input->post('im_key');
- $im_value = $this->input->post('im_value');
- if ($im_ic_id && $im_key && $im_value !== false) {
- $meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
- if ($meta === false) {
- $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
- } else {
- $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
- }
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success'));
- } else {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
- }
- echo json_encode($data);
- return true;
- }
-
- //保存自定义配置
- function delete_meta()
- {
- $im_ic_id = $this->input->post('im_ic_id');
- $im_key = $this->input->post('im_key');
- if ($im_ic_id && $im_key) {
-
- $this->InfoMetas_model->delete($im_ic_id, $im_key);
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success'));
- } else {
- $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
- }
- echo json_encode($data);
- return true;
- }
-}
+permission->is_admin();
+ //$this->output->enable_profiler(TRUE);
+ $this->load->model('Area_model');
+ $this->load->model('Information_model');
+ $this->load->model('InfoContents_model');
+ $this->load->model('InfoStructures_model');
+ $this->load->model('Landscape_model');
+ $this->load->model('Operator_model');
+ $this->load->model('Logs_model');
+ $this->load->model('InfoMetas_model');
+ $this->load->model('Infoauthors_model');
+ $this->load->model('InfoSMS_model');
+ $this->load->library('Amplib'); //加载AMP处理类
+ }
+
+ public function index()
+ {
+ echo '信息首页';
+ }
+
+ public function add($is_parent_id)
+ {
+ //添加空内容.
+ $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', '');
+ $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id);
+ if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) {
+ $is_id = $this->InfoStructures_model->insert_id;
+ $InfoStructures = $this->InfoStructures_model->Detail($is_id);
+ $InfoStructures->is_id = $is_id;
+ $data[] = array('name' => 'ok', 'value' => $InfoStructures);
+ $this->Logs_model->add($this->InfoStructures_model->insert_id);
+ } else {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
+ }
+ echo json_encode($data);
+ return TRUE;
+ }
+
+ //移动结构顺序
+ public function move()
+ {
+ //网站会提交一个同级节点id列表字符串,按照这个去排序
+ $parent_id = $this->input->post('pid');
+ $idsStr = $this->input->post('ids');
+ $idsArray = explode(',', $idsStr);
+ foreach ($idsArray as $key => $value) {
+ if ($value) {
+ //设置排序
+ $this->InfoStructures_model->set_sort($value, $key);
+ //设置path
+ $this->InfoStructures_model->set_path($parent_id, $value);
+ }
+ }
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
+ echo json_encode($data);
+ $this->Logs_model->move($idsStr);
+ return TRUE;
+ }
+
+ //把文章移动到任意板块文章下
+ //is_id 信息结构ID,is_parent_id即将转移到的信息结构id
+ public function move_by_is_id()
+ {
+ $data = array();
+ $is_id = $this->input->post('is_id');
+ $is_parent_id = $this->input->post('is_parent_id');
+ if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) {
+ return false;
+ }
+ //即将移动到文章结构信息
+ $Structure = $this->InfoStructures_model->Detail($is_id);
+ //目标文章结构信息
+ $Structure_parent = $this->InfoStructures_model->Detail($is_parent_id);
+ //只能移动到本站点下
+ if ($Structure->is_sitecode == $Structure_parent->is_sitecode) {
+ //不能搬迁到自己的子节点下
+ if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) {
+ $this->InfoStructures_model->set_path($is_parent_id, $is_id);
+ }
+ //信息的区域类型和id也要修改 todo
+ }
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
+ echo json_encode($data);
+ $this->Logs_model->move($is_id);
+ return TRUE;
+ }
+
+ public function delete($is_id)
+ {
+ //查询结构信息
+ $Structure = $this->InfoStructures_model->Detail($is_id);
+ if ($Structure == FALSE) {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
+ echo json_encode($data);
+ return false;
+ }
+ if ($this->InfoStructures_model->HasChild($Structure->is_id)) {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild'));
+ echo json_encode($data);
+ return false;
+ } else {
+ $info_detail = $this->Information_model->Detail($is_id);
+
+ //删除前,备份amp的meta标签-isid。
+ $meta_value = $this->InfoMetas_model->get($info_detail->ic_id, 'AMP_JSON');
+ if ($meta_value) {
+ $this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_'.$is_id);
+ }
+
+ $this->Logs_model->delete($is_id, $info_detail->ic_content);
+ if (!empty($info_detail->ic_summary)) {
+ $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary);
+ }
+ $this->InfoStructures_model->Delete($Structure->is_id);
+ $this->InfoContents_model->Delete($Structure->is_ic_id);
+ //如果是已经发布的页面,删除静态文件
+ if ($info_detail->ic_status == 1) {
+ $this->update_cache($info_detail->ic_url, true);
+ }
+ //删除成功后返回一个上级链接给用户
+ $drumpurl = site_url('information/edit/' . $Structure->is_parent_id);
+ if ($Structure->is_parent_id == 0)
+ $drumpurl = site_url('/');
+ $data[] = array('name' => 'ok', 'value' => $drumpurl);
+ echo json_encode($data);
+ return true;
+ }
+ }
+
+ //移动优先的编辑
+ public function edit_mobile($is_id){
+ //查询结构信息
+ $Structure = $this->InfoStructures_model->Detail($is_id);
+ if ($Structure == FALSE) {
+ show_404();
+ }
+ //查询结构根节点
+ $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
+ //没有根节点就从它本身开始查询
+ if ($rootStructure == false) {
+ $rootStructure_ID = $Structure->is_id;
+ } else {
+ $rootStructure_ID = $rootStructure->is_id;
+ }
+
+ //查询结构列表信息
+ $data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
+
+ //信息内容
+ $data['information'] = $this->Information_model->Detail($is_id);
+
+ $this->load->view('bootstrap3/header', $data);
+ $this->load->view('mobile_first/editor');
+ $this->load->view('bootstrap3/footer');
+
+ }
+
+ public function edit($is_id)
+ {
+ set_time_limit(30);
+ //$this->output->enable_profiler(true);
+ //查询结构信息
+ $Structure = $this->InfoStructures_model->Detail($is_id);
+ if ($Structure == FALSE) {
+ show_404();
+ }
+ //查询结构根节点
+ $rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
+ //没有根节点就从它本身开始查询
+ if ($rootStructure == false) {
+ $rootStructure_ID = $Structure->is_id;
+ } else {
+ $rootStructure_ID = $rootStructure->is_id;
+ }
+
+ //查询结构列表信息
+ $data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
+
+ //增加一项,属于这个区域,但是结构数据层次不准确的也要列出来
+ //todo:
+ //信息内容
+ $data['information'] = $this->Information_model->Detail($is_id);
+
+ //检查该信息是否已收录
+ $data['embody'] = 1;
+ if (isset($data['information']->ic_id)) {
+ $embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody');
+ if ($embody && $embody != '1') {
+ $data['embody'] = 0;
+ }
+ //设置该信息所有未读消息为已读
+ $this->InfoSMS_model->readed_for_info($data['information']->ic_id);
+ }
+
+ //主节点信息
+ $data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID);
+ //获取未绑定的景点,只有城市有,无视其它区域类型
+ $data['unlink_landscape_list'] = array();
+
+ //可选的展示模板
+ if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
+ $this->config->set_item('templates', $this->config->item('templates_i'));
+ }
+
+ if (in_array($this->config->item('site_code'), array('ah'))) {
+ $this->config->set_item('templates', $this->config->item('templates_ah'));
+ }
+ if (in_array($this->config->item('site_code'), array('pgr'))) {
+ $this->config->set_item('templates', $this->config->item('templates_pgr'));
+ }
+ if (in_array($this->config->item('site_code'), array('ts'))) {
+ $this->config->set_item('templates', $this->config->item('templates_ts'));
+ }
+ if (in_array($this->config->item('site_code'), array('cht'))) {
+ $this->config->set_item('templates', $this->config->item('templates_cht'));
+ }
+ if (in_array($this->config->item('site_code'), array('gm'))) {
+ $this->config->set_item('templates', $this->config->item('templates_gm'));
+ }
+
+
+
+ if ($Structure->is_sitecode == 'ct') {
+ $data['infoTypeList'] = $this->config->item('InfoType_ct');
+ } elseif ($Structure->is_sitecode == 'ah') {
+ $data['infoTypeList'] = $this->config->item('InfoType_ah');
+ } else {
+ switch ($data['rootInformation']->ic_ht_area_type) {
+ case 'c': //城市
+ $data['infoTypeList'] = $this->config->item('InfoType_city');
+ $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id);
+ break;
+ case 'p': //省份
+ $data['infoTypeList'] = $this->config->item('InfoType_province');
+ break;
+ case 'n': //国家
+ $data['infoTypeList'] = $this->config->item('InfoType_country');
+ break;
+ case 't': //特殊区域
+ $data['infoTypeList'] = $this->config->item('InfoType_special');
+ break;
+ case 'e': //大洲
+ $data['infoTypeList'] = array();
+ break;
+ case 'z': //公民游
+ $data['infoTypeList'] = $this->config->item('InfoType_citizen');
+ break;
+ case 'v': //视频
+ $data['infoTypeList'] = $this->config->item('InfoType_video');
+ break;
+ case 'f': //节庆
+ $data['infoTypeList'] = $this->config->item('InfoType_festival');
+ break;
+ case 'pd': //产品管理
+ $data['infoTypeList'] = $this->config->item('InfoType_product');
+ //LMR 2016-7-14
+ if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
+ $this->config->set_item('templates', $this->config->item('templates_product_i'));
+ } else {
+ $this->config->set_item('templates', $this->config->item('templates_product'));
+ }
+ break;
+ default:
+ $data['infoTypeList'] = array('不设置' => 'none', '首页' => 'root');
+ break;
+ }
+ }
+
+
+
+ $data['templateList'] = $this->config->item('templates');
+ //翰特产品类型
+ $data['productTypeList'] = $this->config->item('ProductType_HT');
+ //获取绑定的产品名称
+ switch ($data['information']->ic_ht_product_type) {
+ case 't':
+ $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id);
+ break;
+ default:
+ $data['product_title'] = '';
+ break;
+ }
+ //获取最后更新者信息
+ $data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id);
+
+ //编辑列表
+ $sites = $this->config->item('site');
+ $data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code'));
+ //获取作者列表
+ $data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code'));
+
+ //获取备份信息记录
+ $data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id);
+
+ //所属导航栏目
+ $data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
+
+ $data['my_tags'] = array();
+ $data['all_tags'] = array();
+ if (is_series_site()) {
+ //信息标签
+ //$this->InfoTags_model->ic_id = null;
+ //$data['all_tags'] = $this->InfoTags_model->list_tag();
+ //$this->InfoTags_model->ic_id = $data['information']->ic_id;
+ //$data['my_tags'] = $this->InfoTags_model->list_tag();
+ //差集
+ foreach ($data['all_tags'] as &$it) {
+ foreach ($data['my_tags'] as $it2) {
+ if ($it->it_id == $it2->icit_it_id) {
+ $it = null;
+ break;
+ }
+ }
+ }
+ $data['all_tags'] = array_filter($data['all_tags']);
+ }
+
+ //获取移动优先的模板,如果有的话
+ $mobile_first_template_path='mobile_first/'.$this->config->item('site_code');
+ if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){
+ $data['mobile_first_template']=$this->load->view($mobile_first_template_path, '', TRUE);
+ }else{
+ $data['mobile_first_template']='没有找到移动模板';
+ }
+
+ $this->load->view('bootstrap3/header', $data);
+ $this->load->view('bootstrap3/information_edit');
+ $this->load->view('bootstrap3/footer');
+ }
+
+ /**
+ public function redirect($jumpUrl){
+
+ header('HTTP/1.1 301 Moved Permanently');
+
+ header($jumpUrl);// 301 跳转到设置的 url
+
+ exit();
+
+ } */
+ public function test_proxy($url = false)
+ {
+ $curl = curl_init();
+ //curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com");
+ //curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/');
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_HEADER, 0);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
+ curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333");
+ $request = curl_exec($curl);
+ curl_close($curl);
+ return $request;
+ //echo $request;
+ }
+
+ // 分享数 lzq
+ public function statistical_sharing()
+ {
+
+ //$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
+ $info_ic = $this->Information_model->get_ic_url();
+ $ic_id = $info_ic->ic_id;
+ $ic_url = $info_ic->ic_url;
+ $ic_sitecode = $info_ic->ic_sitecode;
+ $site = $this->config->item('site');
+
+ if (!empty($ic_url)) {
+
+ $result = $this->Information_model->update_ic_date_by_code($ic_id);
+ //var_dump($site['mbj']['site_url']);
+ //$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url;
+ $complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url;
+ //echo $wz_url;
+ $api_return = $this->test_proxy($complete_url);
+ $api_return = json_decode($api_return);
+ if (empty($api_return->shares)) {
+ var_dump($api_return);
+ $shares = 0;
+ } else {
+ var_dump($api_return);
+ $shares = $api_return->shares;
+ }
+
+ //echo $asd->shares;
+ $result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares);
+ }
+
+ //$sstt = $this->config->item('site');
+ //foreach($infolist as $k=>$v){
+ // $aabb[] = $v->ic_sitecode;
+ //}
+ //$url_count = $this->Information_model->get_count_by_code('mbj');
+ //$surl = site_url('/information/fengxiangshu');
+ //redirect($surl,'refresh',301);
+
+ $this->load->view('bootstrap3/header');
+ $this->load->view('bootstrap3/statistical_sharing');
+ }
+
+ public function edit_save()
+ {
+ header('Cache-Control: no-cache');
+ $information = $this->Information_model->Detail($this->input->post('is_id'));
+ if ($information === false) {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
+ echo json_encode($data);
+ return false;
+ }
+
+ $this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required');
+ $this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required');
+ $this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required');
+ $this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check');
+ //这里比较特别,检测两次ic_url,ci会冲掉第一个ic_url的规则,所以需要在下面也加上callback_ic_url_check
+ $this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format');
+
+ if ($this->input->post('ignore_seo_check') === false) {
+ $this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required');
+ $this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]');
+ }
+ if ($this->form_validation->run() == FALSE) {
+ $data = array();
+ foreach ($this->form_validation->_error_array as $key => $value) {
+ $data[] = array('name' => $key, 'value' => $value);
+ }
+ echo json_encode($data);
+ } else {
+ $this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author'));
+
+ //AMP更新和生成 beign
+ $auto_update_amp = $this->input->get_post('auto_update_amp');
+ if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) {
+ $amp_result = $this->amplib->auto_create($information->ic_id);
+ if (!empty($amp_result)) {
+ $amp_result = json_decode($amp_result);
+ if ($amp_result->result == 'ok') {
+ $amp_save_result = $this->amplib->edit_save($information->ic_id, $amp_result->data->amp, '1');
+ if (!empty($amp_save_result)) {
+ $amp_save_result = json_decode($amp_save_result);
+ if ($amp_save_result->name == 'no') {
+ echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误,请重新进入AMP编辑器检查'));
+ return;
+ }
+ }
+ }
+ }
+ }
+ //AMP更新和生成 end
+ //为新闻添加默认发布时间
+ $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate');
+ if (empty($meta_news_createdate)) {
+ add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time()));
+ }
+
+ //如果URL有修改也删除静态文件
+ if ($this->input->post('ic_url') != $information->ic_url) {
+ $this->update_cache($information->ic_url, true);
+ }
+
+ //如果信息不发布则删除静态文件
+ if ($this->input->post('ic_status') == '0') {
+ $this->update_cache($this->input->post('ic_url'), true);
+ }
+
+ //德语站FAQ版块需要删除原来的文件才能更新静态
+ $site_code = $this->config->item('site_code');
+ $ic_url = $this->input->post('ic_url');
+ $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
+
+ if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) {
+ $update_info_log = $this->update_cache($ic_url, true);
+ }else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) {
+ //读取模板生成PC和移动优先文件
+ $this->make_mobile_html();
+ } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
+ $update_info_log = $this->update_cache($ic_url);
+ } else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
+ $update_info_log = $this->update_cache($ic_url);
+ } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0 && strcasecmp($site_code, "ah") != 0) { //非cht站点并且非GM并且非AH
+ $update_info_log = $this->update_cache($ic_url);
+ }else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) {
+ $update_info_log = $this->update_cache($ic_url);
+ }
+
+ if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) {
+ $update_info_log = 'not found update info log';
+ }
+
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log);
+ $this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
+ $this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary'));
+
+ //作者个人页面更新
+ if ($this->config->item('site_code') == 'cht') {
+ $author_pages = array(
+ 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/',
+ 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/',
+ 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/',
+ 'PKL' => 'http://www.chinahighlights.com/author/kelly/',
+ '210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/',
+ '202000027' => 'http://www.chinahighlights.com/author/margaux/',
+ '202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/',
+ '210000018' => 'http://www.chinahighlights.com/author/connie/',
+ '210000016' => 'http://www.chinahighlights.com/author/ben/',
+ '200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/',
+ '210000019' => 'http://www.chinahighlights.com/author/oscar/',
+ '210000021' => 'http://www.chinahighlights.com/author/matthew/',
+ '200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/',
+ '202000018' => 'http://www.chinahighlights.com/author/klaus-capra/',
+ '202000017' => 'http://www.chinahighlights.com/author/christy-campbell/'
+ );
+ $key = $this->input->post('ic_author');
+ if (isset($author_pages[$key])) {
+ $this->update_cache($author_pages[$key]);
+ }
+ }
+
+ echo json_encode($data);
+ }
+ }
+
+ //URL不重复检查
+ function ic_url_check()
+ {
+ if ($this->input->post('ignore_url_check')) {
+ return true;
+ }
+
+ $url = $this->input->post('ic_url');
+ if ($url === '') {
+ return true;
+ }
+ $is_id = $this->input->post('is_id');
+ return $this->Information_model->URLcheck($is_id, $url);
+ }
+
+ //URL格式检查,不能包含大小写、空格等特殊字符
+ function ic_url_format($url)
+ {
+ if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) {
+ return false;
+ }
+ return true;
+ }
+
+ function make_mobile_html(){
+ //获取移动优先的模板,如果有的话
+ $mobile_first_template_path='mobile_first/'.$this->config->item('site_code');
+ if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){
+ $mobile_template=$this->load->view($mobile_first_template_path, '', TRUE);
+ }else{
+ return false;
+ }
+ $mobile_template=str_replace('', $this->input->post('ic_seo_title'), $mobile_template);
+ $mobile_template=str_replace('', $this->input->post('ic_seo_description'), $mobile_template);
+ $mobile_template=str_replace('', $this->input->post('ic_seo_keywords'), $mobile_template);
+ $mobile_template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $mobile_template);
+ $mobile_template=str_replace('', $this->input->post('ic_title'), $mobile_template);
+ $mobile_template=str_replace('', $this->input->post('ic_content'), $mobile_template);
+
+ // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
+ $mobile_html=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url');
+ $mobile_html=str_replace("\\", "/", $mobile_html);
+ if(substr($mobile_html, -1, 1)== '/'){
+ $mobile_html=$mobile_html.'index.htm';
+ }
+ $mobile_html.='-mobile.htm';
+ create_folder_by_path(dirname($mobile_html));
+ file_put_contents($mobile_html, $mobile_template, LOCK_EX);
+ }
+
+ //更新静态文件
+ //不用参数提交的原因是可能url带有特殊字符,CI会报错
+ public function update_cache($static_html_url = false, $delete_only = false)
+ {
+ $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url');
+ $url = str_replace($this->config->item('site_url'), '', $url);
+ $original_url = $url; //原始链接
+ $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only');
+
+ switch ($this->config->item('site_code')) {
+ case 'cht':
+ $search_list = $this->Information_model->search_url($url);
+ $amp_request = FALSE;
+ foreach ($search_list as $key => $req_url) {
+ $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS');
+ if ($meta_amp_status) {
+ $amp_request = TRUE;
+ }
+ }
+ if ($amp_request) {
+ $url = 'http://169.54.167.189:22224/ampreq' . $url;
+ } else {
+ $url = 'http://169.54.167.189:22224' . $url;
+ }
+ break;
+ case 'ah':
+ if ($delete_only === true) {
+ $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
+ } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
+ $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
+ }
+ break;
+
+ case 'gm':
+ //GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台
+ //if ($delete_only) {
+ // $url = "http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url);
+ //} else {
+ //先删除再生成,部分页面没有在信息平台中
+ GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url));
+ $url = "http://144.76.185.44:8029/gm.php/information/detail/?static_html_url=" . $url;
+ //}
+ break;
+
+ case 'vac': //国际站
+ case 'vc':
+ case 'it':
+ case 'ru':
+ case 'jp':
+ $information = $this->Information_model->Detail($url);
+ if ($delete_only || !$information || $information->ic_ht_area_type === 'q') {
+ //只删除操作,在url修改和不发布信息的时候使用
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
+ } else {
+ $tmp = $url;
+ //判断是否是更新信息
+ // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
+ if (!empty($information->ic_content)) {
+ $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
+ } else {
+ //先尝试删除静态文件。
+ //$try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
+ //file_get_contents($try_del);
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
+ }
+ if (isset($information->ic_type) && $information->ic_type == 'product') {
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
+ }
+ //int return direct
+ $cache_url = $this->input->post('cache_url');
+ if ($url && !$cache_url) {
+ /*
+ ignore_user_abort(true);
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_TIMEOUT, 1);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容
+ curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD
+ curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
+ curl_setopt($ch, CURLOPT_NOBODY, 1);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+ curl_exec($ch);
+ curl_close($ch);
+ */
+ $data['async_update'] = $url;
+ $data[] = array('name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url);
+ //如果是外部调用就返回结果,内部就不返回了
+ if ($cache_url) {
+ echo json_encode($data);
+ }
+ return $data;
+ }
+ }
+ break;
+
+ case 'ct': //子站点使用
+ $url = 'http://50.97.246.187:22223' . $url;
+ break;
+ case 'sht':
+ case 'gl':
+ case 'mbj':
+ case 'yz':
+ $url = $this->config->item('site_url') . $url . '@cache@refresh';
+ break;
+ default:
+ return false;
+ break;
+ }
+
+ $content = GET_HTTP($url);
+ if ($content === false) {
+ $data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
+ } else {
+ //手动更新的话,接着更新CDN缓存
+ $msg = $this->lang->line('update_cache_success');
+
+ if ($this->input->post('updatecdn') == 1) {
+ $notice = $this->update_cdn();
+ if ($notice == 200) {
+ $msg .= $this->lang->line('update_cdn_success');
+ } else {
+ $msg .= $this->lang->line('update_cdn_failed') . '
' . $notice;
+ }
+ }
+ $data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
+ }
+ //如果是外部调用就返回结果,内部就不返回了
+ if ($this->input->post('cache_url')) {
+ echo json_encode($data);
+ }
+ return $data;
+ }
+
+ //更新CDN缓存
+ public function update_cdn($static_html_url = false)
+ {
+ $flag = false; //false:不更新,true:更新
+ $update_site = array('jp', 'ru'); //需要更新CDN的站点
+ //需要更新的url
+ $url = $static_html_url;
+ if (empty($url))
+ $url = $this->input->post('cache_url');
+
+ //如果传递进来的url是带有域名,则对域名进行判断
+ $tempu = parse_url($url);
+ if (isset($tempu['host'])) {
+ $url = isset($tempu['path']) ? $tempu['path'] : '/';
+ $pad = $tempu['host'];
+ $flag = true;
+ }
+ //如果传递进来的url没有域名,则使用当前站点的信息进行判断
+ else {
+ $url = str_replace($this->config->item('site_url'), '', $url);
+ $pad = str_replace('http://', '', $this->config->item('site_url'));
+ if (in_array($this->config->item('site_code'), $update_site))
+ $flag = TRUE;
+ }
+
+ //默认更新成功,如果不成功,则返回错误提示信息
+ $notice = 200;
+ if ($flag) {
+ $result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json');
+ $result = json_decode($result, true);
+ if ($result['resultCode'] != 200)
+ $notice = $result['notice'] . $result['details'];
+ }
+ return $notice;
+ }
+
+ //获取产品信息,提供给用户选择进行绑定
+ function get_products()
+ {
+ $HT_productType = $this->input->post('product_type');
+ $HT_productName = $this->input->post('product_name');
+ //产品类型
+ switch ($HT_productType) {
+ case 't':
+ $data['productList'] = $this->Landscape_model->search_list($HT_productName);
+ break;
+ default:
+ $data['productList'] = array();
+ break;
+ }
+ $data['product_type'] = $HT_productType;
+ $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true);
+ $data = array();
+ $data[] = array('name' => 'ok', 'value' => $product_list_page);
+ echo json_encode($data);
+ return true;
+ }
+
+ //显示备份的内容
+ function backup_content($log_id)
+ {
+ $data['log_info'] = $this->Logs_model->read($log_id);
+ if($data['log_info']->log_action == 'backup_amp'){
+ $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id,true);
+ }else{
+ $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id);
+ }
+ $this->load->view('bootstrap/header', $data);
+ $this->load->view('bootstrap/information_backup_content');
+ $this->load->view('bootstrap/footer');
+ }
+
+ //保存自定义配置
+ function save_meta()
+ {
+ $im_ic_id = $this->input->post('im_ic_id');
+ $im_key = $this->input->post('im_key');
+ $im_value = $this->input->post('im_value');
+ if ($im_ic_id && $im_key && $im_value !== false) {
+ $meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
+ if ($meta === false) {
+ $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
+ } else {
+ $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
+ }
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success'));
+ } else {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
+ }
+ echo json_encode($data);
+ return true;
+ }
+
+ //保存自定义配置
+ function delete_meta()
+ {
+ $im_ic_id = $this->input->post('im_ic_id');
+ $im_key = $this->input->post('im_key');
+ if ($im_ic_id && $im_key) {
+
+ $this->InfoMetas_model->delete($im_ic_id, $im_key);
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success'));
+ } else {
+ $data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
+ }
+ echo json_encode($data);
+ return true;
+ }
+}
diff --git a/application/libraries/aliyun_log_lib.php b/application/libraries/aliyun_log_lib.php
new file mode 100644
index 00000000..ee543319
--- /dev/null
+++ b/application/libraries/aliyun_log_lib.php
@@ -0,0 +1,9 @@
+'globalhoghlights','ah'=>'asiahighlights');//站点日志存储库,每个网站对应一个
+
+
+ function __construct()
+ {
+ parent::__construct();
+ $this->load->model('wwwlogs_model');
+ $this->load->library('Aliyun_log_lib');
+ $this->Log_Client = new Aliyun_Log_Client($this->endpoint, $this->accessKeyId, $this->accessKey, $this->token);
+ }
+
+ public function index()
+ {
+ $data=array();
+ $orders=$this->wwwlogs_model->get_update_list(10);
+ if($orders){
+ foreach ($orders as $item){
+ $this->orders_view_path($item->COLI_SN,$item->COLI_WebCode,$item->COLI_SenderIP);
+ echo 'COLI_WebCode:'.$item->COLI_WebCode.' COLI_ID:'.$item->COLI_ID.' COLI_SenderIP:'.$item->COLI_SenderIP.'
';
+ }
+ }
+ $this->load->view('welcome');
+ }
+
+ //定时抓取订单日志
+ public function orders_view_path($COLI_SN,$sitecode='cht',$ip,$offset=0){
+ $query_string="
+ * | select time_local,http_referer,request_uri,http_user_agent,http_x_forwarded_for
+ remote_addr,request_method,request_time,status,body_bytes_sent,upstream_response_time,request_body from log where
+ request_uri NOT like '%.jpg'
+ and request_uri NOT like '%.png'
+ and request_uri NOT like '%.gif'
+ and request_uri NOT like '/guide-use.php%'
+ and request_uri NOT like '/index.php%'
+ and request_uri NOT like '/secureforms/form_token'
+ and remote_addr='$ip'
+ ";//ORDER BY time_local ASC 时间精度不够,会导致相同排序错误,只能用系统默认排序
+ /*
+remote_addr :'23.99.99.139'
+AND NOT request_uri :"/secureforms/form_token"
+AND NOT request_uri :".jpg"
+AND NOT request_uri :".png"
+AND NOT request_uri :".gif"
+AND NOT request_uri :"guide-use.php"
+AND NOT request_uri : "/index.php"
+ */
+ $from = time()-604800;//往前 604800(7天), 1296000(15天)
+ $to = time();
+ $request = new Aliyun_Log_Models_GetLogsRequest('globalhoghlights', $this->logstore[$sitecode], $from, $to, '', $query_string, 100, $offset, true);
+ try {
+ $LogData = new StdClass;
+ $LogData->wl_sitecode=$sitecode;
+ $LogData->wl_COLI_SN=$COLI_SN;//订单SN
+ $response = $this->Log_Client->getLogs($request);
+ foreach ($response -> getLogs() as $log) {
+ foreach ($log -> getContents() as $key => $value) {
+ $LogData->$key=$value;
+ }
+ $this->wwwlogs_model->add('wwwlogs',$LogData);
+ }
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+ }
+
+
+ public function getLogs(Aliyun_Log_Client $client, $project, $logstore)
+ {
+ $topic = '';
+ $from = time()-604800;//往前7天
+ $to = time();
+ $request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, "", 100, 0, false);
+
+ try {
+ $response = $client->getLogs($request);
+ foreach ($response -> getLogs() as $log) {
+ print $log -> getTime()."\t";
+ foreach ($log -> getContents() as $key => $value) {
+ print $key.":".$value."\t";
+ }
+ print "\n";
+ }
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+ }
+}
diff --git a/application/third_party/wwwlog/models/wwwlogs_model.php b/application/third_party/wwwlog/models/wwwlogs_model.php
new file mode 100644
index 00000000..14309ecd
--- /dev/null
+++ b/application/third_party/wwwlog/models/wwwlogs_model.php
@@ -0,0 +1,80 @@
+HT = $this->load->database('HT', TRUE);
+ $this->INFO = $this->load->database('INFO', TRUE);
+ }
+
+ public function init() {
+ $this->topnum = false;
+ $this->where = false;
+ $this->orderby = ' order by COLI_ApplyDate desc ';
+ }
+
+ public function detail($psd_URL, $psd_SiteCode) {
+ $this->init();
+ $this->topnum = 1;
+ $this->where = ' AND psd.psd_URL=N' . $this->INFO->escape($psd_URL);
+ $this->where .= ' AND psd.psd_SiteCode=' . $this->INFO->escape($psd_SiteCode);
+ return $this->get_list();
+ }
+
+ public function add($table, $data) {
+ if ($this->INFO->insert($table, $data)) {
+ return $this->INFO->last_id($table);
+ } else {
+ return false;
+ }
+ }
+
+ public function get_update_list($topnum = 10) {
+ $this->init();
+ $this->topnum = $topnum;
+ return $this->get_list();
+ }
+
+ public function update($table, $data, $where) {
+ $this->INFO->update($table, $data, $where);
+ }
+
+ //删除数据
+ // public function delete($psd_id) {
+ // $sql = " DELETE FROM PageSpeedData WHERE psd_id=? ";
+ // return $this->INFO->query($sql, array($psd_id));
+ // }
+
+ public function get_list() {
+ $this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
+ $sql .= "
+ COLI_SN,COLI_ID, COLI_WebCode,COLI_Name, COLI_OrderDetailText, COLI_OrderStartDate,COLI_SenderIP,COLI_WebCode,COLI_ApplyDate from ConfirmLineInfo
+ where 1=1
+ and COLI_WebCode in ('cht','ah')
+ and not exists (select top 1 1 from InfoManager.dbo.wwwlogs where wl_COLI_SN=COLI_SN )
+ and COLI_SenderIP is not null
+ and DeleteFlag=0
+ and COLI_ApplyDate>=DATEADD(day,-7,GETDATE())
+ ";
+ $this->where ? $sql.=$this->where : false;
+ $this->orderby ? $sql.=$this->orderby : false;
+ $query = $this->HT->query($sql);
+ //print_r($this->INFO->queries);
+ if ($this->topnum === 1) {
+ if ($query->num_rows() > 0) {
+ $row = $query->row();
+ return $row;
+ } else {
+ return FALSE;
+ }
+ } else {
+ return $query->result();
+ }
+ }
+
+}
diff --git a/application/third_party/wwwlog/views/welcome.php b/application/third_party/wwwlog/views/welcome.php
new file mode 100644
index 00000000..5f1923bb
--- /dev/null
+++ b/application/third_party/wwwlog/views/welcome.php
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+ www log
+
+
+
+ WWW log
+
+
+
+
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Client.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Client.php
new file mode 100644
index 00000000..72f5a30e
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Client.php
@@ -0,0 +1,1081 @@
+setEndpoint ( $endpoint ); // set $this->logHost
+ $this->accessKeyId = $accessKeyId;
+ $this->accessKey = $accessKey;
+ $this->stsToken = $token;
+ $this->source = Aliyun_Log_Util::getLocalIp();
+ }
+ private function setEndpoint($endpoint) {
+ $pos = strpos ( $endpoint, "://" );
+ if ($pos !== false) { // be careful, !==
+ $pos += 3;
+ $endpoint = substr ( $endpoint, $pos );
+ }
+ $pos = strpos ( $endpoint, "/" );
+ if ($pos !== false) // be careful, !==
+ $endpoint = substr ( $endpoint, 0, $pos );
+ $pos = strpos ( $endpoint, ':' );
+ if ($pos !== false) { // be careful, !==
+ $this->port = ( int ) substr ( $endpoint, $pos + 1 );
+ $endpoint = substr ( $endpoint, 0, $pos );
+ } else
+ $this->port = 80;
+ $this->isRowIp = Aliyun_Log_Util::isIp ( $endpoint );
+ $this->logHost = $endpoint;
+ $this->endpoint = $endpoint . ':' . ( string ) $this->port;
+ }
+
+ /**
+ * GMT format time string.
+ *
+ * @return string
+ */
+ protected function getGMT() {
+ return gmdate ( 'D, d M Y H:i:s' ) . ' GMT';
+ }
+
+
+ /**
+ * Decodes a JSON string to a JSON Object.
+ * Unsuccessful decode will cause an Aliyun_Log_Exception.
+ *
+ * @return string
+ * @throws Aliyun_Log_Exception
+ */
+ protected function parseToJson($resBody, $requestId) {
+ if (! $resBody)
+ return NULL;
+
+ $result = json_decode ( $resBody, true );
+ if ($result === NULL){
+ throw new Aliyun_Log_Exception ( 'BadResponse', "Bad format,not json: $resBody", $requestId );
+ }
+ return $result;
+ }
+
+ /**
+ * @return array
+ */
+ protected function getHttpResponse($method, $url, $body, $headers) {
+ $request = new RequestCore ( $url );
+ foreach ( $headers as $key => $value )
+ $request->add_header ( $key, $value );
+ $request->set_method ( $method );
+ $request->set_useragent(USER_AGENT);
+ if ($method == "POST" || $method == "PUT")
+ $request->set_body ( $body );
+ $request->send_request ();
+ $response = array ();
+ $response [] = ( int ) $request->get_response_code ();
+ $response [] = $request->get_response_header ();
+ $response [] = $request->get_response_body ();
+ return $response;
+ }
+
+ /**
+ * @return array
+ * @throws Aliyun_Log_Exception
+ */
+ private function sendRequest($method, $url, $body, $headers) {
+ try {
+ list ( $responseCode, $header, $resBody ) =
+ $this->getHttpResponse ( $method, $url, $body, $headers );
+ } catch ( Exception $ex ) {
+ throw new Aliyun_Log_Exception ( $ex->getMessage (), $ex->__toString () );
+ }
+
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+
+ if ($responseCode == 200) {
+ return array ($resBody,$header);
+ }
+ else {
+ $exJson = $this->parseToJson ( $resBody, $requestId );
+ if (isset($exJson ['error_code']) && isset($exJson ['error_message'])) {
+ throw new Aliyun_Log_Exception ( $exJson ['error_code'],
+ $exJson ['error_message'], $requestId );
+ } else {
+ if ($exJson) {
+ $exJson = ' The return json is ' . json_encode($exJson);
+ } else {
+ $exJson = '';
+ }
+ throw new Aliyun_Log_Exception ( 'RequestError',
+ "Request is failed. Http code is $responseCode.$exJson", $requestId );
+ }
+ }
+ }
+
+ /**
+ * @return array
+ * @throws Aliyun_Log_Exception
+ */
+ private function send($method, $project, $body, $resource, $params, $headers) {
+ if ($body) {
+ $headers ['Content-Length'] = strlen ( $body );
+ if(isset($headers ["x-log-bodyrawsize"])==false)
+ $headers ["x-log-bodyrawsize"] = 0;
+ $headers ['Content-MD5'] = Aliyun_Log_Util::calMD5 ( $body );
+ } else {
+ $headers ['Content-Length'] = 0;
+ $headers ["x-log-bodyrawsize"] = 0;
+ $headers ['Content-Type'] = ''; // If not set, http request will add automatically.
+ }
+
+ $headers ['x-log-apiversion'] = API_VERSION;
+ $headers ['x-log-signaturemethod'] = 'hmac-sha1';
+ if(strlen($this->stsToken) >0)
+ $headers ['x-acs-security-token'] = $this -> stsToken;
+ if(is_null($project))$headers ['Host'] = $this->logHost;
+ else $headers ['Host'] = "$project.$this->logHost";
+ $headers ['Date'] = $this->GetGMT ();
+ $signature = Aliyun_Log_Util::getRequestAuthorization ( $method, $resource, $this->accessKey,$this->stsToken, $params, $headers );
+ $headers ['Authorization'] = "LOG $this->accessKeyId:$signature";
+
+ $url = $resource;
+ if ($params)
+ $url .= '?' . Aliyun_Log_Util::urlEncode ( $params );
+ if ($this->isRowIp)
+ $url = "http://$this->endpoint$url";
+ else{
+ if(is_null($project))
+ $url = "http://$this->endpoint$url";
+ else $url = "http://$project.$this->endpoint$url";
+ }
+ return $this->sendRequest ( $method, $url, $body, $headers );
+ }
+
+ /**
+ * Put logs to Log Service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_PutLogsRequest $request the PutLogs request parameters class
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_PutLogsResponse
+ */
+ public function putLogs(Aliyun_Log_Models_PutLogsRequest $request) {
+ if (count ( $request->getLogitems () ) > 4096)
+ throw new Aliyun_Log_Exception ( 'InvalidLogSize', "logItems' length exceeds maximum limitation: 4096 lines." );
+
+ $logGroup = new LogGroup ();
+ $topic = $request->getTopic () !== null ? $request->getTopic () : '';
+ $logGroup->setTopic ( $request->getTopic () );
+ $source = $request->getSource ();
+
+ if ( ! $source )
+ $source = $this->source;
+ $logGroup->setSource ( $source );
+ $logitems = $request->getLogitems ();
+ foreach ( $logitems as $logItem ) {
+ $log = new Log ();
+ $log->setTime ( $logItem->getTime () );
+ $content = $logItem->getContents ();
+ foreach ( $content as $key => $value ) {
+ $content = new Log_Content ();
+ $content->setKey ( $key );
+ $content->setValue ( $value );
+ $log->addContents ( $content );
+ }
+
+ $logGroup->addLogs ( $log );
+ }
+
+ $body = Aliyun_Log_Util::toBytes( $logGroup );
+ unset ( $logGroup );
+
+ $bodySize = strlen ( $body );
+ if ($bodySize > 3 * 1024 * 1024) // 3 MB
+ throw new Aliyun_Log_Exception ( 'InvalidLogSize', "logItems' size exceeds maximum limitation: 3 MB." );
+ $params = array ();
+ $headers = array ();
+ $headers ["x-log-bodyrawsize"] = $bodySize;
+ $headers ['x-log-compresstype'] = 'deflate';
+ $headers ['Content-Type'] = 'application/x-protobuf';
+ $body = gzcompress ( $body, 6 );
+
+ $logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $shardKey = $request -> getShardKey();
+ $resource = "/logstores/" . $logstore.($shardKey== null?"/shards/lb":"/shards/route");
+ if($shardKey)
+ $params["key"]=$shardKey;
+ list ( $resp, $header ) = $this->send ( "POST", $project, $body, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_PutLogsResponse ( $header );
+ }
+
+ /**
+ * create shipper service
+ * @param Aliyun_Log_Models_CreateShipperRequest $request
+ * return Aliyun_Log_Models_CreateShipperResponse
+ */
+ public function createShipper(Aliyun_Log_Models_CreateShipperRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper";
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["Content-Type"] = "application/json";
+
+ $body = array(
+ "shipperName" => $request->getShipperName(),
+ "targetType" => $request->getTargetType(),
+ "targetConfiguration" => $request->getTargetConfigration()
+ );
+ $body_str = json_encode($body);
+ $headers["x-log-bodyrawsize"] = strlen($body_str);
+ list($resp, $header) = $this->send("POST", $project,$body_str,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_CreateShipperResponse($resp, $header);
+ }
+
+ /**
+ * create shipper service
+ * @param Aliyun_Log_Models_UpdateShipperRequest $request
+ * return Aliyun_Log_Models_UpdateShipperResponse
+ */
+ public function updateShipper(Aliyun_Log_Models_UpdateShipperRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["Content-Type"] = "application/json";
+
+ $body = array(
+ "shipperName" => $request->getShipperName(),
+ "targetType" => $request->getTargetType(),
+ "targetConfiguration" => $request->getTargetConfigration()
+ );
+ $body_str = json_encode($body);
+ $headers["x-log-bodyrawsize"] = strlen($body_str);
+ list($resp, $header) = $this->send("PUT", $project,$body_str,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_UpdateShipperResponse($resp, $header);
+ }
+
+ /**
+ * get shipper tasks list, max 48 hours duration supported
+ * @param Aliyun_Log_Models_GetShipperTasksRequest $request
+ * return Aliyun_Log_Models_GetShipperTasksResponse
+ */
+ public function getShipperTasks(Aliyun_Log_Models_GetShipperTasksRequest $request){
+ $headers = array();
+ $params = array(
+ 'from' => $request->getStartTime(),
+ 'to' => $request->getEndTime(),
+ 'status' => $request->getStatusType(),
+ 'offset' => $request->getOffset(),
+ 'size' => $request->getSize()
+ );
+ $resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName()."/tasks";
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["x-log-bodyrawsize"] = 0;
+ $headers["Content-Type"] = "application/json";
+
+ list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_GetShipperTasksResponse($resp, $header);
+ }
+
+ /**
+ * retry shipper tasks list by task ids
+ * @param Aliyun_Log_Models_RetryShipperTasksRequest $request
+ * return Aliyun_Log_Models_RetryShipperTasksResponse
+ */
+ public function retryShipperTasks(Aliyun_Log_Models_RetryShipperTasksRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName()."/tasks";
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+
+ $headers["Content-Type"] = "application/json";
+ $body = $request->getTaskLists();
+ $body_str = json_encode($body);
+ $headers["x-log-bodyrawsize"] = strlen($body_str);
+ list($resp, $header) = $this->send("PUT", $project,$body_str,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_RetryShipperTasksResponse($resp, $header);
+ }
+
+ /**
+ * delete shipper service
+ * @param Aliyun_Log_Models_DeleteShipperRequest $request
+ * return Aliyun_Log_Models_DeleteShipperResponse
+ */
+ public function deleteShipper(Aliyun_Log_Models_DeleteShipperRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["x-log-bodyrawsize"] = 0;
+ $headers["Content-Type"] = "application/json";
+
+ list($resp, $header) = $this->send("DELETE", $project,null,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_DeleteShipperResponse($resp, $header);
+ }
+
+ /**
+ * get shipper config service
+ * @param Aliyun_Log_Models_GetShipperConfigRequest $request
+ * return Aliyun_Log_Models_GetShipperConfigResponse
+ */
+ public function getShipperConfig(Aliyun_Log_Models_GetShipperConfigRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["x-log-bodyrawsize"] = 0;
+ $headers["Content-Type"] = "application/json";
+
+ list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_GetShipperConfigResponse($resp, $header);
+ }
+
+ /**
+ * list shipper service
+ * @param Aliyun_Log_Models_ListShipperRequest $request
+ * return Aliyun_Log_Models_ListShipperResponse
+ */
+ public function listShipper(Aliyun_Log_Models_ListShipperRequest $request){
+ $headers = array();
+ $params = array();
+ $resource = "/logstores/".$request->getLogStore()."/shipper";
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["x-log-bodyrawsize"] = 0;
+ $headers["Content-Type"] = "application/json";
+
+ list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
+ $requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson($resp, $requestId);
+ return new Aliyun_Log_Models_ListShipperResponse($resp, $header);
+ }
+
+ /**
+ * create logstore
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_CreateLogstoreRequest $request the CreateLogStore request parameters class.
+ * @throws Aliyun_Log_Exception
+ * return Aliyun_Log_Models_CreateLogstoreResponse
+ */
+ public function createLogstore(Aliyun_Log_Models_CreateLogstoreRequest $request){
+ $headers = array ();
+ $params = array ();
+ $resource = '/logstores';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["x-log-bodyrawsize"] = 0;
+ $headers["Content-Type"] = "application/json";
+ $body = array(
+ "logstoreName" => $request -> getLogstore(),
+ "ttl" => (int)($request -> getTtl()),
+ "shardCount" => (int)($request -> getShardCount())
+ );
+ $body_str = json_encode($body);
+ $headers["x-log-bodyrawsize"] = strlen($body_str);
+ list($resp,$header) = $this -> send("POST",$project,$body_str,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_CreateLogstoreResponse($resp,$header);
+ }
+ /**
+ * update logstore
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_UpdateLogstoreRequest $request the UpdateLogStore request parameters class.
+ * @throws Aliyun_Log_Exception
+ * return Aliyun_Log_Models_UpdateLogstoreResponse
+ */
+ public function updateLogstore(Aliyun_Log_Models_UpdateLogstoreRequest $request){
+ $headers = array ();
+ $params = array ();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $headers["Content-Type"] = "application/json";
+ $body = array(
+ "logstoreName" => $request -> getLogstore(),
+ "ttl" => (int)($request -> getTtl()),
+ "shardCount" => (int)($request -> getShardCount())
+ );
+ $resource = '/logstores/'.$request -> getLogstore();
+ $body_str = json_encode($body);
+ $headers["x-log-bodyrawsize"] = strlen($body_str);
+ list($resp,$header) = $this -> send("PUT",$project,$body_str,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_UpdateLogstoreResponse($resp,$header);
+ }
+ /**
+ * List all logstores of requested project.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_ListLogstoresRequest $request the ListLogstores request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListLogstoresResponse
+ */
+ public function listLogstores(Aliyun_Log_Models_ListLogstoresRequest $request) {
+ $headers = array ();
+ $params = array ();
+ $resource = '/logstores';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListLogstoresResponse ( $resp, $header );
+ }
+
+ /**
+ * Delete logstore
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_DeleteLogstoreRequest $request the DeleteLogstores request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_DeleteLogstoresResponse
+ */
+ public function deleteLogstore(Aliyun_Log_Models_DeleteLogstoreRequest $request) {
+ $headers = array ();
+ $params = array ();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $logstore = $request -> getLogstore() != null ? $request -> getLogstore() :"";
+ $resource = "/logstores/$logstore";
+ list ( $resp, $header ) = $this->send ( "DELETE", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_DeleteLogstoreResponse ( $resp, $header );
+ }
+
+ /**
+ * List all topics in a logstore.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_ListTopicsRequest $request the ListTopics request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListTopicsResponse
+ */
+ public function listTopics(Aliyun_Log_Models_ListTopicsRequest $request) {
+ $headers = array ();
+ $params = array ();
+ if ($request->getToken () !== null)
+ $params ['token'] = $request->getToken ();
+ if ($request->getLine () !== null)
+ $params ['line'] = $request->getLine ();
+ $params ['type'] = 'topic';
+ $logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $resource = "/logstores/$logstore";
+ list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListTopicsResponse ( $resp, $header );
+ }
+
+ /**
+ * Get histograms of requested query from log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetHistogramsRequest $request the GetHistograms request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return array(json body, http header)
+ */
+ public function getHistogramsJson(Aliyun_Log_Models_GetHistogramsRequest $request) {
+ $headers = array ();
+ $params = array ();
+ if ($request->getTopic () !== null)
+ $params ['topic'] = $request->getTopic ();
+ if ($request->getFrom () !== null)
+ $params ['from'] = $request->getFrom ();
+ if ($request->getTo () !== null)
+ $params ['to'] = $request->getTo ();
+ if ($request->getQuery () !== null)
+ $params ['query'] = $request->getQuery ();
+ $params ['type'] = 'histogram';
+ $logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $resource = "/logstores/$logstore";
+ list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return array($resp, $header);
+ }
+
+ /**
+ * Get histograms of requested query from log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetHistogramsRequest $request the GetHistograms request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_GetHistogramsResponse
+ */
+ public function getHistograms(Aliyun_Log_Models_GetHistogramsRequest $request) {
+ $ret = $this->getHistogramsJson($request);
+ $resp = $ret[0];
+ $header = $ret[1];
+ return new Aliyun_Log_Models_GetHistogramsResponse ( $resp, $header );
+ }
+
+ /**
+ * Get logs from Log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetLogsRequest $request the GetLogs request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return array(json body, http header)
+ */
+ public function getLogsJson(Aliyun_Log_Models_GetLogsRequest $request) {
+ $headers = array ();
+ $params = array ();
+ if ($request->getTopic () !== null)
+ $params ['topic'] = $request->getTopic ();
+ if ($request->getFrom () !== null)
+ $params ['from'] = $request->getFrom ();
+ if ($request->getTo () !== null)
+ $params ['to'] = $request->getTo ();
+ if ($request->getQuery () !== null)
+ $params ['query'] = $request->getQuery ();
+ $params ['type'] = 'log';
+ if ($request->getLine () !== null)
+ $params ['line'] = $request->getLine ();
+ if ($request->getOffset () !== null)
+ $params ['offset'] = $request->getOffset ();
+ if ($request->getOffset () !== null)
+ $params ['reverse'] = $request->getReverse () ? 'true' : 'false';
+ $logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $resource = "/logstores/$logstore";
+ list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return array($resp, $header);
+ //return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
+ }
+
+ /**
+ * Get logs from Log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetLogsRequest $request the GetLogs request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_GetLogsResponse
+ */
+ public function getLogs(Aliyun_Log_Models_GetLogsRequest $request) {
+ $ret = $this->getLogsJson($request);
+ $resp = $ret[0];
+ $header = $ret[1];
+ return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
+ }
+
+ /**
+ * Get logs from Log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetProjectLogsRequest $request the GetLogs request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return array(json body, http header)
+ */
+ public function getProjectLogsJson(Aliyun_Log_Models_GetProjectLogsRequest $request) {
+ $headers = array ();
+ $params = array ();
+ if ($request->getQuery () !== null)
+ $params ['query'] = $request->getQuery ();
+ $project = $request->getProject () !== null ? $request->getProject () : '';
+ $resource = "/logs";
+ list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return array($resp, $header);
+ //return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
+ }
+ /**
+ * Get logs from Log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetProjectLogsRequest $request the GetLogs request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_GetLogsResponse
+ */
+ public function getProjectLogs(Aliyun_Log_Models_GetProjectLogsRequest $request) {
+ $ret = $this->getProjectLogsJson($request);
+ $resp = $ret[0];
+ $header = $ret[1];
+ return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
+ }
+
+ /**
+ * Get logs from Log service with shardid conditions.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_BatchGetLogsRequest $request the BatchGetLogs request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_BatchGetLogsResponse
+ */
+ public function batchGetLogs(Aliyun_Log_Models_BatchGetLogsRequest $request) {
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+ $shardId = $request->getShardId()!==null?$request->getShardId():'';
+ if($request->getCount()!==null)
+ $params['count']=$request->getCount();
+ if($request->getCursor()!==null)
+ $params['cursor']=$request->getCursor();
+ if($request->getEndCursor()!==null)
+ $params['end_cursor']=$request->getEndCursor();
+ $params['type']='log';
+ $headers['Accept-Encoding']='gzip';
+ $headers['accept']='application/x-protobuf';
+
+ $resource = "/logstores/$logstore/shards/$shardId";
+ list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
+ //$resp is a byteArray
+ $resp = gzuncompress($resp);
+ if($resp===false)$resp = new LogGroupList();
+
+ else {
+ $resp = new LogGroupList($resp);
+ }
+ return new Aliyun_Log_Models_BatchGetLogsResponse ( $resp, $header );
+ }
+
+ /**
+ * List Shards from Log service with Project and logstore conditions.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_ListShardsRequest $request the ListShards request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListShardsResponse
+ */
+ public function listShards(Aliyun_Log_Models_ListShardsRequest $request) {
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+
+ $resource='/logstores/'.$logstore.'/shards';
+ list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
+ }
+
+ /**
+ * split a shard into two shards with Project and logstore and shardId and midHash conditions.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_SplitShardRequest $request the SplitShard request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListShardsResponse
+ */
+ public function splitShard(Aliyun_Log_Models_SplitShardRequest $request) {
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+ $shardId = $request -> getShardId()!== null ? $request -> getShardId():-1;
+ $midHash = $request -> getMidHash()!= null?$request -> getMidHash():"";
+
+ $resource='/logstores/'.$logstore.'/shards/'.$shardId;
+ $params["action"] = "split";
+ $params["key"] = $midHash;
+ list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
+ }
+ /**
+ * merge two shards into one shard with Project and logstore and shardId and conditions.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_MergeShardsRequest $request the MergeShards request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListShardsResponse
+ */
+ public function MergeShards(Aliyun_Log_Models_MergeShardsRequest $request) {
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+ $shardId = $request -> getShardId()!= null ? $request -> getShardId():-1;
+
+ $resource='/logstores/'.$logstore.'/shards/'.$shardId;
+ $params["action"] = "merge";
+ list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
+ }
+ /**
+ * delete a read only shard with Project and logstore and shardId conditions.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_DeleteShardRequest $request the DeleteShard request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_ListShardsResponse
+ */
+ public function DeleteShard(Aliyun_Log_Models_DeleteShardRequest $request) {
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+ $shardId = $request -> getShardId()!= null ? $request -> getShardId():-1;
+
+ $resource='/logstores/'.$logstore.'/shards/'.$shardId;
+ list($resp,$header) = $this->send("DELETE",$project,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ return new Aliyun_Log_Models_DeleteShardResponse ( $header );
+ }
+
+ /**
+ * Get cursor from Log service.
+ * Unsuccessful opertaion will cause an Aliyun_Log_Exception.
+ *
+ * @param Aliyun_Log_Models_GetCursorRequest $request the GetCursor request parameters class.
+ * @throws Aliyun_Log_Exception
+ * @return Aliyun_Log_Models_GetCursorResponse
+ */
+ public function getCursor(Aliyun_Log_Models_GetCursorRequest $request){
+ $params = array();
+ $headers = array();
+ $project = $request->getProject()!==null?$request->getProject():'';
+ $logstore = $request->getLogstore()!==null?$request->getLogstore():'';
+ $shardId = $request->getShardId()!==null?$request->getShardId():'';
+ $mode = $request->getMode()!==null?$request->getMode():'';
+ $fromTime = $request->getFromTime()!==null?$request->getFromTime():-1;
+
+ if((empty($mode) xor $fromTime==-1)==false){
+ if(!empty($mode))
+ throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode and fromTime can not be not empty simultaneously");
+ else
+ throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode and fromTime can not be empty simultaneously");
+ }
+ if(!empty($mode) && strcmp($mode,'begin')!==0 && strcmp($mode,'end')!==0)
+ throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode value invalid:$mode");
+ if($fromTime!==-1 && (is_integer($fromTime)==false || $fromTime<0))
+ throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. FromTime value invalid:$fromTime");
+ $params['type']='cursor';
+ if($fromTime!==-1)$params['from']=$fromTime;
+ else $params['mode'] = $mode;
+ $resource='/logstores/'.$logstore.'/shards/'.$shardId;
+ list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_GetCursorResponse($resp,$header);
+ }
+
+ public function createConfig(Aliyun_Log_Models_CreateConfigRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ if($request->getConfig()!==null){
+ $body = json_encode($request->getConfig()->toArray());
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/configs';
+ list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
+ return new Aliyun_Log_Models_CreateConfigResponse($header);
+ }
+
+ public function updateConfig(Aliyun_Log_Models_UpdateConfigRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ $configName='';
+ if($request->getConfig()!==null){
+ $body = json_encode($request->getConfig()->toArray());
+ $configName=($request->getConfig()->getConfigName()!==null)?$request->getConfig()->getConfigName():'';
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/configs/'.$configName;
+ list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
+ return new Aliyun_Log_Models_UpdateConfigResponse($header);
+ }
+
+ public function getConfig(Aliyun_Log_Models_GetConfigRequest $request){
+ $params = array();
+ $headers = array();
+
+ $configName = ($request->getConfigName()!==null)?$request->getConfigName():'';
+
+ $resource = '/configs/'.$configName;
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_GetConfigResponse($resp,$header);
+ }
+
+ public function deleteConfig(Aliyun_Log_Models_DeleteConfigRequest $request){
+ $params = array();
+ $headers = array();
+ $configName = ($request->getConfigName()!==null)?$request->getConfigName():'';
+ $resource = '/configs/'.$configName;
+ list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
+ return new Aliyun_Log_Models_DeleteConfigResponse($header);
+ }
+
+ public function listConfigs(Aliyun_Log_Models_ListConfigsRequest $request){
+ $params = array();
+ $headers = array();
+
+ if($request->getConfigName()!==null)$params['configName'] = $request->getConfigName();
+ if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
+ if($request->getSize()!==null)$params['size'] = $request->getSize();
+
+ $resource = '/configs';
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListConfigsResponse($resp,$header);
+ }
+
+ public function createMachineGroup(Aliyun_Log_Models_CreateMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ if($request->getMachineGroup()!==null){
+ $body = json_encode($request->getMachineGroup()->toArray());
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/machinegroups';
+ list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
+
+ return new Aliyun_Log_Models_CreateMachineGroupResponse($header);
+ }
+
+ public function updateMachineGroup(Aliyun_Log_Models_UpdateMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ $groupName='';
+ if($request->getMachineGroup()!==null){
+ $body = json_encode($request->getMachineGroup()->toArray());
+ $groupName=($request->getMachineGroup()->getGroupName()!==null)?$request->getMachineGroup()->getGroupName():'';
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/machinegroups/'.$groupName;
+ list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
+ return new Aliyun_Log_Models_UpdateMachineGroupResponse($header);
+ }
+
+ public function getMachineGroup(Aliyun_Log_Models_GetMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+
+ $groupName = ($request->getGroupName()!==null)?$request->getGroupName():'';
+
+ $resource = '/machinegroups/'.$groupName;
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_GetMachineGroupResponse($resp,$header);
+ }
+
+ public function deleteMachineGroup(Aliyun_Log_Models_DeleteMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+
+ $groupName = ($request->getGroupName()!==null)?$request->getGroupName():'';
+ $resource = '/machinegroups/'.$groupName;
+ list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
+ return new Aliyun_Log_Models_DeleteMachineGroupResponse($header);
+ }
+
+ public function listMachineGroups(Aliyun_Log_Models_ListMachineGroupsRequest $request){
+ $params = array();
+ $headers = array();
+
+ if($request->getGroupName()!==null)$params['groupName'] = $request->getGroupName();
+ if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
+ if($request->getSize()!==null)$params['size'] = $request->getSize();
+
+ $resource = '/machinegroups';
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+
+ return new Aliyun_Log_Models_ListMachineGroupsResponse($resp,$header);
+ }
+
+ public function applyConfigToMachineGroup(Aliyun_Log_Models_ApplyConfigToMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+ $configName=$request->getConfigName();
+ $groupName=$request->getGroupName();
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/machinegroups/'.$groupName.'/configs/'.$configName;
+ list($resp,$header) = $this->send("PUT",NULL,NULL,$resource,$params,$headers);
+ return new Aliyun_Log_Models_ApplyConfigToMachineGroupResponse($header);
+ }
+
+ public function removeConfigFromMachineGroup(Aliyun_Log_Models_RemoveConfigFromMachineGroupRequest $request){
+ $params = array();
+ $headers = array();
+ $configName=$request->getConfigName();
+ $groupName=$request->getGroupName();
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/machinegroups/'.$groupName.'/configs/'.$configName;
+ list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
+ return new Aliyun_Log_Models_RemoveConfigFromMachineGroupResponse($header);
+ }
+
+ public function getMachine(Aliyun_Log_Models_GetMachineRequest $request){
+ $params = array();
+ $headers = array();
+
+ $uuid = ($request->getUuid()!==null)?$request->getUuid():'';
+
+ $resource = '/machines/'.$uuid;
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_GetMachineResponse($resp,$header);
+ }
+
+ public function createACL(Aliyun_Log_Models_CreateACLRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ if($request->getAcl()!==null){
+ $body = json_encode($request->getAcl()->toArray());
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/acls';
+ list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_CreateACLResponse($resp,$header);
+ }
+
+ public function updateACL(Aliyun_Log_Models_UpdateACLRequest $request){
+ $params = array();
+ $headers = array();
+ $body=null;
+ $aclId='';
+ if($request->getAcl()!==null){
+ $body = json_encode($request->getAcl()->toArray());
+ $aclId=($request->getAcl()->getAclId()!==null)?$request->getAcl()->getAclId():'';
+ }
+ $headers ['Content-Type'] = 'application/json';
+ $resource = '/acls/'.$aclId;
+ list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
+ return new Aliyun_Log_Models_UpdateACLResponse($header);
+ }
+
+ public function getACL(Aliyun_Log_Models_GetACLRequest $request){
+ $params = array();
+ $headers = array();
+
+ $aclId = ($request->getAclId()!==null)?$request->getAclId():'';
+
+ $resource = '/acls/'.$aclId;
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+
+ return new Aliyun_Log_Models_GetACLResponse($resp,$header);
+ }
+
+ public function deleteACL(Aliyun_Log_Models_DeleteACLRequest $request){
+ $params = array();
+ $headers = array();
+ $aclId = ($request->getAclId()!==null)?$request->getAclId():'';
+ $resource = '/acls/'.$aclId;
+ list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
+ return new Aliyun_Log_Models_DeleteACLResponse($header);
+ }
+
+ public function listACLs(Aliyun_Log_Models_ListACLsRequest $request){
+ $params = array();
+ $headers = array();
+ if($request->getPrincipleId()!==null)$params['principleId'] = $request->getPrincipleId();
+ if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
+ if($request->getSize()!==null)$params['size'] = $request->getSize();
+
+ $resource = '/acls';
+ list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
+ $requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
+ $resp = $this->parseToJson ( $resp, $requestId );
+ return new Aliyun_Log_Models_ListACLsResponse($resp,$header);
+ }
+
+}
+
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Exception.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Exception.php
new file mode 100644
index 00000000..b1ac87e4
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Exception.php
@@ -0,0 +1,72 @@
+code = $code;
+ $this->message = $message;
+ $this->requestId = $requestId;
+ }
+
+ /**
+ * The __toString() method allows a class to decide how it will react when
+ * it is treated like a string.
+ *
+ * @return string
+ */
+ public function __toString() {
+ return "Aliyun_Log_Exception: \n{\n ErrorCode: $this->code,\n ErrorMessage: $this->message\n RequestId: $this->requestId\n}\n";
+ }
+
+ /**
+ * Get Aliyun_Log_Exception error code.
+ *
+ * @return string
+ */
+ public function getErrorCode() {
+ return $this->code;
+ }
+
+ /**
+ * Get Aliyun_Log_Exception error message.
+ *
+ * @return string
+ */
+ public function getErrorMessage() {
+ return $this->message;
+ }
+
+ /**
+ * Get log service sever requestid, '' is set if client or Http error.
+ *
+ * @return string
+ */
+ public function getRequestId() {
+ return $this->requestId;
+ }
+}
+
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/LoggerFactory.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/LoggerFactory.php
new file mode 100644
index 00000000..4a918def
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/LoggerFactory.php
@@ -0,0 +1,69 @@
+logFlush();
+ }
+ }
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/ACL.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/ACL.php
new file mode 100644
index 00000000..5b1169ee
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/ACL.php
@@ -0,0 +1,110 @@
+principleType = $principleType;
+ $this->principleId = $principleId;
+ $this->object = $object;
+ $this->privilege = $privilege;
+ $this->aclId = $aclId;
+
+ $this->createTime = $createTime;
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function getPrincipleType(){
+ return $this->principleType;
+ }
+ public function setPrincipleType($principleType){
+ $this->principleType = $principleType;
+ }
+
+ public function getPrincipleId(){
+ return $this->principleId;
+ }
+ public function setPrincipleId($principleId){
+ $this->principleId = $principleId;
+ }
+
+ public function getObject(){
+ return $this->object;
+ }
+ public function setObject($object){
+ $this->object = $object;
+ }
+ public function getPrivilege(){
+ return $this->privilege;
+ }
+ public function setPrivilege($privilege){
+ $this->privilege = $privilege;
+ }
+ public function getAclId(){
+ return $this->aclId;
+ }
+ public function setAclId($aclId){
+ $this->aclId = $aclId;
+ }
+ public function getCreateTime(){
+ return $this->createTime;
+ }
+ public function setCreateTime($createTime){
+ $this->createTime = $createTime;
+ }
+ public function getLastModifyTime(){
+ return $this->lastModifyTime;
+ }
+ public function setLastModifyTime($lastModifyTime){
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function toArray(){
+ $format_array = array();
+ if($this->principleType!==null)
+ $format_array['principleType'] = $this->principleType;
+ if($this->principleId!==null)
+ $format_array['principleId'] = $this->principleId;
+ if($this->object!==null)
+ $format_array['object'] = $this->object;
+ if($this->privilege!==null)
+ $format_array['privilege'] = $this->privilege;
+ if($this->aclId!==null)
+ $format_array['aclId'] = $this->aclId;
+ if($this->createTime!==null)
+ $format_array['createTime'] = $this->createTime;
+ if($this->lastModifyTime!==null)
+ $format_array['lastModifyTime'] = $this->lastModifyTime;
+ return $format_array;
+ }
+
+ public function setFromArray($resp){
+ $principleType = ($resp['principleType']!==null)?$resp['principleType']:null;
+ $principleId = ($resp['principleId']!==null)?$resp['principleId']:null;
+ $object = ($resp['object']!==null)?$resp['object']:null;
+ $privilege = ($resp['privilege']!==null)?$resp['privilege']:array();
+ $aclId = ($resp['aclId']!==null)?$resp['aclId']:null;
+ $createTime = ($resp['createTime']!==null)?$resp['createTime']:null;
+ $lastModifyTime = ($resp['lastModifyTime']!==null)?$resp['lastModifyTime']:null;
+
+ $this->setPrincipleType($principleType);
+ $this->setPrincipleId($principleId);
+ $this->setObject($object);
+ $this->setPrivilege($privilege);
+ $this->setAclId($aclId);
+ $this->setCreateTime($createTime);
+ $this->setLastModifyTime($lastModifyTime);
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/CompressedLogGroup.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/CompressedLogGroup.php
new file mode 100644
index 00000000..8f163b88
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/CompressedLogGroup.php
@@ -0,0 +1,38 @@
+time = $time;
+ if ($contents)
+ $this->contents = $contents;
+ else
+ $this->contents = array ();
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Config.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Config.php
new file mode 100644
index 00000000..585e95c3
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Config.php
@@ -0,0 +1,198 @@
+filePattern=$filePattern;
+ $this->key=$key;
+ $this->localStorage=$localStorage;
+ $this->logBeginRegex=$logBeginRegex;
+ $this->logPath=$logPath;
+ $this->logType=$logType;
+ $this->regex=$regex;
+ $this->timeFormat=$timeFormat;
+ $this->filterRegex=$filterRegex;
+ $this->filterKey=$filterKey;
+ $this->topicFormat=$topicFormat;
+ }
+
+ public function toArray(){
+ $resArray = array();
+ if($this->filePattern!==null)
+ $resArray['filePattern'] = $this->filePattern;
+ if($this->key!==null)
+ $resArray['key'] = $this->key;
+ if($this->localStorage!==null)
+ $resArray['localStorage'] = $this->localStorage;
+ if($this->logBeginRegex!==null)
+ $resArray['logBeginRegex'] = $this->logBeginRegex;
+ if($this->logPath!==null)
+ $resArray['logPath'] = $this->logPath;
+ if($this->logType!==null)
+ $resArray['logType'] = $this->logType;
+ if($this->regex!==null)
+ $resArray['regex'] = $this->regex;
+ if($this->timeFormat!==null)
+ $resArray['timeFormat'] = $this->timeFormat;
+ if($this->filterRegex!==null)
+ $resArray['filterRegex'] = $this->filterRegex;
+ if($this->filterKey!==null)
+ $resArray['filterKey'] = $this->filterKey;
+ if($this->topicFormat!==null)
+ $resArray['topicFormat'] = $this->topicFormat;
+ return $resArray;
+ }
+}
+
+class Aliyun_Log_Models_Config_OutputDetail {
+ public $projectName;
+ public $logstoreName;
+
+ public function __construct($projectName='',$logstoreName=''){
+ $this->projectName = $projectName;
+ $this->logstoreName = $logstoreName;
+ }
+ public function toArray(){
+ $resArray = array();
+ if($this->projectName!==null)
+ $resArray['projectName'] = $this->projectName;
+ if($this->logstoreName!==null)
+ $resArray['logstoreName'] = $this->logstoreName;
+ return $resArray;
+ }
+}
+
+class Aliyun_Log_Models_Config {
+
+ private $configName;
+ private $inputType;
+ private $inputDetail;
+ private $outputType;
+ private $outputDetail;
+
+ private $createTime;
+ private $lastModifyTime;
+
+ public function __construct($configName='',$inputType='',$inputDetail=null,
+ $outputType='',$outputDetail=null,$createTime=null,$lastModifyTime=null) {
+ $this->configName = $configName;
+ $this->inputType = $inputType;
+ $this->inputDetail = $inputDetail;
+ $this->outputType = $outputType;
+ $this->outputDetail = $outputDetail;
+ $this->createTime = $createTime;
+ $this->lastModifyTime = $lastModifyTime;
+
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+ public function setConfigName($configName){
+ $this->configName = $configName;
+ }
+ public function getInputType(){
+ return $this->inputType;
+ }
+ public function setInputType($inputType){
+ $this->inputType = $inputType;
+ }
+ public function getInputDetail(){
+ return $this->inputDetail;
+ }
+ public function setInputDetail($inputDetail){
+ $this->inputDetail = $inputDetail;
+ }
+ public function getOutputType(){
+ return $this->outputType;
+ }
+ public function setOutputType($outputType){
+ $this->outputType = $outputType;
+ }
+ public function getOutputDetail(){
+ return $this->outputDetail;
+ }
+ public function setOutputDetail($outputDetail){
+ $this->outputDetail = $outputDetail;
+ }
+ public function getCreateTime(){
+ return $this->createTime;
+ }
+ public function setCreateTime($createTime){
+ $this->createTime = $createTime;
+ }
+
+ public function getLastModifyTime(){
+ return $this->lastModifyTime;
+ }
+ public function setLastModifyTime($lastModifyTime){
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function toArray(){
+ $format_array = array();
+ if($this->configName!==null)
+ $format_array['configName'] = $this->configName;
+ if($this->inputType!==null)
+ $format_array['inputType'] = $this->inputType;
+ if($this->inputDetail!==null)
+ $format_array['inputDetail'] = $this->inputDetail->toArray();
+ if($this->outputType!==null)
+ $format_array['outputType'] = $this->outputType;
+ if($this->outputDetail!==null)
+ $format_array['outputDetail'] = $this->outputDetail->toArray();
+ if($this->createTime!==null)
+ $format_array['createTime'] = $this->createTime;
+ if($this->lastModifyTime!==null)
+ $format_array['lastModifyTime'] = $this->lastModifyTime;
+ return $format_array;
+ }
+
+ public function setFromArray($resp){
+ $inputDetail = new Aliyun_Log_Models_Config_InputDetail();
+ $inputDetail->filePattern = $resp['inputDetail']['filePattern'];
+ $inputDetail->key = $resp['inputDetail']['key'];
+ $inputDetail->localStorage = $resp['inputDetail']['localStorage'];
+ $inputDetail->logBeginRegex = $resp['inputDetail']['logBeginRegex'];
+ $inputDetail->logPath = $resp['inputDetail']['logPath'];
+ $inputDetail->logType = $resp['inputDetail']['logType'];
+ $inputDetail->regex = $resp['inputDetail']['regex'];
+ $inputDetail->timeFormat = $resp['inputDetail']['timeFormat'];
+ $inputDetail->filterRegex = $resp['inputDetail']['filterRegex'];
+ $inputDetail->filterKey = $resp['inputDetail']['filterKey'];
+ $inputDetail->topicFormat = $resp['inputDetail']['topicFormat'];
+
+ $outputDetail = new Aliyun_Log_Models_Config_OutputDetail();
+ $outputDetail->projectName = $resp['outputDetail']['projectName'];
+ $outputDetail->logstoreName = $resp['outputDetail']['logstoreName'];
+
+ $configName=$resp['configName'];
+ $inputType=$resp['inputType'];
+ $outputType=$resp['outputType'];
+
+ $this->setConfigName($configName);
+ $this->setInputType($inputType);
+ $this->setInputDetail($inputDetail);
+ $this->setOutputType($outputType);
+ $this->setOutputDetail($outputDetail);
+
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Histogram.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Histogram.php
new file mode 100644
index 00000000..b241ffb8
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Histogram.php
@@ -0,0 +1,90 @@
+from = $from;
+ $this->to = $to;
+ $this->count = $count;
+ $this->progress = $progress;
+ }
+
+ /**
+ * Get begin time
+ *
+ * @return integer the begin time
+ */
+ public function getFrom() {
+ return $this->from;
+ }
+
+ /**
+ * Get the end time
+ *
+ * @return integer the end time
+ */
+ public function getTo() {
+ return $this->to;
+ }
+
+ /**
+ * Get log count of histogram that query hits
+ *
+ * @return integer log count of histogram that query hits
+ */
+ public function getCount() {
+ return $this->count;
+ }
+
+ /**
+ * Check if the histogram is completed
+ *
+ * @return bool true if this histogram is completed
+ */
+ public function isCompleted() {
+ return $this->progress == 'Complete';
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogItem.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogItem.php
new file mode 100644
index 00000000..0eea8114
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogItem.php
@@ -0,0 +1,92 @@
+time = $time;
+ if ($contents)
+ $this->contents = $contents;
+ else
+ $this->contents = array ();
+ }
+
+ /**
+ * Get log time
+ *
+ * @return integer log time
+ */
+ public function getTime() {
+ return $this->time;
+ }
+
+ /**
+ * Set log time
+ *
+ * @param integer $time
+ * log time
+ */
+ public function setTime($time) {
+ $this->time = $time;
+ }
+
+ /**
+ * Get log contents
+ *
+ * @return array log contents
+ */
+ public function getContents() {
+ return $this->contents;
+ }
+
+ /**
+ * Set log contents
+ *
+ * @param array $contents
+ * log contents
+ */
+ public function setContents($contents) {
+ $this->contents = $contents;
+ }
+
+ /**
+ * Add a key/value pair as log content to the log
+ *
+ * @param string $key
+ * log content key
+ * @param string $value
+ * log content value
+ */
+ public function pushBack($key, $value) {
+ $this->contents [$key] = $value;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogLevel/LogLevel.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogLevel/LogLevel.php
new file mode 100644
index 00000000..86dfc040
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/LogLevel/LogLevel.php
@@ -0,0 +1,92 @@
+level = $level;
+ }
+
+ /**
+ * Compares two logger levels.
+ *
+ * @param LoggerLevels $other
+ * @return boolean
+ */
+ public function equals($other) {
+ if($other instanceof Aliyun_Log_Models_LogLevel_LogLevel) {
+ if($this->level == $other->level) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public static function getLevelDebug(){
+ if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug])){
+ self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug] = new Aliyun_Log_Models_LogLevel_LogLevel('debug');
+ }
+ return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug];
+ }
+
+ public static function getLevelInfo(){
+ if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info])){
+ self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info] = new Aliyun_Log_Models_LogLevel_LogLevel('info');
+ }
+ return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info];
+ }
+
+ public static function getLevelWarn(){
+ if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn])){
+ self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn] = new Aliyun_Log_Models_LogLevel_LogLevel('warn');
+ }
+ return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn];
+ }
+
+ public static function getLevelError(){
+ if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error])){
+ self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error] = new Aliyun_Log_Models_LogLevel_LogLevel('error');
+ }
+ return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error];
+ }
+
+ public static function getLevelStr(Aliyun_Log_Models_LogLevel_LogLevel $logLevel){
+
+ $logLevelStr = '';
+ if(null === $logLevel){
+ $logLevelStr = 'info';
+ }
+ switch ($logLevel->level){
+ case "error":
+ $logLevelStr= 'error';
+ break;
+ case "warn":
+ $logLevelStr= 'warn';
+ break;
+ case "info":
+ $logLevelStr= 'info';
+ break;
+ case "debug":
+ $logLevelStr= 'debug';
+ break;
+ }
+ return $logLevelStr;
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Machine.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Machine.php
new file mode 100644
index 00000000..dc8fce7b
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Machine.php
@@ -0,0 +1,173 @@
+ip = $ip;
+ $this->os = $os;
+ $this->hostName = $hostName;
+ }
+
+ public function getIp(){
+ return $this->ip;
+ }
+ public function setIp($ip){
+ $this->ip = $ip;
+ }
+
+
+ public function getOs(){
+ return $this->os;
+ }
+ public function setOs($os){
+ $this->os = $os;
+ }
+
+ public function getHostName(){
+ return $this->hostName;
+ }
+ public function setHostName($hostname){
+ $this->hostName = $hostName;
+ }
+ public function toArray(){
+ $resArr = array();
+ if($this->ip!==null)
+ $resArr['ip'] = $this->ip;
+ if($this->os!==null)
+ $resArr['os'] = $this->os;
+ if($this->hostName!==null)
+ $resArr['hostName'] = $this->hostName;
+ return $resArr;
+ }
+}
+
+class Aliyun_Log_Models_Machine_Status{
+ public $binaryCurVersion;
+ public $binaryDeployVersion;
+
+ public function __construct($binaryCurVersion=null,$binaryDeployVersion=null){
+ $this->binaryCurVersion = $binaryCurVersion;
+ $this->binaryDeployVersion = $binaryDeployVersion;
+ }
+
+ public function toArray(){
+ $resArr = array();
+ if($this->binaryCurVersion!==null)
+ $resArr['binaryCurVersion'] = $this->binaryCurVersion;
+ if($this->binaryDeployVersion!==null)
+ $resArr['binaryDeployVersion'] = $this->binaryDeployVersion;
+ return $resArr;
+ }
+}
+
+
+class Aliyun_Log_Models_Machine {
+ private $uuid;
+ private $lastHeartbeatTime;
+ private $info;
+ private $status;
+
+ private $createTime;
+ private $lastModifyTime;
+
+ public function __construct($uuid=null,$lastHeartbeatTime=null,$info=null,
+ $status=null,$createTime=null,$lastModifyTime=null) {
+ $this->uuid = $uuid;
+ $this->lastHeartbeatTime = $lastHeartbeatTime;
+ $this->info = $info;
+ $this->status = $status;
+
+ $this->createTime = $createTime;
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function getUuid(){
+ return $this->uuid;
+ }
+ public function setUuid($uuid){
+ $this->uuid = $uuid;
+ }
+ public function getLastHeartbeatTime(){
+ return $this->lastHeartbeatTime;
+ }
+ public function setLastHeartbeatTime($lastHeartbeatTime){
+ $this->lastHeartbeatTime = $lastHeartbeatTime;
+ }
+ public function getInfo(){
+ return $this->info;
+ }
+ public function setInfo($info){
+ $this->info = $info;
+ }
+ public function getStatus(){
+ return $this->status;
+ }
+ public function setStatus($status){
+ $this->status = $status;
+ }
+
+ public function getCreateTime(){
+ return $this->createTime;
+ }
+ public function setCreateTime($createTime){
+ $this->createTime = $createTime;
+ }
+ public function getLastModifyTime(){
+ return $this->lastModifyTime;
+ }
+ public function setLastModifyTime($lastModifyTime){
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function toArray(){
+ $resArr = array();
+ if($this->uuid!==null)
+ $resArr['uuid'] = $this->uuid;
+ if($this->lastHeartbeatTime!==null)
+ $resArr['lastHeartbeatTime'] = $this->lastHeartbeatTime;
+ if($this->info!==null)
+ $resArr['info'] = $this->info->toArray();
+ if($this->status!==null)
+ $resArr['status'] = $this->status->toArray();
+ if($this->createTime!==null)
+ $resArr['createTime'] = $this->createTime;
+ if($this->lastModifyTime!==null)
+ $resArr['lastModifyTime'] = $this->lastModifyTime;
+ return $resArr;
+ }
+
+ public function setFromArray($resp){
+ $info=null;
+ if(isset($resp['info'])){
+ $ip=(isset($resp['info']['ip']))?$resp['info']['ip']:null;
+ $os=(isset($resp['info']['os']))?$resp['info']['os']:null;
+ $hostName=(isset($resp['info']['hostName']))?$resp['info']['hostName']:null;
+ $info = new Aliyun_Log_Models_Machine_Info($ip,$os,$hostName);
+ }
+ $status = null;
+ if(isset($resp['status'])){
+ $binaryCurVersion=(isset($resp['status']['binaryCurVersion']))?$resp['status']['binaryCurVersion']:null;
+ $binaryDeployVersion=(isset($resp['status']['binaryDeployVersion']))?$resp['status']['binaryDeployVersion']:null;
+ $status = new Aliyun_Log_Models_Machine_Status($binaryCurVersion,$binaryDeployVersion);
+ }
+ $uuid=(isset($resp['uuid']))?$resp['uuid']:null;
+ $lastHeartbeatTime=(isset($resp['lastHeartbeatTime']))?$resp['lastHeartbeatTime']:null;
+ $createTime=(isset($resp['createTime']))?$resp['createTime']:null;
+ $lastModifyTime=(isset($resp['lastModifyTime']))?$resp['lastModifyTime']:null;
+
+ $this->setUuid($uuid);
+ $this->setLastHeartbeatTime($lastHeartbeatTime);
+ $this->setInfo($info);
+ $this->setStatus($status);
+ $this->setCreateTime($createTime);
+ $this->setLastModifyTime($lastModifyTime);
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/MachineGroup.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/MachineGroup.php
new file mode 100644
index 00000000..6d724c99
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/MachineGroup.php
@@ -0,0 +1,132 @@
+externalName = $externalName;
+ $this->groupTopic = $groupTopic;
+ }
+ public function toArray(){
+ $resArray = array();
+ if($this->externalName!==null)
+ $resArray['externalName'] = $this->externalName;
+ if($this->groupTopic!==null)
+ $resArray['groupTopic'] = $this->groupTopic;
+ return $resArray;
+ }
+}
+
+class Aliyun_Log_Models_MachineGroup {
+ private $groupName;
+ private $groupType;
+ private $groupAttribute;
+ private $machineList;
+
+ private $createTime;
+ private $lastModifyTime;
+
+ public function __construct($groupName='',$groupType='',$groupAttribute=null,
+ $machineList=null,$createTime=null,$lastModifyTime=null) {
+ $this->groupName = $groupName;
+ $this->groupType = $groupType;
+ $this->groupAttribute = $groupAttribute;
+ $this->machineList = $machineList;
+ $this->createTime = $createTime;
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function getGroupName(){
+ return $this->groupName;
+ }
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+ public function getGroupType(){
+ return $this->groupType;
+ }
+ public function setGroupType($groupType){
+ $this->groupType = $groupType;
+ }
+ public function getGroupAttribute(){
+ return $this->groupAttribute;
+ }
+ public function setGroupAttribute($groupAttribute){
+ $this->groupAttribute = $groupAttribute;
+ }
+ public function getMachineList(){
+ return $this->machineList;
+ }
+ public function setMachineList($machineList){
+ $this->machineList = $machineList;
+ }
+ public function getCreateTime(){
+ return $this->createTime;
+ }
+ public function setCreateTime($createTime){
+ $this->createTime = $createTime;
+ }
+ public function getLastModifyTime(){
+ return $this->lastModifyTime;
+ }
+ public function setLastModifyTime($lastModifyTime){
+ $this->lastModifyTime = $lastModifyTime;
+ }
+
+ public function toArray(){
+ $format_array = array();
+ if($this->groupName!==null)
+ $format_array['groupName'] = $this->groupName;
+ if($this->groupType!==null)
+ $format_array['groupType'] = $this->groupType;
+ if($this->groupAttribute!==null)
+ $format_array['groupAttribute'] = $this->groupAttribute->toArray();
+ if($this->machineList!==null){
+ $mlArr = array();
+ foreach($this->machineList as $value){
+ $mlArr[] = $value->toArray();
+ }
+ $format_array['machineList'] = $mlArr;
+ }
+ if($this->createTime!==null)
+ $format_array['createTime'] = $this->createTime;
+ if($this->lastModifyTime!==null)
+ $format_array['lastModifyTime'] = $this->lastModifyTime;
+ return $format_array;
+ }
+
+ public function setFromArray($resp){
+ $groupAttribute = null;
+ if(isset($resp['groupAttribute'])){
+ $groupAttributeArr = $resp['groupAttribute'];
+ $groupAttribute = new Aliyun_Log_Models_MachineGroup_GroupAttribute();
+ if(isset($groupAttributeArr['externalName']))
+ $groupAttribute->externalName = $groupAttributeArr['externalName'];
+ if(isset($groupAttributeArr['groupTopic']))
+ $groupAttribute->groupTopic = $groupAttributeArr['groupTopic'];
+ }
+ $groupName = ($resp['groupName']!==null)?$resp['groupName']:null;
+ $groupType = ($resp['groupType']!==null)?$resp['groupType']:null;
+ $machineList = array();
+ if(isset($resp['machineList']) && is_array($resp['machineList']) && count($resp['machineList'])>0){
+ foreach($resp['machineList'] as $value){
+ $machine = new Aliyun_Log_Models_Machine();
+ $machine->setFromArray($value);
+ $machineList[] = $machine;
+ }
+ }
+
+ $createTime = ($resp['createTime']!==null)?$resp['createTime']:null;
+ $lastModifyTime = ($resp['lastModifyTime']!==null)?$resp['lastModifyTime']:null;
+ $this->setGroupName($groupName);
+ $this->setGroupType($groupType);
+ $this->setGroupAttribute($groupAttribute);
+ $this->setMachineList($machineList);
+ $this->setCreateTime($createTime);
+ $this->setLastModifyTime($lastModifyTime);
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperConfig.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperConfig.php
new file mode 100644
index 00000000..916bc7e7
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperConfig.php
@@ -0,0 +1,166 @@
+roleArn;
+ }
+
+ /**
+ * @param mixed $roleArn
+ */
+ public function setRoleArn($roleArn)
+ {
+ $this->roleArn = $roleArn;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPathFormat()
+ {
+ return $this->pathFormat;
+ }
+
+ /**
+ * @param mixed $pathFormat
+ */
+ public function setPathFormat($pathFormat)
+ {
+ $this->pathFormat = $pathFormat;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getStorage()
+ {
+ return $this->storage;
+ }
+
+ /**
+ * @param mixed $storage
+ */
+ public function setStorage($storage)
+ {
+ $this->storage = $storage;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getOssBucket()
+ {
+ return $this->ossBucket;
+ }
+
+ /**
+ * @param mixed $ossBucket
+ */
+ public function setOssBucket($ossBucket)
+ {
+ $this->ossBucket = $ossBucket;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getOssPrefix()
+ {
+ return $this->ossPrefix;
+ }
+
+ /**
+ * @param mixed $ossPrefix
+ */
+ public function setOssPrefix($ossPrefix)
+ {
+ $this->ossPrefix = $ossPrefix;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getBufferInterval()
+ {
+ return $this->bufferInterval;
+ }
+
+ /**
+ * @param mixed $bufferInterval
+ */
+ public function setBufferInterval($bufferInterval)
+ {
+ $this->bufferInterval = $bufferInterval;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getBufferSize()
+ {
+ return $this->bufferSize;
+ }
+
+ /**
+ * @param mixed $bufferSize
+ */
+ public function setBufferSize($bufferSize)
+ {
+ if($bufferSize > 256 || $bufferSize < 5){
+ throw new Exception("buffSize is not valide, must between 5 and 256");
+ }
+ $this->bufferSize = $bufferSize;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCompressType()
+ {
+ return $this->compressType;
+ }
+
+ /**
+ * @param mixed $compressType
+ */
+ public function setCompressType($compressType)
+ {
+ $this->compressType = $compressType;
+ }
+
+
+ public function to_json_object() {
+ $json = array(
+ 'ossBucket' => $this->ossBucket,
+ 'ossPrefix' => $this->ossPrefix,
+ 'bufferInterval' => $this->bufferInterval,
+ 'bufferSize' => $this->bufferSize,
+ 'compressType' => $this->compressType,
+ 'roleArn' => $this->roleArn,
+ 'pathFormat' => $this->pathFormat,
+ 'storage' => $this->storage->to_json_object()
+ );
+ if($this->storage->getFormat() == 'json'){
+ unset($json['storage']);
+ }
+ return $json;
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperCsvStorage.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperCsvStorage.php
new file mode 100644
index 00000000..1c8af912
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperCsvStorage.php
@@ -0,0 +1,107 @@
+columns;
+ }
+
+ /**
+ * @param mixed $columns
+ */
+ public function setColumns($columns)
+ {
+ $this->columns = $columns;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDelimiter(): string
+ {
+ return $this->delimiter;
+ }
+
+ /**
+ * @param string $delimiter
+ */
+ public function setDelimiter(string $delimiter)
+ {
+ $this->delimiter = $delimiter;
+ }
+
+ /**
+ * @return string
+ */
+ public function getQuote(): string
+ {
+ return $this->quote;
+ }
+
+ /**
+ * @param string $quote
+ */
+ public function setQuote(string $quote)
+ {
+ $this->quote = $quote;
+ }
+
+ /**
+ * @return string
+ */
+ public function getNullIdentifier(): string
+ {
+ return $this->nullIdentifier;
+ }
+
+ /**
+ * @param string $nullIdentifier
+ */
+ public function setNullIdentifier(string $nullIdentifier)
+ {
+ $this->nullIdentifier = $nullIdentifier;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isHeader(): bool
+ {
+ return $this->header;
+ }
+
+ /**
+ * @param bool $header
+ */
+ public function setHeader(bool $header)
+ {
+ $this->header = $header;
+ }
+
+ public function to_json_object(){
+ $detail = array(
+ 'columns' => $this->columns,
+ 'delimiter' => $this->delimiter,
+ 'quote' => $this->quote,
+ 'nullIdentifier' => $this->nullIdentifier,
+ 'header' => $this->header
+ );
+ return array(
+ 'detail' => $detail,
+ 'format' => parent::getFormat()
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperJsonStorage.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperJsonStorage.php
new file mode 100644
index 00000000..1e2ef8e7
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperJsonStorage.php
@@ -0,0 +1,12 @@
+columns;
+ }
+
+ /**
+ * @param mixed $columns
+ */
+ public function setColumns($columns)
+ {
+ $this->columns = $columns;
+ }
+
+ public function to_json_object(){
+ $detail = array(
+ 'columns' => $this->columns
+ );
+ return array(
+ 'detail' => $detail,
+ 'format' => parent::getFormat()
+ );
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperStorage.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperStorage.php
new file mode 100644
index 00000000..64f8d24f
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/OssShipperStorage.php
@@ -0,0 +1,27 @@
+format;
+ }
+
+ /**
+ * @param mixed $format
+ */
+ public function setFormat($format)
+ {
+ $this->format = $format;
+ }
+
+
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ApplyConfigToMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ApplyConfigToMachineGroupRequest.php
new file mode 100644
index 00000000..28291ca2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ApplyConfigToMachineGroupRequest.php
@@ -0,0 +1,39 @@
+groupName = $groupName;
+ $this->configName = $configName;
+ }
+ public function getGroupName(){
+ return $this->groupName;
+ }
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+ public function setConfigName($configName){
+ $this->configName = $configName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/BatchGetLogsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/BatchGetLogsRequest.php
new file mode 100644
index 00000000..a4232b35
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/BatchGetLogsRequest.php
@@ -0,0 +1,160 @@
+logstore = $logstore;
+ $this->shardId = $shardId;
+ $this->count = $count;
+ $this->cursor = $cursor;
+ $this->endCursor = $end_cursor;
+ }
+
+ /**
+ * Get logstore name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore() {
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore) {
+ $this->logstore = $logstore;
+ }
+
+ /**
+ * Get shard ID
+ *
+ * @return string shardId
+ */
+ public function getShardId() {
+ return $this->shardId;
+ }
+
+ /**
+ * Set shard ID
+ *
+ * @param string $shardId
+ * shard ID
+ */
+ public function setShardId($shardId) {
+ $this->shardId = $shardId;
+ }
+
+ /**
+ * Get max return loggroup number
+ *
+ * @return integer count
+ */
+ public function getCount() {
+ return $this->count;
+ }
+
+ /**
+ * Set max return loggroup number
+ *
+ * @param integer $count
+ * max return loggroup number
+ */
+ public function setCount($count) {
+ $this->count = $count;
+ }
+
+ /**
+ * Get start cursor
+ *
+ * @return string cursor
+ */
+ public function getCursor() {
+ return $this->cursor;
+ }
+
+ /**
+ * Get end cursor
+ *
+ * @return string cursor
+ */
+ public function getEndCursor() {
+ return $this->endCursor;
+ }
+
+ /**
+ * Set start cursor
+ *
+ * @param string $cursor
+ * start cursor
+ */
+ public function setCursor($cursor) {
+ $this->cursor = $cursor;
+ }
+
+ /**
+ * Set end cursor
+ *
+ * @param string $cursor
+ * end cursor
+ */
+ public function setEndCursor($cursor) {
+ $this->endCursor = $cursor;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateACLRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateACLRequest.php
new file mode 100644
index 00000000..7b0892c4
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateACLRequest.php
@@ -0,0 +1,32 @@
+acl = $acl;
+ }
+
+ public function getAcl(){
+ return $this->acl;
+ }
+ public function setAcl($acl){
+ $this->acl = $acl;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateConfigRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateConfigRequest.php
new file mode 100644
index 00000000..5ad80ca1
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateConfigRequest.php
@@ -0,0 +1,35 @@
+config = $config;
+ }
+
+ public function getConfig(){
+ return $this->config;
+
+ }
+
+ public function setConfig($config){
+ $this->config = $config;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateLogstoreRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateLogstoreRequest.php
new file mode 100644
index 00000000..0fc6670c
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateLogstoreRequest.php
@@ -0,0 +1,42 @@
+ logstore = $logstore;
+ $this -> ttl = $ttl;
+ $this -> shardCount = $shardCount;
+ }
+ public function getLogstore()
+ {
+ return $this -> logstore;
+ }
+ public function getTtl()
+ {
+ return $this -> ttl;
+ }
+ public function getShardCount()
+ {
+ return $this -> shardCount;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateMachineGroupRequest.php
new file mode 100644
index 00000000..6f707c95
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateMachineGroupRequest.php
@@ -0,0 +1,31 @@
+machineGroup = $machineGroup;
+ }
+ public function getMachineGroup(){
+ return $this->machineGroup;
+ }
+ public function setMachineGroup($machineGroup){
+ $this->machineGroup = $machineGroup;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateShipperRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateShipperRequest.php
new file mode 100644
index 00000000..63af99d9
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/CreateShipperRequest.php
@@ -0,0 +1,94 @@
+logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetType()
+ {
+ return $this->targetType;
+ }
+
+ /**
+ * @param mixed $targetType
+ */
+ public function setTargetType($targetType)
+ {
+ $this->targetType = $targetType;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetConfigration()
+ {
+ return $this->targetConfigration;
+ }
+
+ /**
+ * @param mixed $targetConfigration
+ */
+ public function setTargetConfigration($targetConfigration)
+ {
+ $this->targetConfigration = $targetConfigration;
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteACLRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteACLRequest.php
new file mode 100644
index 00000000..2006c90c
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteACLRequest.php
@@ -0,0 +1,31 @@
+aclId = $aclId;
+ }
+ public function getAclId(){
+ return $this->aclId;
+ }
+ public function setAclId($aclId){
+ $this->aclId = $aclId;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteConfigRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteConfigRequest.php
new file mode 100644
index 00000000..3afc9ec4
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteConfigRequest.php
@@ -0,0 +1,33 @@
+configName = $configName;
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+
+ public function setConfigName($configName){
+ $this->configName=$configName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteLogstoreRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteLogstoreRequest.php
new file mode 100644
index 00000000..8c0d39f2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteLogstoreRequest.php
@@ -0,0 +1,30 @@
+ logstore = $logstore;
+ }
+ public function getLogstore()
+ {
+ return $this -> logstore;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteMachineGroupRequest.php
new file mode 100644
index 00000000..a04367b2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteMachineGroupRequest.php
@@ -0,0 +1,34 @@
+groupName = $groupName;
+ }
+
+ public function getGroupName(){
+ return $this->groupName;
+ }
+
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShardRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShardRequest.php
new file mode 100644
index 00000000..e45a3712
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShardRequest.php
@@ -0,0 +1,39 @@
+logstore = $logstore;
+ $this->shardId = $shardId;
+ }
+
+ public function getLogstore(){
+ return $this->logstore;
+ }
+
+ public function setLogstore($logstore){
+ $this->logstore = $logstore;
+ }
+
+ public function getShardId(){
+ return $this->shardId;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShipperRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShipperRequest.php
new file mode 100644
index 00000000..650f9ae2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/DeleteShipperRequest.php
@@ -0,0 +1,53 @@
+logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetACLRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetACLRequest.php
new file mode 100644
index 00000000..ce9690a0
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetACLRequest.php
@@ -0,0 +1,30 @@
+aclId = $aclId;
+ }
+ public function getAclId(){
+ return $this->aclId;
+ }
+ public function setAclId($aclId){
+ $this->aclId = $aclId;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetConfigRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetConfigRequest.php
new file mode 100644
index 00000000..78a15d2f
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetConfigRequest.php
@@ -0,0 +1,34 @@
+configName = $configName;
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+
+ public function setConfigName($configName){
+ $this->configName = $configName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetCursorRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetCursorRequest.php
new file mode 100644
index 00000000..933b2e8a
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetCursorRequest.php
@@ -0,0 +1,138 @@
+logstore = $logstore;
+ $this->shardId = $shardId;
+ $this->mode = $mode;
+ $this->fromTime = $fromTime;
+ }
+
+ /**
+ * Get logstore name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore(){
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore){
+ $this->logstore = $logstore;
+ }
+
+ /**
+ * Get shard id
+ *
+ * @return string shard id
+ */
+ public function getShardId(){
+ return $this->shardId;
+ }
+
+ /**
+ * Set shard id
+ *
+ * @param string $shardId
+ * shard id
+ */
+ public function setShardId($shardId){
+ $this->shardId = $shardId;
+ }
+
+ /**
+ * Get mode
+ *
+ * @return string mode
+ */
+ public function getMode(){
+ return $this->mode;
+ }
+
+ /**
+ * Set mode
+ *
+ * @param string $mode
+ * value must be 'begin' or 'end'
+ */
+ public function setMode($mode){
+ $this->mode = $mode;
+ }
+
+ /**
+ * Get from time
+ *
+ * @return integer(unix_timestamp) from time
+ */
+ public function getFromTime(){
+ return $this->fromTime;
+ }
+
+ /**
+ * Set from time
+ *
+ * @param integer $fromTime
+ * from time (unix_timestamp)
+ */
+ public function setFromTime($fromTime){
+ $this->fromTime = $fromTime;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetHistogramsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetHistogramsRequest.php
new file mode 100644
index 00000000..8df75e68
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetHistogramsRequest.php
@@ -0,0 +1,161 @@
+logstore = $logstore;
+ $this->from = $from;
+ $this->to = $to;
+ $this->topic = $topic;
+ $this->query = $query;
+ }
+
+ /**
+ * Get logstore name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore() {
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore) {
+ $this->logstore = $logstore;
+ }
+
+ /**
+ * Get topic name
+ *
+ * @return string topic name
+ */
+ public function getTopic() {
+ return $this->topic;
+ }
+
+ /**
+ * Set topic name
+ *
+ * @param string $topic
+ * topic name
+ */
+ public function setTopic($topic) {
+ $this->topic = $topic;
+ }
+
+ /**
+ * Get begin time
+ *
+ * @return integer begin time
+ */
+ public function getFrom() {
+ return $this->from;
+ }
+
+ /**
+ * Set begin time
+ *
+ * @param integer $from
+ * begin time
+ */
+ public function setFrom($from) {
+ $this->from = $from;
+ }
+
+ /**
+ * Get end time
+ *
+ * @return integer end time
+ */
+ public function getTo() {
+ return $this->to;
+ }
+
+ /**
+ * Set end time
+ *
+ * @param integer $to
+ * end time
+ */
+ public function setTo($to) {
+ $this->to = $to;
+ }
+
+ /**
+ * Get user defined query
+ *
+ * @return string user defined query
+ */
+ public function getQuery() {
+ return $this->query;
+ }
+
+ /**
+ * Set user defined query
+ *
+ * @param string $query
+ * user defined query
+ */
+ public function setQuery($query) {
+ $this->query = $query;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetLogsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetLogsRequest.php
new file mode 100644
index 00000000..32ef4671
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetLogsRequest.php
@@ -0,0 +1,242 @@
+logstore = $logstore;
+ $this->from = $from;
+ $this->to = $to;
+ $this->topic = $topic;
+ $this->query = $query;
+ $this->line = $line;
+ $this->offset = $offset;
+ $this->reverse = $reverse;
+ }
+
+ /**
+ * Get logstore name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore() {
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore) {
+ $this->logstore = $logstore;
+ }
+
+ /**
+ * Get topic name
+ *
+ * @return string topic name
+ */
+ public function getTopic() {
+ return $this->topic;
+ }
+
+ /**
+ * Set topic name
+ *
+ * @param string $topic
+ * topic name
+ */
+ public function setTopic($topic) {
+ $this->topic = $topic;
+ }
+
+ /**
+ * Get begin time
+ *
+ * @return integer begin time
+ */
+ public function getFrom() {
+ return $this->from;
+ }
+
+ /**
+ * Set begin time
+ *
+ * @param integer $from
+ * begin time
+ */
+ public function setFrom($from) {
+ $this->from = $from;
+ }
+
+ /**
+ * Get end time
+ *
+ * @return integer end time
+ */
+ public function getTo() {
+ return $this->to;
+ }
+
+ /**
+ * Set end time
+ *
+ * @param integer $to
+ * end time
+ */
+ public function setTo($to) {
+ $this->to = $to;
+ }
+
+ /**
+ * Get user defined query
+ *
+ * @return string user defined query
+ */
+ public function getQuery() {
+ return $this->query;
+ }
+
+ /**
+ * Set user defined query
+ *
+ * @param string $query
+ * user defined query
+ */
+ public function setQuery($query) {
+ $this->query = $query;
+ }
+
+ /**
+ * Get max line number of return logs
+ *
+ * @return integer max line number of return logs
+ */
+ public function getLine() {
+ return $this->line;
+ }
+
+ /**
+ * Set max line number of return logs
+ *
+ * @param integer $line
+ * max line number of return logs
+ */
+ public function setLine($line) {
+ $this->line = $line;
+ }
+
+ /**
+ * Get line offset of return logs
+ *
+ * @return integer line offset of return logs
+ */
+ public function getOffset() {
+ return $this->offset;
+ }
+
+ /**
+ * Set request line offset of return logs
+ *
+ * @param integer $offset
+ * line offset of return logs
+ */
+ public function setOffset($offset) {
+ $this->offset = $offset;
+ }
+
+ /**
+ * Get request reverse flag
+ *
+ * @return bool reverse flag
+ */
+ public function getReverse() {
+ return $this->reverse;
+ }
+
+ /**
+ * Set request reverse flag
+ *
+ * @param bool $reverse
+ * reverse flag
+ */
+ public function setReverse($reverse) {
+ $this->reverse = $reverse;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineGroupRequest.php
new file mode 100644
index 00000000..8df5b03c
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineGroupRequest.php
@@ -0,0 +1,31 @@
+groupName = $groupName;
+ }
+ public function getGroupName(){
+ return $this->groupName;
+ }
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineRequest.php
new file mode 100644
index 00000000..5100c222
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetMachineRequest.php
@@ -0,0 +1,34 @@
+uuid = $uuid;
+ }
+
+ public function getUuid(){
+ return $this->uuid;
+ }
+
+ public function setUuid($uuid){
+ $this->uuid = $uuid;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetProjectLogsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetProjectLogsRequest.php
new file mode 100644
index 00000000..45bd143d
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetProjectLogsRequest.php
@@ -0,0 +1,45 @@
+query = $query;
+ }
+
+
+
+ /**
+ * Get user defined query
+ *
+ * @return string user defined query
+ */
+ public function getQuery() {
+ return $this->query;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperConfigRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperConfigRequest.php
new file mode 100644
index 00000000..eafc01d2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperConfigRequest.php
@@ -0,0 +1,53 @@
+logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperTasksRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperTasksRequest.php
new file mode 100644
index 00000000..b31f6187
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/GetShipperTasksRequest.php
@@ -0,0 +1,146 @@
+startTime;
+ }
+
+ /**
+ * @param mixed $startTime
+ */
+ public function setStartTime($startTime)
+ {
+ $this->startTime = $startTime;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getEndTime()
+ {
+ return $this->endTime;
+ }
+
+ /**
+ * @param mixed $endTime
+ */
+ public function setEndTime($endTime)
+ {
+ $this->endTime = $endTime;
+ }
+
+ /**
+ * @return
+ */
+ public function getStatusType()
+ {
+ return $this->statusType;
+ }
+
+ /**
+ * @param $statusType
+ */
+ public function setStatusType($statusType)
+ {
+ $this->statusType = $statusType;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getOffset()
+ {
+ return $this->offset;
+ }
+
+ /**
+ * @param mixed $offset
+ */
+ public function setOffset($offset)
+ {
+ $this->offset = $offset;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSize()
+ {
+ return $this->size;
+ }
+
+ /**
+ * @param mixed $size
+ */
+ public function setSize($size)
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLogStore()
+ {
+ return $this->logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListACLsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListACLsRequest.php
new file mode 100644
index 00000000..d6311e11
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListACLsRequest.php
@@ -0,0 +1,51 @@
+offset = $offset;
+ $this->size = $size;
+ $this->principleId = $principleId;
+ }
+
+ public function getOffset(){
+ return $this->offset;
+ }
+ public function setOffset($offset){
+ $this->offset = $offset;
+ }
+
+ public function getSize(){
+ return $this->size;
+ }
+ public function setSize($size){
+ $this->size = $size;
+ }
+
+ public function getPrincipleId(){
+ return $this->principleId;
+ }
+ public function setPrincipleId($principleId){
+ $this->principleId = $principleId;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListConfigsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListConfigsRequest.php
new file mode 100644
index 00000000..82049a24
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListConfigsRequest.php
@@ -0,0 +1,54 @@
+configName = $configName;
+ $this->offset = $offset;
+ $this->size = $size;
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+
+ public function setConfigName($configName){
+ $this->configName = $configName;
+ }
+
+ public function getOffset(){
+ return $this->offset;
+ }
+
+ public function setOffset($offset){
+ $this->offset = $offset;
+ }
+
+ public function getSize(){
+ return $this->size;
+ }
+
+ public function setSize($size){
+ $this->size = $size;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListLogstoresRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListLogstoresRequest.php
new file mode 100644
index 00000000..497afd75
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListLogstoresRequest.php
@@ -0,0 +1,24 @@
+groupName = $groupName;
+ $this->offset = $offset;
+ $this->size = $size;
+ }
+
+ public function getGroupName(){
+ return $this->groupName;
+ }
+
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+
+ public function getOffset(){
+ return $this->offset;
+ }
+
+ public function setOffset($offset){
+ $this->offset = $offset;
+ }
+
+ public function getSize(){
+ return $this->size;
+ }
+
+ public function setSize($size){
+ $this->size = $size;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShardsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShardsRequest.php
new file mode 100644
index 00000000..2bbf718c
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShardsRequest.php
@@ -0,0 +1,36 @@
+logstore = $logstore;
+ }
+
+ public function getLogstore(){
+ return $this->logstore;
+ }
+
+ public function setLogstore($logstore){
+ $this->logstore = $logstore;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShipperRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShipperRequest.php
new file mode 100644
index 00000000..03aa8be0
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListShipperRequest.php
@@ -0,0 +1,37 @@
+logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListTopicsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListTopicsRequest.php
new file mode 100644
index 00000000..60882c14
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/ListTopicsRequest.php
@@ -0,0 +1,102 @@
+logstore = $logstore;
+ $this->token = $token;
+ $this->line = $line;
+ }
+
+ /**
+ * Get logstroe name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore() {
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore) {
+ $this->logstore = $logstore;
+ }
+
+
+ /**
+ * Get start token to list topics
+ *
+ * @return string start token to list topics
+ */
+ public function getToken() {
+ return $this->token;
+ }
+
+ /**
+ * Set start token to list topics
+ *
+ * @param string $token start token to list topics
+ */
+ public function setToken($token) {
+ $this->token = $token;
+ }
+
+
+ /**
+ * Get max topic counts to return
+ *
+ * @return integer max topic counts to return
+ */
+ public function getLine() {
+ return $this->line;
+ }
+
+ /**
+ * Set max topic counts to return
+ *
+ * @param integer $line max topic counts to return
+ */
+ public function setLine($line) {
+ $this->line = $line;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/MergeShardsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/MergeShardsRequest.php
new file mode 100644
index 00000000..31512a60
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/MergeShardsRequest.php
@@ -0,0 +1,39 @@
+logstore = $logstore;
+ $this->shardId = $shardId;
+ }
+
+ public function getLogstore(){
+ return $this->logstore;
+ }
+
+ public function setLogstore($logstore){
+ $this->logstore = $logstore;
+ }
+
+ public function getShardId(){
+ return $this->shardId;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/PutLogsRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/PutLogsRequest.php
new file mode 100644
index 00000000..f72ab4ea
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/PutLogsRequest.php
@@ -0,0 +1,156 @@
+logstore = $logstore;
+ $this->topic = $topic;
+ $this->source = $source;
+ $this->logitems = $logitems;
+ $this->shardKey = $shardKey;
+ }
+
+ /**
+ * Get logstroe name
+ *
+ * @return string logstore name
+ */
+ public function getLogstore() {
+ return $this->logstore;
+ }
+
+ /**
+ * Set logstore name
+ *
+ * @param string $logstore
+ * logstore name
+ */
+ public function setLogstore($logstore) {
+ $this->logstore = $logstore;
+ }
+
+ /**
+ * Get topic name
+ *
+ * @return string topic name
+ */
+ public function getTopic() {
+ return $this->topic;
+ }
+
+ /**
+ * Set topic name
+ *
+ * @param string $topic
+ * topic name
+ */
+ public function setTopic($topic) {
+ $this->topic = $topic;
+ }
+
+ /**
+ * Get all the log data
+ *
+ * @return array LogItem array, log data
+ */
+ public function getLogItems() {
+ return $this->logitems;
+ }
+
+ /**
+ * Set the log data
+ *
+ * @param array $logitems
+ * LogItem array, log data
+ */
+ public function setLogItems($logitems) {
+ $this->logitems = $logitems;
+ }
+
+ /**
+ * Get log source
+ *
+ * @return string log source
+ */
+ public function getSource() {
+ return $this->source;
+ }
+
+ /**
+ * set log source
+ *
+ * @param string $source
+ * log source
+ */
+ public function setSource($source) {
+ $this->source = $source;
+ }
+ /**
+ * set shard key
+ *
+ * @param string shardkey
+ */
+ public function setShardKey($key){
+ $this -> shardKey=$key;
+ }
+ /**
+ * get shard key
+ *
+ * @return string shardKey
+ */
+ public function getShardKey(){
+ return $this ->shardKey;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RemoveConfigFromMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RemoveConfigFromMachineGroupRequest.php
new file mode 100644
index 00000000..193c2f8a
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RemoveConfigFromMachineGroupRequest.php
@@ -0,0 +1,40 @@
+groupName = $groupName;
+ $this->configName = $configName;
+ }
+ public function getGroupName(){
+ return $this->groupName;
+ }
+ public function setGroupName($groupName){
+ $this->groupName = $groupName;
+ }
+
+ public function getConfigName(){
+ return $this->configName;
+ }
+ public function setConfigName($configName){
+ $this->configName = $configName;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/Request.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/Request.php
new file mode 100644
index 00000000..43efbc2d
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/Request.php
@@ -0,0 +1,47 @@
+project = $project;
+ }
+
+ /**
+ * Get project name
+ *
+ * @return string project name
+ */
+ public function getProject() {
+ return $this->project;
+ }
+
+ /**
+ * Set project name
+ *
+ * @param string $project
+ * project name
+ */
+ public function setProject($project) {
+ $this->project = $project;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RetryShipperTasksRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RetryShipperTasksRequest.php
new file mode 100644
index 00000000..36343a9a
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/RetryShipperTasksRequest.php
@@ -0,0 +1,70 @@
+taskLists;
+ }
+
+ /**
+ * @param mixed $taskLists
+ */
+ public function setTaskLists($taskLists)
+ {
+ $this->taskLists = $taskLists;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLogStore()
+ {
+ return $this->logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/SplitShardRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/SplitShardRequest.php
new file mode 100644
index 00000000..129b87e5
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/SplitShardRequest.php
@@ -0,0 +1,44 @@
+logstore = $logstore;
+ $this->shardId = $shardId;
+ $this->midHash = $midHash;
+ }
+
+ public function getLogstore(){
+ return $this->logstore;
+ }
+
+ public function setLogstore($logstore){
+ $this->logstore = $logstore;
+ }
+
+ public function getShardId(){
+ return $this->shardId;
+ }
+ public function getMidHash(){
+ return $this->midHash;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateACLRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateACLRequest.php
new file mode 100644
index 00000000..f9cc97d8
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateACLRequest.php
@@ -0,0 +1,31 @@
+acl = $acl;
+ }
+
+ public function getAcl(){
+ return $this->acl;
+ }
+ public function setAcl($acl){
+ $this->acl = $acl;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateConfigRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateConfigRequest.php
new file mode 100644
index 00000000..6549594b
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateConfigRequest.php
@@ -0,0 +1,33 @@
+config = $config;
+ }
+
+ public function getConfig(){
+ return $this->config;
+ }
+
+ public function setConfig($config){
+ $this->config = $config;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateLogstoreRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateLogstoreRequest.php
new file mode 100644
index 00000000..874a70a9
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateLogstoreRequest.php
@@ -0,0 +1,42 @@
+ logstore = $logstore;
+ $this -> ttl = $ttl;
+ $this -> shardCount = $shardCount;
+ }
+ public function getLogstore()
+ {
+ return $this -> logstore;
+ }
+ public function getTtl()
+ {
+ return $this -> ttl;
+ }
+ public function getShardCount()
+ {
+ return $this -> shardCount;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateMachineGroupRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateMachineGroupRequest.php
new file mode 100644
index 00000000..719ef6eb
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateMachineGroupRequest.php
@@ -0,0 +1,34 @@
+machineGroup = $machineGroup;
+ }
+
+ public function getMachineGroup(){
+ return $this->machineGroup;
+ }
+
+ public function setMachineGroup($machineGroup){
+ $this->machineGroup = $machineGroup;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateShipperRequest.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateShipperRequest.php
new file mode 100644
index 00000000..fe687ed9
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Request/UpdateShipperRequest.php
@@ -0,0 +1,89 @@
+logStore;
+ }
+
+ /**
+ * @param mixed $logStore
+ */
+ public function setLogStore($logStore)
+ {
+ $this->logStore = $logStore;
+ }
+
+ /**
+ * Aliyun_Log_Models_CreateShipperRequest Constructor
+ *
+ */
+ public function __construct($project) {
+ parent::__construct ( $project );
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getShipperName()
+ {
+ return $this->shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetType()
+ {
+ return $this->targetType;
+ }
+
+ /**
+ * @param mixed $targetType
+ */
+ public function setTargetType($targetType)
+ {
+ $this->targetType = $targetType;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetConfigration()
+ {
+ return $this->targetConfigration;
+ }
+
+ /**
+ * @param mixed $targetConfigration
+ */
+ public function setTargetConfigration($targetConfigration)
+ {
+ $this->targetConfigration = $targetConfigration;
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ApplyConfigToMachineGroupResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ApplyConfigToMachineGroupResponse.php
new file mode 100644
index 00000000..253e1ac9
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ApplyConfigToMachineGroupResponse.php
@@ -0,0 +1,29 @@
+logPackageList = $resp->getLogGroupListArray();
+ $this->nextCursor = (isset($header['x-log-cursor']))?$header['x-log-cursor']:null;
+
+ }
+
+ public function getLogPackageList(){
+ return $this->logPackageList;
+ }
+
+ public function getNextCursor(){
+ return $this->nextCursor;
+ }
+
+ public function getCount() {
+ return count($this->logPackageList);
+ }
+
+ public function getLogPackage($index){
+ if($index<$this->getCount()){
+ return $this->logPackageList[$index];
+ }
+ else{
+ throw new OutOfBoundsException('Index must less than size of logPackageList');
+ }
+ }
+
+ public function getLogGroupList(){
+ return $this->logPackageList;
+ }
+
+ public function getLogGroup($index){
+ if($index<$this->getCount()){
+ return $this->logPackageList[$index];
+ }
+ else{
+ throw new OutOfBoundsException('Index must less than size of logPackageList');
+ }
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateACLResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateACLResponse.php
new file mode 100644
index 00000000..c075b602
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateACLResponse.php
@@ -0,0 +1,33 @@
+aclId = $resp['aclId'];
+ }
+ public function getAclId(){
+ return $this->aclId;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateConfigResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateConfigResponse.php
new file mode 100644
index 00000000..99e22630
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/CreateConfigResponse.php
@@ -0,0 +1,29 @@
+acl = null;
+ if($resp!==null){
+ $this->acl = new Aliyun_Log_Models_ACL();
+ $this->acl->setFromArray($resp);
+ }
+ }
+
+ public function getAcl(){
+ return $this->acl;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetConfigResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetConfigResponse.php
new file mode 100644
index 00000000..a4619a2f
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetConfigResponse.php
@@ -0,0 +1,37 @@
+config = new Aliyun_Log_Models_Config();
+ $this->config->setFromArray($resp);
+ }
+
+ public function getConfig(){
+ return $this->config;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetCursorResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetCursorResponse.php
new file mode 100644
index 00000000..320c0e91
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetCursorResponse.php
@@ -0,0 +1,41 @@
+cursor = $resp['cursor'];
+ }
+
+ /**
+ * Get cursor from the response
+ *
+ * @return string cursor
+ */
+ public function getCursor(){
+ return $this->cursor;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetHistogramsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetHistogramsResponse.php
new file mode 100644
index 00000000..9e8c6b28
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetHistogramsResponse.php
@@ -0,0 +1,77 @@
+
+
+ /**
+ * Aliyun_Log_Models_GetHistogramsResponse constructor
+ *
+ * @param array $resp
+ * GetHistogramsResponse HTTP response body
+ * @param array $header
+ * GetHistogramsResponse HTTP response header
+ */
+ public function __construct($resp, $header) {
+ parent::__construct ( $header );
+ $this->progress = $header ['x-log-progress'];
+ $this->count = $header ['x-log-count'];
+ $this->histograms = array ();
+ foreach ( $resp as $data )
+ $this->histograms [] = new Aliyun_Log_Models_Histogram ( $data ['from'], $data ['to'], $data ['count'], $data ['progress'] );
+ }
+
+ /**
+ * Check if the histogram is completed
+ *
+ * @return bool true if this histogram is completed
+ */
+ public function isCompleted() {
+ return $this->progress == 'Complete';
+ }
+
+ /**
+ * Get total logs' count that current query hits
+ *
+ * @return integer total logs' count that current query hits
+ */
+ public function getTotalCount() {
+ return $this->count;
+ }
+
+ /**
+ * Get histograms on the requested time range: [from, to)
+ *
+ * @return array Aliyun_Log_Models_Histogram array, histograms on the requested time range
+ */
+ public function getHistograms() {
+ return $this->histograms;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetLogsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetLogsResponse.php
new file mode 100644
index 00000000..d56dc0cf
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetLogsResponse.php
@@ -0,0 +1,81 @@
+count = $header['x-log-count'];
+ $this->progress = $header ['x-log-progress'];
+ $this->logs = array ();
+ foreach ( $resp as $data ) {
+ $contents = $data;
+ $time = $data ['__time__'];
+ $source = $data ['__source__'];
+ unset ( $contents ['__time__'] );
+ unset ( $contents ['__source__'] );
+ $this->logs [] = new Aliyun_Log_Models_QueriedLog ( $time, $source, $contents );
+ }
+ }
+
+ /**
+ * Get log number from the response
+ *
+ * @return integer log number
+ */
+ public function getCount() {
+ return $this->count;
+ }
+
+ /**
+ * Check if the get logs query is completed
+ *
+ * @return bool true if this logs query is completed
+ */
+ public function isCompleted() {
+ return $this->progress == 'Complete';
+ }
+
+ /**
+ * Get all logs from the response
+ *
+ * @return array Aliyun_Log_Models_QueriedLog array, all log data
+ */
+ public function getLogs() {
+ return $this->logs;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineGroupResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineGroupResponse.php
new file mode 100644
index 00000000..3bb8b3cb
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineGroupResponse.php
@@ -0,0 +1,36 @@
+machineGroup = new Aliyun_Log_Models_MachineGroup();
+ $this->machineGroup->setFromArray($resp);
+ }
+
+ public function getMachineGroup(){
+ return $this->machineGroup;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineResponse.php
new file mode 100644
index 00000000..fe98f7f0
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetMachineResponse.php
@@ -0,0 +1,38 @@
+machine = new Aliyun_Log_Models_Machine();
+ $this->machine->setFromArray($resp);
+
+ }
+
+ public function getMachine(){
+ return $this->machine;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperConfigResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperConfigResponse.php
new file mode 100644
index 00000000..15ceb15d
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperConfigResponse.php
@@ -0,0 +1,81 @@
+shipperName;
+ }
+
+ /**
+ * @param mixed $shipperName
+ */
+ public function setShipperName($shipperName)
+ {
+ $this->shipperName = $shipperName;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetType()
+ {
+ return $this->targetType;
+ }
+
+ /**
+ * @param mixed $targetType
+ */
+ public function setTargetType($targetType)
+ {
+ $this->targetType = $targetType;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTargetConfigration()
+ {
+ return $this->targetConfigration;
+ }
+
+ /**
+ * @param mixed $targetConfigration
+ */
+ public function setTargetConfigration($targetConfigration)
+ {
+ $this->targetConfigration = $targetConfigration;
+ }
+
+
+
+ /**
+ * Aliyun_Log_Models_GetShipperConfigResponse constructor
+ *
+ * @param array $resp
+ * GetLogs HTTP response body
+ * @param array $header
+ * GetLogs HTTP response header
+ */
+ public function __construct($resp, $header) {
+ parent::__construct ( $header );
+ $this->shipperName = $resp['shipperName'];
+ $this->targetConfigration = $resp['targetConfiguration'];
+ $this->targetType = $resp['targetType'];
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperTasksResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperTasksResponse.php
new file mode 100644
index 00000000..bb2f7ba2
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/GetShipperTasksResponse.php
@@ -0,0 +1,97 @@
+total = $resp['total'];
+ $this->count = $resp['count'];
+ $this->statistics = $resp['statistics'];
+ $this->tasks = $resp['tasks'];
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCount()
+ {
+ return $this->count;
+ }
+
+ /**
+ * @param mixed $count
+ */
+ public function setCount($count)
+ {
+ $this->count = $count;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTotal()
+ {
+ return $this->total;
+ }
+
+ /**
+ * @param mixed $total
+ */
+ public function setTotal($total)
+ {
+ $this->total = $total;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getStatistics()
+ {
+ return $this->statistics;
+ }
+
+ /**
+ * @param mixed $statistics
+ */
+ public function setStatistics($statistics)
+ {
+ $this->statistics = $statistics;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTasks()
+ {
+ return $this->tasks;
+ }
+
+ /**
+ * @param mixed $tasks
+ */
+ public function setTasks($tasks)
+ {
+ $this->tasks = $tasks;
+ }
+
+
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListACLsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListACLsResponse.php
new file mode 100644
index 00000000..ca3bf202
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListACLsResponse.php
@@ -0,0 +1,44 @@
+setFromArray($value);
+ $aclArr[]=$aclObj;
+ }
+ }
+ $this->acls = $aclArr;
+ }
+
+ public function getAcls(){
+ return $this->acls;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListConfigsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListConfigsResponse.php
new file mode 100644
index 00000000..fcaf0a72
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListConfigsResponse.php
@@ -0,0 +1,44 @@
+size = $resp['total'];
+ $this->configs = $resp['configs'];
+ }
+
+ public function getSize(){
+ return count($this->configs);
+ }
+
+ public function getTotal(){
+ return $this ->total;
+ }
+
+ public function getConfigs(){
+ return $this->configs;
+ }
+
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListLogstoresResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListLogstoresResponse.php
new file mode 100644
index 00000000..b62c72ae
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListLogstoresResponse.php
@@ -0,0 +1,57 @@
+count = $resp ['total'];
+ $this->logstores = $resp ['logstores'];
+ }
+
+ /**
+ * Get total count of logstores from the response
+ *
+ * @return integer the number of total logstores from the response
+ */
+ public function getCount() {
+ return $this->count;
+ }
+
+ /**
+ * Get all the logstores from the response
+ *
+ * @return array all logstore
+ */
+ public function getLogstores() {
+ return $this->logstores;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListMachineGroupsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListMachineGroupsResponse.php
new file mode 100644
index 00000000..84b3443d
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListMachineGroupsResponse.php
@@ -0,0 +1,45 @@
+offset = $resp['offset'];
+ $this->size = $resp['size'];
+ $this->machineGroups = $resp['machinegroups'];
+ }
+
+ public function getOffset(){
+ return $this->offset;
+ }
+
+ public function getSize(){
+ return $this->size;
+ }
+
+ public function getMachineGroups(){
+ return $this->machineGroups;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShardsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShardsResponse.php
new file mode 100644
index 00000000..71eea160
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShardsResponse.php
@@ -0,0 +1,42 @@
+$value){
+ $this->shardIds[] = $value['shardID'];
+ $this->shards[] = new Aliyun_Log_Models_Shard($value['shardID'],$value["status"],$value["inclusiveBeginKey"],$value["exclusiveEndKey"],$value["createTime"]);
+ }
+ }
+
+ public function getShardIds(){
+ return $this-> shardIds;
+ }
+ public function getShards()
+ {
+ return $this -> shards;
+ }
+
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShipperResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShipperResponse.php
new file mode 100644
index 00000000..d147161c
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListShipperResponse.php
@@ -0,0 +1,78 @@
+count;
+ }
+
+ /**
+ * @param mixed $count
+ */
+ public function setCount($count)
+ {
+ $this->count = $count;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getTotal()
+ {
+ return $this->total;
+ }
+
+ /**
+ * @param mixed $total
+ */
+ public function setTotal($total)
+ {
+ $this->total = $total;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getShippers()
+ {
+ return $this->shippers;
+ }
+
+ /**
+ * @param mixed $shippers
+ */
+ public function setShippers($shippers)
+ {
+ $this->shippers = $shippers;
+ }
+
+
+ /**
+ * Aliyun_Log_Models_ListShipperResponse constructor
+ *
+ * @param array $resp
+ * GetLogs HTTP response body
+ * @param array $header
+ * GetLogs HTTP response header
+ */
+ public function __construct($resp, $header) {
+ parent::__construct ( $header );
+ $this->count = $resp['count'];
+ $this->total = $resp['total'];
+ $this->shippers = $resp['shipper'];
+ }
+}
\ No newline at end of file
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListTopicsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListTopicsResponse.php
new file mode 100644
index 00000000..a41a9eda
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/ListTopicsResponse.php
@@ -0,0 +1,73 @@
+count = $header['x-log-count'];
+ $this->topics = $resp ;
+ $this->nextToken = isset ( $header['x-log-nexttoken'] ) ? $header['x-log-nexttoken'] : NULL;
+ }
+
+ /**
+ * Get the number of all the topics from the response
+ *
+ * @return integer the number of all the topics from the response
+ */
+ public function getCount() {
+ return $this->count;
+ }
+
+ /**
+ * Get all the topics from the response
+ *
+ * @return array topics list
+ */
+ public function getTopics() {
+ return $this->topics;
+ }
+
+ /**
+ * Return the next token from the response. If there is no more topic to list, it will return None
+ *
+ * @return string/null next token used to list more topics
+ */
+ public function getNextToken() {
+ return $this->nextToken;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/PutLogsResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/PutLogsResponse.php
new file mode 100644
index 00000000..c68191f1
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/PutLogsResponse.php
@@ -0,0 +1,24 @@
+time = $time;
+ $this->source = $source;
+ $this->contents = $contents; // deep copy
+ }
+
+ /**
+ * Get log source
+ *
+ * @return string log source
+ */
+ public function getSource() {
+ return $this->source;
+ }
+
+ /**
+ * Get log time
+ *
+ * @return integer log time
+ */
+ public function getTime() {
+ return $this->time;
+ }
+
+ /**
+ * Get log contents, content many key/value pair.
+ *
+ * @return array log contents
+ */
+ public function getContents() {
+ return $this->contents;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RemoveConfigFromMachineGroupResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RemoveConfigFromMachineGroupResponse.php
new file mode 100644
index 00000000..a4737f6b
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RemoveConfigFromMachineGroupResponse.php
@@ -0,0 +1,28 @@
+headers = $headers;
+ }
+
+ /**
+ * Get all http headers
+ *
+ * @return array HTTP response header
+ */
+ public function getAllHeaders() {
+ return $this->headers;
+ }
+
+ /**
+ * Get specified http header
+ *
+ * @param string $key
+ * key to get header
+ *
+ * @return string HTTP response header. '' will be return if not set.
+ */
+ public function getHeader($key) {
+ return isset ($this->headers[$key]) ? $this->headers [$key] : '';
+ }
+
+ /**
+ * Get the request id of the response. '' will be return if not set.
+ *
+ * @return string request id
+ */
+ public function getRequestId() {
+ return isset ( $this->headers ['x-log-requestid'] ) ? $this->headers ['x-log-requestid'] : '';
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RetryShipperTasksResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RetryShipperTasksResponse.php
new file mode 100644
index 00000000..a666b1a9
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/RetryShipperTasksResponse.php
@@ -0,0 +1,22 @@
+shardId=$shardId;
+ $this->status = $status;
+ $this->inclusiveBeginKey = $inclusiveBeginKey;
+ $this->exclusiveEndKey = $exclusiveEndKey;
+ $this->createTime = $createTime;
+ }
+
+ /**
+ * Get the shardId
+ *
+ * @return integer the shard id
+ */
+ public function getShardId(){
+ return $this -> shardId;
+ }
+ /**
+ * Get the shard status
+ *
+ * @return string the shard status
+ */
+ public function getStatus(){
+ return $this -> status;
+ }
+ /**
+ * Get the shard inclusive begin key
+ *
+ * @return string inclusive begin key
+ */
+ public function getInclusiveBeginKey(){
+ return $this -> inclusiveBeginKey;
+ }
+ /**
+ * Get the shard exclusive begin key
+ *
+ * @return string exclusive begin key
+ */
+ public function getExclusiveBeginKey(){
+ return $this -> exclusiveBeginKey;
+ }
+ /**
+ * Get the shard create time
+ *
+ * @return integer createTime
+ */
+ public function getCreateTime(){
+ return $this -> createTime;
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/UpdateACLResponse.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/UpdateACLResponse.php
new file mode 100644
index 00000000..4c58a82e
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Models/Response/UpdateACLResponse.php
@@ -0,0 +1,29 @@
+maxCacheLog = 100;
+ }else{
+ $this->maxCacheLog = $maxCacheLog;
+ }
+
+ if(NULL === $maxCacheBytes || !is_integer($maxCacheBytes)){
+ $this->maxCacheBytes = 256 * 1024;
+ }else{
+ $this->maxCacheBytes = $maxCacheBytes;
+ }
+
+ if(NULL === $maxWaitTime || !is_integer($maxWaitTime)){
+ $this->maxWaitTime = 5;
+ }else{
+ $this->maxWaitTime = $maxWaitTime;
+ }
+ if($client == null || $project == null || $logstore == null){
+ throw new Exception('the input parameter is invalid! create SimpleLogger failed!');
+ }
+ $this->client = $client;
+ $this->project = $project;
+ $this->logstore = $logstore;
+ $this->topic = $topic;
+ $this->previousLogTime = time();
+ $this->cacheBytes = 0;
+ }
+
+ /**
+ * add logItem to cached array, and post the cached messages when cache reach the limitation
+ * @param $cur_time
+ * @param $logItem
+ */
+ private function logItem($cur_time, $logItem){
+ array_push($this->logItems, $logItem);
+ if ($cur_time - $this->previousLogTime >= $this->maxWaitTime || sizeof($this->logItems) >= $this->maxCacheLog
+ || $this->cacheBytes >= $this->maxCacheBytes)
+ {
+ $this->logBatch($this->logItems, $this->topic);
+ $this->logItems = [];
+ $this->previousLogTime = time();
+ $this->cacheBytes = 0;
+ }
+ }
+
+ /**
+ * log single string message
+ * @param Aliyun_Log_Models_LogLevel_LogLevel $logLevel
+ * @param $logMessage
+ * @throws Exception
+ */
+ private function logSingleMessage(Aliyun_Log_Models_LogLevel_LogLevel $logLevel, $logMessage){
+ if(is_array($logMessage)){
+ throw new Exception('array is not supported in this function, please use logArrayMessage!');
+ }
+ $cur_time = time();
+ $contents = array( // key-value pair
+ 'time'=>date('m/d/Y h:i:s a', $cur_time),
+ 'loglevel'=> Aliyun_Log_Models_LogLevel_LogLevel::getLevelStr($logLevel),
+ 'msg'=>$logMessage
+ );
+ $this->cacheBytes += strlen($logMessage) + 32;
+ $logItem = new Aliyun_Log_Models_LogItem();
+ $logItem->setTime($cur_time);
+ $logItem->setContents($contents);
+ $this->logItem($cur_time, $logItem);
+ }
+
+ /**
+ * log array message
+ * @param Aliyun_Log_Models_LogLevel_LogLevel $logLevel
+ * @param $logMessage
+ * @throws Exception
+ */
+ private function logArrayMessage(Aliyun_Log_Models_LogLevel_LogLevel $logLevel, $logMessage){
+ if(!is_array($logMessage)){
+ throw new Exception('input message is not array, please use logSingleMessage!');
+ }
+ $cur_time = time();
+ $contents = array( // key-value pair
+ 'time'=>date('m/d/Y h:i:s a', $cur_time)
+ );
+ $contents['logLevel'] = Aliyun_Log_Models_LogLevel_LogLevel::getLevelStr($logLevel);
+ foreach ($logMessage as $key => $value)
+ {
+ $contents[$key] = $value;
+ $this->cacheBytes += strlen($key) + strlen($value);
+ }
+ $this->cacheBytes += 32;
+ $logItem = new Aliyun_Log_Models_LogItem();
+ $logItem->setTime($cur_time);
+ $logItem->setContents($contents);
+ $this->logItem($cur_time, $logItem);
+ }
+
+ /**
+ * submit string log message with info level
+ * @param $logMessage
+ */
+ public function info( $logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelInfo();
+ $this->logSingleMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit string log message with debug level
+ * @param $logMessage
+ */
+ public function debug($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelDebug();
+ $this->logSingleMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit string log message with warn level
+ * @param $logMessage
+ */
+ public function warn($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelWarn();
+ $this->logSingleMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit string log message with error level
+ * @param $logMessage
+ */
+ public function error($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelError();
+ $this->logSingleMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit array log message with info level
+ * @param $logMessage
+ */
+ public function infoArray($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelInfo();
+ $this->logArrayMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit array log message with debug level
+ * @param $logMessage
+ */
+ public function debugArray($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelDebug();
+ $this->logArrayMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit array log message with warn level
+ * @param $logMessage
+ */
+ public function warnArray($logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelWarn();
+ $this->logArrayMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * submit array log message with error level
+ * @param $logMessage
+ */
+ public function errorArray( $logMessage){
+ $logLevel = Aliyun_Log_Models_LogLevel_LogLevel::getLevelError();
+ $this->logArrayMessage($logLevel, $logMessage);
+ }
+
+ /**
+ * get current machine IP
+ * @return string
+ */
+ private function getLocalIp(){
+ $local_ip = getHostByName(php_uname('n'));
+ if(strlen($local_ip) == 0){
+ $local_ip = getHostByName(getHostName());
+ }
+ return $local_ip;
+ }
+
+ /**
+ * submit log messages in bulk
+ * @param $logItems
+ * @param $topic
+ */
+ private function logBatch($logItems, $topic){
+ $ip = $this->getLocalIp();
+ $request = new Aliyun_Log_Models_PutLogsRequest($this->project, $this->logstore,
+ $topic, $ip, $logItems);
+ $error_exception = NULL;
+ for($i = 0 ; $i < 3 ; $i++)
+ {
+ try{
+ $response = $this->client->putLogs($request);
+ return;
+ } catch (Aliyun_Log_Exception $ex) {
+ $error_exception = $ex;
+ } catch (Exception $ex) {
+ var_dump($ex);
+ $error_exception = $ex;
+ }
+ }
+ if ($error_exception != NULL)
+ {
+ var_dump($error_exception);
+ }
+ }
+
+ /**
+ * manually flush all cached log to log server
+ */
+ public function logFlush(){
+ if(sizeof($this->logItems) > 0){
+ $this->logBatch($this->logItems, $this->topic);
+ $this->logItems = [];
+ $this->previousLogTime= time();
+ $this->cacheBytes = 0;
+ }
+ }
+
+ function __destruct() {
+ if(sizeof($this->logItems) > 0){
+ $this->logBatch($this->logItems, $this->topic);
+ }
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/Util.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Util.php
new file mode 100644
index 00000000..47f6c53e
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/Util.php
@@ -0,0 +1,187 @@
+255)
+ return 0;
+ return preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $gonten);
+ }
+
+ /**
+ * Calculate string $value MD5.
+ *
+ * @return string
+ */
+ public static function calMD5($value) {
+ return strtoupper(md5($value));
+ }
+
+ /**
+ * Calculate string $content hmacSHA1 with secret key $key.
+ *
+ * @return string
+ */
+ public static function hmacSHA1($content, $key) {
+ $signature = hash_hmac("sha1", $content, $key, true);
+ return base64_encode($signature);
+ }
+
+ /**
+ * Change $logGroup to bytes.
+ *
+ * @return string
+ */
+ public static function toBytes($logGroup) {
+ $mem = fopen("php://memory", "rwb");
+ $logGroup->write($mem);
+ rewind($mem);
+ $bytes="";
+
+ if(feof($mem)===false){
+ $bytes = fread($mem, 10*1024*1024);
+ }
+ fclose($mem);
+
+ return $bytes;
+
+ //$mem = fopen("php://memory", "wb");
+ /* $fiveMBs = 5*1024*1024;
+ $mem = fopen("php://temp/maxmemory:$fiveMBs", 'rwb');
+ $logGroup->write($mem);
+ // rewind($mem);
+
+ // fclose($mem);
+ //d://logGroup.pdoc
+ // $mem = fopen("php://memory", "rb");
+ // $mem = fopen("php://temp/maxmemory:$fiveMBs", 'r+');
+ $bytes;
+ while(!feof($mem))
+ $bytes = fread($mem, 10*1024*1024);
+ fclose($mem);
+ //test
+ if($bytes===false)echo "fread fail";
+ return $bytes;*/
+
+ }
+
+
+ /**
+ * Get url encode.
+ *
+ * @return string
+ */
+ public static function urlEncodeValue($value) {
+ return urlencode ( $value );
+ }
+
+ /**
+ * Get url encode.
+ *
+ * @return string
+ */
+ public static function urlEncode($params) {
+ ksort ( $params );
+ $url = "";
+ $first = true;
+ foreach ( $params as $key => $value ) {
+ $val = Aliyun_Log_Util::urlEncodeValue ( $value );
+ if ($first) {
+ $first = false;
+ $url = "$key=$val";
+ } else
+ $url .= "&$key=$val";
+ }
+ return $url;
+ }
+
+ /**
+ * Get canonicalizedLOGHeaders string as defined.
+ *
+ * @return string
+ */
+ public static function canonicalizedLOGHeaders($header) {
+ ksort ( $header );
+ $content = '';
+ $first = true;
+ foreach ( $header as $key => $value )
+ if (strpos ( $key, "x-log-" ) === 0 || strpos ( $key, "x-acs-" ) === 0) { // x-log- header
+ if ($first) {
+ $content .= $key . ':' . $value;
+ $first = false;
+ } else
+ $content .= "\n" . $key . ':' . $value;
+ }
+ return $content;
+ }
+
+ /**
+ * Get canonicalizedResource string as defined.
+ *
+ * @return string
+ */
+ public static function canonicalizedResource($resource, $params) {
+ if ($params) {
+ ksort ( $params );
+ $urlString = "";
+ $first = true;
+ foreach ( $params as $key => $value ) {
+ if ($first) {
+ $first = false;
+ $urlString = "$key=$value";
+ } else
+ $urlString .= "&$key=$value";
+ }
+ return $resource . '?' . $urlString;
+ }
+ return $resource;
+ }
+
+ /**
+ * Get request authorization string as defined.
+ *
+ * @return string
+ */
+ public static function getRequestAuthorization($method, $resource, $key,$stsToken, $params, $headers) {
+ if (! $key)
+ return '';
+ $content = $method . "\n";
+ if (isset ( $headers ['Content-MD5'] ))
+ $content .= $headers ['Content-MD5'];
+ $content .= "\n";
+ if (isset ( $headers ['Content-Type'] ))
+ $content .= $headers ['Content-Type'];
+ $content .= "\n";
+ $content .= $headers ['Date'] . "\n";
+ $content .= Aliyun_Log_Util::canonicalizedLOGHeaders ( $headers ) . "\n";
+ $content .= Aliyun_Log_Util::canonicalizedResource ( $resource, $params );
+ return Aliyun_Log_Util::hmacSHA1 ( $content, $key );
+ }
+
+}
+
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/log.proto.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/log.proto.php
new file mode 100644
index 00000000..2d8b952f
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/log.proto.php
@@ -0,0 +1,629 @@
+read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("Log_Content: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->key_ = $tmp;
+ $limit-=$len;
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->value_ = $tmp;
+ $limit-=$len;
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->key_)) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, strlen($this->key_));
+ fwrite($fp, $this->key_);
+ }
+ if (!is_null($this->value_)) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, strlen($this->value_));
+ fwrite($fp, $this->value_);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->key_)) {
+ $l = strlen($this->key_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->value_)) {
+ $l = strlen($this->value_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ if ($this->key_ === null) return false;
+ if ($this->value_ === null) return false;
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('key_', $this->key_)
+ . Protobuf::toString('value_', $this->value_);
+ }
+
+ // required string key = 1;
+
+ private $key_ = null;
+ public function clearKey() { $this->key_ = null; }
+ public function hasKey() { return $this->key_ !== null; }
+ public function getKey() { if($this->key_ === null) return ""; else return $this->key_; }
+ public function setKey($value) { $this->key_ = $value; }
+
+ // required string value = 2;
+
+ private $value_ = null;
+ public function clearValue() { $this->value_ = null; }
+ public function hasValue() { return $this->value_ !== null; }
+ public function getValue() { if($this->value_ === null) return ""; else return $this->value_; }
+ public function setValue($value) { $this->value_ = $value; }
+
+ // @@protoc_insertion_point(class_scope:Log.Content)
+}
+
+// message Log
+class Log {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("Log: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 0');
+ $tmp = Protobuf::read_varint($fp, $limit);
+ if ($tmp === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $this->time_ = $tmp;
+
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->contents_[] = new Log_Content($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->time_)) {
+ fwrite($fp, "\x08");
+ Protobuf::write_varint($fp, $this->time_);
+ }
+ if (!is_null($this->contents_))
+ foreach($this->contents_ as $v) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->time_)) {
+ $size += 1 + Protobuf::size_varint($this->time_);
+ }
+ if (!is_null($this->contents_))
+ foreach($this->contents_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ if ($this->time_ === null) return false;
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('time_', $this->time_)
+ . Protobuf::toString('contents_', $this->contents_);
+ }
+
+ // required uint32 time = 1;
+
+ private $time_ = null;
+ public function clearTime() { $this->time_ = null; }
+ public function hasTime() { return $this->time_ !== null; }
+ public function getTime() { if($this->time_ === null) return 0; else return $this->time_; }
+ public function setTime($value) { $this->time_ = $value; }
+
+ // repeated .Log.Content contents = 2;
+
+ private $contents_ = null;
+ public function clearContents() { $this->contents_ = null; }
+ public function getContentsCount() { if ($this->contents_ === null ) return 0; else return count($this->contents_); }
+ public function getContents($index) { return $this->contents_[$index]; }
+ public function getContentsArray() { if ($this->contents_ === null ) return array(); else return $this->contents_; }
+ public function setContents($index, $value) {$this->contents_[$index] = $value; }
+ public function addContents($value) { $this->contents_[] = $value; }
+ public function addAllContents(array $values) { foreach($values as $value) {$this->contents_[] = $value;} }
+
+ // @@protoc_insertion_point(class_scope:Log)
+}
+
+// message LogGroup
+class LogGroup {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("LogGroup: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->logs_[] = new Log($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->reserved_ = $tmp;
+ $limit-=$len;
+ break;
+ case 3:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->topic_ = $tmp;
+ $limit-=$len;
+ break;
+ case 4:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->source_ = $tmp;
+ $limit-=$len;
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->logs_))
+ foreach($this->logs_ as $v) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ if (!is_null($this->reserved_)) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, strlen($this->reserved_));
+ fwrite($fp, $this->reserved_);
+ }
+ if (!is_null($this->topic_)) {
+ fwrite($fp, "\x1a");
+ Protobuf::write_varint($fp, strlen($this->topic_));
+ fwrite($fp, $this->topic_);
+ }
+ if (!is_null($this->source_)) {
+ fwrite($fp, "\"");
+ Protobuf::write_varint($fp, strlen($this->source_));
+ fwrite($fp, $this->source_);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->logs_))
+ foreach($this->logs_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->reserved_)) {
+ $l = strlen($this->reserved_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->topic_)) {
+ $l = strlen($this->topic_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->source_)) {
+ $l = strlen($this->source_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('logs_', $this->logs_)
+ . Protobuf::toString('reserved_', $this->reserved_)
+ . Protobuf::toString('topic_', $this->topic_)
+ . Protobuf::toString('source_', $this->source_);
+ }
+
+ // repeated .Log logs = 1;
+
+ private $logs_ = null;
+ public function clearLogs() { $this->logs_ = null; }
+ public function getLogsCount() { if ($this->logs_ === null ) return 0; else return count($this->logs_); }
+ public function getLogs($index) { return $this->logs_[$index]; }
+ public function getLogsArray() { if ($this->logs_ === null ) return array(); else return $this->logs_; }
+ public function setLogs($index, $value) {$this->logs_[$index] = $value; }
+ public function addLogs($value) { $this->logs_[] = $value; }
+ public function addAllLogs(array $values) { foreach($values as $value) {$this->logs_[] = $value;} }
+
+ // optional string reserved = 2;
+
+ private $reserved_ = null;
+ public function clearReserved() { $this->reserved_ = null; }
+ public function hasReserved() { return $this->reserved_ !== null; }
+ public function getReserved() { if($this->reserved_ === null) return ""; else return $this->reserved_; }
+ public function setReserved($value) { $this->reserved_ = $value; }
+
+ // optional string topic = 3;
+
+ private $topic_ = null;
+ public function clearTopic() { $this->topic_ = null; }
+ public function hasTopic() { return $this->topic_ !== null; }
+ public function getTopic() { if($this->topic_ === null) return ""; else return $this->topic_; }
+ public function setTopic($value) { $this->topic_ = $value; }
+
+ // optional string source = 4;
+
+ private $source_ = null;
+ public function clearSource() { $this->source_ = null; }
+ public function hasSource() { return $this->source_ !== null; }
+ public function getSource() { if($this->source_ === null) return ""; else return $this->source_; }
+ public function setSource($value) { $this->source_ = $value; }
+
+ // @@protoc_insertion_point(class_scope:LogGroup)
+}
+
+// message LogPackage
+class LogPackage {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("LogPackage: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->data_ = $tmp;
+ $limit-=$len;
+ break;
+ case 2:
+ ASSERT('$wire == 0');
+ $tmp = Protobuf::read_varint($fp, $limit);
+ if ($tmp === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $this->uncompressSize_ = $tmp;
+
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->data_)) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, strlen($this->data_));
+ fwrite($fp, $this->data_);
+ }
+ if (!is_null($this->uncompressSize_)) {
+ fwrite($fp, "\x10");
+ Protobuf::write_varint($fp, $this->uncompressSize_);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->data_)) {
+ $l = strlen($this->data_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->uncompressSize_)) {
+ $size += 1 + Protobuf::size_varint($this->uncompressSize_);
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ if ($this->data_ === null) return false;
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('data_', $this->data_)
+ . Protobuf::toString('uncompressSize_', $this->uncompressSize_);
+ }
+
+ // required bytes data = 1;
+
+ private $data_ = null;
+ public function clearData() { $this->data_ = null; }
+ public function hasData() { return $this->data_ !== null; }
+ public function getData() { if($this->data_ === null) return ""; else return $this->data_; }
+ public function setData($value) { $this->data_ = $value; }
+
+ // optional int32 uncompress_size = 2;
+
+ private $uncompressSize_ = null;
+ public function clearUncompressSize() { $this->uncompressSize_ = null; }
+ public function hasUncompressSize() { return $this->uncompressSize_ !== null; }
+ public function getUncompressSize() { if($this->uncompressSize_ === null) return 0; else return $this->uncompressSize_; }
+ public function setUncompressSize($value) { $this->uncompressSize_ = $value; }
+
+ // @@protoc_insertion_point(class_scope:LogPackage)
+}
+
+// message LogPackageList
+class LogPackageList {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("LogPackageList: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->packages_[] = new LogPackage($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->packages_))
+ foreach($this->packages_ as $v) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->packages_))
+ foreach($this->packages_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('packages_', $this->packages_);
+ }
+
+ // repeated .LogPackage packages = 1;
+
+ private $packages_ = null;
+ public function clearPackages() { $this->packages_ = null; }
+ public function getPackagesCount() { if ($this->packages_ === null ) return 0; else return count($this->packages_); }
+ public function getPackages($index) { return $this->packages_[$index]; }
+ public function getPackagesArray() { if ($this->packages_ === null ) return array(); else return $this->packages_; }
+ public function setPackages($index, $value) {$this->packages_[$index] = $value; }
+ public function addPackages($value) { $this->packages_[] = $value; }
+ public function addAllPackages(array $values) { foreach($values as $value) {$this->packages_[] = $value;} }
+
+ // @@protoc_insertion_point(class_scope:LogPackageList)
+}
+
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/protocolbuffers.inc.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/protocolbuffers.inc.php
new file mode 100644
index 00000000..9e363d7b
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/protocolbuffers.inc.php
@@ -0,0 +1,315 @@
+read($fp, $limit);
+ if (isset($str))
+ fclose($fp);
+ }
+ }
+}
+
+/**
+ * Class to aid in the parsing and creating of Protocol Buffer Messages
+ * This class should be included by the developer before they use a
+ * generated protobuf class.
+ *
+ * @author Andrew Brampton
+ *
+ */
+class Protobuf {
+
+ const TYPE_DOUBLE = 1; // double, exactly eight bytes on the wire.
+ const TYPE_FLOAT = 2; // float, exactly four bytes on the wire.
+ const TYPE_INT64 = 3; // int64, varint on the wire. Negative numbers
+ // take 10 bytes. Use TYPE_SINT64 if negative
+ // values are likely.
+ const TYPE_UINT64 = 4; // uint64, varint on the wire.
+ const TYPE_INT32 = 5; // int32, varint on the wire. Negative numbers
+ // take 10 bytes. Use TYPE_SINT32 if negative
+ // values are likely.
+ const TYPE_FIXED64 = 6; // uint64, exactly eight bytes on the wire.
+ const TYPE_FIXED32 = 7; // uint32, exactly four bytes on the wire.
+ const TYPE_BOOL = 8; // bool, varint on the wire.
+ const TYPE_STRING = 9; // UTF-8 text.
+ const TYPE_GROUP = 10; // Tag-delimited message. Deprecated.
+ const TYPE_MESSAGE = 11; // Length-delimited message.
+
+ const TYPE_BYTES = 12; // Arbitrary byte array.
+ const TYPE_UINT32 = 13; // uint32, varint on the wire
+ const TYPE_ENUM = 14; // Enum, varint on the wire
+ const TYPE_SFIXED32 = 15; // int32, exactly four bytes on the wire
+ const TYPE_SFIXED64 = 16; // int64, exactly eight bytes on the wire
+ const TYPE_SINT32 = 17; // int32, ZigZag-encoded varint on the wire
+ const TYPE_SINT64 = 18; // int64, ZigZag-encoded varint on the wire
+
+ /**
+ * Returns a string representing this wiretype
+ */
+ public static function get_wiretype($wire_type) {
+ switch ($wire_type) {
+ case 0: return 'varint';
+ case 1: return '64-bit';
+ case 2: return 'length-delimited';
+ case 3: return 'group start';
+ case 4: return 'group end';
+ case 5: return '32-bit';
+ default: return 'unknown';
+ }
+ }
+
+ /**
+ * Returns how big (in bytes) this number would be as a varint
+ */
+ public static function size_varint($i) {
+/* $len = 0;
+ do {
+ $i = $i >> 7;
+ $len++;
+ } while ($i != 0);
+ return $len;
+*/
+ // TODO Change to a binary search
+ if ($i < 0x80)
+ return 1;
+ if ($i < 0x4000)
+ return 2;
+ if ($i < 0x200000)
+ return 3;
+ if ($i < 0x10000000)
+ return 4;
+ if ($i < 0x800000000)
+ return 5;
+ if ($i < 0x40000000000)
+ return 6;
+ if ($i < 0x2000000000000)
+ return 7;
+ if ($i < 0x100000000000000)
+ return 8;
+ if ($i < 0x8000000000000000)
+ return 9;
+ }
+
+ /**
+ * Tries to read a varint from $fp.
+ * @returns the Varint from the stream, or false if the stream has reached eof.
+ */
+ public static function read_varint($fp, &$limit = null) {
+ $value = '';
+ $len = 0;
+ do { // Keep reading until we find the last byte
+ $b = fread($fp, 1);
+ if ($b === false)
+ throw new Exception("read_varint(): Error reading byte");
+ if (strlen($b) < 1)
+ break;
+
+ $value .= $b;
+ $len++;
+ } while ($b >= "\x80");
+
+ if ($len == 0) {
+ if (feof($fp))
+ return false;
+ throw new Exception("read_varint(): Error reading byte");
+ }
+
+ if ($limit !== null)
+ $limit -= $len;
+
+ $i = 0;
+ $shift = 0;
+ for ($j = 0; $j < $len; $j++) {
+ $i |= ((ord($value[$j]) & 0x7F) << $shift);
+ $shift += 7;
+ }
+
+ return $i;
+ }
+
+ public static function read_double($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_float ($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_uint64($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_int64 ($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_uint32($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_int32 ($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_zint32($fp){throw new Exception("I've not coded it yet Exception");}
+ public static function read_zint64($fp){throw new Exception("I've not coded it yet Exception");}
+
+ /**
+ * Writes a varint to $fp
+ * returns the number of bytes written
+ * @param $fp
+ * @param $i The int to encode
+ * @return The number of bytes written
+ */
+ public static function write_varint($fp, $i) {
+ $len = 0;
+ do {
+ $v = $i & 0x7F;
+ $i = $i >> 7;
+
+ if ($i != 0)
+ $v |= 0x80;
+
+ if (fwrite($fp, chr($v)) !== 1)
+ throw new Exception("write_varint(): Error writing byte");
+
+ $len++;
+ } while ($i != 0);
+
+ return $len;
+ }
+
+ public static function write_double($fp, $d){throw new Exception("I've not coded it yet Exception");}
+ public static function write_float ($fp, $f){throw new Exception("I've not coded it yet Exception");}
+ public static function write_uint64($fp, $i){throw new Exception("I've not coded it yet Exception");}
+ public static function write_int64 ($fp, $i){throw new Exception("I've not coded it yet Exception");}
+ public static function write_uint32($fp, $i){throw new Exception("I've not coded it yet Exception");}
+ public static function write_int32 ($fp, $i){throw new Exception("I've not coded it yet Exception");}
+ public static function write_zint32($fp, $i){throw new Exception("I've not coded it yet Exception");}
+ public static function write_zint64($fp, $i){throw new Exception("I've not coded it yet Exception");}
+
+ /**
+ * Seek past a varint
+ */
+ public static function skip_varint($fp) {
+ $len = 0;
+ do { // Keep reading until we find the last byte
+ $b = fread($fp, 1);
+ if ($b === false)
+ throw new Exception("skip(varint): Error reading byte");
+ $len++;
+ } while ($b >= "\x80");
+ return $len;
+ }
+
+ /**
+ * Seek past the current field
+ */
+ public static function skip_field($fp, $wire_type) {
+ switch ($wire_type) {
+ case 0: // varint
+ return Protobuf::skip_varint($fp);
+
+ case 1: // 64bit
+ if (fseek($fp, 8, SEEK_CUR) === -1)
+ throw new Exception('skip(' . ProtoBuf::get_wiretype(1) . '): Error seeking');
+ return 8;
+
+ case 2: // length delimited
+ $varlen = 0;
+ $len = Protobuf::read_varint($fp, $varlen);
+ if (fseek($fp, $len, SEEK_CUR) === -1)
+ throw new Exception('skip(' . ProtoBuf::get_wiretype(2) . '): Error seeking');
+ return $len - $varlen;
+
+ //case 3: // Start group TODO we must keep looping until we find the closing end grou
+
+ //case 4: // End group - We should never skip a end group!
+ // return 0; // Do nothing
+
+ case 5: // 32bit
+ if (fseek($fp, 4, SEEK_CUR) === -1)
+ throw new Exception('skip('. ProtoBuf::get_wiretype(5) . '): Error seeking');
+ return 4;
+
+ default:
+ throw new Exception('skip('. ProtoBuf::get_wiretype($wire_type) . '): Unsupported wire_type');
+ }
+ }
+
+ /**
+ * Read a unknown field from the stream and return its raw bytes
+ */
+ public static function read_field($fp, $wire_type, &$limit = null) {
+ switch ($wire_type) {
+ case 0: // varint
+ return Protobuf::read_varint($fp, $limit);
+
+ case 1: // 64bit
+ $limit -= 8;
+ return fread($fp, 8);
+
+ case 2: // length delimited
+ $len = Protobuf::read_varint($fp, $limit);
+ $limit -= $len;
+ return fread($fp, $len);
+
+ //case 3: // Start group TODO we must keep looping until we find the closing end grou
+
+ //case 4: // End group - We should never skip a end group!
+ // return 0; // Do nothing
+
+ case 5: // 32bit
+ $limit -= 4;
+ return fread($fp, 4);
+
+ default:
+ throw new Exception('read_unknown('. ProtoBuf::get_wiretype($wire_type) . '): Unsupported wire_type');
+ }
+ }
+
+ /**
+ * Used to aid in pretty printing of Protobuf objects
+ */
+ private static $print_depth = 0;
+ private static $indent_char = "\t";
+ private static $print_limit = 50;
+
+ public static function toString($key, $value) {
+ if (is_null($value))
+ return;
+ $ret = str_repeat(self::$indent_char, self::$print_depth) . "$key=>";
+ if (is_array($value)) {
+ $ret .= "array(\n";
+ self::$print_depth++;
+ foreach($value as $i => $v)
+ $ret .= self::toString("[$i]", $v);
+ self::$print_depth--;
+ $ret .= str_repeat(self::$indent_char, self::$print_depth) . ")\n";
+ } else {
+ if (is_object($value)) {
+ self::$print_depth++;
+ $ret .= get_class($value) . "(\n";
+ $ret .= $value->__toString() . "\n";
+ self::$print_depth--;
+ $ret .= str_repeat(self::$indent_char, self::$print_depth) . ")\n";
+ } elseif (is_string($value)) {
+ $safevalue = addcslashes($value, "\0..\37\177..\377");
+ if (strlen($safevalue) > self::$print_limit) {
+ $safevalue = substr($safevalue, 0, self::$print_limit) . '...';
+ }
+
+ $ret .= '"' . $safevalue . '" (' . strlen($value) . " bytes)\n";
+
+ } elseif (is_bool($value)) {
+ $ret .= ($value ? 'true' : 'false') . "\n";
+ } else {
+ $ret .= (string)$value . "\n";
+ }
+ }
+ return $ret;
+ }
+}
+?>
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/requestcore.class.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/requestcore.class.php
new file mode 100644
index 00000000..89608d9b
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/requestcore.class.php
@@ -0,0 +1,1026 @@
+).
+ */
+ public $request_class = 'RequestCore';
+
+ /**
+ * The default class to use for HTTP Responses (defaults to ).
+ */
+ public $response_class = 'ResponseCore';
+
+ /**
+ * Default useragent string to use.
+ */
+ public $useragent = 'RequestCore/1.4.3';
+
+ /**
+ * File to read from while streaming up.
+ */
+ public $read_file = null;
+
+ /**
+ * The resource to read from while streaming up.
+ */
+ public $read_stream = null;
+
+ /**
+ * The size of the stream to read from.
+ */
+ public $read_stream_size = null;
+
+ /**
+ * The length already read from the stream.
+ */
+ public $read_stream_read = 0;
+
+ /**
+ * File to write to while streaming down.
+ */
+ public $write_file = null;
+
+ /**
+ * The resource to write to while streaming down.
+ */
+ public $write_stream = null;
+
+ /**
+ * Stores the intended starting seek position.
+ */
+ public $seek_position = null;
+
+ /**
+ * The location of the cacert.pem file to use.
+ */
+ public $cacert_location = false;
+
+ /**
+ * The state of SSL certificate verification.
+ */
+ public $ssl_verification = true;
+
+ /**
+ * The user-defined callback function to call when a stream is read from.
+ */
+ public $registered_streaming_read_callback = null;
+
+ /**
+ * The user-defined callback function to call when a stream is written to.
+ */
+ public $registered_streaming_write_callback = null;
+
+
+ /*%******************************************************************************************%*/
+ // CONSTANTS
+
+ /**
+ * GET HTTP Method
+ */
+ const HTTP_GET = 'GET';
+
+ /**
+ * POST HTTP Method
+ */
+ const HTTP_POST = 'POST';
+
+ /**
+ * PUT HTTP Method
+ */
+ const HTTP_PUT = 'PUT';
+
+ /**
+ * DELETE HTTP Method
+ */
+ const HTTP_DELETE = 'DELETE';
+
+ /**
+ * HEAD HTTP Method
+ */
+ const HTTP_HEAD = 'HEAD';
+
+
+ /*%******************************************************************************************%*/
+ // CONSTRUCTOR/DESTRUCTOR
+
+ /**
+ * Constructs a new instance of this class.
+ *
+ * @param string $url (Optional) The URL to request or service endpoint to query.
+ * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
+ * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
+ * @return $this A reference to the current instance.
+ */
+ public function __construct($url = null, $proxy = null, $helpers = null)
+ {
+ // Set some default values.
+ $this->request_url = $url;
+ $this->method = self::HTTP_GET;
+ $this->request_headers = array();
+ $this->request_body = '';
+
+ // Set a new Request class if one was set.
+ if (isset($helpers['request']) && !empty($helpers['request']))
+ {
+ $this->request_class = $helpers['request'];
+ }
+
+ // Set a new Request class if one was set.
+ if (isset($helpers['response']) && !empty($helpers['response']))
+ {
+ $this->response_class = $helpers['response'];
+ }
+
+ if ($proxy)
+ {
+ $this->set_proxy($proxy);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Destructs the instance. Closes opened file handles.
+ *
+ * @return $this A reference to the current instance.
+ */
+ public function __destruct()
+ {
+ if (isset($this->read_file) && isset($this->read_stream))
+ {
+ fclose($this->read_stream);
+ }
+
+ if (isset($this->write_file) && isset($this->write_stream))
+ {
+ fclose($this->write_stream);
+ }
+
+ return $this;
+ }
+
+
+ /*%******************************************************************************************%*/
+ // REQUEST METHODS
+
+ /**
+ * Sets the credentials to use for authentication.
+ *
+ * @param string $user (Required) The username to authenticate with.
+ * @param string $pass (Required) The password to authenticate with.
+ * @return $this A reference to the current instance.
+ */
+ public function set_credentials($user, $pass)
+ {
+ $this->username = $user;
+ $this->password = $pass;
+ return $this;
+ }
+
+ /**
+ * Adds a custom HTTP header to the cURL request.
+ *
+ * @param string $key (Required) The custom HTTP header to set.
+ * @param mixed $value (Required) The value to assign to the custom HTTP header.
+ * @return $this A reference to the current instance.
+ */
+ public function add_header($key, $value)
+ {
+ $this->request_headers[$key] = $value;
+ return $this;
+ }
+
+ /**
+ * Removes an HTTP header from the cURL request.
+ *
+ * @param string $key (Required) The custom HTTP header to set.
+ * @return $this A reference to the current instance.
+ */
+ public function remove_header($key)
+ {
+ if (isset($this->request_headers[$key]))
+ {
+ unset($this->request_headers[$key]);
+ }
+ return $this;
+ }
+
+ /**
+ * Set the method type for the request.
+ *
+ * @param string $method (Required) One of the following constants: , , , , .
+ * @return $this A reference to the current instance.
+ */
+ public function set_method($method)
+ {
+ $this->method = strtoupper($method);
+ return $this;
+ }
+
+ /**
+ * Sets a custom useragent string for the class.
+ *
+ * @param string $ua (Required) The useragent string to use.
+ * @return $this A reference to the current instance.
+ */
+ public function set_useragent($ua)
+ {
+ $this->useragent = $ua;
+ return $this;
+ }
+
+ /**
+ * Set the body to send in the request.
+ *
+ * @param string $body (Required) The textual content to send along in the body of the request.
+ * @return $this A reference to the current instance.
+ */
+ public function set_body($body)
+ {
+ $this->request_body = $body;
+ return $this;
+ }
+
+ /**
+ * Set the URL to make the request to.
+ *
+ * @param string $url (Required) The URL to make the request to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_request_url($url)
+ {
+ $this->request_url = $url;
+ return $this;
+ }
+
+ /**
+ * Set additional CURLOPT settings. These will merge with the default settings, and override if
+ * there is a duplicate.
+ *
+ * @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings.
+ * @return $this A reference to the current instance.
+ */
+ public function set_curlopts($curlopts)
+ {
+ $this->curlopts = $curlopts;
+ return $this;
+ }
+
+ /**
+ * Sets the length in bytes to read from the stream while streaming up.
+ *
+ * @param integer $size (Required) The length in bytes to read from the stream.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_stream_size($size)
+ {
+ $this->read_stream_size = $size;
+
+ return $this;
+ }
+
+ /**
+ * Sets the resource to read from while streaming up. Reads the stream from its current position until
+ * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by and
+ * .
+ *
+ * @param resource $resource (Required) The readable resource to read from.
+ * @param integer $size (Optional) The size of the stream to read.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_stream($resource, $size = null)
+ {
+ if (!isset($size) || $size < 0)
+ {
+ $stats = fstat($resource);
+
+ if ($stats && $stats['size'] >= 0)
+ {
+ $position = ftell($resource);
+
+ if ($position !== false && $position >= 0)
+ {
+ $size = $stats['size'] - $position;
+ }
+ }
+ }
+
+ $this->read_stream = $resource;
+
+ return $this->set_read_stream_size($size);
+ }
+
+ /**
+ * Sets the file to read from while streaming up.
+ *
+ * @param string $location (Required) The readable location to read from.
+ * @return $this A reference to the current instance.
+ */
+ public function set_read_file($location)
+ {
+ $this->read_file = $location;
+ $read_file_handle = fopen($location, 'r');
+
+ return $this->set_read_stream($read_file_handle);
+ }
+
+ /**
+ * Sets the resource to write to while streaming down.
+ *
+ * @param resource $resource (Required) The writeable resource to write to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_write_stream($resource)
+ {
+ $this->write_stream = $resource;
+
+ return $this;
+ }
+
+ /**
+ * Sets the file to write to while streaming down.
+ *
+ * @param string $location (Required) The writeable location to write to.
+ * @return $this A reference to the current instance.
+ */
+ public function set_write_file($location)
+ {
+ $this->write_file = $location;
+ $write_file_handle = fopen($location, 'w');
+
+ return $this->set_write_stream($write_file_handle);
+ }
+
+ /**
+ * Set the proxy to use for making requests.
+ *
+ * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
+ * @return $this A reference to the current instance.
+ */
+ public function set_proxy($proxy)
+ {
+ $proxy = parse_url($proxy);
+ $proxy['user'] = isset($proxy['user']) ? $proxy['user'] : null;
+ $proxy['pass'] = isset($proxy['pass']) ? $proxy['pass'] : null;
+ $proxy['port'] = isset($proxy['port']) ? $proxy['port'] : null;
+ $this->proxy = $proxy;
+ return $this;
+ }
+
+ /**
+ * Set the intended starting seek position.
+ *
+ * @param integer $position (Required) The byte-position of the stream to begin reading from.
+ * @return $this A reference to the current instance.
+ */
+ public function set_seek_position($position)
+ {
+ $this->seek_position = isset($position) ? (integer) $position : null;
+
+ return $this;
+ }
+
+ /**
+ * Register a callback function to execute whenever a data stream is read from using
+ * .
+ *
+ * The user-defined callback function should accept three arguments:
+ *
+ *
+ * $curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.
+ * $file_handle
- resource
- Required - The file handle resource that represents the file on the local file system.
+ * $length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.
+ *
+ *
+ * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
+ * - The name of a global function to execute, passed as a string.
+ * - A method to execute, passed as
array('ClassName', 'MethodName')
.
+ * - An anonymous function (PHP 5.3+).
+ * @return $this A reference to the current instance.
+ */
+ public function register_streaming_read_callback($callback)
+ {
+ $this->registered_streaming_read_callback = $callback;
+
+ return $this;
+ }
+
+ /**
+ * Register a callback function to execute whenever a data stream is written to using
+ * .
+ *
+ * The user-defined callback function should accept two arguments:
+ *
+ *
+ * $curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.
+ * $length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.
+ *
+ *
+ * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
+ * - The name of a global function to execute, passed as a string.
+ * - A method to execute, passed as
array('ClassName', 'MethodName')
.
+ * - An anonymous function (PHP 5.3+).
+ * @return $this A reference to the current instance.
+ */
+ public function register_streaming_write_callback($callback)
+ {
+ $this->registered_streaming_write_callback = $callback;
+
+ return $this;
+ }
+
+
+ /*%******************************************************************************************%*/
+ // PREPARE, SEND, AND PROCESS REQUEST
+
+ /**
+ * A callback function that is invoked by cURL for streaming up.
+ *
+ * @param resource $curl_handle (Required) The cURL handle for the request.
+ * @param resource $file_handle (Required) The open file handle resource.
+ * @param integer $length (Required) The maximum number of bytes to read.
+ * @return binary Binary data from a stream.
+ */
+ public function streaming_read_callback($curl_handle, $file_handle, $length)
+ {
+ // Once we've sent as much as we're supposed to send...
+ if ($this->read_stream_read >= $this->read_stream_size)
+ {
+ // Send EOF
+ return '';
+ }
+
+ // If we're at the beginning of an upload and need to seek...
+ if ($this->read_stream_read == 0 && isset($this->seek_position) && $this->seek_position !== ftell($this->read_stream))
+ {
+ if (fseek($this->read_stream, $this->seek_position) !== 0)
+ {
+ throw new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.');
+ }
+ }
+
+ $read = fread($this->read_stream, min($this->read_stream_size - $this->read_stream_read, $length)); // Remaining upload data or cURL's requested chunk size
+ $this->read_stream_read += strlen($read);
+
+ $out = $read === false ? '' : $read;
+
+ // Execute callback function
+ if ($this->registered_streaming_read_callback)
+ {
+ call_user_func($this->registered_streaming_read_callback, $curl_handle, $file_handle, $out);
+ }
+
+ return $out;
+ }
+
+ /**
+ * A callback function that is invoked by cURL for streaming down.
+ *
+ * @param resource $curl_handle (Required) The cURL handle for the request.
+ * @param binary $data (Required) The data to write.
+ * @return integer The number of bytes written.
+ */
+ public function streaming_write_callback($curl_handle, $data)
+ {
+ $length = strlen($data);
+ $written_total = 0;
+ $written_last = 0;
+
+ while ($written_total < $length)
+ {
+ $written_last = fwrite($this->write_stream, substr($data, $written_total));
+
+ if ($written_last === false)
+ {
+ return $written_total;
+ }
+
+ $written_total += $written_last;
+ }
+
+ // Execute callback function
+ if ($this->registered_streaming_write_callback)
+ {
+ call_user_func($this->registered_streaming_write_callback, $curl_handle, $written_total);
+ }
+
+ return $written_total;
+ }
+
+ /**
+ * Prepares and adds the details of the cURL request. This can be passed along to a
+ * function.
+ *
+ * @return resource The handle for the cURL object.
+ */
+ public function prep_request()
+ {
+ $curl_handle = curl_init();
+
+ // Set default options.
+ curl_setopt($curl_handle, CURLOPT_URL, $this->request_url);
+ curl_setopt($curl_handle, CURLOPT_FILETIME, true);
+ curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false);
+ curl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5);
+ curl_setopt($curl_handle, CURLOPT_HEADER, true);
+ curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl_handle, CURLOPT_TIMEOUT, 50);
+ curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 50);
+ curl_setopt($curl_handle, CURLOPT_NOSIGNAL, true);
+ curl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url);
+ curl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent);
+ curl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback'));
+
+ // Verification of the SSL cert
+ if ($this->ssl_verification)
+ {
+ curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true);
+ curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+ }
+ else
+ {
+ curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false);
+ }
+
+ // chmod the file as 0755
+ if ($this->cacert_location === true)
+ {
+ curl_setopt($curl_handle, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
+ }
+ elseif (is_string($this->cacert_location))
+ {
+ curl_setopt($curl_handle, CURLOPT_CAINFO, $this->cacert_location);
+ }
+
+ // Debug mode
+ if ($this->debug_mode)
+ {
+ curl_setopt($curl_handle, CURLOPT_VERBOSE, true);
+ }
+
+ // Handle open_basedir & safe mode
+ if (!ini_get('safe_mode') && !ini_get('open_basedir'))
+ {
+ curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
+ }
+
+ // Enable a proxy connection if requested.
+ if ($this->proxy)
+ {
+ curl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, true);
+
+ $host = $this->proxy['host'];
+ $host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : '';
+ curl_setopt($curl_handle, CURLOPT_PROXY, $host);
+
+ if (isset($this->proxy['user']) && isset($this->proxy['pass']))
+ {
+ curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']);
+ }
+ }
+
+ // Set credentials for HTTP Basic/Digest Authentication.
+ if ($this->username && $this->password)
+ {
+ curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ curl_setopt($curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
+ }
+
+ // Handle the encoding if we can.
+ if (extension_loaded('zlib'))
+ {
+ curl_setopt($curl_handle, CURLOPT_ENCODING, '');
+ }
+
+ // Process custom headers
+ if (isset($this->request_headers) && count($this->request_headers))
+ {
+ $temp_headers = array();
+
+ foreach ($this->request_headers as $k => $v)
+ {
+ $temp_headers[] = $k . ': ' . $v;
+ }
+
+ curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);
+ }
+
+ switch ($this->method)
+ {
+ case self::HTTP_PUT:
+ //unset($this->read_stream);
+ curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT');
+ if (isset($this->read_stream))
+ {
+ if (!isset($this->read_stream_size) || $this->read_stream_size < 0)
+ {
+ throw new RequestCore_Exception('The stream size for the streaming upload cannot be determined.');
+ }
+
+ curl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size);
+ curl_setopt($curl_handle, CURLOPT_UPLOAD, true);
+ }
+ else
+ {
+ curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
+ }
+ break;
+
+ case self::HTTP_POST:
+ curl_setopt($curl_handle, CURLOPT_POST, true);
+ curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
+ break;
+
+ case self::HTTP_HEAD:
+ curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD);
+ curl_setopt($curl_handle, CURLOPT_NOBODY, 1);
+ break;
+
+ default: // Assumed GET
+ curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, $this->method);
+ if (isset($this->write_stream))
+ {
+ curl_setopt($curl_handle, CURLOPT_WRITEFUNCTION, array($this, 'streaming_write_callback'));
+ curl_setopt($curl_handle, CURLOPT_HEADER, false);
+ }
+ else
+ {
+ curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
+ }
+ break;
+ }
+
+ // Merge in the CURLOPTs
+ if (isset($this->curlopts) && sizeof($this->curlopts) > 0)
+ {
+ foreach ($this->curlopts as $k => $v)
+ {
+ curl_setopt($curl_handle, $k, $v);
+ }
+ }
+
+ return $curl_handle;
+ }
+
+ /**
+ * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the
+ * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
+ * parameters.
+ *
+ * @param resource $curl_handle (Optional) The reference to the already executed cURL request.
+ * @param string $response (Optional) The actual response content itself that needs to be parsed.
+ * @return ResponseCore A object containing a parsed HTTP response.
+ */
+ public function process_response($curl_handle = null, $response = null)
+ {
+ if ($response)
+ {
+ $this->response = $response;
+ }
+ // As long as this came back as a valid resource...
+ if (is_resource($curl_handle))
+ {
+ // Determine what's what.
+ $header_size = curl_getinfo($curl_handle, CURLINFO_HEADER_SIZE);
+ $this->response_headers = substr($this->response, 0, $header_size);
+ $this->response_body = substr($this->response, $header_size);
+ $this->response_code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
+ $this->response_info = curl_getinfo($curl_handle);
+
+ // Parse out the headers
+ $this->response_headers = explode("\r\n\r\n", trim($this->response_headers));
+ $this->response_headers = array_pop($this->response_headers);
+ $this->response_headers = explode("\r\n", $this->response_headers);
+ array_shift($this->response_headers);
+
+ // Loop through and split up the headers.
+ $header_assoc = array();
+ foreach ($this->response_headers as $header)
+ {
+ $kv = explode(': ', $header);
+ $header_assoc[strtolower($kv[0])] = isset($kv[1])?$kv[1]:'';
+ }
+
+ // Reset the headers to the appropriate property.
+ $this->response_headers = $header_assoc;
+ $this->response_headers['_info'] = $this->response_info;
+ $this->response_headers['_info']['method'] = $this->method;
+
+ if ($curl_handle && $this->response)
+ {
+ return new $this->response_class($this->response_headers, $this->response_body, $this->response_code, $curl_handle);
+ }
+ }
+
+ // Return false
+ return false;
+ }
+
+ /**
+ * Sends the request, calling necessary utility functions to update built-in properties.
+ *
+ * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not.
+ * @return string The resulting unparsed data from the request.
+ */
+ public function send_request($parse = false)
+ {
+ set_time_limit(0);
+
+ $curl_handle = $this->prep_request();
+ $this->response = curl_exec($curl_handle);
+
+ if ($this->response === false)
+ {
+ throw new RequestCore_Exception('cURL resource: ' . (string) $curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
+ }
+
+ $parsed_response = $this->process_response($curl_handle, $this->response);
+
+ curl_close($curl_handle);
+
+ if ($parse)
+ {
+ return $parsed_response;
+ }
+
+ return $this->response;
+ }
+
+ /**
+ * Sends the request using , enabling parallel requests. Uses the "rolling" method.
+ *
+ * @param array $handles (Required) An indexed array of cURL handles to process simultaneously.
+ * @param array $opt (Optional) An associative array of parameters that can have the following keys:
+ * callback
- string|array
- Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the [0]
index is the class and the [1]
index is the method name.
+ * limit
- integer
- Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.
+ * @return array Post-processed cURL responses.
+ */
+ public function send_multi_request($handles, $opt = null)
+ {
+ set_time_limit(0);
+
+ // Skip everything if there are no handles to process.
+ if (count($handles) === 0) return array();
+
+ if (!$opt) $opt = array();
+
+ // Initialize any missing options
+ $limit = isset($opt['limit']) ? $opt['limit'] : -1;
+
+ // Initialize
+ $handle_list = $handles;
+ $http = new $this->request_class();
+ $multi_handle = curl_multi_init();
+ $handles_post = array();
+ $added = count($handles);
+ $last_handle = null;
+ $count = 0;
+ $i = 0;
+
+ // Loop through the cURL handles and add as many as it set by the limit parameter.
+ while ($i < $added)
+ {
+ if ($limit > 0 && $i >= $limit) break;
+ curl_multi_add_handle($multi_handle, array_shift($handles));
+ $i++;
+ }
+
+ do
+ {
+ $active = false;
+
+ // Start executing and wait for a response.
+ while (($status = curl_multi_exec($multi_handle, $active)) === CURLM_CALL_MULTI_PERFORM)
+ {
+ // Start looking for possible responses immediately when we have to add more handles
+ if (count($handles) > 0) break;
+ }
+
+ // Figure out which requests finished.
+ $to_process = array();
+
+ while ($done = curl_multi_info_read($multi_handle))
+ {
+ // Since curl_errno() isn't reliable for handles that were in multirequests, we check the 'result' of the info read, which contains the curl error number, (listed here http://curl.haxx.se/libcurl/c/libcurl-errors.html )
+ if ($done['result'] > 0)
+ {
+ throw new RequestCore_Exception('cURL resource: ' . (string) $done['handle'] . '; cURL error: ' . curl_error($done['handle']) . ' (' . $done['result'] . ')');
+ }
+
+ // Because curl_multi_info_read() might return more than one message about a request, we check to see if this request is already in our array of completed requests
+ elseif (!isset($to_process[(int) $done['handle']]))
+ {
+ $to_process[(int) $done['handle']] = $done;
+ }
+ }
+
+ // Actually deal with the request
+ foreach ($to_process as $pkey => $done)
+ {
+ $response = $http->process_response($done['handle'], curl_multi_getcontent($done['handle']));
+ $key = array_search($done['handle'], $handle_list, true);
+ $handles_post[$key] = $response;
+
+ if (count($handles) > 0)
+ {
+ curl_multi_add_handle($multi_handle, array_shift($handles));
+ }
+
+ curl_multi_remove_handle($multi_handle, $done['handle']);
+ curl_close($done['handle']);
+ }
+ }
+ while ($active || count($handles_post) < $added);
+
+ curl_multi_close($multi_handle);
+
+ ksort($handles_post, SORT_NUMERIC);
+ return $handles_post;
+ }
+
+
+ /*%******************************************************************************************%*/
+ // RESPONSE METHODS
+
+ /**
+ * Get the HTTP response headers from the request.
+ *
+ * @param string $header (Optional) A specific header value to return. Defaults to all headers.
+ * @return string|array All or selected header values.
+ */
+ public function get_response_header($header = null)
+ {
+ if ($header)
+ {
+ return $this->response_headers[strtolower($header)];
+ }
+ return $this->response_headers;
+ }
+
+ /**
+ * Get the HTTP response body from the request.
+ *
+ * @return string The response body.
+ */
+ public function get_response_body()
+ {
+ return $this->response_body;
+ }
+
+ /**
+ * Get the HTTP response code from the request.
+ *
+ * @return string The HTTP response code.
+ */
+ public function get_response_code()
+ {
+ return $this->response_code;
+ }
+}
+
+
+/**
+ * Container for all response-related methods.
+ */
+class ResponseCore
+{
+ /**
+ * Stores the HTTP header information.
+ */
+ public $header;
+
+ /**
+ * Stores the SimpleXML response.
+ */
+ public $body;
+
+ /**
+ * Stores the HTTP response code.
+ */
+ public $status;
+
+ /**
+ * Constructs a new instance of this class.
+ *
+ * @param array $header (Required) Associative array of HTTP headers (typically returned by ).
+ * @param string $body (Required) XML-formatted response from AWS.
+ * @param integer $status (Optional) HTTP response status code from the request.
+ * @return object Contains an `header` property (HTTP headers as an associative array), a or `body` property, and an `status` code.
+ */
+ public function __construct($header, $body, $status = null)
+ {
+ $this->header = $header;
+ $this->body = $body;
+ $this->status = $status;
+
+ return $this;
+ }
+
+ /**
+ * Did we receive the status code we expected?
+ *
+ * @param integer|array $codes (Optional) The status code(s) to expect. Pass an for a single acceptable value, or an of integers for multiple acceptable values.
+ * @return boolean Whether we received the expected status code or not.
+ */
+ public function isOK($codes = array(200, 201, 204, 206))
+ {
+ if (is_array($codes))
+ {
+ return in_array($this->status, $codes);
+ }
+
+ return $this->status === $codes;
+ }
+}
+
+/**
+ * Default RequestCore Exception.
+ */
+class RequestCore_Exception extends Exception {}
diff --git a/lib/aliyun-log-php-sdk-master/Aliyun/Log/sls.proto.php b/lib/aliyun-log-php-sdk-master/Aliyun/Log/sls.proto.php
new file mode 100644
index 00000000..84e81893
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Aliyun/Log/sls.proto.php
@@ -0,0 +1,515 @@
+read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("Log_Content: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->key_ = $tmp;
+ $limit-=$len;
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->value_ = $tmp;
+ $limit-=$len;
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->key_)) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, strlen($this->key_));
+ fwrite($fp, $this->key_);
+ }
+ if (!is_null($this->value_)) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, strlen($this->value_));
+ fwrite($fp, $this->value_);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->key_)) {
+ $l = strlen($this->key_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->value_)) {
+ $l = strlen($this->value_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ if ($this->key_ === null) return false;
+ if ($this->value_ === null) return false;
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('key_', $this->key_)
+ . Protobuf::toString('value_', $this->value_);
+ }
+
+ // required string Key = 1;
+
+ private $key_ = null;
+ public function clearKey() { $this->key_ = null; }
+ public function hasKey() { return $this->key_ !== null; }
+ public function getKey() { if($this->key_ === null) return ""; else return $this->key_; }
+ public function setKey($value) { $this->key_ = $value; }
+
+ // required string Value = 2;
+
+ private $value_ = null;
+ public function clearValue() { $this->value_ = null; }
+ public function hasValue() { return $this->value_ !== null; }
+ public function getValue() { if($this->value_ === null) return ""; else return $this->value_; }
+ public function setValue($value) { $this->value_ = $value; }
+
+ // @@protoc_insertion_point(class_scope:Log.Content)
+}
+
+// message Log
+class Log {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("Log: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 0');
+ $tmp = Protobuf::read_varint($fp, $limit);
+ if ($tmp === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $this->time_ = $tmp;
+
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->contents_[] = new Log_Content($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->time_)) {
+ fwrite($fp, "\x08");
+ Protobuf::write_varint($fp, $this->time_);
+ }
+ if (!is_null($this->contents_))
+ foreach($this->contents_ as $v) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->time_)) {
+ $size += 1 + Protobuf::size_varint($this->time_);
+ }
+ if (!is_null($this->contents_))
+ foreach($this->contents_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ if ($this->time_ === null) return false;
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('time_', $this->time_)
+ . Protobuf::toString('contents_', $this->contents_);
+ }
+
+ // required uint32 Time = 1;
+
+ private $time_ = null;
+ public function clearTime() { $this->time_ = null; }
+ public function hasTime() { return $this->time_ !== null; }
+ public function getTime() { if($this->time_ === null) return 0; else return $this->time_; }
+ public function setTime($value) { $this->time_ = $value; }
+
+ // repeated .Log.Content Contents = 2;
+
+ private $contents_ = null;
+ public function clearContents() { $this->contents_ = null; }
+ public function getContentsCount() { if ($this->contents_ === null ) return 0; else return count($this->contents_); }
+ public function getContents($index) { return $this->contents_[$index]; }
+ public function getContentsArray() { if ($this->contents_ === null ) return array(); else return $this->contents_; }
+ public function setContents($index, $value) {$this->contents_[$index] = $value; }
+ public function addContents($value) { $this->contents_[] = $value; }
+ public function addAllContents(array $values) { foreach($values as $value) {$this->contents_[] = $value;} }
+
+ // @@protoc_insertion_point(class_scope:Log)
+}
+
+// message LogGroup
+class LogGroup {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("LogGroup: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->logs_[] = new Log($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ case 2:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->category_ = $tmp;
+ $limit-=$len;
+ break;
+ case 3:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->topic_ = $tmp;
+ $limit-=$len;
+ break;
+ case 4:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ if ($len > 0)
+ $tmp = fread($fp, $len);
+ else
+ $tmp = '';
+ if ($tmp === false)
+ throw new Exception("fread($len) returned false");
+ $this->source_ = $tmp;
+ $limit-=$len;
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->logs_))
+ foreach($this->logs_ as $v) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ if (!is_null($this->category_)) {
+ fwrite($fp, "\x12");
+ Protobuf::write_varint($fp, strlen($this->category_));
+ fwrite($fp, $this->category_);
+ }
+ if (!is_null($this->topic_)) {
+ fwrite($fp, "\x1a");
+ Protobuf::write_varint($fp, strlen($this->topic_));
+ fwrite($fp, $this->topic_);
+ }
+ if (!is_null($this->source_)) {
+ fwrite($fp, "\"");
+ Protobuf::write_varint($fp, strlen($this->source_));
+ fwrite($fp, $this->source_);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->logs_))
+ foreach($this->logs_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->category_)) {
+ $l = strlen($this->category_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->topic_)) {
+ $l = strlen($this->topic_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ if (!is_null($this->source_)) {
+ $l = strlen($this->source_);
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('logs_', $this->logs_)
+ . Protobuf::toString('category_', $this->category_)
+ . Protobuf::toString('topic_', $this->topic_)
+ . Protobuf::toString('source_', $this->source_);
+ }
+
+ // repeated .Log Logs = 1;
+
+ private $logs_ = null;
+ public function clearLogs() { $this->logs_ = null; }
+ public function getLogsCount() { if ($this->logs_ === null ) return 0; else return count($this->logs_); }
+ public function getLogs($index) { return $this->logs_[$index]; }
+ public function getLogsArray() { if ($this->logs_ === null ) return array(); else return $this->logs_; }
+ public function setLogs($index, $value) {$this->logs_[$index] = $value; }
+ public function addLogs($value) { $this->logs_[] = $value; }
+ public function addAllLogs(array $values) { foreach($values as $value) {$this->logs_[] = $value;} }
+
+ // optional string Category = 2;
+
+ private $category_ = null;
+ public function clearCategory() { $this->category_ = null; }
+ public function hasCategory() { return $this->category_ !== null; }
+ public function getCategory() { if($this->category_ === null) return ""; else return $this->category_; }
+ public function setCategory($value) { $this->category_ = $value; }
+
+ // optional string Topic = 3;
+
+ private $topic_ = null;
+ public function clearTopic() { $this->topic_ = null; }
+ public function hasTopic() { return $this->topic_ !== null; }
+ public function getTopic() { if($this->topic_ === null) return ""; else return $this->topic_; }
+ public function setTopic($value) { $this->topic_ = $value; }
+
+ // optional string Source = 4;
+
+ private $source_ = null;
+ public function clearSource() { $this->source_ = null; }
+ public function hasSource() { return $this->source_ !== null; }
+ public function getSource() { if($this->source_ === null) return ""; else return $this->source_; }
+ public function setSource($value) { $this->source_ = $value; }
+
+ // @@protoc_insertion_point(class_scope:LogGroup)
+}
+
+// message LogGroupList
+class LogGroupList {
+ private $_unknown;
+
+ function __construct($in = NULL, &$limit = PHP_INT_MAX) {
+ if($in !== NULL) {
+ if (is_string($in)) {
+ $fp = fopen('php://memory', 'r+b');
+ fwrite($fp, $in);
+ rewind($fp);
+ } else if (is_resource($in)) {
+ $fp = $in;
+ } else {
+ throw new Exception('Invalid in parameter');
+ }
+ $this->read($fp, $limit);
+ }
+ }
+
+ function read($fp, &$limit = PHP_INT_MAX) {
+ while(!feof($fp) && $limit > 0) {
+ $tag = Protobuf::read_varint($fp, $limit);
+ if ($tag === false) break;
+ $wire = $tag & 0x07;
+ $field = $tag >> 3;
+ //var_dump("LogGroupList: Found $field type " . Protobuf::get_wiretype($wire) . " $limit bytes left");
+ switch($field) {
+ case 1:
+ ASSERT('$wire == 2');
+ $len = Protobuf::read_varint($fp, $limit);
+ if ($len === false)
+ throw new Exception('Protobuf::read_varint returned false');
+ $limit-=$len;
+ $this->logGroupList_[] = new LogGroup($fp, $len);
+ ASSERT('$len == 0');
+ break;
+ default:
+ $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit);
+ }
+ }
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ }
+
+ function write($fp) {
+ if (!$this->validateRequired())
+ throw new Exception('Required fields are missing');
+ if (!is_null($this->logGroupList_))
+ foreach($this->logGroupList_ as $v) {
+ fwrite($fp, "\x0a");
+ Protobuf::write_varint($fp, $v->size()); // message
+ $v->write($fp);
+ }
+ }
+
+ public function size() {
+ $size = 0;
+ if (!is_null($this->logGroupList_))
+ foreach($this->logGroupList_ as $v) {
+ $l = $v->size();
+ $size += 1 + Protobuf::size_varint($l) + $l;
+ }
+ return $size;
+ }
+
+ public function validateRequired() {
+ return true;
+ }
+
+ public function __toString() {
+ return ''
+ . Protobuf::toString('unknown', $this->_unknown)
+ . Protobuf::toString('logGroupList_', $this->logGroupList_);
+ }
+
+ // repeated .LogGroup logGroupList = 1;
+
+ private $logGroupList_ = null;
+ public function clearLogGroupList() { $this->logGroupList_ = null; }
+ public function getLogGroupListCount() { if ($this->logGroupList_ === null ) return 0; else return count($this->logGroupList_); }
+ public function getLogGroupList($index) { return $this->logGroupList_[$index]; }
+ public function getLogGroupListArray() { if ($this->logGroupList_ === null ) return array(); else return $this->logGroupList_; }
+ public function setLogGroupList($index, $value) {$this->logGroupList_[$index] = $value; }
+ public function addLogGroupList($value) { $this->logGroupList_[] = $value; }
+ public function addAllLogGroupList(array $values) { foreach($values as $value) {$this->logGroupList_[] = $value;} }
+
+ // @@protoc_insertion_point(class_scope:LogGroupList)
+}
+
diff --git a/lib/aliyun-log-php-sdk-master/License.txt b/lib/aliyun-log-php-sdk-master/License.txt
new file mode 100644
index 00000000..bf0942ef
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/License.txt
@@ -0,0 +1,26 @@
+阿里云计算日志服务软件开发工具包Python语言版
+Aliyun Log Service SDK for PHP
+
+版权所有 (C)阿里云计算有限公司
+Copyright (C) Alibaba Cloud Computing
+All rights reserved.
+http://www.aliyun.com
+
+==============================================================================
+本软件包还包含多个第三方软件库。使用本软件包代表你同时同意如下第三方软件包许可。
+
+This distribution contains multiple components, someof which fall
+under different licenses. By using this package or any of the bundled
+components enumerated below, you agree to be bound by the conditions
+of the license for each respective component.
+
+protobuf
+------------------
+License:Simplified BSD License (http://opensource.org/licenses/BSD-2-Clause)
+Website:https://github.com/bramp/protoc-gen-php
+
+
+requestcore
+-----------------
+License: BSD License (http://opensource.org/licenses/bsd-license.php)
+Website:https://github.com/pzb/requestcore/blob/master/requestcore.class.php
diff --git a/lib/aliyun-log-php-sdk-master/Log_Autoload.php b/lib/aliyun-log-php-sdk-master/Log_Autoload.php
new file mode 100644
index 00000000..2ac63d77
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/Log_Autoload.php
@@ -0,0 +1,32 @@
+5)
+ $classPath = array_slice($classPath, 0, 5);
+ if(strpos($className, 'Request') !== false){
+ $lastPath = end($classPath);
+ array_pop($classPath);
+ array_push($classPath,'Request');
+ array_push($classPath, $lastPath);
+ }
+ if(strpos($className, 'Response') !== false){
+ $lastPath = end($classPath);
+ array_pop($classPath);
+ array_push($classPath,'Response');
+ array_push($classPath, $lastPath);
+ }
+ $filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
+ if (file_exists($filePath))
+ require_once($filePath);
+ }
+}
+
+spl_autoload_register('Aliyun_Log_PHP_Client_Autoload');
diff --git a/lib/aliyun-log-php-sdk-master/README.md b/lib/aliyun-log-php-sdk-master/README.md
new file mode 100644
index 00000000..1575cee8
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/README.md
@@ -0,0 +1,31 @@
+# Aliyun Log Service PHP SDK
+
+## API VERSION
+
+0.6.1
+
+## SDK RELEASE TIME
+
+2018-02-18
+
+## Introduction
+
+Log Service SDK for PHP,used to set/get log data to Aliyun Log Service(www.aliyun.com/product/sls).
+
+API Reference: [中文](https://help.aliyun.com/document_detail/29007.html) [ENGLISH](https://www.alibabacloud.com/help/doc-detail/29007.htm)
+
+
+### Summary
+
+1. Request-Request style Restful API interface
+2. Use Protocol buffer to send data
+3. Data can be compressed when sending to server
+4. Aliyun_Log_Exception will be thrown if any error happen
+5. Introduce simple logger for submit log easily with different levels
+6. Create local log cache to submit several logs in single http post.
+
+## Environment Requirement
+
+1. PHP 7.1.7 and later:Master Branch
+2. PHP 5.2+:[Tree v1.0](https://github.com/aliyun/aliyun-log-php-sdk/tree/v1.0)
+
diff --git a/lib/aliyun-log-php-sdk-master/build.bat b/lib/aliyun-log-php-sdk-master/build.bat
new file mode 100644
index 00000000..61c19e19
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/build.bat
@@ -0,0 +1,119 @@
+@ECHO OFF
+setlocal EnableDelayedExpansion
+
+ECHO Start to package SLS php sdk...
+
+SET SUCCESS_RET=0
+SET ERROR_NO_SETUP_FILE=1
+SET ERROR_NO_VERSION=2
+SET ERROR_NO_DOCS=3
+SET ERROR_ROBOCOPY=4
+
+::
+:: package all the output from php sdk source tree to release format (as bellow)
+::
+:: |--Aliyun
+:: |--docs
+:: |--sample
+:: |--test
+:: |--License.txt
+:: |--Readme.txt
+:: |--Log_Autoload.php
+:: |--build.md
+::
+:: Usage: build.bat
+::
+:: Notes: this script must be run under root folder of php SDK code base.
+
+::prepare environment variables
+SET SOURCE_ROOT=Aliyun
+SET DOCS_ROOT=docs
+SET SAMPLE_ROOT=sample
+SET TEST_ROOT=test
+SET TITLE=SLS_PHP_SDK
+SET PACKAGE_NAME=SLS_PHP_SDK
+
+::STEP-1: get current version information from source codes
+SET VERSION_FILE=Log_Autoload.php
+
+IF NOT EXIST "%VERSION_FILE%" (
+ ECHO Failed to file %VERSION_FILE% on current directory.
+ EXIT /B %ERROR_NO_SETUP_FILE%
+)
+
+SET SDK_VERSION=
+FOR /f "tokens=1-3 delims= " %%G in (%VERSION_FILE%) do (
+ IF "%%G"=="$version" (
+ IF "%%H"=="=" (
+ SET SDK_VERSION=%%I
+ )
+ )
+)
+
+::like $version = '0.4.4';
+::trim spaces and ;
+SET SDK_VERSION=%SDK_VERSION:'=%
+SET SDK_VERSION=%SDK_VERSION:;=%
+
+IF "SDK_VERSION"=="" (
+ ECHO Failed to get version information from source codes...
+ EXIT /B %ERROR_NO_VERSION%
+)
+
+::SETP-2: build documentation from latest php source codes by "phpDocumentor.phar" tool
+SET PROD_VERSION=%SDK_VERSION:~0,3%
+SET DOCS_AUTO_GENERATION_DIR=%DOCS_ROOT%\_build\html
+
+ECHO %PROD_VERSION%
+
+php tools\phpDocumentor.phar --title="%TITLE%" --defaultpackagename="%PACKAGE_NAME%" --template="responsive-twig" -d %SOURCE_ROOT% -t %DOCS_ROOT%
+
+IF NOT EXIST "%DOCS_ROOT%"\index.html (
+ ECHO Failed to generate rst files for documentation.
+ EXIT /B %ERROR_NO_DOCS%
+)
+
+SET DOCS_AUTO_GENERATION_DIR=docs
+
+::SETP-3: package all the files into output directory
+SET OUTPUT_FOLDER=.\build\%SDK_VERSION%
+SET OUTPUT_SOURCE_FOLDER=%OUTPUT_FOLDER%\%SOURCE_ROOT%
+SET OUTPUT_DOCS_FOLDER=%OUTPUT_FOLDER%\%DOCS_ROOT%
+SET OUTPUT_SAMPLE_FOLDER=%OUTPUT_FOLDER%\%SAMPLE_ROOT%
+SET OUTPUT_API_REF_FOLDER=%OUTPUT_FOLDER%_API
+SET OUTPUT_TEST_FOLDER=%OUTPUT_FOLDER%_TEST
+
+IF EXIST "%OUTPUT_FOLDER%" RMDIR /Q /S "%OUTPUT_FOLDER%"
+MKDIR "%OUTPUT_FOLDER%"
+
+:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+ROBOCOPY ".\%SOURCE_ROOT%" "%OUTPUT_SOURCE_FOLDER%" *.php /S /NFL /NDL
+IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+ROBOCOPY ".\%DOCS_AUTO_GENERATION_DIR%" "%OUTPUT_DOCS_FOLDER%" /S /NFL /NDL /XD .doctrees
+IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+ROBOCOPY ".\%SAMPLE_ROOT%" "%OUTPUT_SAMPLE_FOLDER%" /S /NFL /NDL
+IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+COPY /Y ".\*.txt" "%OUTPUT_FOLDER%"
+COPY /Y ".\*.php" "%OUTPUT_FOLDER%"
+
+IF EXIST "%OUTPUT_API_REF_FOLDER%" RMDIR /Q /S "%OUTPUT_API_REF_FOLDER%"
+MKDIR "%OUTPUT_API_REF_FOLDER%"
+
+:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+ROBOCOPY ".\%DOCS_AUTO_GENERATION_DIR%" "%OUTPUT_API_REF_FOLDER%" /S /NFL /NDL /XD .doctrees
+IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+IF EXIST "%OUTPUT_TEST_FOLDER%" RMDIR /Q /S "%OUTPUT_TEST_FOLDER%"
+MKDIR "%OUTPUT_TEST_FOLDER%"
+
+:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+ROBOCOPY ".\%TEST_ROOT%" "%OUTPUT_TEST_FOLDER%" /S /NFL /NDL
+IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+:END
+ECHO on
+:: exit script with successful exit code
+@EXIT /B %SUCCESS_RET%
diff --git a/lib/aliyun-log-php-sdk-master/build.md b/lib/aliyun-log-php-sdk-master/build.md
new file mode 100644
index 00000000..454b7a86
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/build.md
@@ -0,0 +1,54 @@
+Copyright
+=========
+
+Copyright (C) Alibaba Cloud Computing
+All rights reserved
+
+
+Aliyun SLS Client SDK for PHP
+=============================
+
+This project provides SLS client SDK libraries that make it easy to access Simple Log Service put logs, get log stores, get topics, get histograms and get logs. For more information about the SDK, you can see about the html files in the docs file.
+The SDK supports PHP version>=5.2.
+
+
+Sample
+======
+
+```PHP
+ListLogstores($request);
+ var_dump($response);
+ } catch (SLSException $ex) {
+ var_dump($ex);
+ } catch (Exception $ex) {
+ var_dump($ex);
+ }
+```
+
+First, you need to require_once Log_Autoload.php wherever Log_Autoload.php is located.
+Second, you need to declare Aliyun_Log_Client $client.
+Third, you need to build a Aliyun_Log_Models_Request $request.
+Fourth, you can make a function call like $client->ListLogstores($request), and get SLS response $response.
+In the end, you can get what you want $response.
+If you get SLSException, you can get the error code, error message, request id if SLS sever has a response.
+You can see the sample/sample.php for more information about the key client features.
+
+
+About the html files
+====================
+
+The html files were created by PHP Document.
+http://www.phpdoc.org
+php phpDocumentor.phar --title="SLS_PHP_SDK" --defaultpackagename="SLS_PHP_SDK" --template="responsive" -d Aliyun -t docs
diff --git a/lib/aliyun-log-php-sdk-master/build.sh b/lib/aliyun-log-php-sdk-master/build.sh
new file mode 100644
index 00000000..672a7779
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/build.sh
@@ -0,0 +1,116 @@
+echo " Start to package SLS php sdk..."
+
+export SUCCESS_RET=0
+export ERROR_NO_SETUP_FILE=1
+export ERROR_NO_VERSION=2
+export ERROR_NO_DOCS=3
+export ERROR_ROBOCOPY=4
+
+#::
+#:: package all the output from php sdk source tree to release format (as bellow)
+#::
+#:: |--Aliyun
+#:: |--docs
+#:: |--sample
+#:: |--test
+#:: |--License.txt
+#:: |--Readme.txt
+#:: |--Log_Autoload.php
+#:: |--build.md
+#::
+#:: Usage: build.bat
+#::
+#:: Notes: this script must be run under root folder of php SDK code base.
+
+#::prepare environment variables
+export SOURCE_ROOT=Aliyun
+export DOCS_ROOT=docs
+export SAMPLE_ROOT=sample
+export TEST_ROOT=test
+export TITLE=LOG_PHP_SDK
+export PACKAGE_NAME=LOG_PHP_SDK
+
+#::STEP-1: get current version information from source codes
+export VERSION_FILE=Log_Autoload.php
+
+if [ ! -f $VERSION_FILE ]; then
+ echo 'Failed to file $VERSION_FILE on current directory.'
+ exit 0
+fi
+SDK_VERSION=`grep '^\$version' $VERSION_FILE|cut -d "'" -f 2`
+
+#::like $version = '0.4.4';
+#::trim spaces and ;
+
+if [ "$SDK_VERSION" == "" ]; then
+ echo "Failed to get version information from source codes..."
+ exit
+fi
+
+#::SETP-2: build documentation from latest php source codes by "phpDocumentor.phar" tool
+export PROD_VERSION=${SDK_VERSION:0:3}
+export DOCS_AUTO_GENERATION_DIR=$DOCS_ROOT/_build/html
+
+echo $PROD_VERSION
+
+php tools/phpDocumentor.phar --title="$TITLE" --defaultpackagename="$PACKAGE_NAME" --template="responsive-twig" -d $SOURCE_ROOT -t $DOCS_ROOT
+
+if [ ! -f $DOCS_ROOT/index.html ]; then
+ echo "Failed to generate rst files for documentation."
+ exit 0
+fi
+
+export DOCS_AUTO_GENERATION_DIR=docs
+
+#::SETP-3: package all the files into output directory
+export OUTPUT_FOLDER=./build/$SDK_VERSION
+export OUTPUT_SOURCE_FOLDER=$OUTPUT_FOLDER/$SOURCE_ROOT
+export OUTPUT_DOCS_FOLDER=$OUTPUT_FOLDER/$DOCS_ROOT
+export OUTPUT_SAMPLE_FOLDER=$OUTPUT_FOLDER/$SAMPLE_ROOT
+export OUTPUT_API_REF_FOLDER=${OUTPUT_FOLDER}_API
+export OUTPUT_TEST_FOLDER=${OUTPUT_FOLDER}_TEST
+
+if [ -d $OUTPUT_FOLDER ]; then
+ rm -rf $OUTPUT_FOLDER
+ mkdir $OUTPUT_FOLDER
+fi
+
+#:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+find $SOURCE_ROOT/* -type f | grep \.php$ | cpio -pd $OUTPUT_SOURCE_FOLDER
+#ROBOCOPY ".\%SOURCE_ROOT%" "%OUTPUT_SOURCE_FOLDER%" *.php /S /NFL /NDL
+
+find ./$DOCS_AUTO_GENERATION_DIR -type f |grep .doctrees |cpio -pd $OUTPUT_DOCS_FOLDER
+#ROBOCOPY ".\%DOCS_AUTO_GENERATION_DIR%" "%OUTPUT_DOCS_FOLDER%" /S /NFL /NDL /XD .doctrees
+#IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+
+cp -r ./$SAMPLE_ROOT $OUTPUT_SAMPLE_FOLDER
+#ROBOCOPY ".\%SAMPLE_ROOT%" "%OUTPUT_SAMPLE_FOLDER%" /S /NFL /NDL
+#IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+cp -f ./*.txt $OUTPUT_FOLDER
+cp -f ./*.php $OUTPUT_FOLDER
+#COPY /Y ".\*.txt" "$OUTPUT_FOLDER"
+#COPY /Y ".\*.php" "$OUTPUT_FOLDER"
+
+if [ -d $OUTPUT_API_REF_FOLDER ]; then
+ rm -rf $OUTPUT_API_REF_FOLDER
+ mkdir $OUTPUT_API_REF_FOLDER
+fi
+#IF EXIST "%OUTPUT_API_REF_FOLDER%" RMDIR /Q /S "%OUTPUT_API_REF_FOLDER%"
+#MKDIR "%OUTPUT_API_REF_FOLDER%"
+
+#:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+find $DOCS_AUTO_GENERATION_DIR/* -type f | grep .doctrees|cpio -pd $OUTPUT_API_REF_FOLDER
+#ROBOCOPY ".\%DOCS_AUTO_GENERATION_DIR%" "%OUTPUT_API_REF_FOLDER%" /S /NFL /NDL /XD .doctrees
+
+if [ -d $OUTPUT_TEST_FOLDER ]; then
+ rm -rf $OUTPUT_TEST_FOLDER
+ mkdir $OUTPUT_TEST_FOLDER
+fi
+#IF EXIST "%OUTPUT_TEST_FOLDER%" RMDIR /Q /S "%OUTPUT_TEST_FOLDER%"
+#MKDIR "%OUTPUT_TEST_FOLDER%"
+
+##:: ROBOCOPY return code has special definition, please check http://ss64.com/nt/robocopy-exit.html
+cp -r $TEST_ROOT $OUTPUT_TEST_FOLDER
+#ROBOCOPY ".\%TEST_ROOT%" "%OUTPUT_TEST_FOLDER%" /S /NFL /NDL
+#IF %ERRORLEVEL% GTR 1 ( EXIT /B %ERROR_ROBOCOPY% )
+exit 0
diff --git a/lib/aliyun-log-php-sdk-master/sample/loggerSample.php b/lib/aliyun-log-php-sdk-master/sample/loggerSample.php
new file mode 100644
index 00000000..414ca047
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/sample/loggerSample.php
@@ -0,0 +1,376 @@
+ 'tet',
+ 'haha' => 'hehe'
+);
+
+//create same logger instance by calling factory method with same parameters
+$anotherLogger = Aliyun_Log_LoggerFactory::getLogger($client, $project, $logstore);
+
+//create different logger instance by calling factory method with topic parameter defined
+$batchLogger = Aliyun_Log_LoggerFactory::getLogger($client, $project, $logstore,'helloworld');
+
+// batch submit single string message, with default cache size 100
+for($i = 1; $i <= 129; $i++){
+ $batchLogger->info('something wrong with the inner info '.$i);
+}
+
+// manually flush log message
+$batchLogger->logFlush();
+
+// query logs manually;
+getLogs($client,$project,$logstore);
+
+$anotherLogger->info('test log message 000 info');
+$anotherLogger->warn('test log message 000 warn');
+$anotherLogger->error('test log message 000 error');
+$anotherLogger->debug('test log message 000 debug');
+
+$logMap['level'] = 'info';
+$anotherLogger->infoArray($logMap);
+$logMap['level'] = 'debug';
+$anotherLogger->debugArray($logMap);
+$logMap['level'] = 'warn';
+$anotherLogger->warnArray($logMap);
+$logMap['level'] = 'error';
+$anotherLogger->errorArray($logMap);
+
+$anotherLogger->logFlush();
+/**
+ * client and logger usage end
+ */
+
+// create a csv shipper and delete it
+createCsvShipper($client, $project, $logstore);
+getAndRetryShipperTasks($client, $project, $logstore, 'testcsvshipper');
+var_dump(getShipperConfig($client, $project, $logstore, 'testcsvshipper'));
+deleteShipper($client, $project, $logstore,'testcsvshipper');
+
+// create a json shipper and delete it
+createJsonShipper($client, $project, $logstore);
+var_dump(getShipperConfig($client, $project, $logstore, 'testjsonshipper'));
+deleteShipper($client, $project, $logstore,'testjsonshipper');
+
+// create a parquet shipper and delete it
+createParquetShipper($client, $project, $logstore);
+var_dump(getShipperConfig($client, $project, $logstore, 'testparquetshipper'));
+deleteShipper($client, $project, $logstore,'testparquetshipper');
+
+// create a csv shipper and update it
+createCsvShipper($client, $project, $logstore);
+$listShppers = listShipper($client, $project, $logstore);
+var_dump(updateShipper($client, $project, $logstore, $listShppers->getShippers()[0]));
+
+function updateShipper($client, $project, $logstore, $shipperName){
+
+ $updateShipper = new Aliyun_Log_Models_UpdateShipperRequest($project);
+ $updateShipper->setShipperName($shipperName);
+ $updateShipper->setTargetType('oss');
+ $updateShipper->setLogStore($logstore);
+
+ $ossConfigResp = getShipperConfig($client, $project, $logstore, $shipperName);
+ $ossConfigResp->getTargetConfigration()['bufferInterval'] = 500;
+
+ $updateShipper->setTargetConfigration($ossConfigResp->getTargetConfigration());
+
+ $updateShipperResp = $client->updateShipper($updateShipper);
+
+ return $updateShipperResp;
+}
+
+function getAndRetryShipperTasks(Aliyun_Log_Client $client, $project, $logstore,$shipperName){
+ $getShipperTasks = new Aliyun_Log_Models_GetShipperTasksRequest($project);
+ $getShipperTasks->setShipperName($shipperName);
+ $getShipperTasks->setLogStore($logstore);
+ $getShipperTasks->setStartTime(time()-10000);
+ $getShipperTasks->setEndTime(time());
+ $getShipperTasks->setStatusType('');//means all status
+ $getShipperTasks->setOffset(0);
+ $getShipperTasks->setSize(5);
+
+ $tasks = $client->getShipperTasks($getShipperTasks);
+ var_dump(json_encode($tasks->getStatistics()));
+ var_dump(json_encode($tasks->getTasks()));
+
+ $taskIdList = array();
+ for($i=0, $size=count($tasks->getTasks());$i<$size;++$i){
+ $taskId = $tasks->getTasks()[$i]['id'];
+ array_push($taskIdList, $taskId);
+ }
+
+ $retryShipperTask = new Aliyun_Log_Models_RetryShipperTasksRequest($project);
+ $retryShipperTask->setShipperName($shipperName);
+ $retryShipperTask->setLogStore($logstore);
+ $retryShipperTask->setTaskLists($taskIdList);
+ $client->retryShipperTasks($retryShipperTask);
+}
+
+function deleteShipper(Aliyun_Log_Client $client, $project, $logstore, $shipperName){
+ //try delete the existing shipper
+ $deleteShipper = new Aliyun_Log_Models_DeleteShipperRequest($project);
+ $deleteShipper->setShipperName($shipperName);
+ $deleteShipper->setLogStore($logstore);
+ try{
+ $client->deleteShipper($deleteShipper);
+ }catch (Exception $ex){}
+}
+
+function getShipperCommonConfig(Aliyun_Log_Models_OssShipperStorage $ossShipperStorage){
+ $ossConfig = new Aliyun_Log_Models_OssShipperConfig();
+ $ossConfig->setOssBucket('sls-test-oss-shipper');
+ $ossConfig->setOssPrefix('logtailalarm');
+ $ossConfig->setBufferInterval(300);
+ $ossConfig->setBufferSize(5);
+ $ossConfig->setCompressType('none');
+ $ossConfig->setRoleArn('acs:ram::1654218965343050:role/aliyunlogdefaultrole');
+ $ossConfig->setStorage($ossShipperStorage);
+ $ossConfig->setPathFormat('%Y/%m/%d/%H');
+ return $ossConfig;
+}
+
+function createCommonShipper($project, $logstore, $shipperName){
+ //create shipper with csv storage
+ $shipper = new Aliyun_Log_Models_CreateShipperRequest($project);
+ $shipper->setShipperName($shipperName);
+ $shipper->setTargetType('oss');
+ $shipper->setLogStore($logstore);
+ return $shipper;
+}
+
+function createCsvShipper(Aliyun_Log_Client $client, $project, $logstore){
+ $shipper = createCommonShipper($project, $logstore, 'testcsvshipper');
+
+ $ossCsvStorage = new Aliyun_Log_Models_OssShipperCsvStorage();
+ $ossCsvStorage->setColumns(array('__topic__',
+ 'alarm_count',
+ 'alarm_message',
+ 'alarm_type',
+ 'category',
+ 'project_name'));
+ $ossCsvStorage->setDelimiter(',');
+ $ossCsvStorage->setQuote('"');
+ $ossCsvStorage->setHeader(false);
+ $ossCsvStorage->setNullIdentifier('');
+ $ossCsvStorage->setFormat('csv');
+
+ $ossConfig = getShipperCommonConfig($ossCsvStorage);
+
+ $shipper->setTargetConfigration($ossConfig->to_json_object());
+ try{
+ $client->createShipper($shipper);
+ }catch (Exception $exception){
+ var_dump($exception);
+ }
+}
+
+/**
+ * List all shards in current log configuration
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ */
+function listShard(Aliyun_Log_Client $client,$project,$logstore){
+ $request = new Aliyun_Log_Models_ListShardsRequest($project,$logstore);
+ try
+ {
+ $response = $client -> listShards($request);
+ print("
");
+ foreach ($response ->getShardIds() as $shardId){
+ print($shardId."
");
+ }
+
+ } catch (Exception $ex) {
+ print("exception code: ".$ex -> getErrorCode());
+ }
+}
+
+/**
+ * sumit log by client directly
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ */
+function putLogs(Aliyun_Log_Client $client, $project, $logstore) {
+ $topic = 'TestTopic';
+
+ $contents = array( // key-value pair
+ 'TestKey'=>'TestContent',
+ 'message'=>'test log from '.' at '.date('m/d/Y h:i:s a', time())
+ );
+ $logItem = new Aliyun_Log_Models_LogItem();
+ $logItem->setTime(time());
+ $logItem->setContents($contents);
+ $logitems = array($logItem);
+ $request = new Aliyun_Log_Models_PutLogsRequest($project, $logstore,
+ $topic, "", $logitems);
+
+ try {
+ $response = $client->putLogs($request);
+ print($response ->getRequestId());
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+/**
+ * query log by client directly
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ */
+function getLogs(Aliyun_Log_Client $client, $project, $logstore) {
+ $topic = 'MainFlow';
+ $from = time()-3600;
+ $to = time();
+ $request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, '', 100, 0, False);
+
+ try {
+ $response = $client->getLogs($request);
+ foreach($response -> getLogs() as $log)
+ {
+ print $log -> getTime()."\t";
+ foreach($log -> getContents() as $key => $value){
+ print $key.":".$value."
";
+ }
+ print "\n";
+ }
+
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+/**
+ * Query existing shipper configuration from log server
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ * @param $shipperName
+ * @return Aliyun_Log_Models_GetShipperConfigRequest
+ */
+function getShipperConfig(Aliyun_Log_Client $client, $project, $logstore, $shipperName){
+
+ $getShipperConfig = new Aliyun_Log_Models_GetShipperConfigRequest($project);
+ $getShipperConfig->setShipperName($shipperName);
+ $getShipperConfig->setLogStore($logstore);
+ $getconfigResp = $client->getShipperConfig($getShipperConfig);
+ return $getconfigResp;
+}
+
+/**
+ * get the list of existing shippers
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ * @return Aliyun_Log_Models_ListShipperResponse
+ */
+function listShipper(Aliyun_Log_Client $client, $project, $logstore){
+ $listShipper = new Aliyun_Log_Models_ListShipperRequest($project);
+ $listShipper->setLogStore($logstore);
+ $listShpperResp = $client->listShipper($listShipper);
+ return $listShpperResp;
+}
+
+/**
+ * create a parquet shipper
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ */
+function createParquetShipper(Aliyun_Log_Client $client, $project, $logstore){
+ //create shipper with json storage
+ $shipper = createCommonShipper($project, $logstore, 'testparquetshipper');
+
+ $ossParquetStorage = new Aliyun_Log_Models_OssShipperParquetStorage();
+ $ossParquetStorage->setFormat('parquet');
+ $ossParquetStorage->setColumns(array(
+ array(
+ 'name' => '__topic__',
+ 'type' => 'string'
+ ),
+ array(
+ 'name' => 'alarm_count',
+ 'type' => 'int32'
+ ),
+ array(
+ 'name' => 'alarm_message',
+ 'type' => 'string'
+ ),
+ array(
+ 'name' => 'alarm_type',
+ 'type' => 'string'
+ ),
+ array(
+ 'name' => 'is_active',
+ 'type' => 'boolean'
+ ),
+ array(
+ 'name' => 'project_name',
+ 'type' => 'string'
+ ),
+ ));
+ $ossConfig = getShipperCommonConfig($ossParquetStorage);
+ $shipper->setTargetConfigration($ossConfig->to_json_object());
+
+ try{
+
+ $client->createShipper($shipper);
+ }catch (Exception $exception){
+ var_dump($exception);
+ }
+
+}
+
+/**
+ * create a json shipper
+ * @param Aliyun_Log_Client $client
+ * @param $project
+ * @param $logstore
+ */
+function createJsonShipper(Aliyun_Log_Client $client, $project, $logstore){
+ // create a json shipper
+ $ossJsonStorage = new Aliyun_Log_Models_OssShipperJsonStorage();
+ $ossJsonStorage->setFormat('json');
+
+ //create shipper with json storage
+ $shipper = createCommonShipper($project, $logstore, 'testjsonshipper');
+
+ $ossConfig = getShipperCommonConfig($ossJsonStorage);
+
+ $shipper->setTargetConfigration($ossConfig->to_json_object());
+ try{
+ $client->createShipper($shipper);
+ }catch (Exception $exception){
+ var_dump($exception);
+ }
+}
diff --git a/lib/aliyun-log-php-sdk-master/sample/sample.php b/lib/aliyun-log-php-sdk-master/sample/sample.php
new file mode 100644
index 00000000..c031101f
--- /dev/null
+++ b/lib/aliyun-log-php-sdk-master/sample/sample.php
@@ -0,0 +1,251 @@
+'TestContent'
+ );
+ $logItem = new Aliyun_Log_Models_LogItem();
+ $logItem->setTime(time());
+ $logItem->setContents($contents);
+ $logitems = array($logItem);
+ $request = new Aliyun_Log_Models_PutLogsRequest($project, $logstore,
+ $topic, null, $logitems);
+
+ try {
+ $response = $client->putLogs($request);
+ logVarDump($response);
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+function listLogstores(Aliyun_Log_Client $client, $project) {
+ try{
+ $request = new Aliyun_Log_Models_ListLogstoresRequest($project);
+ $response = $client->listLogstores($request);
+ logVarDump($response);
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+
+function listTopics(Aliyun_Log_Client $client, $project, $logstore) {
+ $request = new Aliyun_Log_Models_ListTopicsRequest($project, $logstore);
+
+ try {
+ $response = $client->listTopics($request);
+ logVarDump($response);
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+function getLogs(Aliyun_Log_Client $client, $project, $logstore) {
+ $topic = '';
+ $from = time()-3600;
+ $to = time();
+ $request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, "*| select * from log where request_uri NOT like '%.jpg' and request_uri NOT like '*.png' and request_uri NOT like '*.gif'", 100, 0, False);
+
+ try {
+ $response = $client->getLogs($request);
+ foreach($response -> getLogs() as $log)
+ {
+ print $log -> getTime()."\t";
+ foreach($log -> getContents() as $key => $value){
+ print $key.":".$value."\t";
+ }
+ print "\n";
+ }
+
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+function getHistograms(Aliyun_Log_Client $client, $project, $logstore) {
+ $topic = 'TestTopic';
+ $from = time()-3600;
+ $to = time();
+ $request = new Aliyun_Log_Models_GetHistogramsRequest($project, $logstore, $from, $to, $topic, '');
+
+ try {
+ $response = $client->getHistograms($request);
+ logVarDump($response);
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+function listShard(Aliyun_Log_Client $client,$project,$logstore){
+ $request = new Aliyun_Log_Models_ListShardsRequest($project,$logstore);
+ try
+ {
+ $response = $client -> listShards($request);
+ logVarDump($response);
+ } catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+function batchGetLogs(Aliyun_Log_Client $client,$project,$logstore)
+{
+ $listShardRequest = new Aliyun_Log_Models_ListShardsRequest($project,$logstore);
+ $listShardResponse = $client -> listShards($listShardRequest);
+ foreach($listShardResponse-> getShardIds() as $shardId)
+ {
+ $getCursorRequest = new Aliyun_Log_Models_GetCursorRequest($project,$logstore,$shardId,null, time() - 60);
+ $response = $client -> getCursor($getCursorRequest);
+ $cursor = $response-> getCursor();
+ $count = 100;
+ while(true)
+ {
+ $batchGetDataRequest = new Aliyun_Log_Models_BatchGetLogsRequest($project,$logstore,$shardId,$count,$cursor);
+ logVarDump($batchGetDataRequest);
+ $response = $client -> batchGetLogs($batchGetDataRequest);
+ if($cursor == $response -> getNextCursor())
+ {
+ break;
+ }
+ $logGroupList = $response -> getLogGroupList();
+ foreach($logGroupList as $logGroup)
+ {
+ print ($logGroup->getCategory());
+
+ foreach($logGroup -> getLogsArray() as $log)
+ {
+ foreach($log -> getContentsArray() as $content)
+ {
+ print($content-> getKey().":".$content->getValue()."\t");
+ }
+ print("\n");
+ }
+ }
+ $cursor = $response -> getNextCursor();
+ }
+ }
+}
+
+function batchGetLogsWithRange(Aliyun_Log_Client $client,$project,$logstore)
+{
+ $listShardRequest = new Aliyun_Log_Models_ListShardsRequest($project,$logstore);
+ $listShardResponse = $client -> listShards($listShardRequest);
+ foreach($listShardResponse-> getShardIds() as $shardId)
+ {
+ //pull data which reached server at time range [now - 60s, now) for every shard
+ $curTime = time();
+ $beginCursorResponse = $client->getCursor(new Aliyun_Log_Models_GetCursorRequest($project,$logstore,$shardId,null,$curTime - 60));
+ $beginCursor = $beginCursorResponse-> getCursor();
+ $endCursorResponse = $client -> getCursor(new Aliyun_Log_Models_GetCursorRequest($project,$logstore,$shardId,null,$curTime));
+ $endCursor = $endCursorResponse-> getCursor();
+ $cursor = $beginCursor;
+ print("-----------------------------------------\nbatchGetLogs for shard: ".$shardId.", cursor range: [".$beginCursor.", ".$endCursor.")\n");
+ $count = 100;
+ while(true)
+ {
+ $batchGetDataRequest = new Aliyun_Log_Models_BatchGetLogsRequest($project,$logstore,$shardId,$count,$cursor,$endCursor);
+ $response = $client -> batchGetLogs($batchGetDataRequest);
+ $logGroupList = $response -> getLogGroupList();
+ $logGroupCount = 0;
+ $logCount = 0;
+ foreach($logGroupList as $logGroup)
+ {
+ $logGroupCount += 1;
+ foreach($logGroup -> getLogsArray() as $log)
+ {
+ $logCount += 1;
+ foreach($log -> getContentsArray() as $content)
+ {
+ print($content-> getKey().":".$content->getValue()."\t");
+ }
+ print("\n");
+ }
+ }
+ $nextCursor = $response -> getNextCursor();
+ print("batchGetLogs once, cursor: ".$cursor.", nextCursor: ".nextCursor.", logGroups: ".$logGroupCount.", logs: ".$logCount."\n");
+ if($cursor == $nextCursor)
+ {
+ //read data finished
+ break;
+ }
+ $cursor = $nextCursor;
+ }
+ }
+}
+
+function mergeShard(Aliyun_Log_Client $client,$project,$logstore,$shardId)
+{
+ $request = new Aliyun_Log_Models_MergeShardsRequest($project,$logstore,$shardId);
+ try
+ {
+ $response = $client -> mergeShards($request);
+ logVarDump($response);
+ }catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+function splitShard(Aliyun_Log_Client $client,$project,$logstore,$shardId,$midHash)
+{
+ $request = new Aliyun_Log_Models_SplitShardRequest($project,$logstore,$shardId,$midHash);
+ try
+ {
+ $response = $client -> splitShard($request);
+ logVarDump($response);
+ }catch (Aliyun_Log_Exception $ex) {
+ logVarDump($ex);
+ } catch (Exception $ex) {
+ logVarDump($ex);
+ }
+}
+
+function logVarDump($expression){
+ print "
loginfo begin = ".get_class($expression)."
";
+ var_dump($expression);
+ print "
loginfo end
";
+}
+
+/*
+ * please refer to aliyun sdk document for detail:
+ * http://help.aliyun-inc.com/internaldoc/detail/29074.html?spm=0.0.0.0.tqUNn5
+ */
+$endpoint = 'cn-guangzhou.log.aliyuncs.com';
+$accessKeyId = 'LTAI4G9HFUkuYzYCBhPK4n2w';
+$accessKey = 'Yh5vtntTF9JCX8yylvcRlwzO4Prbzb';
+$project = 'globalhoghlights';
+$logstore = 'globalhoghlights';
+$token = "";
+
+$client = new Aliyun_Log_Client($endpoint, $accessKeyId, $accessKey,$token);
+//listShard($client,$project,$logstore);
+//mergeShard($client,$project,$logstore,2);
+//deleteShard($client,$project,$logstore,2);
+//splitShard($client,$project,$logstore,2,"80000000000000000000000000000001");
+//putLogs($client, $project, $logstore);
+//listShard($client,$project,$logstore);
+//batchGetLogs($client,$project,$logstore);
+//batchGetLogsWithRange($client,$project,$logstore);
+//listLogstores($client, $project);
+//listTopics($client, $project, $logstore);
+//getHistograms($client, $project, $logstore);
+getLogs($client, $project, $logstore);