Add some analysing stuff, rendered value is written now more often
This commit is contained in:
parent
9b5c6ed580
commit
c4ba035ee3
28
boot.php
28
boot.php
|
@ -467,6 +467,7 @@ class App {
|
||||||
public $is_tablet;
|
public $is_tablet;
|
||||||
public $is_friendica_app;
|
public $is_friendica_app;
|
||||||
public $performance = array();
|
public $performance = array();
|
||||||
|
public $callstack = array();
|
||||||
|
|
||||||
public $nav_sel;
|
public $nav_sel;
|
||||||
|
|
||||||
|
@ -552,7 +553,15 @@ class App {
|
||||||
$this->performance["rendering"] = 0;
|
$this->performance["rendering"] = 0;
|
||||||
$this->performance["parser"] = 0;
|
$this->performance["parser"] = 0;
|
||||||
$this->performance["marktime"] = 0;
|
$this->performance["marktime"] = 0;
|
||||||
$this->performance["markstart"] = microtime(true);
|
|
||||||
|
$this->performance["file"] = 0;
|
||||||
|
$this->performance["file"] = 0;
|
||||||
|
|
||||||
|
$this->callstack["database"] = array();
|
||||||
|
$this->callstack["network"] = array();
|
||||||
|
$this->callstack["file"] = array();
|
||||||
|
$this->callstack["rendering"] = array();
|
||||||
|
$this->callstack["parser"] = array();
|
||||||
|
|
||||||
$this->config = array();
|
$this->config = array();
|
||||||
$this->page = array();
|
$this->page = array();
|
||||||
|
@ -1016,6 +1025,23 @@ class App {
|
||||||
|
|
||||||
$this->performance[$value] += (float)$duration;
|
$this->performance[$value] += (float)$duration;
|
||||||
$this->performance["marktime"] += (float)$duration;
|
$this->performance["marktime"] += (float)$duration;
|
||||||
|
|
||||||
|
// Trace the different functions with their timestamps
|
||||||
|
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5);
|
||||||
|
|
||||||
|
array_shift($trace);
|
||||||
|
|
||||||
|
$function = array();
|
||||||
|
foreach ($trace AS $func)
|
||||||
|
$function[] = $func["function"];
|
||||||
|
|
||||||
|
$function = implode(", ", $function);
|
||||||
|
|
||||||
|
//$last = array_pop($trace);
|
||||||
|
//$function = $last["function"];
|
||||||
|
|
||||||
|
$this->callstack[$value][$function] += (float)$duration;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mark_timestamp($mark) {
|
function mark_timestamp($mark) {
|
||||||
|
|
|
@ -315,11 +315,11 @@ function localize_item(&$item){
|
||||||
}
|
}
|
||||||
|
|
||||||
// add zrl's to public images
|
// add zrl's to public images
|
||||||
$photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
|
// $photo_pattern = "/\[url=(.*?)\/photos\/(.*?)\/image\/(.*?)\]\[img(.*?)\]h(.*?)\[\/img\]\[\/url\]/is";
|
||||||
if(preg_match($photo_pattern,$item['body'])) {
|
// if(preg_match($photo_pattern,$item['body'])) {
|
||||||
$photo_replace = '[url=' . zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]';
|
// $photo_replace = '[url=' . zrl('$1' . '/photos/' . '$2' . '/image/' . '$3' ,true) . '][img' . '$4' . ']h' . '$5' . '[/img][/url]';
|
||||||
$item['body'] = bb_tag_preg_replace($photo_pattern, $photo_replace, 'url', $item['body']);
|
// $item['body'] = bb_tag_preg_replace($photo_pattern, $photo_replace, 'url', $item['body']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// add sparkle links to appropriate permalinks
|
// add sparkle links to appropriate permalinks
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ function cron_run(&$argv, &$argc){
|
||||||
|
|
||||||
// Repair missing Diaspora settings
|
// Repair missing Diaspora settings
|
||||||
$r = q("SELECT `id`, `url` FROM `contact`
|
$r = q("SELECT `id`, `url` FROM `contact`
|
||||||
WHERE `uid` > 0 AND `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
|
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
|
||||||
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
|
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
|
||||||
if ($r) {
|
if ($r) {
|
||||||
foreach ($r AS $contact) {
|
foreach ($r AS $contact) {
|
||||||
|
|
|
@ -1973,11 +1973,15 @@ function diaspora_photo($importer,$xml,$msg,$attempt=1) {
|
||||||
array($remote_photo_name, 'scaled_full_' . $remote_photo_name));
|
array($remote_photo_name, 'scaled_full_' . $remote_photo_name));
|
||||||
|
|
||||||
if(strpos($parent_item['body'],$link_text) === false) {
|
if(strpos($parent_item['body'],$link_text) === false) {
|
||||||
|
|
||||||
|
$parent_item['body'] = $link_text . $parent_item['body'];
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `body` = '%s', `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
$r = q("UPDATE `item` SET `body` = '%s', `visible` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||||
dbesc($link_text . $parent_item['body']),
|
dbesc($parent_item['body']),
|
||||||
intval($parent_item['id']),
|
intval($parent_item['id']),
|
||||||
intval($parent_item['uid'])
|
intval($parent_item['uid'])
|
||||||
);
|
);
|
||||||
|
put_item_in_cache($parent_item, true);
|
||||||
update_thread($parent_item['id']);
|
update_thread($parent_item['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -955,8 +955,9 @@ function add_page_info_data($data) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$hashtags = "\n";
|
$hashtags = "\n";
|
||||||
foreach ($data["keywords"] AS $keyword) {
|
foreach ($data["keywords"] AS $keyword) {
|
||||||
$hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
|
/// @todo make a positive list of allowed characters
|
||||||
array("","", "", "", "", ""), $keyword);
|
$hashtag = str_replace(array(" ", "+", "/", ".", "#", "'", "’", "`", "(", ")", "„", "“"),
|
||||||
|
array("","", "", "", "", "", "", "", "", "", "", ""), $keyword);
|
||||||
$hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] ";
|
$hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1415,9 +1415,13 @@ function prepare_body(&$item,$attach = false, $preview = false) {
|
||||||
$item['hashtags'] = $hashtags;
|
$item['hashtags'] = $hashtags;
|
||||||
$item['mentions'] = $mentions;
|
$item['mentions'] = $mentions;
|
||||||
|
|
||||||
|
$test = $item["rendered-html"];
|
||||||
put_item_in_cache($item, true);
|
put_item_in_cache($item, true);
|
||||||
$s = $item["rendered-html"];
|
$s = $item["rendered-html"];
|
||||||
|
|
||||||
|
//if ($test != $s)
|
||||||
|
// $s .= "<hr>*********************************<hr>".$test;
|
||||||
|
|
||||||
$prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview);
|
$prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview);
|
||||||
call_hooks('prepare_body', $prep_arr);
|
call_hooks('prepare_body', $prep_arr);
|
||||||
$s = $prep_arr['html'];
|
$s = $prep_arr['html'];
|
||||||
|
|
|
@ -112,7 +112,7 @@ function update_thread_uri($itemuri, $uid) {
|
||||||
|
|
||||||
function update_thread($itemid, $setmention = false) {
|
function update_thread($itemid, $setmention = false) {
|
||||||
$items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
|
$items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
|
||||||
`deleted`, `origin`, `forum_mode`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
`deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
|
||||||
|
|
||||||
if (!$items)
|
if (!$items)
|
||||||
return;
|
return;
|
||||||
|
@ -125,7 +125,7 @@ function update_thread($itemid, $setmention = false) {
|
||||||
$sql = "";
|
$sql = "";
|
||||||
|
|
||||||
foreach ($item AS $field => $data)
|
foreach ($item AS $field => $data)
|
||||||
if (!in_array($field, array("guid", "title", "body"))) {
|
if (!in_array($field, array("guid", "title", "body", "rendered-html", "rendered-hash"))) {
|
||||||
if ($sql != "")
|
if ($sql != "")
|
||||||
$sql .= ", ";
|
$sql .= ", ";
|
||||||
|
|
||||||
|
@ -142,9 +142,11 @@ function update_thread($itemid, $setmention = false) {
|
||||||
if (!$items)
|
if (!$items)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$result = q("UPDATE `item` SET `title` = '%s', `body` = '%s' WHERE `id` = %d",
|
$result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d",
|
||||||
dbesc($item["title"]),
|
dbesc($item["title"]),
|
||||||
dbesc($item["body"]),
|
dbesc($item["body"]),
|
||||||
|
dbesc($item["rendered-html"]),
|
||||||
|
dbesc($item["rendered-hash"]),
|
||||||
intval($items[0]["id"])
|
intval($items[0]["id"])
|
||||||
);
|
);
|
||||||
logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG);
|
logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG);
|
||||||
|
|
Loading…
Reference in a new issue