Added some more timestamp measuring
This commit is contained in:
parent
1cf3cb493f
commit
dbe8275ae5
|
@ -681,6 +681,8 @@ function bb_RemovePictureLinks($match) {
|
|||
if(is_null($text)){
|
||||
$a = get_app();
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$ch = @curl_init($match[1]);
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -688,6 +690,8 @@ function bb_RemovePictureLinks($match) {
|
|||
@curl_exec($ch);
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
if (substr($curl_info["content_type"], 0, 6) == "image/")
|
||||
$text = "[url=".$match[1]."]".$match[1]."[/url]";
|
||||
else {
|
||||
|
@ -731,6 +735,8 @@ function bb_CleanPictureLinksSub($match) {
|
|||
if(is_null($text)){
|
||||
$a = get_app();
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$ch = @curl_init($match[1]);
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, true);
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -738,6 +744,8 @@ function bb_CleanPictureLinksSub($match) {
|
|||
@curl_exec($ch);
|
||||
$curl_info = @curl_getinfo($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
// if its a link to a picture then embed this picture
|
||||
if (substr($curl_info["content_type"], 0, 6) == "image/")
|
||||
$text = "[img]".$match[1]."[/img]";
|
||||
|
|
|
@ -1151,6 +1151,8 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
|
||||
$url = trim($url, "'");
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$siteinfo = array();
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
@ -1165,6 +1167,8 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
$http_code = $curl_info['http_code'];
|
||||
curl_close($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
if ((($curl_info['http_code'] == "301") OR ($curl_info['http_code'] == "302"))
|
||||
AND (($curl_info['redirect_url'] != "") OR ($curl_info['location'] != ""))) {
|
||||
if ($curl_info['redirect_url'] != "")
|
||||
|
@ -1185,6 +1189,8 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html"))
|
||||
return($url);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
|
@ -1196,6 +1202,8 @@ function original_url($url, $depth=1, $fetchbody = false) {
|
|||
$body = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
if (trim($body) == "")
|
||||
return($url);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ function oembed_replacecb($matches){
|
|||
|
||||
|
||||
function oembed_fetch_url($embedurl, $no_rich_type = false){
|
||||
|
||||
$embedurl = trim($embedurl, "'");
|
||||
$embedurl = trim($embedurl, '"');
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
$siteinfo["url"] = $url;
|
||||
$siteinfo["type"] = "link";
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
|
@ -84,6 +86,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
$http_code = $curl_info['http_code'];
|
||||
curl_close($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
if ((($curl_info['http_code'] == "301") OR ($curl_info['http_code'] == "302") OR ($curl_info['http_code'] == "303") OR ($curl_info['http_code'] == "307"))
|
||||
AND (($curl_info['redirect_url'] != "") OR ($curl_info['location'] != ""))) {
|
||||
if ($curl_info['redirect_url'] != "")
|
||||
|
@ -110,6 +114,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html"))
|
||||
return($siteinfo);
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
// Now fetch the body as well
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
@ -124,6 +130,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
$http_code = $curl_info['http_code'];
|
||||
curl_close($ch);
|
||||
|
||||
$a->save_timestamp($stamp1, "network");
|
||||
|
||||
// Fetch the first mentioned charset. Can be in body or header
|
||||
$charset = "";
|
||||
if (preg_match('/charset=(.*?)['."'".'"\s\n]/', $header, $matches))
|
||||
|
|
Loading…
Reference in New Issue
Block a user