Page MenuHomePhabricator

Clean up require_once()'s of autoloaded files
Open, LowPublic

Description

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.

Details

Reference
bz24687

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:02 PM
bzimport set Reference to bz24687.
bzimport added a subscriber: Unknown Object (MLST).

(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?

Removed one require_once() from Setup in r70556.

tekmosis wrote:

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.

(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 https://www.mediawiki.org/wiki/Manual:Cache.

Krinkle set Security to None.
Krinkle removed subscribers: Unknown Object (MLST), Krinkle.
Danny_B renamed this task from Clean up require_once()'s of autoloaded files (tracking) to Clean up require_once()'s of autoloaded files.Jul 11 2016, 1:27 AM
Danny_B removed a project: Tracking-Neverending.
Danny_B updated the task description. (Show Details)