Changeset 1365009
- Timestamp:
- 03/06/2016 12:25:55 PM (10 years ago)
- Location:
- stacksight
- Files:
-
- 15 edited
- 12 copied
-
tags/1.7.12 (copied) (copied from stacksight/trunk)
-
tags/1.7.12/inc/wp-health-backups.php (modified) (2 diffs)
-
tags/1.7.12/inc/wp-health-seo.php (copied) (copied from stacksight/trunk/inc/wp-health-seo.php)
-
tags/1.7.12/readme.txt (copied) (copied from stacksight/trunk/readme.txt) (1 diff)
-
tags/1.7.12/stacksight-php-sdk/SSClientBase.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/SSClientBase.php) (2 diffs)
-
tags/1.7.12/stacksight-php-sdk/SSHttpRequest.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/SSHttpRequest.php) (1 diff)
-
tags/1.7.12/stacksight-php-sdk/SSLogsTracker.php (modified) (2 diffs)
-
tags/1.7.12/stacksight-php-sdk/SSUtilities.php (modified) (1 diff)
-
tags/1.7.12/stacksight-php-sdk/bootstrap-drupal.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/bootstrap-drupal.php)
-
tags/1.7.12/stacksight-php-sdk/bootstrap-wp.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/bootstrap-wp.php)
-
tags/1.7.12/stacksight-php-sdk/platforms/SSDrupalClient.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/platforms/SSDrupalClient.php)
-
tags/1.7.12/stacksight-php-sdk/platforms/SSWordpressClient.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/platforms/SSWordpressClient.php)
-
tags/1.7.12/stacksight-php-sdk/requests/SSHttpInterface.php (modified) (1 diff)
-
tags/1.7.12/stacksight-php-sdk/requests/SSHttpRequestCurl.php (modified) (1 diff)
-
tags/1.7.12/stacksight-php-sdk/requests/SSHttpRequestMultiCurl.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/requests/SSHttpRequestMultiCurl.php)
-
tags/1.7.12/stacksight-php-sdk/requests/SSHttpRequestSockets.php (copied) (copied from stacksight/trunk/stacksight-php-sdk/requests/SSHttpRequestSockets.php) (6 diffs)
-
tags/1.7.12/wp-stacksight.php (copied) (copied from stacksight/trunk/wp-stacksight.php) (2 diffs)
-
trunk/inc/wp-health-backups.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/stacksight-php-sdk/SSClientBase.php (modified) (2 diffs)
-
trunk/stacksight-php-sdk/SSHttpRequest.php (modified) (1 diff)
-
trunk/stacksight-php-sdk/SSLogsTracker.php (modified) (2 diffs)
-
trunk/stacksight-php-sdk/SSUtilities.php (modified) (1 diff)
-
trunk/stacksight-php-sdk/requests/SSHttpInterface.php (modified) (1 diff)
-
trunk/stacksight-php-sdk/requests/SSHttpRequestCurl.php (modified) (1 diff)
-
trunk/stacksight-php-sdk/requests/SSHttpRequestSockets.php (modified) (6 diffs)
-
trunk/wp-stacksight.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
stacksight/tags/1.7.12/inc/wp-health-backups.php
r1295919 r1365009 13 13 ); 14 14 15 public $last_months = 1; 16 15 17 public function getBackupsData(){ 16 18 $backup_list = UpdraftPlus_Options::get_updraft_option('updraft_backup_history'); … … 20 22 21 23 foreach($backup_list as $timestamp => $backups_info){ 24 $time_mm = strtotime("+$this->last_months month"); 25 // If date more than 1 month - skip it 26 if(date('Y-m-d', $timestamp) < date('Y-m-d', $time_mm)) 27 continue; 28 22 29 $this->backups_size = 0; 23 30 $this->backup_files = array(); -
stacksight/tags/1.7.12/readme.txt
r1361764 r1365009 4 4 Requires at least: 3.5 5 5 Tested up to: 4.3 6 Stable tag: 1.7.1 16 Stable tag: 1.7.12 7 7 License: GPLv2 or later 8 8 -
stacksight/tags/1.7.12/stacksight-php-sdk/SSClientBase.php
r1316922 r1365009 25 25 private $curl_obj = array(); 26 26 27 public $stacksight_bot_name = 'Stacksight BOT'; 28 public $stacksight_bot_ico = 'https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2015-08-26/9685505874_5c499cefd86aa883b7f4_68.jpg'; 29 27 30 public function __construct($token, $platform, $app_id = false, $group = false) { 28 31 $this->token = $token; … … 104 107 } 105 108 109 public function sendSlackNotify($message, $type){ 110 $color = false; 111 switch($type){ 112 case 'error': 113 $pretext = "Error"; 114 $color = 'danger'; 115 break; 116 case 'warn': 117 $pretext = "Warning"; 118 $color = 'warning'; 119 break; 120 default: 121 $pretext = "Info"; 122 $color = '#28D7E5'; 123 break; 124 } 125 126 $data = array( 127 "attachments" => array( 128 array( 129 "pretext" => SSUtilities::currentPageURL(), 130 // "author_name" => $this->stacksight_bot_name, 131 // "author_icon" => $this->stacksight_bot_ico, 132 "text" => $message, 133 "title" => $pretext, 134 "color" => $color 135 ) 136 ) 137 ); 138 if (strlen(json_encode($data)) > $this->socket_limit) 139 $response = $this->request_curl->sendSlackNotify($data); 140 else 141 $response = $this->request_socket->sendSlackNotify($data); 142 } 143 106 144 public function sendUpdates($data, $isMulticURL = false) { 107 145 $this->_setAppParams($data); -
stacksight/tags/1.7.12/stacksight-php-sdk/SSHttpRequest.php
r1316922 r1365009 25 25 } 26 26 27 public function sendSlackNotify($data) { 28 $incoming_url = parse_url(STACKSIGHT_INCOMING_SLACK_URL); 29 $this->host = $incoming_url['host']; 30 $this->api_path = ltrim($incoming_url['path'], '/'); 31 $this->createSocket(true); 32 $this->sendRequest($data, false); 33 } 34 27 35 public function sendUpdates($data) { 28 36 $this->sendRequest($data, self::UPDATE_URL); -
stacksight/tags/1.7.12/stacksight-php-sdk/SSLogsTracker.php
r1274850 r1365009 33 33 34 34 $message = $errstr.' in '.$errfile.' on line '.$errline; 35 36 35 switch ($errno) { 37 36 case E_ERROR: // 1 // 38 $this->client->sendLog('E_ERROR: ' . $message, 'error'); break; 37 $this->client->sendLog('E_ERROR: ' . $message, 'error'); 38 $this->_sendSlackMessage($message, 'error'); 39 break; 39 40 case E_WARNING: // 2 // 40 $this->client->sendLog('E_WARNING: ' . $message, 'warn'); break; 41 $this->client->sendLog('E_WARNING: ' . $message, 'warn'); 42 $this->_sendSlackMessage($message, 'warn'); 43 break; 41 44 case E_PARSE: // 4 // 42 $this->client->sendLog('E_PARSE: ' . $message, 'error'); break; 45 $this->client->sendLog('E_PARSE: ' . $message, 'error'); 46 $this->_sendSlackMessage($message, 'error'); 47 break; 43 48 case E_NOTICE: // 8 // 44 $this->client->sendLog('E_NOTICE: ' . $message, 'info'); break; 49 $this->client->sendLog('E_NOTICE: ' . $message, 'info'); 50 $this->_sendSlackMessage($message, 'info'); 51 break; 45 52 case E_CORE_ERROR: // 16 // 46 $this->client->sendLog('E_CORE_ERROR: ' . $message, 'error'); break; 53 $this->client->sendLog('E_CORE_ERROR: ' . $message, 'error'); 54 $this->_sendSlackMessage($message, 'error'); 55 break; 47 56 case E_CORE_WARNING: // 32 // 48 $this->client->sendLog('E_CORE_WARNING: ' . $message, 'warn'); break; 57 $this->client->sendLog('E_CORE_WARNING: ' . $message, 'warn'); 58 $this->_sendSlackMessage($message, 'warn'); 59 break; 49 60 case E_COMPILE_ERROR: // 64 // 50 $this->client->sendLog('E_COMPILE_ERROR: ' . $message, 'error'); break; 61 $this->client->sendLog('E_COMPILE_ERROR: ' . $message, 'error'); 62 $this->_sendSlackMessage($message, 'error'); 63 break; 51 64 case E_COMPILE_WARNING: // 128 // 52 $this->client->sendLog('E_COMPILE_WARNING: ' . $message, 'warn'); break; 65 $this->client->sendLog('E_COMPILE_WARNING: ' . $message, 'warn'); 66 $this->_sendSlackMessage($message, 'warn'); 67 break; 53 68 case E_USER_ERROR: // 256 // 54 $this->client->sendLog('E_USER_ERROR: ' . $message, 'error'); break; 69 $this->client->sendLog('E_USER_ERROR: ' . $message, 'error'); 70 $this->_sendSlackMessage($message, 'error'); 71 break; 55 72 case E_USER_WARNING: // 512 // 56 $this->client->sendLog('E_USER_WARNING: ' . $message, 'warn'); break; 73 $this->client->sendLog('E_USER_WARNING: ' . $message, 'warn'); 74 $this->_sendSlackMessage($message, 'warn'); 75 break; 57 76 case E_USER_NOTICE: // 1024 // 58 $this->client->sendLog('E_USER_NOTICE: ' . $message, 'info'); break; 77 $this->client->sendLog('E_USER_NOTICE: ' . $message, 'info'); 78 $this->_sendSlackMessage($message, 'info'); 79 break; 59 80 case E_STRICT: // 2048 // 60 $this->client->sendLog('E_STRICT: ' . $message, 'info'); break; 81 $this->client->sendLog('E_STRICT: ' . $message, 'info'); 82 $this->_sendSlackMessage($message, 'info'); 83 break; 61 84 case E_RECOVERABLE_ERROR: // 4096 // 62 $this->client->sendLog('E_RECOVERABLE_ERROR: ' . $message, 'error'); break; 85 $this->client->sendLog('E_RECOVERABLE_ERROR: ' . $message, 'error'); 86 $this->_sendSlackMessage($message, 'error'); 87 break; 63 88 } 64 89 … … 73 98 } 74 99 100 101 75 102 return false; 76 103 } 104 105 private function _sendSlackMessage($message, $type){ 106 if((defined('STACKSIGHT_INCOMING_SLACK_URL') && defined('STACKSIGHT_SEND_TO_SLACK_EVENTS'))){ 107 $types = unserialize(STACKSIGHT_SEND_TO_SLACK_EVENTS); 108 if(in_array($type, $types)){ 109 $this->client->sendSlackNotify($message, $type); 110 } 111 } 112 } 77 113 } -
stacksight/tags/1.7.12/stacksight-php-sdk/SSUtilities.php
r1274850 r1365009 27 27 return str_replace(array_keys($params), $params, $str); 28 28 } 29 30 static function currentPageURL() { 31 $pageURL = 'http'; 32 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 33 $pageURL .= "://"; 34 if ($_SERVER["SERVER_PORT"] != "80") { 35 $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 36 } else { 37 $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; 38 } 39 return $pageURL; 40 } 29 41 } -
stacksight/tags/1.7.12/stacksight-php-sdk/requests/SSHttpInterface.php
r1282300 r1365009 4 4 public function publishEvent($data); 5 5 public function sendLog($data); 6 public function sendSlackNotify($data); 6 7 public function sendUpdates($data); 7 8 public function sendHealth($data); -
stacksight/tags/1.7.12/stacksight-php-sdk/requests/SSHttpRequestCurl.php
r1282300 r1365009 4 4 public function sendRequest($data, $url = false){ 5 5 $data_string = json_encode($data); 6 $ch = ($url) ? curl_init(INDEX_ENDPOINT_01.$url) : curl_init(INDEX_ENDPOINT_01.'/'.$data['index'].'/'.$data['eType']); 6 $total_url = ($url) ? INDEX_ENDPOINT_01.$url : INDEX_ENDPOINT_01.'/'.$data['index'].'/'.$data['eType']; 7 $ch = curl_init($total_url); 8 7 9 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 8 10 curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); -
stacksight/tags/1.7.12/stacksight-php-sdk/requests/SSHttpRequestSockets.php
r1327555 r1365009 20 20 } 21 21 22 p rivate function createSocket(){22 public function createSocket($recreate = false){ 23 23 $flags = STREAM_CLIENT_ASYNC_CONNECT; 24 if(!$this->_socket ){24 if(!$this->_socket || $recreate === true){ 25 25 if($this->_socket = @stream_socket_client($this->protocol . "://" . $this->host. ':' . $this->port, $errno, $errstr, $this->timeout, $flags)){ 26 26 stream_set_blocking($this->_socket, false); … … 34 34 } 35 35 } 36 37 36 } 38 37 … … 42 41 } 43 42 44 public function sendRequest($data, $url = false){43 public function sendRequest($data, $url = null){ 45 44 if($this->_state_socket === true){ 46 if($url === false)45 if($url === null) 47 46 $url = $this->api_path.'/'.$data['index'].'/'.$data['eType']; 48 47 else … … 50 49 51 50 $content = json_encode($data); 51 52 52 $req = ""; 53 53 $req.= "POST /$url HTTP/1.1\r\n"; … … 59 59 $req.= $content; 60 60 61 if(! fwrite($this->_socket, $req)){61 if(!@fwrite($this->_socket, $req)){ 62 62 $sended = false; 63 63 for($i = 0; $i <= $this->max_retry; $i++){ 64 64 usleep(200000); 65 if(fwrite($this->_socket, $req)){ 65 if(@fwrite($this->_socket, $req)){ 66 SSUtilities::error_log("Error fwrire socket. Tried $i timeы...", 'error_socket_connection'); 66 67 $sended = true; 67 68 break; … … 72 73 usleep(200000); 73 74 $this->createSocket(); 74 if(!fwrite($this->_socket, $req)){ 75 if(!@fwrite($this->_socket, $req)){ 76 SSUtilities::error_log("Error fwrire socket after sleep.", 'error_socket_connection'); 75 77 $cURL = new SSHttpRequestCurl(); 76 $cURL->sendRequest($data , $url);78 $cURL->sendRequest($data); 77 79 } 78 80 } -
stacksight/tags/1.7.12/wp-stacksight.php
r1361764 r1365009 4 4 * Plugin URI: http://mean.io 5 5 * Description: Stacksight wordpress support (featuring events, error logs and updates) 6 * Version: 1.7.1 16 * Version: 1.7.12 7 7 * Author: Stacksight LTD 8 8 * Author URI: http://stacksight.io … … 291 291 */ 292 292 public function create_admin_page() { 293 $this->cron_do_main_job(); 293 294 ?> 294 295 <div class="ss-wrap"> -
stacksight/trunk/inc/wp-health-backups.php
r1295919 r1365009 13 13 ); 14 14 15 public $last_months = 1; 16 15 17 public function getBackupsData(){ 16 18 $backup_list = UpdraftPlus_Options::get_updraft_option('updraft_backup_history'); … … 20 22 21 23 foreach($backup_list as $timestamp => $backups_info){ 24 $time_mm = strtotime("+$this->last_months month"); 25 // If date more than 1 month - skip it 26 if(date('Y-m-d', $timestamp) < date('Y-m-d', $time_mm)) 27 continue; 28 22 29 $this->backups_size = 0; 23 30 $this->backup_files = array(); -
stacksight/trunk/readme.txt
r1361764 r1365009 4 4 Requires at least: 3.5 5 5 Tested up to: 4.3 6 Stable tag: 1.7.1 16 Stable tag: 1.7.12 7 7 License: GPLv2 or later 8 8 -
stacksight/trunk/stacksight-php-sdk/SSClientBase.php
r1316922 r1365009 25 25 private $curl_obj = array(); 26 26 27 public $stacksight_bot_name = 'Stacksight BOT'; 28 public $stacksight_bot_ico = 'https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2015-08-26/9685505874_5c499cefd86aa883b7f4_68.jpg'; 29 27 30 public function __construct($token, $platform, $app_id = false, $group = false) { 28 31 $this->token = $token; … … 104 107 } 105 108 109 public function sendSlackNotify($message, $type){ 110 $color = false; 111 switch($type){ 112 case 'error': 113 $pretext = "Error"; 114 $color = 'danger'; 115 break; 116 case 'warn': 117 $pretext = "Warning"; 118 $color = 'warning'; 119 break; 120 default: 121 $pretext = "Info"; 122 $color = '#28D7E5'; 123 break; 124 } 125 126 $data = array( 127 "attachments" => array( 128 array( 129 "pretext" => SSUtilities::currentPageURL(), 130 // "author_name" => $this->stacksight_bot_name, 131 // "author_icon" => $this->stacksight_bot_ico, 132 "text" => $message, 133 "title" => $pretext, 134 "color" => $color 135 ) 136 ) 137 ); 138 if (strlen(json_encode($data)) > $this->socket_limit) 139 $response = $this->request_curl->sendSlackNotify($data); 140 else 141 $response = $this->request_socket->sendSlackNotify($data); 142 } 143 106 144 public function sendUpdates($data, $isMulticURL = false) { 107 145 $this->_setAppParams($data); -
stacksight/trunk/stacksight-php-sdk/SSHttpRequest.php
r1316922 r1365009 25 25 } 26 26 27 public function sendSlackNotify($data) { 28 $incoming_url = parse_url(STACKSIGHT_INCOMING_SLACK_URL); 29 $this->host = $incoming_url['host']; 30 $this->api_path = ltrim($incoming_url['path'], '/'); 31 $this->createSocket(true); 32 $this->sendRequest($data, false); 33 } 34 27 35 public function sendUpdates($data) { 28 36 $this->sendRequest($data, self::UPDATE_URL); -
stacksight/trunk/stacksight-php-sdk/SSLogsTracker.php
r1274850 r1365009 33 33 34 34 $message = $errstr.' in '.$errfile.' on line '.$errline; 35 36 35 switch ($errno) { 37 36 case E_ERROR: // 1 // 38 $this->client->sendLog('E_ERROR: ' . $message, 'error'); break; 37 $this->client->sendLog('E_ERROR: ' . $message, 'error'); 38 $this->_sendSlackMessage($message, 'error'); 39 break; 39 40 case E_WARNING: // 2 // 40 $this->client->sendLog('E_WARNING: ' . $message, 'warn'); break; 41 $this->client->sendLog('E_WARNING: ' . $message, 'warn'); 42 $this->_sendSlackMessage($message, 'warn'); 43 break; 41 44 case E_PARSE: // 4 // 42 $this->client->sendLog('E_PARSE: ' . $message, 'error'); break; 45 $this->client->sendLog('E_PARSE: ' . $message, 'error'); 46 $this->_sendSlackMessage($message, 'error'); 47 break; 43 48 case E_NOTICE: // 8 // 44 $this->client->sendLog('E_NOTICE: ' . $message, 'info'); break; 49 $this->client->sendLog('E_NOTICE: ' . $message, 'info'); 50 $this->_sendSlackMessage($message, 'info'); 51 break; 45 52 case E_CORE_ERROR: // 16 // 46 $this->client->sendLog('E_CORE_ERROR: ' . $message, 'error'); break; 53 $this->client->sendLog('E_CORE_ERROR: ' . $message, 'error'); 54 $this->_sendSlackMessage($message, 'error'); 55 break; 47 56 case E_CORE_WARNING: // 32 // 48 $this->client->sendLog('E_CORE_WARNING: ' . $message, 'warn'); break; 57 $this->client->sendLog('E_CORE_WARNING: ' . $message, 'warn'); 58 $this->_sendSlackMessage($message, 'warn'); 59 break; 49 60 case E_COMPILE_ERROR: // 64 // 50 $this->client->sendLog('E_COMPILE_ERROR: ' . $message, 'error'); break; 61 $this->client->sendLog('E_COMPILE_ERROR: ' . $message, 'error'); 62 $this->_sendSlackMessage($message, 'error'); 63 break; 51 64 case E_COMPILE_WARNING: // 128 // 52 $this->client->sendLog('E_COMPILE_WARNING: ' . $message, 'warn'); break; 65 $this->client->sendLog('E_COMPILE_WARNING: ' . $message, 'warn'); 66 $this->_sendSlackMessage($message, 'warn'); 67 break; 53 68 case E_USER_ERROR: // 256 // 54 $this->client->sendLog('E_USER_ERROR: ' . $message, 'error'); break; 69 $this->client->sendLog('E_USER_ERROR: ' . $message, 'error'); 70 $this->_sendSlackMessage($message, 'error'); 71 break; 55 72 case E_USER_WARNING: // 512 // 56 $this->client->sendLog('E_USER_WARNING: ' . $message, 'warn'); break; 73 $this->client->sendLog('E_USER_WARNING: ' . $message, 'warn'); 74 $this->_sendSlackMessage($message, 'warn'); 75 break; 57 76 case E_USER_NOTICE: // 1024 // 58 $this->client->sendLog('E_USER_NOTICE: ' . $message, 'info'); break; 77 $this->client->sendLog('E_USER_NOTICE: ' . $message, 'info'); 78 $this->_sendSlackMessage($message, 'info'); 79 break; 59 80 case E_STRICT: // 2048 // 60 $this->client->sendLog('E_STRICT: ' . $message, 'info'); break; 81 $this->client->sendLog('E_STRICT: ' . $message, 'info'); 82 $this->_sendSlackMessage($message, 'info'); 83 break; 61 84 case E_RECOVERABLE_ERROR: // 4096 // 62 $this->client->sendLog('E_RECOVERABLE_ERROR: ' . $message, 'error'); break; 85 $this->client->sendLog('E_RECOVERABLE_ERROR: ' . $message, 'error'); 86 $this->_sendSlackMessage($message, 'error'); 87 break; 63 88 } 64 89 … … 73 98 } 74 99 100 101 75 102 return false; 76 103 } 104 105 private function _sendSlackMessage($message, $type){ 106 if((defined('STACKSIGHT_INCOMING_SLACK_URL') && defined('STACKSIGHT_SEND_TO_SLACK_EVENTS'))){ 107 $types = unserialize(STACKSIGHT_SEND_TO_SLACK_EVENTS); 108 if(in_array($type, $types)){ 109 $this->client->sendSlackNotify($message, $type); 110 } 111 } 112 } 77 113 } -
stacksight/trunk/stacksight-php-sdk/SSUtilities.php
r1274850 r1365009 27 27 return str_replace(array_keys($params), $params, $str); 28 28 } 29 30 static function currentPageURL() { 31 $pageURL = 'http'; 32 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 33 $pageURL .= "://"; 34 if ($_SERVER["SERVER_PORT"] != "80") { 35 $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 36 } else { 37 $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; 38 } 39 return $pageURL; 40 } 29 41 } -
stacksight/trunk/stacksight-php-sdk/requests/SSHttpInterface.php
r1282300 r1365009 4 4 public function publishEvent($data); 5 5 public function sendLog($data); 6 public function sendSlackNotify($data); 6 7 public function sendUpdates($data); 7 8 public function sendHealth($data); -
stacksight/trunk/stacksight-php-sdk/requests/SSHttpRequestCurl.php
r1282300 r1365009 4 4 public function sendRequest($data, $url = false){ 5 5 $data_string = json_encode($data); 6 $ch = ($url) ? curl_init(INDEX_ENDPOINT_01.$url) : curl_init(INDEX_ENDPOINT_01.'/'.$data['index'].'/'.$data['eType']); 6 $total_url = ($url) ? INDEX_ENDPOINT_01.$url : INDEX_ENDPOINT_01.'/'.$data['index'].'/'.$data['eType']; 7 $ch = curl_init($total_url); 8 7 9 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 8 10 curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); -
stacksight/trunk/stacksight-php-sdk/requests/SSHttpRequestSockets.php
r1327555 r1365009 20 20 } 21 21 22 p rivate function createSocket(){22 public function createSocket($recreate = false){ 23 23 $flags = STREAM_CLIENT_ASYNC_CONNECT; 24 if(!$this->_socket ){24 if(!$this->_socket || $recreate === true){ 25 25 if($this->_socket = @stream_socket_client($this->protocol . "://" . $this->host. ':' . $this->port, $errno, $errstr, $this->timeout, $flags)){ 26 26 stream_set_blocking($this->_socket, false); … … 34 34 } 35 35 } 36 37 36 } 38 37 … … 42 41 } 43 42 44 public function sendRequest($data, $url = false){43 public function sendRequest($data, $url = null){ 45 44 if($this->_state_socket === true){ 46 if($url === false)45 if($url === null) 47 46 $url = $this->api_path.'/'.$data['index'].'/'.$data['eType']; 48 47 else … … 50 49 51 50 $content = json_encode($data); 51 52 52 $req = ""; 53 53 $req.= "POST /$url HTTP/1.1\r\n"; … … 59 59 $req.= $content; 60 60 61 if(! fwrite($this->_socket, $req)){61 if(!@fwrite($this->_socket, $req)){ 62 62 $sended = false; 63 63 for($i = 0; $i <= $this->max_retry; $i++){ 64 64 usleep(200000); 65 if(fwrite($this->_socket, $req)){ 65 if(@fwrite($this->_socket, $req)){ 66 SSUtilities::error_log("Error fwrire socket. Tried $i timeы...", 'error_socket_connection'); 66 67 $sended = true; 67 68 break; … … 72 73 usleep(200000); 73 74 $this->createSocket(); 74 if(!fwrite($this->_socket, $req)){ 75 if(!@fwrite($this->_socket, $req)){ 76 SSUtilities::error_log("Error fwrire socket after sleep.", 'error_socket_connection'); 75 77 $cURL = new SSHttpRequestCurl(); 76 $cURL->sendRequest($data , $url);78 $cURL->sendRequest($data); 77 79 } 78 80 } -
stacksight/trunk/wp-stacksight.php
r1361764 r1365009 4 4 * Plugin URI: http://mean.io 5 5 * Description: Stacksight wordpress support (featuring events, error logs and updates) 6 * Version: 1.7.1 16 * Version: 1.7.12 7 7 * Author: Stacksight LTD 8 8 * Author URI: http://stacksight.io … … 291 291 */ 292 292 public function create_admin_page() { 293 $this->cron_do_main_job(); 293 294 ?> 294 295 <div class="ss-wrap">
Note: See TracChangeset
for help on using the changeset viewer.