📜 ⬆️ ⬇️

Quick Joomla - index.php file

In this topic, I would like to share some tips (note: sometimes they are completely inapplicable!) To speed up the work of Joomla 1.0 (many tips apply to 1.5). Caching will not be considered, because at first I optimize everything as much as possible without it, and only then caching methods.
So let's start with index.php
1. do you need https? correctly, we kill 4 lines that check this case. Saved a couple of milliseconds.
2. if ($mosConfig_offline == 1) - is our site not planning to be offline? We kill, we save nothing.
3. Mambots? For ordinary, non-primitive sites are rarely needed, will you agree? Although it happens, I do something in the onStart trigger. In fact, the call of the Mambots can also be removed if it is not needed. More precious milliseconds.
4. if (file_exists( $mosConfig_absolute_path .'/components/com_sef/sef.php' )) - don't you really know if a file exists on your site? We decide on which branch of the condition we need and delete the rest. Savings - the time it takes to execute a single file_exists each time a page is displayed.
5. $menu = new mosMenu( $database ); - very often the composition of the menu within the site does not change. If so, then we kill the request call and the $ menu variable is assigned what should work (you can see print_r).
6. frontend login & logout controls - has anyone ever seen javascript inside it? Kill and his company.
7. $cur_template = $mainframe->getTemplate(); - Do you have different templates on each page? I usually have one, so I do $cur_template = ' '; - save one request to the database.
8. // display the offline alert if an admin is logged in - is it a // display the offline alert if an admin is logged in or nothing? Also removed.
9. // loads template file - we know that our template exists, why do we need an extra check of file_exists?

If the topic is interesting, I can describe how to make a very fast template, optimize the work of the modules and remove something from the kernel.
Thanks for attention.

')

Source: https://habr.com/ru/post/25598/


All Articles