Problem deleting media file

Hello all,

We have a problem removing a media from library.
We choose to “Unassign from all layouts” but when we press the 'Yes" button the displayed gear works for ever.

Troubleshooting the issue we got the following POST response:

Notice: Trying to get property of non-object in /home/idcs/public_html/xibo/lib/data/region.data.class.php on line 374

Fatal error: Call to a member function removeChild() on null in /home/idcs/public_html/xibo/lib/data/region.data.class.php on line 374

The CMS log showed this:

17-08-31 11:01:07 CMS module Updating Region
17-08-31 11:01:07 CMS LayoutMediaGroupSecurity Unlink OUT
17-08-31 11:01:07 CMS LayoutMediaGroupSecurity Unlink IN
17-08-31 11:01:07 CMS Media Module SetError Module Class: Error Number [-1] Error Message [Cannot find this media item. Please refresh the region options.]
17-08-31 11:01:07 CMS Layout GetLayoutXml OUT
17-08-31 11:01:07 CMS Layout GetLayoutXml IN
17-08-31 11:01:07 CMS module Module created with MediaID: 3153 LayoutID: 135 and RegionID: 55421bc9d4025
17-08-31 11:01:07 CMS module UnassignFromAll Unassigning MediaID 3153 from Layout: SuperFast_1_2
17-08-31 11:01:05 CMS module Module created with MediaID: 3153 LayoutID: 0 and RegionID:
17-08-31 11:01:05 CMS module Creating new module with MediaID: 3153 LayoutID: 0 and RegionID:

Then we unassigned the specific media from the specific layout (still exists on other layouts) but the error is still the same!

What can possibly go wrong?

Thank you in advance!

What CMS version are you using please?

Hi Peter.

This one is Version 1.7.3.

I think I can recall something like this in earlier versions of 1.7 series (although I can’t seem to find a bug report for it atm) , that’s why I’ve asked about the CMS version first.

Is it possible to try and upgrade the CMS to at least 1.7.9 and see if the issue persists?

This is our most used CMS and I don’t dare to touch it.

Is there another way?

I have full access to the CMS files and also been capable to mangle a bit with the PHP.

It might be this one https://github.com/xibosignage/xibo/issues/545

If you really don’t want to make upgrade on the CMS, then perhaps you could try adding the code from Dan’s commit to your CMS? ie https://github.com/dasgarner/xibo-cms/commit/d57cb5d44868178687e707767e3d25f2ad954807 in lib/data/region.data.class.php file.

1 Like

Our paths just joined.

I have already put this commit in the code and now the Yes button returns back to media library but deleting media is still not possible.
It says again to unassign from all layouts!

This commit says about corrupted layouts with left over lklayoutmedia records.

If I remove from database the relative records will this solve the problem?

Is there a way to check for these left over records?

Also I can confirm that the XLF does NOT contain the specific media but the relations exist!

You have arrived at the answer in this case - manually removing those link records from the database. It is not clear how or why those links become “orphans”, but removing them should solve the issue.

I should say that this is only possible if the mediaId’s do not still exist in the XLF as you have indicated.

I can confirm that removing the records from the database I was able to select “delete” for these media files.

Thank you Dan and Peter for your support!

2 Likes

What is considered for a layout to be broken?

As in invalid?
Usually empty region or no regions at all alternatively player may say layout is invalid if has problems downloading requiredFiles or playing them.

If you mean how can it become ‘corrupted’ as per the original problem, as Dan said it’s not clear to us why this happens in 1.7 series I’m afraid.

If you’re having a problem with specific layout that seems to be valid, but player do not want to show it, then I’m happy to look at your layout if you can send it to me (via private message)

Hi Peter,

I’m not asking how but rather what “corrupted” means.

My intention is to make a tool that will search which files are “stalled” in lkmedialayout and remove them safely.

As your first sentence

Usually empty region or no regions at all alternatively player may say layout is invalid if has problems downloading requiredFiles or playing them.

That means that there will be no entry of the specific file in the XML so the lkmedialayout entry is orphan for sure!