Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12443 from Wikia/SUS-1521-WallThread-getLastMessa…
Browse files Browse the repository at this point in the history
…ge-profiling

SUS-1521 | report a proper DB query caller in WallThread::getLastMessage
  • Loading branch information
macbre committed Feb 20, 2017
2 parents 15cf248 + 10f1db4 commit 6765110
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extensions/wikia/Wall/WallThread.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,16 @@ public function purgeLastMessage() {
WikiaDataAccess::cachePurge( $key );
}

/**
* TODO: used by ForumController::boardThread() method only. Move it there?
*
* @return null|WallMessage
*/
public function getLastMessage() {
$key = wfMemcKey( __CLASS__, '-thread-lastreply-key', $this->mThreadId );
$fname = __METHOD__;

$data = WikiaDataAccess::cache( $key, 30 * 24 * 60 * 60, function() {
$data = WikiaDataAccess::cache( $key, 30 * 24 * 60 * 60, function() use ( $fname ) {
$db = wfGetDB( DB_SLAVE );
$row = $db->selectRow(
[ 'comments_index' ],
Expand All @@ -205,7 +211,7 @@ public function getLastMessage() {
'deleted' => 0,
'removed' => 0
],
__METHOD__
$fname
);
return $row;
} );
Expand Down

0 comments on commit 6765110

Please sign in to comment.