r24957 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24956‎ | r24957 | r24958 >
Date:17:17, 20 August 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Yet more profiling.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Factbox.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Hooks.php
@@ -41,6 +41,7 @@
4242 * link.
4343 */
4444 function smwfParsePropertiesCallback($semanticLink) {
 45+ wfProfileIn("smwfParsePropertiesCallback (SMW)");
4546 if (array_key_exists(2,$semanticLink)) {
4647 $attribute = $semanticLink[2];
4748 } else { $attribute = ''; }
@@ -57,7 +58,9 @@
5859 $attr = SMWFactbox::addProperty($singleAttribute,$value,$valueCaption);
5960 }
6061
61 - return $attr->getShortWikitext(true);
 62+ $result = $attr->getShortWikitext(true);
 63+ wfProfileOut("smwfParsePropertiesCallback (SMW)");
 64+ return $result;
6265 }
6366
6467
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Factbox.php
@@ -53,6 +53,7 @@
5454 * various formats.
5555 */
5656 static function addProperty($propertyname, $value, $caption) {
 57+ wfProfileIn("SMWFactbox::addProperty (SMW)");
5758 global $smwgContLang, $smwgStoreActive, $smwgIP;
5859 include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
5960 // See if this attribute is a special one like e.g. "Has unit"
@@ -66,9 +67,12 @@
6768 if ($smwgStoreActive) {
6869 SMWFactbox::$semdata->addPropertyValue($propertyname,$result);
6970 }
 71+ wfProfileOut("SMWFactbox::addProperty (SMW)");
7072 return $result;
7173 case SMW_SP_IMPORTED_FROM: // this requires special handling
72 - return SMWFactbox::addImportedDefinition($value,$caption);
 74+ $result = SMWFactbox::addImportedDefinition($value,$caption);
 75+ wfProfileOut("SMWFactbox::addProperty (SMW)");
 76+ return $result;
7377 default: // generic special attribute
7478 if ( $special === SMW_SP_SERVICE_LINK ) { // do some custom formatting in this case
7579 global $wgContLang;
@@ -83,6 +87,7 @@
8488 if ($smwgStoreActive) {
8589 SMWFactbox::$semdata->addSpecialValue($special,$result);
8690 }
 91+ wfProfileOut("SMWFactbox::addProperty (SMW)");
8792 return $result;
8893 }
8994 }
@@ -189,11 +194,15 @@
190195 */
191196 static function printFactbox(&$text) {
192197 global $wgContLang, $wgServer, $smwgShowFactbox, $smwgStoreActive, $smwgIP;
193 - if (!$smwgStoreActive) return true;
 198+ if (!$smwgStoreActive) return;
 199+ wfProfileIn("SMWFactbox::printFactbox (SMW)");
194200 switch ($smwgShowFactbox) {
195 - case SMW_FACTBOX_HIDDEN: return true;
 201+ case SMW_FACTBOX_HIDDEN:
 202+ wfProfileOut("SMWFactbox::printFactbox (SMW)");
 203+ return;
196204 case SMW_FACTBOX_NONEMPTY:
197205 if ( (!SMWFactbox::$semdata->hasProperties()) && (!SMWFactbox::$semdata->hasSpecialProperties()) ) {
 206+ wfProfileOut("SMWFactbox::printFactbox (SMW)");
198207 return;
199208 }
200209 }
@@ -213,6 +222,7 @@
214223 SMWFactbox::printProperties($text);
215224 SMWFactbox::printSpecialProperties($text);
216225 $text .= '</table></div>';
 226+ wfProfileOut("SMWFactbox::printFactbox (SMW)");
217227 }
218228
219229 /**
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
@@ -34,19 +34,24 @@
3535 * can be set later on.
3636 */
3737 static public function newPropertyValue($propertyname, $value=false, $caption=false) {
 38+ wfProfileIn("SMWDataValueFactory::newPropertyValue (SMW)");
3839 if(array_key_exists($propertyname,SMWDataValueFactory::$m_typelabels)) { // use cache
39 - return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname);
 40+ $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname);
 41+ wfProfileOut("SMWDataValueFactory::newPropertyValue (SMW)");
 42+ return $result;
4043 } // else: find type for property:
4144
4245 $ptitle = Title::newFromText($propertyname, SMW_NS_PROPERTY);
4346 if ($ptitle !== NULL) {
44 - return SMWDataValueFactory::newPropertyObjectValue($ptitle,$value,$caption);
 47+ $result = SMWDataValueFactory::newPropertyObjectValue($ptitle,$value,$caption);
4548 } else {
4649 $type = SMWDataValueFactory::newTypeIDValue('__typ');
4750 $type->setXSDValue('_wpg');
4851 SMWDataValueFactory::$m_typelabels[$propertyname] = $type;
49 - return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname);
 52+ $result = SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname);
5053 }
 54+ wfProfileOut("SMWDataValueFactory::newPropertyValue (SMW)");
 55+ return $result;
5156 }
5257
5358 /**

Status & tagging log