Last modified: 2013-03-28 02:59:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 24687 - Clean up require_once()'s of autoloaded files (tracking)
Clean up require_once()'s of autoloaded files (tracking)
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: tracking
Depends on:
Blocks: code_quality tracking
  Show dependency treegraph
Reported: 2010-08-06 11:54 UTC by Danny B.
Modified: 2013-03-28 02:59 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Danny B. 2010-08-06 11:54:12 UTC
If file either requires autoloader or autoloader is already loaded from parent, it should not require the file(s) listed in autoloader again.

Spotted affected files listed in further comments.
Comment 1 Danny B. 2010-08-06 11:59:15 UTC
Comment 2 Danny B. 2010-08-06 12:02:08 UTC
Comment 3 Chad H. 2010-08-06 12:09:04 UTC
(In reply to comment #1)
> config/Installer.php

This file is going away entirely, very soon. No need to bother.

(In reply to comment #2)
> includes/Setup.php

Most of the requires in Setup.php need to be included in the global scope (global functions, defines, etc) and can't run through the autoloader. Less global-oriented code would help with that.

Any other suggestions?
Comment 4 Chad H. 2010-08-06 12:13:14 UTC
Removed one require_once() from Setup in r70556.
Comment 5 Danny B. 2010-08-06 12:23:48 UTC
Comment 6 Jamie Taniguchi 2011-01-21 22:04:33 UTC
I did a profile on my wiki to see why it's so slow and the AutoLoader.php is being hit 50+ times and that's excluding extensions, the AutoLoader.php script alone takes a total average of 530ms. Is that really necessary when viewing a page? that seems inefficient to me but again, I don't know if every one of those files are required to be loaded.
Comment 7 Krinkle 2012-10-26 05:03:35 UTC
(In reply to comment #6)
> I did a profile on my wiki to see why it's so slow and the AutoLoader.php is
> being hit 50+ times and that's excluding extensions

Define 'being hit'? The number of require_once's for it should be very slim. But even then, a require_once will, as the name says, only "hit" it once.

Though 530ms is a lot, it most certainly helps to configure cache. Running any serious/production wiki without cache is irresponsible.

At the very least activate internal caches such as for i18n, expensive operations (dbcache or memcached). If you want to avoid hits to (most of) the backend entirely you could go for file cache or even go large-scale and set up squid/varnish in front of it. Read more at

Note You need to log in before you can comment on or make changes to this bug.