We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29468
    • 3 Posts
    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.





      • 22303 MODX Staff
      • 10,725 Posts
      Where is the thread from May you are referencing? (No link appears in your post)

      You might check FS#427 — connectors\php Folder Deleted On Failed Upload; that also appears to be a similar issue. And all of these issues are part of the MCPuk Resource Browser, which is used as the default resource browser for MODx. It may also have been used in Drupal, though I’m not familiar enough with that project to really know for sure.
        • 29468
        • 3 Posts
        The thread I found from May is at http://modxcms.com/forums/index.php/topic,14896.0.html. It seems there might have been some other issues as well.

        I thought the MCPuk Resource Browser was used for the FCK Resource Browser, which I am not using. The MODx File Manager seems to be in /manager/actions/files.dynamic.php . I could be mistaken though, I’ve just briefly tried to find where the trouble may be.
          • 22303 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.
            • 29468
            • 3 Posts
            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.


              • 22303 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.
                • 21257 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.
                  Mike Schell
                  Lead Developer, MODX Cloud
                  Email: [email protected]
                  GitHub: https://github.com/netProphET/
                  Twitter: @mkschell