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

       Web browser: ---
             Bug #: 39813
           Summary: Implement immutable object constructors with caching
                    for mw.User, mw.Title, mw.Page (tracking)
           Product: MediaWiki
           Version: 1.20-git
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: JavaScript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---


mw.Title already exists though it needs more work and could use some caching.

mw.User doesn't exist yet as a constructor, but preliminary work has already
been done with a lazy-loading system (with the introduction of
mw.user.getGroups and mw.user.getRights - similar to in PHP where those methods
call ->init() which does nothing if already loaded and loads it if not).

Each of these would be constructed (without being initialized) by default in
their lowercase equivalents (mw.title, mw.user, mw.page).

I suggest we write an abstract class that implements:
* Caching by unique identifier
* Methods to clear cache
* Methods to populate cache
* etc.

Eventually this will also allows us to clean up stuff that doesn't belong in
mw.config (wgUserName, wgUserGroups, wgCategories, wgCurRevisionId, wgTitle).

And if those vars provide sufficient information to fully populate a cache, we
can even optimize for the current context instances and prepopulate them.

Or do it the other way around (populate mw.user/title/page/revision from the
page output, and put a backwards compatible thing in mw.config that accesses
those from mw.user/title/page/revision)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to