picking up the page load times a bit
This commit is contained in:
parent
21b3dc9c27
commit
7bdbb8331c
@ -311,6 +311,7 @@ function localize_item(&$item){
|
|||||||
if(!function_exists('conversation')) {
|
if(!function_exists('conversation')) {
|
||||||
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||||
|
|
||||||
|
$tstart = dba_timer();
|
||||||
|
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
|
|
||||||
@ -522,6 +523,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
|
|
||||||
$comments = array();
|
$comments = array();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
||||||
|
|
||||||
if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
|
if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
|
||||||
if(! x($comments,$item['parent']))
|
if(! x($comments,$item['parent']))
|
||||||
$comments[$item['parent']] = 1;
|
$comments[$item['parent']] = 1;
|
||||||
@ -549,6 +552,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
||||||
|
$tfirst = dba_timer();
|
||||||
|
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$template = $tpl;
|
$template = $tpl;
|
||||||
$commentww = '';
|
$commentww = '';
|
||||||
@ -872,8 +877,21 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
call_hooks('display_item', $arr);
|
call_hooks('display_item', $arr);
|
||||||
|
|
||||||
$threads[$threadsid]['items'][] = $arr['output'];
|
$threads[$threadsid]['items'][] = $arr['output'];
|
||||||
|
|
||||||
|
$tlast = dba_timer();
|
||||||
|
|
||||||
|
// logger('render dba_timer: item# ' . $item['id'] . ' ' . sprintf('%01.4f',$tlast - $tfirst));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// logger('render total dba_timer: ' . sprintf('%01.4f',$tlast - $tstart));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// logger('threads: ' . count($threads) . ' update: ' . $update);
|
// logger('threads: ' . count($threads) . ' update: ' . $update);
|
||||||
@ -907,6 +925,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tfinal = dba_timer();
|
||||||
|
// logger('render template dba_timer: ' . sprintf('%01.4f',$tfinal - $tlast));
|
||||||
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -189,6 +189,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function replace($s, $r) {
|
public function replace($s, $r) {
|
||||||
|
// $t1 = dba_timer();
|
||||||
$this->r = $r;
|
$this->r = $r;
|
||||||
|
|
||||||
$s = $this->_build_nodes($s);
|
$s = $this->_build_nodes($s);
|
||||||
@ -199,12 +200,17 @@
|
|||||||
// remove comments block
|
// remove comments block
|
||||||
$s = preg_replace('/{#[^#]*#}/', "" , $s);
|
$s = preg_replace('/{#[^#]*#}/', "" , $s);
|
||||||
|
|
||||||
|
// $t2 = dba_timer();
|
||||||
|
|
||||||
// replace strings recursively (limit to 10 loops)
|
// replace strings recursively (limit to 10 loops)
|
||||||
$os = ""; $count=0;
|
$os = ""; $count=0;
|
||||||
while($os!=$s && $count<10){
|
while($os!=$s && $count<10){
|
||||||
$os=$s; $count++;
|
$os=$s; $count++;
|
||||||
$s = $this->var_replace($s);
|
$s = $this->var_replace($s);
|
||||||
}
|
}
|
||||||
|
// $t3 = dba_timer();
|
||||||
|
// logger('macro timer: ' . sprintf('%01.4f %01.4f',$t3 - $t2, $t2 - $t1));
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
js/main.js
39
js/main.js
@ -154,6 +154,27 @@
|
|||||||
window.location.href=window.location.href
|
window.location.href=window.location.href
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// start live update
|
||||||
|
|
||||||
|
if($('#live-network').length) { src = 'network'; liveUpdate(); }
|
||||||
|
if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
|
||||||
|
if($('#live-community').length) { src = 'community'; liveUpdate(); }
|
||||||
|
if($('#live-notes').length) { src = 'notes'; liveUpdate(); }
|
||||||
|
if($('#live-display').length) {
|
||||||
|
if(liking) {
|
||||||
|
liking = 0;
|
||||||
|
window.location.href=window.location.href
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($('#live-photos').length) {
|
||||||
|
if(liking) {
|
||||||
|
liking = 0;
|
||||||
|
window.location.href=window.location.href
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(data.network == 0) {
|
if(data.network == 0) {
|
||||||
data.network = '';
|
data.network = '';
|
||||||
$('#net-update').removeClass('show')
|
$('#net-update').removeClass('show')
|
||||||
@ -188,24 +209,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// start live update
|
|
||||||
|
|
||||||
if($('#live-network').length) { src = 'network'; liveUpdate(); }
|
|
||||||
if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
|
|
||||||
if($('#live-community').length) { src = 'community'; liveUpdate(); }
|
|
||||||
if($('#live-notes').length) { src = 'notes'; liveUpdate(); }
|
|
||||||
if($('#live-display').length) {
|
|
||||||
if(liking) {
|
|
||||||
liking = 0;
|
|
||||||
window.location.href=window.location.href
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($('#live-photos').length) {
|
|
||||||
if(liking) {
|
|
||||||
liking = 0;
|
|
||||||
window.location.href=window.location.href
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}) ;
|
}) ;
|
||||||
}
|
}
|
||||||
|
@ -602,6 +602,8 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
if($load)
|
if($load)
|
||||||
$simple_update = '';
|
$simple_update = '';
|
||||||
|
|
||||||
|
$start = dba_timer();
|
||||||
|
|
||||||
if($nouveau && $load) {
|
if($nouveau && $load) {
|
||||||
// "New Item View" - show all items unthreaded in reverse created date order
|
// "New Item View" - show all items unthreaded in reverse created date order
|
||||||
|
|
||||||
@ -625,7 +627,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items);
|
||||||
}
|
}
|
||||||
elseif($load) {
|
elseif($load) {
|
||||||
logger('loading:');
|
|
||||||
// Normal conversation view
|
// Normal conversation view
|
||||||
|
|
||||||
|
|
||||||
@ -696,7 +698,7 @@ logger('loading:');
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('items: ' . count($items));
|
// logger('items: ' . count($items));
|
||||||
|
|
||||||
// We aren't going to try and figure out at the item, group, and page
|
// We aren't going to try and figure out at the item, group, and page
|
||||||
// level which items you've seen and which you haven't. If you're looking
|
// level which items you've seen and which you haven't. If you're looking
|
||||||
@ -714,11 +716,20 @@ logger('items: ' . count($items));
|
|||||||
|
|
||||||
$mode = (($nouveau) ? 'network-new' : 'network');
|
$mode = (($nouveau) ? 'network-new' : 'network');
|
||||||
|
|
||||||
|
$first = dba_timer();
|
||||||
|
|
||||||
$o .= conversation($a,$items,$mode,$update,'client');
|
$o .= conversation($a,$items,$mode,$update,'client');
|
||||||
|
|
||||||
|
|
||||||
|
$second = dba_timer();
|
||||||
|
|
||||||
if(! $update) {
|
if(! $update) {
|
||||||
$o .= alt_pager($a,count($items));
|
$o .= alt_pager($a,count($items));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// logger('parent dba_timer: ' . sprintf('%01.4f',$first - $start));
|
||||||
|
// logger('child dba_timer: ' . sprintf('%01.4f',$second - $first));
|
||||||
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
24
mod/ping.php
24
mod/ping.php
@ -17,6 +17,7 @@ function ping_init(&$a) {
|
|||||||
$result['notice'] = array();
|
$result['notice'] = array();
|
||||||
$result['info'] = array();
|
$result['info'] = array();
|
||||||
|
|
||||||
|
$t0 = dba_timer();
|
||||||
|
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
|
|
||||||
@ -89,6 +90,9 @@ function ping_init(&$a) {
|
|||||||
if($t)
|
if($t)
|
||||||
$result['notify'] = intval($t[0]['total']);
|
$result['notify'] = intval($t[0]['total']);
|
||||||
|
|
||||||
|
|
||||||
|
$t1 = dba_timer();
|
||||||
|
|
||||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`,
|
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`,
|
||||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
|
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
|
||||||
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
|
`pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`
|
||||||
@ -108,12 +112,18 @@ function ping_init(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$t2 = dba_timer();
|
||||||
|
|
||||||
$intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
$intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
||||||
`fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
|
`fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
|
||||||
FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
|
FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
|
||||||
WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0",
|
WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$t3 = dba_timer();
|
||||||
|
|
||||||
$intros2 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
$intros2 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
||||||
`contact`.`name`, `contact`.`url`, `contact`.`photo`
|
`contact`.`name`, `contact`.`url`, `contact`.`photo`
|
||||||
FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
|
FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
|
||||||
@ -124,6 +134,8 @@ function ping_init(&$a) {
|
|||||||
$intros = count($intros1) + count($intros2);
|
$intros = count($intros1) + count($intros2);
|
||||||
$result['intros'] = intval($intros);
|
$result['intros'] = intval($intros);
|
||||||
|
|
||||||
|
$t4 = dba_timer();
|
||||||
|
|
||||||
$myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
|
$myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
|
||||||
$mails = q("SELECT *, COUNT(*) AS `total` FROM `mail`
|
$mails = q("SELECT *, COUNT(*) AS `total` FROM `mail`
|
||||||
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
|
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
|
||||||
@ -138,8 +150,18 @@ function ping_init(&$a) {
|
|||||||
if($regs)
|
if($regs)
|
||||||
$result['register'] = intval($regs[0]['total']);
|
$result['register'] = intval($regs[0]['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$t5 = dba_timer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$x = json_encode($result);
|
||||||
|
|
||||||
echo json_encode($result);
|
$t6 = dba_timer();
|
||||||
|
|
||||||
|
// logger('ping timer: ' . sprintf('%01.4f %01.4f %01.4f %01.4f %01.4f %01.4f',$t6 - $t5, $t5 - $t4, $t4 - $t3, $t3 - $t2, $t2 - $t1, $t1 - $t0));
|
||||||
|
|
||||||
|
echo $x;
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if(typeof acl=="undefined"){
|
setTimeout( function () {
|
||||||
acl = new ACL(
|
if(typeof acl=="undefined"){
|
||||||
baseurl+"/acl",
|
acl = new ACL(
|
||||||
[ $allowcid,$allowgid,$denycid,$denygid ]
|
baseurl+"/acl",
|
||||||
);
|
[ $allowcid,$allowgid,$denycid,$denygid ]
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
}, 5000 );
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -103,6 +103,7 @@ function initEditor(cb){
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
editor = true;
|
editor = true;
|
||||||
// setup acl popup
|
// setup acl popup
|
||||||
$("a#jot-perms-icon").fancybox({
|
$("a#jot-perms-icon").fancybox({
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<link rel='stylesheet' type='text/css' href='$baseurl/library/fullcalendar/fullcalendar.css' />
|
|
||||||
<script language="javascript" type="text/javascript"
|
|
||||||
src="$baseurl/library/fullcalendar/fullcalendar.min.js"></script>
|
|
||||||
<script>
|
|
||||||
// start calendar from yesterday
|
|
||||||
var yesterday= new Date()
|
|
||||||
yesterday.setDate(yesterday.getDate()-1)
|
|
||||||
|
|
||||||
function showEvent(eventid) {
|
|
||||||
$.get(
|
|
||||||
'$baseurl/events/?id='+eventid,
|
|
||||||
function(data){
|
|
||||||
$.fancybox(data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#events-reminder').fullCalendar({
|
|
||||||
firstDay: yesterday.getDay(),
|
|
||||||
year: yesterday.getFullYear(),
|
|
||||||
month: yesterday.getMonth(),
|
|
||||||
date: yesterday.getDate(),
|
|
||||||
events: '$baseurl/events/json/',
|
|
||||||
header: {
|
|
||||||
left: '',
|
|
||||||
center: '',
|
|
||||||
right: ''
|
|
||||||
},
|
|
||||||
timeFormat: 'HH(:mm)',
|
|
||||||
defaultView: 'basicWeek',
|
|
||||||
height: 50,
|
|
||||||
eventClick: function(calEvent, jsEvent, view) {
|
|
||||||
showEvent(calEvent.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<div id="events-reminder" class="$classtoday"></div>
|
|
||||||
<br>
|
|
Reference in New Issue
Block a user