On a new clean install of MODx 0.9.6 (rev 2767) on a Linux server, the MODx File Manager (not FCK) deletes all the jpg and gif files from a folder when you open the folder. It lists the files before it deletes them, but they are really gone (I checked with FTP before and after File Manager opened the folder.
The problem doesn’t occur on my Windows test server (running VertrigoServ 2.18 on XP). But the problem is all too repeatable on my web server running Linux / Apache1.3.27 / PHP 5.2.1 / MySQL 5.0.27 .
To repeat the problem I install MODx with no errors, login to Manager, open Configuration and save it with no changes. Then I open Resources / Manage Files and use it to browse to assets/templates/modxhost/images. First it lists all the image files (and deletes them), then when I go up one level and return to the images folder, it shows the folder contains only two files (Thumbs.db and Thumbs_old.db). All the image files have been deleted.
Does MODx share code with Drupal. I had a similar problem a year ago with Drupal 4.7 on a different Linux host. It automatically deleted jpg and gif files but would leave png files.
I found one thread on the forum here (from May) that mentions this problem, but it had zero responses.
-
MODX Staff
- 10,725 Posts
I think the problem here may be one of permissions. The MODx file manager will create files as the user which is running PHP within Apache. This is typically a user like ’www’ or ’nobody’ and in order for your FTP user account to see and manage them, you’ll need to change the default permissions in the MODx settings to 777 and 666. If created with other permissions, they likely will not be available or visible to you through FTP, SSH, etc. Some hosts run FastCGI or other methods which make PHP run as your user account, which simplifies this situation greatly, but in exchange for a small sacrifice in performance in most cases. Most hosts run it as a server API (module) in Apache though, and this is what complicates the situation...
However, if you are using the resource browser with TinyMCE or FCKEditor, you are using the MCPuk file manager, not the MODx file manager.
The problem may be one of file permissions, but I don’t think so. On my web server Apache runs as me, so permissions aren’t usually a problem.
The files that disappear (in the example I gave to reproduce the problem) are part of the MODx template theme installed by MODX (although any other image files would be deleted as well.) The template and theme show up fine in Firefox (or IE), before using the MODx File Manager to browse the files in the images folder. Somehow File Manager deletes all the graphics files just by displaying the files in the folder. Afterward, the whole MODx theme showes up in Firefox without the graphics because the jpg and gif files have actually been deleted from the server. The whole website shows up in plaintext. That means File Manager must be deleting the css files as well. Sure enough, I just checked and all the css files were deleted as the MODx File Manger traversed through the assets/templates/modxhost folder. The only file left there is modxhost.tpl.
If it is an issue of file permissions, maybe running Apache as "nobody" or another unprivileged user protects the files from being deleted by the MODx File Manager on most servers, but I don’t see how that would be the case.
-
MODX Staff
- 10,725 Posts
Wow, yeah, that definitely doesn’t sound like permissions. Just had to double-check.
As I never personally use the MODx File Manager, I’ve never experienced this behavior, but if you can reproduce it consistently, please post a bug report so we can get this addressed ASAP.
-
MODX Staff
- 730 Posts
I am experiencing this issue on all sites hosted on one particular server.
A direct copy of one of the sites onto my local server does not exhibit the same behavior.
What I’m seeing seems a little crazy to me. I have just watched my clicks through the file manager in the modx event log. The event log reports 2 separate events when I just viewed a folder in the file manager. First event, message "Using file manager". Second event, 3 seconds later (!!?), message "Deleted File". And the file is indeed gone. If there are multiple files in that folder, it deletes every one of them, but it seems as though the script is being called sequentially because a dozen or so "delete" events are spaced out over a few seconds.
This is just a heads up. I’ll work up a Jira ticket.