amurashkin17
Forum Replies Created
-
Forum: Plugins
In reply to: [Developer Debug Tools] Snippets do not handle comments properly@apos37, here is what I found and what concerns I have about WP-CONFIG snippets.
Observations
In the interface, for each snippet, there is a short description on the left, a circle in the middle, and PHP statements on the right (with more explanation under them). The PHP statements font foreground color is
- grey if the statements shown are from the original wp-config.php (DDT finds relevant statement)
- rosy if the suggested statements shown (DDT cannot find relevant statements)
Most circles are empty, few circles have check marks. The reason why the circles are checked is not clear – is it because DDT thinks that the snippet is already there or because DDT will apply the snippet?
The grey statement matches the original statement. Why is the circle checked? The caching is enabled currently – does DDT assume that I want to disable it?
The grey statements match the original statements. Why is the circle is checked? The memory limits are set to some values currently – does DDT assumes that I want to change them?
This is different case than two above. The grey statement matches the original statement. The cron scheduler is already disabled – why then the circle is checked?
The rosy statement does not matches the original statement that is
define('WP_DEBUG', false);
The resulting file has two WP_DEBUG statements
define( 'WP_DEBUG', true );
<— in the DDT sectiondefine('WP_DEBUG', false);
<— the original statementI have tried to add/remove spaces. I have copied the statement from the resulting file and changed true to false. I have copied the resulting statement as is (with true value). All to no avail – at the end, I got two true statements.
The rosy statement matches the current statement
define('WP_DEBUG_LOG', true);
– why is it not grey? The original statement has a space after the comma.Recommendations
Could you write some help text explaining the circle check mark meaning – does it mean that the snippet is already there or that the snippet will be applied? Maybe different marks for each case (one circle and one square:).
If the original statements do not match the proposed statements – on the right side, for example, it would be nice to show the original statements (in grey) and proposed statements (in rosy).
Please do not apply snippets unless they are explicitly selected. In my case, I explicitly checked only “Enable WP_DEBUG Mode” but had also 3 snippets selected by DDT, so got multiple settings changed.
Here is, what I suspect, happened. I used DDT to apply 3 snippets and the file was changed. Then I restored the file from its backup. But DDT seems to keep the selected snippets in the database. So when I used DDT again, the snippets were already preselected. So when I selected 1 snippet, I got 4 snippets applied. The indication (3 check marks) was there, but I did not expect that.
I see two ways to reduce user’s frustration in such a case
- do not preselect snippets, show some indicator instead that the snippet was selected previously (for example, a different circle color without a check mark)
- lock update button until the user resolves previously selected snippets – show different check mark (for example question mark) and allow user to click it until it is selected or not
There are few more things that you might want to consider. wp-config.php file can be edited by other plugins and by users. The order of statements may be important. So some features to keep the file layout will be welcome.
DDT already encloses its section in begin and end comments. So check if the section is there and, if so, do new changed in the section. It will allow users to have code before the section.
An option to update existing statement in place (instead of moving it to DDT section) would be useful. Also an option to keep inline comments.