We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1828
    • 137 Posts
    My clients wish to delete folders that contain files using either the MODx file browser or MCPUK. Neither of these options work. In each case a warning message about the folder possibly containing files is displayed and the user OKs this, but nothing happens.

    Folder/file permissions are 755/644, owned by the cpanel user, with PHP running as the same user via suPHP.

    Is it possible to enable this functionality?

    Thanks,
    Anton
      • 25663 MODX Staff
      • 12,272 Posts
      Unfortunately, no. At least I don’t think it’s possible; they might have added that by now to the MCPuck file manager. You’d need to investigate those options with the creators of that code though.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 1828
        • 137 Posts
        Hi Ryan,

        I understand the situation with MCPUK being a 3rd party component, but why is it not possible to do this with the MODx file browser?

        Anton
          • 25663 MODX Staff
          • 12,272 Posts
          It’s never been coded to do so, and likely we wouldn’t add it as a default behavior because it’s got great potential to do some not so fun things. I can see lots of messages stating, "Well I accidentally clicked delete on assets/images/ using the MODx File Manager. Now my website has no images!!! How do I get them back?"

          If you’d like to submit a patch to enable this functionality as an optional configuration switch in the manager, we’d gladly review it and consider incorporating it (default set to off!) in a future MODx release so it would be easier for your client’s site to be upgraded.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            it’s not that easy...

            if(!@rmdir($folder)) {
            


            http://www.php.net/rmdir

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 1828
              • 137 Posts
              Quote from: rthrash at Aug 07, 2008, 07:53 AM

              I can see lots of messages stating, "Well I accidentally clicked delete on assets/images/ using the MODx File Manager. Now my website has no images!!! How do I get them back?"
              Sure, but this could easily be mitigated by making the setting optional (site config or per security role or whatever) and making sure the warning message is nice and clear - which, in fact, it already is; it’s just that it doesn’t actually follow through on the warning. smiley

              If you’d like to submit a patch to enable this functionality as an optional configuration switch in the manager, we’d gladly review it
              I don’t have a patch to offer as I am not a PHP developer, but I can provide a use case, and perhaps someone might see this as a usability and functionality issue that is worth attending to at some point:

              A client wishes to clean up an image folder containing hundreds of image files in dozens of folders. Before they can delete a folder they have to tediously click on delete for each individual image contained in the folder, including all the auto-generated thumbs.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Actually the file manager folder delete function could refuse to delete the main assets folders. If users are dumb enough to click away at things without looking, and don’t have a backup... well, that’s why such users are sometimes referred to as "lusers". Maybe next time they’ll pay more attention.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org