Sterc / mediamanager

Enterprise grade media management in MODX
https://www.sterc.com/modx/extras/media-manager
7 stars 7 forks source link

Deleting an image was not successful #27

Closed sonicpunk closed 2 years ago

sonicpunk commented 2 years ago

After archiving an image you have the possibility to delete an image.

When clicking on delete, you get the confirmation modal. You click yes, and..... visually nothing changes..

In Dev Tools you see a fatal error:

<br />
<b>Fatal error</b>:  Uncaught TypeError: Argument 1 passed to modProcessor::outputArray() must be of the type array, bool given, called in /var/www/html/cms/core/components/mediamanager/processors/mgr/files.class.php on line 169 and defined in /var/www/html/cms/core/model/modx/modprocessor.class.php:255
Stack trace:
#0 /var/www/html/cms/core/components/mediamanager/processors/mgr/files.class.php(169): modProcessor-&gt;outputArray(true)
#1 /var/www/html/cms/core/components/mediamanager/processors/mgr/files.class.php(52): MediaManagerFilesProcessor-&gt;delete()
#2 /var/www/html/cms/core/model/modx/modprocessor.class.php(180): MediaManagerFilesProcessor-&gt;process()
#3 /var/www/html/cms/core/model/modx/modx.class.php(1788): modProcessor-&gt;run()
#4 /var/www/html/cms/core/model/modx/modconnectorresponse.class.php(144): modX-&gt;runProcessor('mgr/files', Array, Array)
#5 /var/www/html/cms/core/model/modx/modconnectorrequest.class.php(86): modConnectorResponse-&gt;outputContent(Array)
#6 /var/www/html/cms/core/model/modx/modconnectorrequest.class.php( in <b>/var/www/html/cms/core/model/modx/modprocessor.class.php</b> on line <b>255</b><br />
sonicpunk commented 2 years ago

Deleting removes it from the GUI which is good, but the file still remains in the filesystem. I get this error in MODX

[2021-11-23 09:25:35] (ERROR @ /var/www/html/cms/core/components/mediamanager/model/mediamanager/classes/files.class.php : 1549) PHP warning: unlink(archive/1637655928-619ca5782264b.jpg): No such file or directory

The path is not correct!

Falco-Boehnke commented 2 years ago

I'll hijack this issue: I got a similar problem when trying to archive an image

grafik

The file is not found, which is reflected in the modx error log and also reflects on the url, which throws a 404 page when opened.

[2021-11-24 13:34:36] (ERROR @ /paas/c0100/www/core/components/mediamanager/model/mediamanager/classes/files.class.php : 2564) PHP warning: rename(/paas/c0100/www/mediamanager/2021/11/icon.svg,/paas/c0100/www/mediamanager/archive/1637757276-619e315cd26b5.svg): Datei oder Verzeichnis nicht gefunden

As you can see in the image above, the file is still shown inside the MM Interface, creating some issues for the editor.

Weirdly, the same problem occurs in the 'Archived' category, when trying to delete images we get first this networklog on opening: grafik

and this accompanying Modx Errorlog (which I cannot make heads or tails of sadly):

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector.

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector.

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector.

[2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/ [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 644) Could not load class: Redirector from redirector. [2021-11-24 13:39:39] (ERROR @ /paas/c0100/www/core/xpdo/xpdo.class.php : 1248) Problem getting service redirector, instance of class Redirector, from path /paas/c0100/www/core/components/redirector/model/redirector/

Is there a way to clean up the missing images from the MM or in the Database?

Thank you so much for your hard work on this amazing tool! I really appreciate it.

sonicpunk commented 2 years ago

@Falco-Boehnke Which MODX Version and which Media Manager. Version?

Did you try the latest package? https://github.com/Sterc/mediamanager/tree/development/_packages

Don't test this on a production website!! :)

Falco-Boehnke commented 2 years ago

@sonicpunk Sorry, forgot to add the version (no worries, it's not a production system!)

Modx 2.8.3.pl MediaManager 2.5.0

Using the newest package, updated just today.

Also here is the MM Config just in case

image

sonicpunk commented 2 years ago

@gpsietzema In line 1549 $this->uploadDirectory is referenced and is empty. Only the file $path then gets sent to the unlink command. Don't see yet, where a value to uploadDirectory is supposed to be assigned. It is a private variable assigned NULL on line 36.

ilyautkin commented 2 years ago

@sonicpunk Deleting images fixed in new 0.2.6 version. Can you check please?

sonicpunk commented 2 years ago

@ilyautkin This is working for me now.