? ? Pending

User tests: Successful: Unsuccessful:

avatar twister65
twister65
1 Sep 2018

Pull Request for Issue #21943 .

Summary of Changes

Adds the opcache_invalidate function before loading the configuration file.
opcache_invalidate : invalidates the cached file if the modification time of the file is newer than the cached opcodes.

Testing Instructions

  1. Create a site with https://launch.joomla.org/ and change Global configuration (admin).

OR

  1. Create a site on your localhost with these server settings.
    Edit the php.ini file and set the opcache.revalidate_freq value to 60 in the opcache section :

    [opcache]
    zend_extension=php_opcache.dll
    opcache.enable=1
    opcache.enable_cli=0
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.revalidate_freq=60
    opcache.fast_shutdown=1

This is my default configuration (bitnami wappstack server).

Restart Apache service.

  1. Log in as administrator
  2. System -> Global configuration
  3. Change any settings
  4. Save

Expected result

The settings in Global configuration are saved and taken into account.

Actual result

The new global configuration is not taken into account each time I save it (if patch is not applied).

avatar twister65 twister65 - open - 1 Sep 2018
avatar twister65 twister65 - change - 1 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Sep 2018
Category Libraries
avatar mbabker
mbabker - comment - 1 Sep 2018

This in effect cache busts the file every time the configuration is loaded (so on every request). Seems like the cache bust should happen when the global config is saved.

avatar zero-24
zero-24 - comment - 1 Sep 2018

Also here please fill out the template so we know hwy you do this and how to test and please fix the phpcs issue reported on drone:

FILE: /drone/src/github.com/joomla/joomla-cms/libraries/src/Factory.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 572 | ERROR | Please start your comment with a capital letter; found "//
     |       | opcode cache busting before including the filename"
--------------------------------------------------------------------------------
UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------

As well as add a clean line before the actual include.

avatar twister65 twister65 - change - 1 Sep 2018
Labels Added: ?
avatar twister65 twister65 - change - 1 Sep 2018
The description was changed
avatar twister65 twister65 - edited - 1 Sep 2018
avatar twister65 twister65 - change - 1 Sep 2018
The description was changed
avatar twister65 twister65 - edited - 1 Sep 2018
avatar twister65 twister65 - change - 2 Sep 2018
The description was changed
avatar twister65 twister65 - edited - 2 Sep 2018
avatar twister65 twister65 - change - 2 Sep 2018
The description was changed
avatar twister65 twister65 - edited - 2 Sep 2018
avatar ggppdk
ggppdk - comment - 2 Sep 2018

This in effect cache busts the file every time the configuration is loaded (so on every request). Seems like the cache bust should happen when the global config is saved.

Did you miss this comment ? by @mbabker
The cache clearing is called on every request

J3.9 triggers events for Global configuration save (before and after)

onApplicationBeforeSave
onApplicationAfterSave

So against the branch 3.9-dev branch

you could test / try using the code that you have already suggested here,
it should go in some always enabled plugin ... (which one ?)

	/**
	 * On Saving application configuration logging method
	 * Method is called when the application config is being saved
	 *
	 * @param   JRegistry  $config  JRegistry object with the new config
	 *
	 * @return  void
	 *
	 * @since   3.9.0
	 */
	public function onApplicationAfterSave($config)
	{
		if (function_exists('opcache_invalidate'))
		{
			opcache_invalidate(............................);
		}
	}
avatar SharkyKZ
SharkyKZ - comment - 2 Sep 2018

The code should go in com_config model, after the file has been written:

if (!JFile::write($file, $configuration))
{
throw new RuntimeException(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'));
}

avatar twister65
twister65 - comment - 2 Sep 2018

When I change and save global configuration, configuration file is correctly modified (it contains the new editor), but the configuration file was not reloaded with the new configuration (cache was not updated).
opcache_invalidate : invalidates the cached file if the modification time of the file is newer than the cached opcodes.

avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2018
Category Libraries Administration com_config Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2018
Category Libraries Administration com_config Administration com_config
avatar SharkyKZ
SharkyKZ - comment - 3 Sep 2018

I have tested this item successfully on c899ab1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21949.

avatar SharkyKZ SharkyKZ - test_item - 3 Sep 2018 - Tested successfully
avatar twister65
twister65 - comment - 16 Sep 2018

Please, could anyone else test this, I need this fix.
https://docs.joomla.org/Testing_Joomla!_patches/en#Recording_test_results

avatar SharkyKZ
SharkyKZ - comment - 16 Sep 2018

I suggest updating testing instructions to indicate that this can be reproduced when opcache.revalidate_freq is set to a higher value than the default.

avatar twister65 twister65 - change - 22 Oct 2018
The description was changed
avatar twister65 twister65 - edited - 22 Oct 2018
avatar twister65
twister65 - comment - 22 Oct 2018

I suggest updating testing instructions to indicate that this can be reproduced when opcache.revalidate_freq is set to a higher value than the default.

In my php.ini file, opcache.revalidate_freq is set to 60 by default.
I have updated testing instructions, as you suggest.

avatar twister65 twister65 - change - 12 Nov 2018
Title
Fix Editor change does not work #21943
Fix Configuration change has no effect #21943
avatar twister65 twister65 - edited - 12 Nov 2018
avatar twister65 twister65 - change - 12 Nov 2018
The description was changed
avatar twister65 twister65 - edited - 12 Nov 2018
avatar twister65
twister65 - comment - 12 Nov 2018

Cloud access.net server has now the same cached behavior.
You have the same issue (configuration saving) when you launch your Joomla! site :
https://launch.joomla.org/

avatar anka56
anka56 - comment - 13 Nov 2018

I have tested this item successfully on c899ab1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21949.

avatar anka56
anka56 - comment - 13 Nov 2018

I have tested this item successfully on c899ab1


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21949.

avatar anka56 anka56 - test_item - 13 Nov 2018 - Tested successfully
avatar Quy Quy - change - 13 Nov 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 13 Nov 2018

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21949.

avatar mbabker mbabker - change - 17 Nov 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-11-17 17:31:12
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 17 Nov 2018
avatar mbabker mbabker - merge - 17 Nov 2018
avatar sergueikp
sergueikp - comment - 27 Mar 2019

Hi, I'm using native Joomla caching and JCH Optimize Pro plugin which minimize the javascript and html files. I will deactivate it and see if there will be some changes.

Add a Comment

Login with GitHub to post a comment