Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After activating cache_db it is no longer possible to filter by namespaces #16674

Closed
raffy99 opened this issue Jan 4, 2025 · 3 comments · Fixed by #16681
Closed

After activating cache_db it is no longer possible to filter by namespaces #16674

raffy99 opened this issue Jan 4, 2025 · 3 comments · Fixed by #16681
Labels
bug The issue in the code or project, which should be addressed.

Comments

@raffy99
Copy link
Contributor

raffy99 commented Jan 4, 2025

Bug report

Summary

After activating cache_db in system-settins it is no longer possible to filter the system-settings by namespaces

Step to reproduce

Activate cache_db setting then click click on "Filter by namespace"

Observed behavior

Depending on error reporting the click produces an error-alert: "Code: 0 communication failure" or just leaves the system-setting site in an unusable state.

Expected behavior

Show a list of namespaces for filtering.

Environment

MODX Revolution 3.1.0-pl (traditional), Apache/2.4.62 (Unix), PHP Version 8.2.20, 10.6.19-MariaDB

@raffy99 raffy99 added the bug The issue in the code or project, which should be addressed. label Jan 4, 2025
@halftrainedharry
Copy link
Contributor

As far as I can tell, the processor (to load the available namespaces) runs a query like
SELECT GROUP_CONCAT(DISTINCT `settingsNamespace`.`namespace` SEPARATOR '","') AS namespaces FROM `modx_system_settings` AS `settingsNamespace`
here in the code:

$namespaces = $this->modx->getObject($settingsClass, $nsSubquery)->get('namespaces');

When cache_db is set to "Yes", MODX tries to save the result from this query to the cache as a modSystemSetting. But the primary key is missing (as it's not possible to include it in an SQL query like this) and that breaks the code.


The easiest solution is probably to add the third parameter ($cacheFlag) to this call of getObject(), so that the result is never cached:

$namespaces = $this->modx->getObject($settingsClass, $nsSubquery, false)->get('namespaces');

@raffy99
Copy link
Contributor Author

raffy99 commented Jan 6, 2025

Thanks for looking into this. Adding the the cacheFlag-parameter to the call solves the problem.
This bug was not in 3.0.6, which change caused the error?

@halftrainedharry
Copy link
Contributor

I believe it was introduced with #16369.
It looks like a ton of code changes where made for version 3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants