Major routine error, every day?

Hi all

I'm new to Elgg, and I'm having a major problem that I hope someone can help me with.

Every day there is an error that prevents me (and I assume all 1000 other members) from logging in properly. I get a screen stating an error on line 15 of views/default/friends/river/create.php

The only way I have discovered of getting around this is to //line 15, which then messes up friends connections and how they're displayed.

I then go through replacing the main elgg basic files in batches until it looks like everything is back to normal. But I can't do this EVERY DAY!

Please someone help?

Thanks

  • You have a bad entry in your activity river table.

    You can find out which one by editing the file you mentioned to this:

    $performed_by = get_entity($vars['item']->subject_guid);

    if (!$performed_by) {

    error_log("River error: bad performed by field: ".$vars['item']->subject_guid." in the river entry with the ID: ".$vars['item']->id);

    } else {

    // rest of code as usual

    }

    So instead of just commenting out the line, you can route around only the problem entry and even find out which one it is so that it can be fixed (eg. by deleting the bad record in phpMyAdmin, something I normally don't recommend but probably would be fine in the case of the river table).

  • Okay, I've now changed the code to the following:

    $performed_by = get_entity($vars['item']->subject_guid);

    if (!$performed_by) {

    error_log("River error: bad performed by field: ".$vars['item']->subject_guid." in the river entry with the ID: ".$vars['item']->id);

    } else {

    // rest of code as usual

    } // $statement->getSubject();
    $performed_on = get_entity($vars['item']->object_guid);
    $url = $performed_on->getURL();

    $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
    $string = sprintf(elgg_echo("friends:river:add"),$url) . " ";
    $string .= "<a href=\"{$performed_on->getURL()}\">{$performed_on->name}</a>";
    $string .= "<div class=\"river_content_display\">";
    $string .= "<table><tr><td>" . elgg_view("profile/icon",array('entity' => $performed_by, 'size' => 'small')) . "</td>";
    $string .= "<td><div class=\"following_icon\"></div></td><td>" . elgg_view("profile/icon",array('entity' => $performed_on, 'size' => 'small')) . "</td></tr></table>";
    $string .= "</div>";

    echo $string;

    The site is back up and running normally, and the friend connections showing in the Notifications are displaying correctly. Part of the problem was that they were showing the first individual as code instead of their name, and showing that one person had become friends with themselves whgile showing both user icons?!

     

    Is this it now? Do I need to do anything else to prevent this from happening? I'm still a bit concerned about what caused this. And preventing it from happening in the future.

    Where do I need to look to find the problem?

    Thanks again for your help.

  • Look in your error log for the message this prints and post it here.

  • Hi thanks for your help so far.

    I've had a look at the error log and there are repeated errors showing for the bottom bar. So I'm about to remove that plugin.

    But I also have this:

    [30-Jun-2010 14:47:29] WARNING: 2010-06-30 14:47:29 (PDT): "mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" in file /home/lukep/public_html/Network/elgg-1.7.1/engine/lib/database.php (line 51)
    [30-Jun-2010 14:47:29] *** FATAL EXCEPTION *** : exception 'DatabaseException' with message 'Elgg couldn't connect to the database using the given credentials.' in /home/lukep/public_html/Network/elgg-1.7.1/engine/lib/database.php:54

     

    Other users who reported the same error gaining access as I was experiencing stated that it was showing my admin identity too. So it wasn't showing any fault connected to their login, but directly my admin.

    I'm guessing through my incredible powers of deduction ;-) that I have set up the database settings incorrectly? That /Network/elgg-1.7.1/engine/lib/database.php is showing permissions as 644.

    Something else that caught my eye in a new tutorial I've seen while looking for XAMPP info was renaming htaccess_dist to just htaccess. This is something I didn't see in the first instructions I followed setting up, and so didn't do.

    Are there any changes I can make now without messing up the while site? Obviously I don't want to loose over a thousand users through changing a setting on the database or htaccess!

    Thanks again for any help, it really is appreciated.

  • Luke, your last message had nothing to do with the problem we are discussing. There are many messages in a PHP error log and many will be misleading or irrelevant.

    Can you find an example of a message that begins "River error: bad performed by field:" ?

  • Ah, yes. Here it is:

    [01-Jul-2010 07:48:45] River error: bad performed by field: 28691 in the river entry with the ID: 5203
    [01-Jul-2010 07:48:45] PHP Fatal error:  Call to a member function getURL() on a non-object in /home/lukep/public_html/Network/elgg-1.7.1/views/default/friends/river/create.php on line 25

    Sorry, I'm obviously a n00b and the number of lines in that log scared me a little! lol

  • It would probably be safe to delete the elgg river table item with the id 5203 (although you might want to back up your database first).

    Just out of curiosity, is there an elgg entity with the guid 28691 in your database?

  • It's happened again today, same thing on line 25.

    I don't even know where to start to rectify this.

    How do I view the database and delete the problems?

    Probably an extremely elementary question, but like I say I'm new to all this.

    Thanks again

     

  • But you have the check in place. Why do you need to edit the code more than once?

  • Or are you saying that it bothers you that this is appearing in your error log?

    If you don't know how to delete data from your database, just ignore the error message if your site is working properly.