? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
6 Mar 2022

Summary of Changes

When saving Joomla Global Configuration, sort the properties of JConfig A-Z so that configuration.php gets written in a human reader friendly way.

SORT_STRING | SORT_FLAG_CASE is fully compatible with PHP versions Joomla 4 is is targeted at

Testing Instructions

Save Joomla global config - view contents of configuration.php

Actual result BEFORE applying this Pull Request

Semi-random ordering of properties, db crednetials no where near db host for example

Expected result AFTER applying this Pull Request

A-Z with natural case flagging (so M and m are close) to make it easier for humans to find the string they are interested in quicker.

Documentation Changes Required

None. Fully backward compatible.

avatar PhilETaylor PhilETaylor - open - 6 Mar 2022
avatar PhilETaylor PhilETaylor - change - 6 Mar 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Mar 2022
Category Administration com_config
avatar PhilETaylor PhilETaylor - change - 6 Mar 2022
The description was changed
avatar PhilETaylor PhilETaylor - edited - 6 Mar 2022
avatar toivo
toivo - comment - 7 Mar 2022

I have tested this item successfully on e21e9b6

Tested successfully in 4.1.1-dev of 6 March in Wampserver 3.2.7 using PHP 8.0.15


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

avatar toivo toivo - test_item - 7 Mar 2022 - Tested successfully
avatar brianteeman
brianteeman - comment - 7 Mar 2022

Semi-random ordering of properties, db crednetials no where near db host for example

I can not confirm this

image

image

image

avatar brianteeman
brianteeman - comment - 7 Mar 2022

alphabetical sorting is only useful if you already know the name of the variable you are looking for

avatar PhilETaylor
PhilETaylor - comment - 7 Mar 2022

This PR is A-z sorting not per category and not semi random.

It achieves its aim and is better than total random that is the current situation.

avatar PhilETaylor PhilETaylor - change - 7 Mar 2022
Labels Added: ?
avatar PhilETaylor
PhilETaylor - comment - 7 Mar 2022

Go and visit real sites and view their configuration file - you will see I’m right. I open hundreds a month.

If you are manually editing this file, then there is a good chance that you already know why you are opening the file and you already know what you are looking for!

avatar brianteeman
brianteeman - comment - 7 Mar 2022

Go and visit real sites and view their configuration file - you will see I’m right. I open hundreds a month.

I pasted the results of three real sites.

The order they are stored in is defined here

public function createConfiguration($options)

avatar PhilETaylor
PhilETaylor - comment - 7 Mar 2022

That file is only used where installing Joomla and is then deleted. That is not the code used when saving Joomla global config

avatar PhilETaylor
PhilETaylor - comment - 7 Mar 2022

The semi random order is because the order is by luck depending on the order items are added to the $data array, which is also then modified further with no thought to ordering, and further merged with $prev array, and then by converting that array to a Registry object and then ultimately casting of the registry object to string here

$configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));

So yeah, I call that semi-random ordering - it certainly not grouped like you think it is.

avatar PhilETaylor PhilETaylor - change - 7 Mar 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-03-07 18:34:29
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 7 Mar 2022

Add a Comment

Login with GitHub to post a comment