Call to a member function getFileSetID() on a non-object

Permalink
My client appears to have broken their website, every page is showing the above error, leads me to believe that they have deleted a file set which is called in a global area. I can login to the dashboard but not any of the pages and can't see how to rectify the problem. Any ideas?

Websitehttp://www.pests-ealing.org.uk

wildfirelondon
 
mesuva replied on at Permalink Reply
mesuva
What I would do is:

- log into the dashboard and turn on full debug via /index.php/dashboard/system/environment/debug , the setting should be called something like 'Show the debug error output'
- then check the message on the front end, and it should give you more detail as to what block/file is causing this issue.
- I'd then comment out whatever section of code is failing (or put in fix) to get the site running again.
wildfirelondon replied on at Permalink Reply
wildfirelondon
I tried that but got the following

file_put_contents(/home/pests-ealing.org.uk/httpdocs/application/config/generated_overrides/concrete.php): failed to open stream: Permission denied
mesuva replied on at Permalink Reply
mesuva
That means you don't have enough write permissions on the file at that path. On your server (cPanel, etc), look for that file (and folder) and add write permissions, and try again.
wildfirelondon replied on at Permalink Reply
wildfirelondon
I am not a complete newbie lol, just not explaining myself very well. I have already set the complete path to 777 and the concrete.php file 755 and still getting the error.
mesuva replied on at Permalink Reply
mesuva
I can't really suggest any more except to check permissions again. Maybe the file is owned by a different group to that of the running webserver, or it's in the wrong group, and it needs 775 or 777 just to get it saved.
JohntheFish replied on at Permalink Reply
JohntheFish
You can also set the debug settings by directly editing the config. See
https://www.concrete5.org/community/forums/usage/problem-with-core-c...
wildfirelondon replied on at Permalink Reply
wildfirelondon
Thanks, that solution turned the debugger on. I tried to include the code that I am now seeing in this post but the code /code instructions aren't working.

The site is www/pests-ealing.org.uk. It would be fabulous if anyone is kind enough to have a look and confirm that I will need to comment out everything from public function forwards to the end } (which isn't shown).

Bit new to this part of php editing so some guidance will be appreciated.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
You could try something like this (untested)
public function filterBySet($fs)
    {
      if ($fs != false) {
        $table = 'fsf' . $fs->getFileSetID();
        $this->query->leftJoin('f', 'FileSetFiles', $table, 'f.fID = ' . $table . '.fID');
        $this->query->andWhere($table . '.fsID = :fsID' . $fs->getFileSetID());
        $this->query->setParameter('fsID' . $fs->getFileSetID(), $fs->getFileSetID());
    }
   }
mesuva replied on at Permalink Reply
mesuva
Try replacing the whole function with this:

public function filterBySet($fs)
    {
        if ($fs) {
            $table = 'fsf' . $fs->getFileSetID();
            $this->query->leftJoin('f', 'FileSetFiles', $table, 'f.fID = ' . $table . '.fID');
            $this->query->andWhere($table . '.fsID = :fsID' . $fs->getFileSetID());
            $this->query->setParameter('fsID' . $fs->getFileSetID(), $fs->getFileSetID());
        }
    }

That hopefully is enough to get the site running again.

It's still then worth trying to find where some sort of block or functionality is trying to filter by a file set that no longer exists, and then revert the function. If it's some sort of gallery, you may find that with that little change of code above it shows _all_ files from the file manager (so that could be a clue)
wildfirelondon replied on at Permalink Reply
wildfirelondon
I am afraid nether of those got the site up again. I get the following error:

An exception occurred while executing 'SELECT f.fID FROM Files f INNER JOIN FileVersions fv ON f.fID = fv.fID and fv.fvIsApproved = 1 LEFT JOIN FileSearchIndexAttributes fsi ON f.fID = fsi.fID LEFT JOIN Users u ON f.uID = u.uID WHERE fvType = ? ORDER BY fsDisplayOrder asc' with params [1]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fsDisplayOrder' in 'order clause'

I have reverted to the original code so you won't see it now.

Ideas anyone?
JohntheFish replied on at Permalink Reply
JohntheFish
That could be the result of an incomplete core update, where the new column was not successfully added to the database table. I don't know which update would have added that - it seems like it should have been there forever.
mesuva replied on at Permalink Best Answer Reply
mesuva
What about something like
public function filterBySet($fs)
    {
        $fs = \Concrete\Core\File\Set\Set::getByID(123);
        $table = 'fsf' . $fs->getFileSetID();
        $this->query->leftJoin('f', 'FileSetFiles', $table, 'f.fID = ' . $table . '.fID');
        $this->query->andWhere($table . '.fsID = :fsID' . $fs->getFileSetID());
        $this->query->setParameter('fsID' . $fs->getFileSetID(), $fs->getFileSetID());
    }

Where the number 123 is the ID of a file set you definitely know exists.

I'd only just leave this in place until you can work out the thing that is calling this function improperly. You may need to just have a look through your add-ons for calls to filterBySet and work it out from that direction.
wildfirelondon replied on at Permalink Reply
wildfirelondon
This might sound a very obvious question but how do I retrieve a fileset's ID? I tried using the name of a fileset and that didn't work.
mnakalay replied on at Permalink Reply
mnakalay
it should work.
$fs = \Concrete\Core\File\Set\Set::getByName("fileset name");
$fsID = $fs->getFileSetID();