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')) {
|
||||
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
|
||||
$tstart = dba_timer();
|
||||
|
||||
require_once('bbcode.php');
|
||||
|
||||
@ -522,6 +523,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
|
||||
$comments = array();
|
||||
foreach($items as $item) {
|
||||
|
||||
|
||||
if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) {
|
||||
if(! x($comments,$item['parent']))
|
||||
$comments[$item['parent']] = 1;
|
||||
@ -549,6 +552,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
|
||||
foreach($items as $item) {
|
||||
|
||||
$tfirst = dba_timer();
|
||||
|
||||
$comment = '';
|
||||
$template = $tpl;
|
||||
$commentww = '';
|
||||
@ -872,8 +877,21 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
||||
call_hooks('display_item', $arr);
|
||||
|
||||
$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);
|
||||
@ -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;
|
||||
}}
|
||||
|
||||
|
@ -189,6 +189,7 @@
|
||||
}
|
||||
|
||||
public function replace($s, $r) {
|
||||
// $t1 = dba_timer();
|
||||
$this->r = $r;
|
||||
|
||||
$s = $this->_build_nodes($s);
|
||||
@ -199,12 +200,17 @@
|
||||
// remove comments block
|
||||
$s = preg_replace('/{#[^#]*#}/', "" , $s);
|
||||
|
||||
// $t2 = dba_timer();
|
||||
|
||||
// replace strings recursively (limit to 10 loops)
|
||||
$os = ""; $count=0;
|
||||
while($os!=$s && $count<10){
|
||||
$os=$s; $count++;
|
||||
$s = $this->var_replace($s);
|
||||
}
|
||||
// $t3 = dba_timer();
|
||||
// logger('macro timer: ' . sprintf('%01.4f %01.4f',$t3 - $t2, $t2 - $t1));
|
||||
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
39
js/main.js
39
js/main.js
@ -154,6 +154,27 @@
|
||||
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) {
|
||||
data.network = '';
|
||||
$('#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)
|
||||
$simple_update = '';
|
||||
|
||||
$start = dba_timer();
|
||||
|
||||
if($nouveau && $load) {
|
||||
// "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);
|
||||
}
|
||||
elseif($load) {
|
||||
logger('loading:');
|
||||
|
||||
// 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
|
||||
// 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');
|
||||
|
||||
$first = dba_timer();
|
||||
|
||||
$o .= conversation($a,$items,$mode,$update,'client');
|
||||
|
||||
|
||||
$second = dba_timer();
|
||||
|
||||
if(! $update) {
|
||||
$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;
|
||||
}
|
||||
|
24
mod/ping.php
24
mod/ping.php
@ -17,6 +17,7 @@ function ping_init(&$a) {
|
||||
$result['notice'] = array();
|
||||
$result['info'] = array();
|
||||
|
||||
$t0 = dba_timer();
|
||||
|
||||
header("content-type: application/json");
|
||||
|
||||
@ -89,6 +90,9 @@ function ping_init(&$a) {
|
||||
if($t)
|
||||
$result['notify'] = intval($t[0]['total']);
|
||||
|
||||
|
||||
$t1 = dba_timer();
|
||||
|
||||
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`,
|
||||
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
|
||||
`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`,
|
||||
`fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
|
||||
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",
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
$t3 = dba_timer();
|
||||
|
||||
$intros2 = q("SELECT `intro`.`id`, `intro`.`datetime`,
|
||||
`contact`.`name`, `contact`.`url`, `contact`.`photo`
|
||||
FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
|
||||
@ -124,6 +134,8 @@ function ping_init(&$a) {
|
||||
$intros = count($intros1) + count($intros2);
|
||||
$result['intros'] = intval($intros);
|
||||
|
||||
$t4 = dba_timer();
|
||||
|
||||
$myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
|
||||
$mails = q("SELECT *, COUNT(*) AS `total` FROM `mail`
|
||||
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
|
||||
@ -139,7 +151,17 @@ function ping_init(&$a) {
|
||||
$result['register'] = intval($regs[0]['total']);
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
$t5 = dba_timer();
|
||||
|
||||
|
||||
|
||||
$x = 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();
|
||||
|
||||
}
|
||||
|
@ -16,11 +16,13 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
setTimeout( function () {
|
||||
if(typeof acl=="undefined"){
|
||||
acl = new ACL(
|
||||
baseurl+"/acl",
|
||||
[ $allowcid,$allowgid,$denycid,$denygid ]
|
||||
);
|
||||
}
|
||||
}, 5000 );
|
||||
});
|
||||
</script>
|
||||
|
@ -103,6 +103,7 @@ function initEditor(cb){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
editor = true;
|
||||
// setup acl popup
|
||||
$("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