jenkins-bot has submitted this change and it was merged.
Change subject: Kill profiling
......................................................................
Kill profiling
Change-Id: I0de8e2e06f9bf6790dd9b8f9364e70ace1b7ac0a
---
M ApiQueryPageImages.php
M PageImages.body.php
2 files changed, 8 insertions(+), 27 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ApiQueryPageImages.php b/ApiQueryPageImages.php
index 93cb4dd..08146a0 100644
--- a/ApiQueryPageImages.php
+++ b/ApiQueryPageImages.php
@@ -9,10 +9,8 @@
}
public function execute() {
- wfProfileIn( __METHOD__ );
$allTitles = $this->getPageSet()->getGoodTitles();
if ( count( $allTitles ) == 0 ) {
- wfProfileOut( __METHOD__ );
return;
}
$params = $this->extractRequestParams();
@@ -60,29 +58,21 @@
$this->addFields( array( 'pp_page', 'pp_propname',
'pp_value' ) );
$this->addWhere( array( 'pp_page' => array_keys(
$titles ), 'pp_propname' => PageImages::PROP_NAME ) );
- wfProfileIn( __METHOD__ . '-select' );
$res = $this->select( __METHOD__ );
- wfProfileOut( __METHOD__ . '-select' );
- wfProfileIn( __METHOD__ . '-results-pages' );
foreach ( $res as $row ) {
$pageId = $row->pp_page;
$fileName = $row->pp_value;
$this->setResultValues( $prop, $pageId,
$fileName, $size );
}
- wfProfileOut( __METHOD__ . '-results-pages' );
} // End page props image extraction
// Extract images from file namespace pages. In this case we
just use
// the file itself rather than searching for a page_image. (Bug
50252)
- wfProfileIn( __METHOD__ . '-results-files' );
foreach ( $filePageTitles as $pageId => $title ) {
$fileName = $title->getDBkey();
$this->setResultValues( $prop, $pageId, $fileName,
$size );
}
- wfProfileOut( __METHOD__ . '-results-files' );
-
- wfProfileOut( __METHOD__ );
}
public function getCacheMode( $params ) {
diff --git a/PageImages.body.php b/PageImages.body.php
index 587c25b..38307e0 100644
--- a/PageImages.body.php
+++ b/PageImages.body.php
@@ -14,7 +14,6 @@
* @return File|bool
*/
public static function getPageImage( Title $title ) {
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE );
$name = $dbr->selectField( 'page_props',
'pp_value',
@@ -25,7 +24,6 @@
if ( $name ) {
$file = wfFindFile( $name );
}
- wfProfileOut( __METHOD__ );
return $file;
}
@@ -142,7 +140,6 @@
if ( !isset( $lu->getParserOutput()->pageImages ) ) {
return true;
}
- wfProfileIn( __METHOD__ );
$images = $lu->getParserOutput()->pageImages;
$scores = array();
$counter = 0;
@@ -162,7 +159,6 @@
if ( $image ) {
$lu->mProperties[self::PROP_NAME] = $image;
}
- wfProfileOut( __METHOD__ );
return true;
}
@@ -177,11 +173,9 @@
public static function onInfoAction( IContextSource $context,
&$pageInfo ) {
global $wgDefaultUserOptions, $wgThumbLimits;
- wfProfileIn( __METHOD__ );
$imageFile = self::getPageImage( $context->getTitle() );
if ( !$imageFile ) {
// The page has no image
- wfProfileOut( __METHOD__ );
return true;
}
@@ -193,7 +187,6 @@
$thumb = $imageFile->transform( array( 'width' => $thumbSize )
);
if ( !$thumb ) {
- wfProfileOut( __METHOD__ );
return true;
}
$imageHtml = $thumb->toHtml(
@@ -207,7 +200,7 @@
$context->msg( 'pageimages-info-label' ),
$imageHtml
);
- wfProfileOut( __METHOD__ );
+
return true;
}
@@ -218,10 +211,10 @@
*/
public static function onApiOpenSearchSuggest( &$results ) {
global $wgPageImagesExpandOpenSearchXml;
+
if ( !$wgPageImagesExpandOpenSearchXml || !count( $results ) ) {
return true;
}
- wfProfileIn( __METHOD__ );
$pageIds = array_keys( $results );
$data = self::getImages( $pageIds, 50 );
foreach ( $pageIds as $id ) {
@@ -231,7 +224,7 @@
$results[$id]['image'] = null;
}
}
- wfProfileOut( __METHOD__ );
+
return true;
}
@@ -366,15 +359,15 @@
*/
private static function getBlacklist() {
global $wgPageImagesBlacklist, $wgPageImagesBlacklistExpiry,
$wgMemc;
+
static $list = false;
if ( $list !== false ) {
return $list;
}
- wfProfileIn( __METHOD__ );
+
$key = wfMemcKey( 'pageimages', 'blacklist' );
$list = $wgMemc->get( $key );
if ( $list !== false ) {
- wfProfileOut( __METHOD__ );
return $list;
}
wfDebug( __METHOD__ . "(): cache miss\n" );
@@ -393,7 +386,6 @@
}
$list = array_flip( $list );
$wgMemc->set( $key, $list, $wgPageImagesBlacklistExpiry );
- wfProfileOut( __METHOD__ );
return $list;
}
@@ -404,7 +396,6 @@
* @return array
*/
private static function getDbBlacklist( $dbName, $page ) {
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE, array(), $dbName );
$title = Title::newFromText( $page );
$list = array();
@@ -423,7 +414,7 @@
$list[] = $row->pl_title;
}
}
- wfProfileOut( __METHOD__ );
+
return $list;
}
@@ -436,7 +427,7 @@
*/
private static function getUrlBlacklist( $url ) {
global $wgFileExtensions;
- wfProfileIn( __METHOD__ );
+
$list = array();
$text = Http::get( $url, 3 );
$regex = '/\[\[:([^|\#]*?\.(?:' . implode( '|',
$wgFileExtensions ) . '))/i';
@@ -448,7 +439,7 @@
}
}
}
- wfProfileOut( __METHOD__ );
+
return $list;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/186103
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0de8e2e06f9bf6790dd9b8f9364e70ace1b7ac0a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageImages
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits