1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Query optimization.

This commit is contained in:
Cameron
2015-05-10 12:02:32 -07:00
parent 29ddbe09e8
commit d85bc31932
3 changed files with 479 additions and 473 deletions

View File

@@ -890,7 +890,7 @@ class e_user_model extends e_admin_model
*/ */
public function load($user_id = 0, $force = false) public function load($user_id = 0, $force = false)
{ {
$qry = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended as ue ON u.user_id=ue.user_extended_id WHERE user_id={ID}"; $qry = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended as ue ON u.user_id=ue.user_extended_id WHERE u.user_id={ID}";
$this->setParam('db_query', $qry); $this->setParam('db_query', $qry);
parent::load($user_id, $force); parent::load($user_id, $force);
if ($this->getId()) if ($this->getId())
@@ -1834,7 +1834,7 @@ class e_user extends e_user_model
final protected function _load($user_id) final protected function _load($user_id)
{ {
$qry = 'SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended as ue ON u.user_id=ue.user_extended_id WHERE user_id='.intval($user_id); $qry = 'SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended as ue ON u.user_id=ue.user_extended_id WHERE u.user_id='.intval($user_id);
if(e107::getDb()->gen($qry)) if(e107::getDb()->gen($qry))
{ {
return e107::getDb()->fetch(); return e107::getDb()->fetch();

View File

@@ -540,6 +540,8 @@ class plugin_forum_view_shortcodes extends e_shortcode
$text .= "<li role='presentation' class='divider'> </li>"; $text .= "<li role='presentation' class='divider'> </li>";
$type = ($this->postInfo['thread_start']) ? 'thread' : 'Post'; $type = ($this->postInfo['thread_start']) ? 'thread' : 'Post';
// print_a($this->postInfo);
if ((USER && $this->postInfo['post_user'] != USERID && $this->thread->threadInfo['thread_active'])) if ((USER && $this->postInfo['post_user'] != USERID && $this->thread->threadInfo['thread_active']))
{ {
@@ -550,7 +552,8 @@ class plugin_forum_view_shortcodes extends e_shortcode
} }
// only show delete button when post is not the initial post of the topic // only show delete button when post is not the initial post of the topic
if(!$this->forum->threadDetermineInitialPost($this->postInfo['post_id'])) // if(!$this->forum->threadDetermineInitialPost($this->postInfo['post_id']))
if(empty($this->postInfo['thread_start']))
{ {
$text .= "<li class='text-right'><a href='".e_REQUEST_URI."' data-forum-action='deletepost' data-forum-post='".$this->postInfo['post_id']."'>".LAN_DELETE." ".$tp->toGlyph('trash')."</a></li>"; $text .= "<li class='text-right'><a href='".e_REQUEST_URI."' data-forum-action='deletepost' data-forum-post='".$this->postInfo['post_id']."'>".LAN_DELETE." ".$tp->toGlyph('trash')."</a></li>";
} }

View File

@@ -78,9 +78,10 @@ PM_BLOCKED_DELETE
DELETE_BLOCKED_SELECTED DELETE_BLOCKED_SELECTED
*/ */
class pm_shortcodes extends e_shortcode if(!class_exists('pm_shortcodes'))
// class pm_handler_shortcodes
{ {
class pm_shortcodes extends e_shortcode // class pm_handler_shortcodes
{
public $pmPrefs; // PM system options public $pmPrefs; // PM system options
public $pmInfo; // Data relating to current PM being displayed - replaced by $var. public $pmInfo; // Data relating to current PM being displayed - replaced by $var.
public $pmBlocks = array(); // Array of blocked users. public $pmBlocks = array(); // Array of blocked users.
@@ -248,6 +249,7 @@ class pm_shortcodes extends e_shortcode
{ {
$attachments = explode(chr(0), $this->var['pm_attachments']); $attachments = explode(chr(0), $this->var['pm_attachments']);
$i = 0; $i = 0;
$ret = '';
foreach($attachments as $a) foreach($attachments as $a)
{ {
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4); list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
@@ -613,7 +615,8 @@ class pm_shortcodes extends e_shortcode
return e107::getUrl()->create('pm/'.$action, $params, $options); return e107::getUrl()->create('pm/'.$action, $params, $options);
} }
}
} }
?> ?>