- Improved speed due to forced indexes when showing items.

- Possibility to setup a hostname
This commit is contained in:
Michael Vogel 2013-09-15 10:40:58 +02:00
parent 159a7bda85
commit d5ae5ecedd
8 changed files with 41 additions and 38 deletions

View File

@ -420,6 +420,9 @@ if(! class_exists('App')) {
global $default_timezone, $argv, $argc;
if (file_exists(".htpreconfig.php"))
@include(".htpreconfig.php");
$this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
date_default_timezone_set($this->timezone);
@ -478,6 +481,10 @@ if(! class_exists('App')) {
if(isset($path) && strlen($path) && ($path != $this->path))
$this->path = $path;
}
if ($hostname != "")
$this->hostname = $hostname;
if (is_array($argv) && $argc>1 && substr(end($argv), 0, 4)=="http" ) {
$this->set_baseurl(array_pop($argv) );
$argc --;
@ -827,6 +834,7 @@ if(! class_exists('App')) {
//$this->performance["markstart"] -= microtime(true) - $this->performance["marktime"];
$this->performance["markstart"] = microtime(true) - $this->performance["markstart"] - $this->performance["marktime"];
}
}
}

View File

@ -487,7 +487,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$alike = array();
$dlike = array();
// array with html for each thread (parent+comments)
$threads = array();
$threadsid = -1;
@ -697,7 +696,6 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$threads[$threadsid]['items'] = array($arr['output']);
}
}
else
{
@ -754,6 +752,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
}
$threads = $conv->get_template_data($alike, $dlike);
if(!$threads) {
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
$threads = array();

View File

@ -93,6 +93,8 @@ class dba {
$stamp2 = microtime(true);
$duration = (float)($stamp2-$stamp1);
$a->save_timestamp($stamp1, "database");
if(x($a->config,'system') && x($a->config['system'],'db_log')) {
if (($duration > $a->config["system"]["db_loglimit"])) {
$duration = round($duration, 3);
@ -168,7 +170,7 @@ class dba {
}
}
$a->save_timestamp($stamp1, "database");
//$a->save_timestamp($stamp1, "database");
if($this->debug)
logger('dba: ' . printable(print_r($r, true)));

View File

@ -136,7 +136,6 @@ if(! x($_SESSION,'sysmsg_info'))
* any plugins have been added or removed and reacts accordingly.
*/
if($install)
$a->module = 'install';
elseif($maintenance)
@ -320,10 +319,8 @@ if($a->module_loaded) {
$func = str_replace('-','_',current_theme()) . '_content_loaded';
$func($a);
}
}
/*
* Create the page head after setting the language
* and getting any auth credentials

View File

@ -123,7 +123,7 @@ function display_content(&$a, $update = 0) {
if($update) {
$r = q("SELECT id FROM item WHERE item.uid = %d
AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' ))
$sql_extra AND unseen = 1",
intval($a->profile['uid']),
dbesc($item_id),
@ -142,7 +142,7 @@ function display_content(&$a, $update = 0) {
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`moderated` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' )
AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE ( `id` = '%s' OR `uri` = '%s' )
AND uid = %d )
$sql_extra
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
@ -171,7 +171,7 @@ function display_content(&$a, $update = 0) {
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`moderated` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE `uri` = '%s' AND uid = %d )
AND `item`.`parent` = ( SELECT `parent` FROM `item` FORCE INDEX (PRIMARY, `uri`) WHERE `uri` = '%s' AND uid = %d )
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
intval(local_user()),
dbesc($item_uri),

View File

@ -376,7 +376,6 @@ function network_content(&$a, $update = 0) {
}
}
$o = '';
// item filter tabs
@ -498,10 +497,6 @@ function network_content(&$a, $update = 0) {
// --- end item filter tabs
$contact_id = $a->cid;
require_once('include/acl_selectors.php');
@ -572,7 +567,6 @@ function network_content(&$a, $update = 0) {
}
// We don't have to deal with ACLs on this page. You're looking at everything
// that belongs to you, hence you can see all of it. We will filter by group if
// desired.
@ -849,7 +843,6 @@ function network_content(&$a, $update = 0) {
$update_unseen = ' WHERE uid = ' . intval(local_user()) . ' AND unseen = 1 AND parent IN ( ' . dbesc($parents_str) . ' )';
}
// 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
// at the top level network page just mark everything seen.

View File

@ -277,7 +277,7 @@ function profile_content(&$a, $update = 0) {
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
FROM `item` FORCE INDEX (created) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1

View File

@ -130,10 +130,14 @@ class Conversation extends BaseObject {
global $a;
$result = array();
$i = 0;
foreach($this->threads as $item) {
if($item->get_data_value('network') === NETWORK_MAIL && local_user() != $item->get_data_value('uid'))
continue;
$item_data = $item->get_template_data($alike, $dlike);
if(!$item_data) {
logger('[ERROR] Conversation::get_template_data : Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG);
return false;