https://bugzilla.wikimedia.org/show_bug.cgi?id=61045

       Web browser: ---
            Bug ID: 61045
           Summary: Category->getName and Categry->getID hit DB even if
                    they already have the requested info
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Categories
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: mflasc...@wikimedia.org
                CC: bawolff...@gmail.com
    Classification: Unclassified
   Mobile Platform: ---

getName and getID use a generic function getX.  That checks if the overall
instance is initialized (doing so if it wasn't).  Then it returns the requested
info.

However, this is inefficient, since in some cases it already has that info.

For example, if you do:

$c = Category::newFromName( $catName );
...
$canonicalizedCatName = $c->getName()

it will hit the DB even though it already has the canonical name.

It should be lazy, and only hit it if it doesn't have the required info.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to