Krinkle created this task.
Krinkle added projects: Wikibase-DataModel-_javascript_, Wikidata, MediaWiki-extensions-WikibaseClient, Performance-Team.
Herald added a subscriber: Aklapper.

TASK DESCRIPTION

Looking at flame graphs and overall code complexity, there's quite a bit of complexity in how Wikibase registers its _javascript_ modules.

F15215318: Screen Shot 2018-03-12 at 15.25.57.png

entrypoint=extensions/Wikibase/client/WikibaseClient.php

  • lib/WikibaseLib.php
    • $wgResourceModules = array_merge ...
    • lib/resources/Resources.php
      • return array( .. ); preg_match(,,$remoteExtPath)
  • view/WikibaseView.php
    • view/init.mw.php
      • view/resources.php
        • $wgResourceModules = array_merge ...
          • view/lib/Resources.php
            • return array( .. )
              • view/lib/resources/wikibase-data-model.php
                • view/lib/resources/wikibase-data-model/resources.php
                  • return array( .. ); preg_match(,,$remoteExtPath)
              • view/lib/resources/...
                • ...
          • view/resources/Resources.php
            • return array( .. )
              • view/resources/jquery/resources.php
                • return array( .. ); preg_match(,,$remoteExtPath)
              • view/resources/...
                • ...
      • wgHooks / ResourceLoaderRegisterModules
        • preg_match(,,$remoteExtPath)
        • $rl->register( array )
    • view/resources/Resources.php
  • $wgResourceModules = array_merge ...
    • client/resources/Resources.php
      • return array( .. ); preg_match(,,$remoteExtPath)

It seems the the main reason for all this complexity and indirection is that these used to be separate MediaWiki extensions where the extensions/ path specified for remoteExtPath had to vary between "Name-of-micro-extension", "Wikibase" and "Wikidata".

However, as far as I can tell it will only ever be "Wikibase", given T173818 has been resolved.

Questions:

  • Can all this be simplified to simple php files that return a static array with no preg_match complexity?
  • Can we merge them upwards so that we only have a handful of these files rather than a separate one for each file that used to be its own Git repo? At the very least it'd be nice to reduce from 62 files to less than 10, or even just 2? (One for Client, one for Repo). Note that this should not hinder future potential to publish these as separate npm packages, given that those packages will not need MediaWiki-PHP handling, and those publications can happen even a monorepo sub directory.

Related:


TASK DETAIL
https://phabricator.wikimedia.org/T189538

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Krinkle
Cc: Aklapper, Krinkle, Imarlier, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Vali.matei, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to