After updating Modx to version 2.6.0 the "clear cache" menu button doesn't work anymore. Having a closer look at the html code, the browser shows me this:
<a onclick="{literal} MODx.clearCache(); return false;{/literal} ">
Comparing this line of code with the one that is generated in the Modx version 2.5.X I guess it shoud look like this:
<a onclick="MODx.clearCache(); return false;">
@Waivor How would you define "doesn't work anymore"?
I can't replicate this issue on my installation of 2.6.0.
I can't replicate it either.
But maybe it's related to this commit: https://github.com/modxcms/revolution/commit/5529f5eb02af2e7d8240cf1c14e9c394df4fc7a2
@jonleverrier "doesn't work anymore" means that clicking on it doesn't start the procedure of clearing the cache. Clicking on it doesn't have any effect.
@Waivor Have you tried clearing your browser cache since upgrading? Are there any console errors in your browser? Can you replicate the issue?
could there be situations, where this part doesn't run thrue Smarty? @Mark-H
If I remember right, this happened once in my dev installation, when the core package was not build right before the installation. @Waivor Do you use a git-installation?
@Jako I downloaded the traditional installation package (v. 2.6.0) from modx.com, uploaded everything by using FileZilla etc. ... quite ordinary.
Sorry, then it was a different cause/result. I had to comment out {eval var=$navb} in that installation temporary, because the manager did not load anymore. Sadly I don't know the reason anymore.
Maybe a lexicon issue, a wrong encoded/decoded unicode char or some invalid settings in the manager menu.
How big of a jump in upgrade did you do? Maybe if you upgrade version by version it would fix this. Just a thought... https://docs.modx.com/extras/revo/upgrademodx
Also did you try a fresh install on the same server?
@mrhaw I upgraded from Modx 2.5.8 to 2.6.0, so there wasn't a big update jump. So far, I have not done a new installation on my server. It is noticeable that the same error occurs whenever I update an existing system (2.5.8) to 2.6.0.
I'm getting pretty much the same thing when trying to flush permissions. Clearing cache works fine though.
Upgraded from 2.5.7 - 2.6.0
My browser gets an empty response with the error:
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
@digitalpenguin
sounds to me, yours is a different issue and I think, you should open a new issue for yours.
Right, will do!
Getting a lot of these Smarty tags not being processed in my localhost upgraded installation, quite a few menu items don't work, such as Preview Site and Clear Cache and more.
Which is odd, since all of my Cloud installations are upgraded and seem fine.
Maybe because localhost was an upgrade of a pre-release 2.6?
If you could track this down, you could help a lot @sottwell
Installed 2.5.8 on localhost, it upgraded with no problem.
@Waivor could you tell about your environment?
@sottwell Could you look in the HTML code of your backend and locate where the first {literal} occurs after <li id="modx-manager-search-icon">. Especially the entry before that {literal} could help to identify the issue.
I'm sorry, I just dumped everything to start fresh with an updated version of MAMP. However, in all cases, the {literal} tags were exactly as described in the forum post here https://forums.modx.com/thread/103122/upgrade-form-2-5-8-to-2-6-0-manager-menu#dis-post-555045
All menu items that were simple links were fine, it was only the Javascript-activated actions that had the problem.
@Bruno17 MySQL 5.6.19 (both systems), PHP 7.71 Stable and PHP 5.56 Stable (2nd system), both were upgraded (2.5.8 to 2.6.0) with the same results. @sottwell link in the last post describes all the problems I have found so far.
Plugins:
Collections 3.6.0 pl
ContentBlocks 1.7.1 pl
Migx 2.11.0 pl
pdoTools 2.10.2 pl
pThumb 2.3.3 pl
Archivist 1.2.4 pl
Quip 2.3.3 pl
SimpleSearch 1.9.2 pl
@Waivor could you post a dump of the modx_menus table here? Maybe the issue is visible in there.
Hopefully a stupid question: You did run setup after upgrading and did not only upload/merge the files, right?
Yes
Because without running setup I can reproduce this. But it's something different then.
I strongly suspect something in the nature of caching somewhere. ExtJS can get really difficult if it gets fed old files.
@Jako Do you mean this one?
<ul class="modx-subnav">
<li id="users">
<a href="?a=security/user">Users<span class="description">Manage Users and their Permissions</span>
</a>
</li>
<li id="refresh_site">
<a onclick="{literal} MODx.clearCache(); return false;{/literal} ">Clear Cache<span class="description">Delete Cache files in all Contexts</span>
</a>
<ul class="modx-subsubnav">
<li id="refreshuris">
<a onclick="{literal} MODx.refreshURIs(); return false;{/literal} ">Refresh URIs<span class="description">Regenerate system Resource URIs.</span>
</a>
</li>
</ul>
</li>
<li id="remove_locks">
<a onclick="{literal} MODx.removeLocks();return false;{/literal} ">Remove Locks<span class="description">Remove all locks on Manager pages</span>
</a>
</li>
<li id="flush_access">
<a onclick="{literal} MODx.msg.confirm({
title: _('flush_access')
,text: _('flush_access_confirm')
,url: MODx.config.connector_url
,params: {
action: 'security/access/flush'
}
,listeners: {
'success': {fn:function() { location.href = './'; },scope:this}
}
});{/literal} ">Flush Your Permissions<span class="description">Reload this session’s Permissions</span>
</a>
</li>
<li id="flush_sessions">
<a onclick="{literal} MODx.msg.confirm({
title: _('flush_sessions')
,text: _('flush_sessions_confirm')
,url: MODx.config.connector_url
,params: {
action: 'security/flush'
}
,listeners: {
'success': {fn:function() { location.href = './'; },scope:this}
}
});{/literal} ">Logout All Users<span class="description">Immediately destroy all sessions</span>
</a>
</li>
<li id="reports">
<a>Reports<span class="description">Admin reports for your MODX install</span>
</a>
<ul class="modx-subsubnav">
<li id="site_schedule">
<a href="?a=resource/site_schedule">Site Schedule<span class="description">View Resources with upcoming publish or unpublish dates.</span>
</a>
</li>
<li id="view_logging">
<a href="?a=system/logs">Manager Actions<span class="description">View the recent manager activity.</span>
</a>
</li>
<li id="eventlog_viewer">
<a href="?a=system/event">Error Log<span class="description">View the MODX error.log.</span>
</a>
</li>
<li id="view_sysinfo">
<a href="?a=system/info">System Info<span class="description">View server information, such as phpinfo, database info, and more.</span>
</a>
</li>
</ul>
@Waivor I think he meant the modx_menus table in the database. A couple of the relevant lines in the database dump from a properly-working site:
('refresh_site', 'manage', '', 'refresh_site_desc', '', 1, '', 'MODx.clearCache(); return false;', 'empty_cache', 'core'),
('remove_locks', 'manage', '', 'remove_locks_desc', '', 2, '', 'MODx.removeLocks();return false;', 'remove_locks', 'core'),
@Waivor The generated html code above looks right. But the {literal} smarty tags are not removed by Smarty for some reason. Does manager/templates/default/header.tpl contains the {eval var=$navb} tag according to https://github.com/modxcms/revolution/commit/5529f5eb02af2e7d8240cf1c14e9c394df4fc7a2
@sottwell I see, no problem:
```('topnav','','','topnav_desc','','0','','','','core')
('site','topnav','','','','0','','','menu_site','core')
('new_resource','site','resource/create','new_resource_desc','','0','','','new_document','core')
('preview','site','','preview_desc','','4','','MODx.preview();returnfalse;','','core')
('import_site','site','system/import/html','import_site_desc','','5','','','import_static','core')
('import_resources','site','system/import','import_resources_desc','','6','','','import_static','core')
('resource_groups','site','security/resourcegroup','resource_groups_desc','','7','','','access_permissions','core')
('content_types','site','system/contenttype','content_types_desc','','8','','','content_types','core')
('media','topnav','','media_desc','','1','','','file_manager','core')
('file_browser','media','media/browser','file_browser_desc','','0','','','file_manager','core')
('sources','media','source','sources_desc','','1','','','sources','core')
('components','topnav','','','','2','','','components','core')
('installer','components','workspaces','installer_desc','','0','','','packages','core')
('manage','topnav','','','','3','','','menu_tools','core')
('users','manage','security/user','user_management_desc','','0','','','view_user','core')
('refresh_site','manage','','refresh_site_desc','','1','','MODx.clearCache();returnfalse;','empty_cache','core')
('refreshuris','refresh_site','','refreshuris_desc','','0','','MODx.refreshURIs();returnfalse;','empty_cache','core')
('remove_locks','manage','','remove_locks_desc','','2','','MODx.removeLocks();returnfalse;','remove_locks','core')
('flush_access','manage','','flush_access_desc','','3','','MODx.msg.confirm({title:_('flush_access'),text:_('flush_access_confirm'),url:MODx.config.connector_url,params:{action:'security/access/flush'},listeners:{'success':{fn:function(){location.href='./';},scope:this}}});','access_permissions','core')('flush_sessions','manage','','flush_sessions_desc','','4','','MODx.msg.confirm({title:_('flush_sessions'),text:_('flush_sessions_confirm'),url:MODx.config.connector_url,params:{action:'security/flush'},listeners:{'success':{fn:function(){location.href='./';},scope:this}}});','flush_sessions','core')
('reports','manage','','reports_desc','','5','','','menu_reports','core')
('site_schedule','reports','resource/site_schedule','site_schedule_desc','','0','','','view_document','core')
('view_logging','reports','system/logs','view_logging_desc','','1','','','logs','core')
('eventlog_viewer','reports','system/event','eventlog_viewer_desc','','2','','','view_eventlog','core')
('view_sysinfo','reports','system/info','view_sysinfo_desc','','3','','','view_sysinfo','core')
('usernav','','','usernav_desc','','0','','','','core')('user','usernav','','','<spanid="user-avatar">{$userImage}</span><spanid="user-username">{$username}</span>','5','','','menu_user','core')
('profile','user','security/profile','profile_desc','','0','','','change_profile','core')
('messages','user','security/message','messages_desc','','1','','','messages','core')
('logout','user','security/logout','logout_desc','','2','','MODx.logout();returnfalse;','logout','core')
('admin','usernav','','','<iclass="icon-geariconicon-large"></i>','6','','','settings','core')
('system_settings','admin','system/settings','system_settings_desc','','0','','','settings','core')
('bespoke_manager','admin','security/forms','bespoke_manager_desc','','1','','','customize_forms','core')('dashboards','admin','system/dashboards','dashboards_desc','','2','','','dashboards','core')
('contexts','admin','context','contexts_desc','','3','','','view_context','core')
('edit_menu','admin','system/action','edit_menu_desc','','4','','','actions','core')
('acls','admin','security/permission','acls_desc','','5','','','access_permissions','core')
('propertysets','admin','element/propertyset','propertysets_desc','','6','','','property_sets','core')
('lexicon_management','admin','workspaces/lexicon','lexicon_management_desc','','7','','','lexicons','core')('namespaces','admin','workspaces/namespace','namespaces_desc','','8','','','namespaces','core')('about','usernav','help','','<iclass="icon-question-circleiconicon-large"></i>','7','','','help','core')
('contentblocks.menu','components','1','contentblocks.menu_desc','','0','','','administrator','core')
('migx','components','index','MigxKonfigurator','','0','&configs=packagemanager||migxconfigs||setup','','','migx')('formit','components','3','formit.menu_desc','images/icons/plugin.gif','0','','','packages','core')('quip','components','4','quip_desc','images/icons/plugin.gif','4','','','','core')
('collections.menu.collection_templates','components','5','collections.menu.collection_templates_desc','','0','','','packages','core')
@Jako line 73 to line 78 in /templates/default/header.tpl
...
{/if}
{eval var=$navb}
{if $_search}
...
```
Note: I solved the problem by deleting the whole system on the server and reuploading and installing modx 2.6.0 (traditional) (uploading the database, installing snippets etc.).
Just to be sure, you are certain that you did upload (and overwrite the existing files) and ran the installer for an upgrade?
When it happened to my localhost installation, I had used UpgradeMODX.
@sottwell I am not familiar with that extra. What does that do that solved the problem? And what did you to first?
It downloads the requested release, extracts it and moves the files into the appropriate location, then redirects you to the Setup page.
I had downloaded the .zip of the 2.6 from github, built it and installed. Then when the release came out, I installed UpgradeMODX and ran it (it's a Dashboard widget) and everything seemed fine, until checked the main menu.
Later, I installed 2.5.-whatever, checked it to make sure it was good, then again installed UpgradeMODX and repeated the upgrade. This time, everything was fine.
We have a website that has this problem. I can see all the {literal} tags in the source. Can someone confirm that this in fact _works_ on a fresh 2.6.0 site? This problem only occur with an upgrade? I heard reports from the office that the problem happened when they tried to upgrade from 2.5.7, but 2.5.8 was fine.
I don't have seen this issue. Neither at new installations nor at upgraded. I'm also upgrading with Bobs UgradeMODX. But I didn't try it on a local installation.
Could it be something with smarty - cache?
I suppose it is/was a caching issue and some files in core/cache/mgr/smarty are not removed during the update to 2.6.0. The following steps have to happen to reproduce the issue:
manager/controllers/default/header.php are loaded into $navbmanager/templates/default/header.tpl does not contain the {eval var=$navb} smarty tagThe menu content is cached in another place, but that cache can't cause the {literal} issue.
And I don't think that a smarty issue could cause this. In my tests I have tried to create some parsing issues in header.tpl, but then the whole manager breaks with an error 500.
As far as I know, the only smarty cache is in the core/cache/mgr/smarty folder. So the update process should clear this folder and warn the user, if there is something left there.
I tried to manually clear the core/cache/mgr/smarty directory, and the problem is still there. I can also confirm that the menus are cached in core/cache/menu, but without the {literal} tags, so this should not be the cause of the problem.
EDIT: Could it be that eval is turned off?
It can't be disabled, at least there is no statement in the docs for disabling it: https://www.smarty.net/docsv2/en/language.function.eval.tpl
@OptimusCrime: Could you look what's in navb after this line: https://github.com/modxcms/revolution/blob/5529f5eb02af2e7d8240cf1c14e9c394df4fc7a2/manager/controllers/default/header.php#L74 with die($this->modx->smarty->getTemplateVars('navb'));
I did a var_dump. Complete output below:
string(5479) "<li id="limenu-site" class="top">
<a href="javascript:;">Content</a>
<ul class="modx-subnav">
<li id="new_resource">
<a href="?a=resource/create">New Resource<span class="description">Create a Resource — usually a web page</span>
</a>
</li><li id="preview">
<a onclick="{literal} MODx.preview(); return false;{/literal} ">Preview Site<span class="description">View your website in a new window</span>
</a>
</li><li id="import_site">
<a href="?a=system/import/html">Import HTML<span class="description">Import HTML files to Resources</span>
</a>
</li><li id="import_resources">
<a href="?a=system/import">Import Static Resources<span class="description">Import any Content Type based on file extension to Static Resources</span>
</a>
</li><li id="resource_groups">
<a href="?a=security/resourcegroup">Resource Groups<span class="description">Assign Resources to Groups</span>
</a>
</li><li id="content_types">
<a href="?a=system/contenttype">Content Types<span class="description">Add content types for resources, such as .html, .js, etc.</span>
</a>
</li></ul>
</li>
<li id="limenu-media" class="top">
<a href="javascript:;">Media</a>
<ul class="modx-subnav">
<li id="file_browser">
<a href="?a=media/browser">Media Browser<span class="description">View, upload and manage media</span>
</a>
</li><li id="sources">
<a href="?a=source">Media Sources<span class="description">Media sources for use of media from remote services or servers</span>
</a>
</li></ul>
</li>
<li id="limenu-components" class="top">
<a href="javascript:;">Extras</a>
<ul class="modx-subnav">
<li id="installer">
<a href="?a=workspaces">Installer<span class="description">Manage Add-ons and Distributions</span>
</a>
</li><li id="cmpgenerator">
<a href="?a=3">CMP Generator<span class="description">Generate CMP code</span>
</a>
</li><li id="collections.menu.collection_templates">
<a href="?a=1">Collection views<span class="description">Define views for collection's children grid.</span>
</a>
</li></ul>
</li>
<li id="limenu-manage" class="top">
<a href="javascript:;">Manage</a>
<ul class="modx-subnav">
<li id="users">
<a href="?a=security/user">Users<span class="description">Manage Users and their Permissions</span>
</a>
</li><li id="refresh_site">
<a onclick="{literal} MODx.clearCache(); return false;{/literal} ">Clear Cache<span class="description">Delete Cache files in all Contexts</span>
</a>
<ul class="modx-subsubnav">
<li id="refreshuris">
<a onclick="{literal} MODx.refreshURIs(); return false;{/literal} ">Refresh URIs<span class="description">Regenerate system Resource URIs.</span>
</a>
</li></ul>
</li><li id="remove_locks">
<a onclick="{literal} MODx.removeLocks();return false;{/literal} ">Remove Locks<span class="description">Remove all locks on Manager pages</span>
</a>
</li><li id="flush_access">
<a onclick="{literal} MODx.msg.confirm({
title: _('flush_access')
,text: _('flush_access_confirm')
,url: MODx.config.connector_url
,params: {
action: 'security/access/flush'
}
,listeners: {
'success': {fn:function() { location.href = './'; },scope:this}
}
});{/literal} ">Flush Your Permissions<span class="description">Reload this session’s Permissions</span>
</a>
</li><li id="flush_sessions">
<a onclick="{literal} MODx.msg.confirm({
title: _('flush_sessions')
,text: _('flush_sessions_confirm')
,url: MODx.config.connector_url
,params: {
action: 'security/flush'
}
,listeners: {
'success': {fn:function() { location.href = './'; },scope:this}
}
});{/literal} ">Logout All Users<span class="description">Immediately destroy all sessions</span>
</a>
</li><li id="reports">
<a>Reports<span class="description">Admin reports for your MODX install</span>
</a>
<ul class="modx-subsubnav">
<li id="site_schedule">
<a href="?a=resource/site_schedule">Site Schedule<span class="description">View Resources with upcoming publish or unpublish dates.</span>
</a>
</li><li id="view_logging">
<a href="?a=system/logs">Manager Actions<span class="description">View the recent manager activity.</span>
</a>
</li><li id="eventlog_viewer">
<a href="?a=system/event">Error Log<span class="description">View the MODX error.log.</span>
</a>
</li><li id="view_sysinfo">
<a href="?a=system/info">System Info<span class="description">View server information, such as phpinfo, database info, and more.</span>
</a>
</li></ul>
</li></ul>
</li>
<li id="limenu-DevTools" class="top">
<a href="javascript:;">DevTools</a>
<ul class="modx-subnav">
<li id="DB Search">
<a href="?a=home&namespace=dev">DB Search<span class="description">Search resources, templates, chunks and snippets with reguar expressions.</span>
</a>
</li><li id="MODX Error Log">
<a href="?a=system/event">MODX Error Log<span class="description">Track PHP bugs registered by MODX</span>
</a>
</li><li id="xbug.xbug">
<a href="?a=2" onclick="{literal} return false;{/literal} ">xBug<span class="description">xBug Query and Page Profiler Tools.</span>
</a>
<ul class="modx-subsubnav">
<li id="xbug.xbug_query">
<a href="?a=2">xBug Query Debugger.<span class="description">xBug xPDOCriteria Debugging Utility.</span>
</a>
</li><li id="xbug.profiler">
<a href="?a=2&action=profiler">Profiler<span class="description">Analyze parser and sql events during page load</span>
</a>
</li></ul>
</li><li id="Notes">
<a href="?a=notes&namespace=dev">Notes<span class="description">Keep track of your notes when under development.</span>
</a>
</li></ul>
</li>
"
Looks ok, but why it is not evaled with {eval var=$navb} here?
Could you look if the fetched header.tpl (it could be cached somewhere) contain that eval tag?
Is it possible, that it is not cached in core/cache/mgr/smarty but elsewhere (i.e. in a database or the memory)?
@OptimusCrime Did you get further on this? I can't reproduce those issues here, but since you have one installation showing that issue, you could help a lot debugging it.
Sorry! The header.tpl file contains the eval tag. I looked at modSmarty, and it looks like the cache files that related to Smarty are all placed in the directory you specified above. We do not use in memory caching.
Could you remote debug that beast and look whether fetchTemplate is getting the right template + data? There must be some reason why that {eval var=$navb} does not strip the {literal} tags.
Is there possible to create a minimal reproducable example outside of the manager with the same version of Smarty, using eval and {literal} tags? Are we 100% sure that this actually works like it should in Smarty? I tried to search for eval in the code, and as far as I could tell, this is the only place where we to this.
Like I asked earlier; is it confirmed that this works without any issues for sites created with 2.6.0 directly? Can we use the same var_dump I posted above and verify that it actually strips away the tags?
Edit: Can someone try to install 2.5.7 and then upgrade to 2.6.0 and see if this causes the problem?
The template paths are set here: https://github.com/modxcms/revolution/blob/a6dabd869fd426d21ae022caa651554650b6fe74/core/model/modx/modmanagercontroller.class.php#L376
Do you have different paths than /.../manager/templates/default/ set there?
How can I check this? The code is somewhat confusing. We are using a custom template, but only change the login template as far as I know.
Edit: I figured it out. It is because we have our own template. I though this template only used the login.tpl, but it actually contains copies of _all_ template files. We lack the {eval val=$navb} bit from the header.tpl file.
Yay, that looks like it is/could be solved.
If I am right the default template folder is searched everytime. So if you only want to change the login.tpl, you don't have to copy the others.
@Waivor Do you work with own templates too?
@Jako I think you are right. I'll make the guys at the office test this and verify. Awesome work ya'll, especially you Jako :)
I close this now, but we should think about warning the users that use custom templates about the change.
@Jako Yes and no. One of the two websites uses a custom login.tpl. Everytime I update Modx I also update the login.tpl file as well.
@Waivor Your custom template does _not_ have a header.tpl file in it?
@OptimusCrime It does have a header.tpl file. I copied the whole default template folder to create the custom manager login. I only changed the image (path) above the login form in login.tpl and made some adjustments in the login-min.css / login.css file.
That's the problem. Unless you copied the header.tpl file _after_ you upgaded to 2.6.0, you will see the bug. The reason is that there are changes to the default template, but your template does not contain these changes, because they were copied before the change was introduced. Try to copy the header.tpl file from the default template to your template and check if that solves the problem.
… or remove all not changed files in that custom folder. Then MODX will use the according files in the default folder.
Maybe on the topic.
PHP 7.1
Apache 2.4
MySql 5.6
win10
MODX revo 2.6.1
New project. Under development.
Created a plugin for FrontEnd. Hanged on the event OnWebPagePrerender.
I cleared the cache with regular means. (The global cache is disabled).
The plugin does not start.
The problem was solved by deleting the file core \ cache \ context_settings \ web \ context.cache.php
Everything worked.
In MODX revo 2.5.5 - No such problems were detected
I suspect that the problem is that for some reason the plugins are not started, due to the lack of information about such plug-ins in the context file in the cache.
I compared 2 versions 2.5.5 and 2.6.1 to the result of caching.
Settings.
cache_action_map = false
cache_alias_map = false
 cache_context_settings = true
cache_db = false
cache_db_expires = 0
cache_db_session = false
cache_default = true
cache_handler = xPDOFileCache
cache_resource = true
cache_scripts = true
cache_system_settings = true
clear_cache_refresh_trees = true
syncsite_default = true
use_context_resource_table = true
cache_disabled = false
Operations:
2.6.6
2 test.
deleted the context.cache.php files
Updated the page in the admin panel.
in 2.5.5 the file was created again.
in 2.6.1 the file was not created.
Later I will check the result on clean installations.
As long as the output: the cache for "context_settings"is not created and not cleared and not updated.
@ALexeyP0708 How is this related to the issue here?
@OptimusCrime 1. Title topic: clearing the cache link does not work properly in 2.6.0
@ALexeyP0708 I think the root cause of your problem is not connected to the original issue posted here. If you still experience problems, I suggest opening a new issue and follow the provided template.
Most helpful comment
How can I check this? The code is somewhat confusing. We are using a custom template, but only change the login template as far as I know.
Edit: I figured it out. It is because we have our own template. I though this template only used the
login.tpl, but it actually contains copies of _all_ template files. We lack the{eval val=$navb}bit from theheader.tplfile.