modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

Duplicating a resource does not refresh the context aliasMap #13746

Open Mark-H opened 6 years ago

Mark-H commented 6 years ago

Summary

First reported in #13375 (with an incorrect fix), it appears that duplicating a resource in the manager does not refresh the aliasMap automatically. This is causing unnecessary errors from getting logged.

Step to reproduce

  1. First, set the log_level to 3.
  2. Duplicate a resource.
  3. Check the error log to see the errors mentioned below.
  4. Refreshing the resource tree causes the errors to get repeated
  5. Clear the MODX cache through Manage > Clear Cache
  6. Refresh the resource tree to see the errors no longer appear

Observed behavior

These errors are getting logged for each request:

[2018-01-29 22:26:29] (WARN @ /Users/mhamstra/Sites/revolution.local/core/model/modx/modcontext.class.php : 244) `35` was requested but no alias was located.
[2018-01-29 22:26:29] (INFO in modContext::makeUrl @ /Users/mhamstra/Sites/revolution.local/core/model/modx/modcontext.class.php : 321) Resource with id 35 was not found in context web

Expected behavior

Duplicating a resource should cause an update to the contexts' aliasMap, so that the errors do not get logged.

Environment

Confirmed on MODX 2.6.1/2.x latest.

opengeek commented 6 years ago

Those are not errors. That's a warning and info. This needs to use refresh or the PR should be closed.

opengeek commented 6 years ago

Or whatever is triggering those warnings should be addressed directly.