Unused indexes removed, queries changed
This commit is contained in:
parent
747dc934f7
commit
4961fb3a45
9 changed files with 69 additions and 56 deletions
|
@ -887,16 +887,7 @@ function contact_posts($a, $contact_id) {
|
|||
|
||||
$o .= $tab_str;
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `contact-id` = %d LIMIT 1", intval($contact_id));
|
||||
if ($r)
|
||||
$o .= posts_from_contact($a, $contact_id);
|
||||
elseif ($contact["url"]) {
|
||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"])));
|
||||
|
||||
if ($r[0]["id"] <> 0)
|
||||
$o .= posts_from_gcontact($a, $r[0]["id"]);
|
||||
}
|
||||
$o .= posts_from_contact_url($a, $contact["url"]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ function follow_content(&$a) {
|
|||
$a->page['aside'] = "";
|
||||
profile_load($a, "", 0, get_contact_details_by_url($ret["url"]));
|
||||
|
||||
// Show last public posts
|
||||
if ($gcontact_id <> 0) {
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'),
|
||||
array('$title' => t('Status Messages and Posts')
|
||||
));
|
||||
|
||||
$o .= posts_from_gcontact($a, $gcontact_id);
|
||||
// Show last public posts
|
||||
$o .= posts_from_contact_url($a, $ret["url"]);
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -1032,7 +1032,7 @@ function item_post(&$a) {
|
|||
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
|
||||
// or cut back on plugins which do remote deliveries.
|
||||
|
||||
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
|
||||
proc_run('php', "include/notifier.php", $notify_type, $post_id);
|
||||
|
||||
logger('post_complete');
|
||||
|
||||
|
|
|
@ -577,8 +577,8 @@ function network_content(&$a, $update = 0) {
|
|||
$sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
|
||||
else
|
||||
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
|
||||
$sql_order = "`item`.`received`";
|
||||
$order_mode = "received";
|
||||
$sql_order = "`item`.`id`";
|
||||
$order_mode = "id";
|
||||
}
|
||||
}
|
||||
if(strlen($file)) {
|
||||
|
@ -596,8 +596,7 @@ function network_content(&$a, $update = 0) {
|
|||
// only setup pagination on initial page view
|
||||
$pager_sql = '';
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if(get_config('system', 'old_pager')) {
|
||||
$r = q("SELECT COUNT(*) AS `total`
|
||||
FROM $sql_table $sql_post_table INNER JOIN `contact` ON `contact`.`id` = $sql_table.`contact-id`
|
||||
|
@ -636,7 +635,7 @@ function network_content(&$a, $update = 0) {
|
|||
$simple_update = (($update) ? " AND `item`.`unseen` " : '');
|
||||
|
||||
if ($sql_order == "")
|
||||
$sql_order = "`item`.`received`";
|
||||
$sql_order = "`item`.`id`";
|
||||
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
$items = q("SELECT %s FROM $sql_table $sql_post_table %s
|
||||
|
|
|
@ -174,7 +174,7 @@ function nodeinfo_cron() {
|
|||
return;
|
||||
|
||||
$last = get_config('nodeinfo','last_calucation');
|
||||
|
||||
/*
|
||||
if($last) {
|
||||
// Calculate every 24 hours
|
||||
$next = $last + (24 * 60 * 60);
|
||||
|
@ -183,7 +183,7 @@ function nodeinfo_cron() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
logger("cron_start");
|
||||
*/ logger("cron_start");
|
||||
|
||||
$users = q("SELECT profile.*, `user`.`login_date`, `lastitem`.`lastitem_date`
|
||||
FROM (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
|
||||
|
@ -224,12 +224,24 @@ function nodeinfo_cron() {
|
|||
set_config('nodeinfo','active_users_monthly', $active_users_monthly);
|
||||
}
|
||||
|
||||
//$posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND `uid` != 0 AND `id` = `parent` AND left(body, 6) != '[share'");
|
||||
// $posts = q("SELECT COUNT(*) AS `local_posts` FROM `thread`
|
||||
// INNER JOIN `contact` ON `contact`.`id` = `thread`.`contact-id` AND `contact`.`uid` = `thread`.`uid`
|
||||
// WHERE `contact`.`self`");
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM `thread` WHERE `thread`.`wall`");
|
||||
/*
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM `thread`
|
||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||
WHERE `thread`.`wall` AND NOT `thread`.`private` AND
|
||||
`thread`.`uid` != 0 AND LEFT(`item`.`body`, 6) != '[share' AND
|
||||
`thread`.`network` IN ('%s', '%s', '%s')",
|
||||
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));
|
||||
*/
|
||||
/*
|
||||
$posts = q("SELECT COUNT(*) AS `local_posts` FROM `item`
|
||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `contact`.`self` and `item`.`id` = `item`.`parent` AND left(body, 6) != '[share' AND `item`.`network` IN ('%s', '%s', '%s')",
|
||||
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));
|
||||
|
||||
*/
|
||||
if (!is_array($posts))
|
||||
$local_posts = -1;
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue