database sanity check script needed - white page of death when enabling/disabling plugins

is there any script available to check and verify the database  and  remove orphan relationships and unreferenced/dangling entities ?

this week i had a problem with a plugin that did not function properly and i had to remove it, but following its removal i had some artefact leftovers in database that forced me to dig into it using phpMyAdmin.
I managed to clean most of the database and in the process i did a manual purge of the plugin list from the database. Following this, on the plugin list page all hell broke loose and the plugin sorting links did not work, all plugins appeared with links next to them as if they were the first plugin in the list. Anyway.. i solved that problem by purging the plugin order from the database... after a bit more tinkering i started to get the white page of death for everything, including the main elgg site landing page.

This happened at the same time that the elgg servers crashed and i thought maybe it was an internal known bug, so i waited for a patch to be published. When i found that it was just a harddisk crash i started to dig around in the database a bit more, and managed to get my site to a relatively functional stage.

However, i think i missed something because now every time i press the button to disable or enable a plugin i get the infamous white page of death. For the last few days i used phpMyAdmin directly to add plugins to the objects_entity table and then enable them in the entities table.

So, is there any database sanity checker for entities/guids and relationship between entries that are spread across various tables? I already tried the upgrade.php one but that doesn't do anything about my problem with the white page of death when enabling/disabling plugins. :(

  • well, it looks like the same thing is happening when clicking on "group discussion" on this site

    http://community.elgg.org/pg/groups/forum/15815/

    going back to my problem, i have tried the following sql snippets with phpmyadmin:

    had zero results on this:
    select *
    FROM `elggmetadata`
    where `entity_guid` not in (select `guid`
    FROM `elggentities`
    )

    zero results on this:
    select *
    FROM `elggobjects_entity`
    where `guid` not in (select `guid`
    FROM `elggentities`
    )


    had about 400 results on this, but after deleting them nothing happened, i still get the white pages when enabling/disabling plugins:
    select *
    FROM `elggprivate_settings`
    where `entity_guid` not in (select `guid`
    FROM `elggentities`
    )

    zero results on this:
    select *
    FROM `elggentity_relationships`
    where `guid_one` not in (select `guid`
    FROM `elggentities`
    )

     

    anyone has any suggestions what should i try next?

     

    P.S... looks like the white pages problem on group discussion here has been fixed.

  • Recommendation: in .htaccess set php_value display_errors 1

    This should tell you what the error is rather than getting a WSOD

  • More recommendations:

    • Use the garbagecollector plugin to remove unwanted metadata left over from a bad plugin
    • Avoid, avoid, avoid doing brain surgery on Elgg using tools like phpmyadmin. Elgg data structures are complex and span multiple tables. They should be manipulated using the Elgg API. Unless you are extremely careful and very knowledgeable about Elgg internals, directly editing the database will likely corrupt your install.
  • no go.. changed both in php.ini and .htaccess

    in php.ini:

    error_reporting  =  E_ALL
    display_errors = On
    display_startup_errors = On

    and...nothing.. white page again when disabling/enabling a plugin. i'll try again in a few hours, maybe my hosting company doesn't apply php.ini changes immediately (but even so, the changes in htaccess should take effect...weird)

     

    in the http access log i have:

    my_ip - - [12/May/2009:17:18:52 -0400] "GET /elgg/action/admin/plugins/enable?plugin=thewire&__elgg_token=3be0938d8e499828e8202c495c9cef58&__elgg_ts=1242163002 HTTP/1.1" 200 - "http://my_elgg_site_/elgg/pg/admin/plugins/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"

    http 200 status code which means all ok, but zero bytes sent.

     

    P.S.

    and about garbagecollector... it's on and set to weekly cleaning, but it didn't catch the unused/obsolete configuration info left behind by the old plugins that i tried and discarded in the past, which is basically what the following piece of sql revealed (if i'm not mistaken, but i think i'm not)

    select *
    FROM `elggprivate_settings`
    where `entity_guid` not in (select `guid`
    FROM `elggentities`
    )

  • The private settings was an oversight and has been fixed in svn. It shouldn't hurt anything.

    php.ini changes don't take effect until Apache has been restarted.

    Make sure you are running php as an Apache module.

    You could try turning on debug mode in Elgg. This could give you a better idea when you are hitting your issue.

     

  • @Adita

    "..manual purge of the plugin list from the database" ==> what did you do here ? that is dangerous !

    A white screen with Elgg usually almost always means there is some sort of PHP error.

    Look at your apache error.log at the bottom just after you get the WSOD - there will be some error mssg there which indicate  who's chundering.

  • managed to get elgg to create an error log on disk, but it only contains lines identical to this one:

    [12-May-2009 17:40:56] WARNING: 2009-05-12 17:52:56 (EDT): "Missing argument 1 for ElggDiskFilestore::__construct(), called in /home/my_site/public_html/elgg/engine/lib/filestore.php on line 623 and defined" in file /home/my_site/public_html/elgg/engine/lib/filestore.php (line 156)

    and from what i read around here this a known occurence and is not a fatal error, just a warning.

    I turned on the debug mode by adding $CONFIG->debug = true; to the end of engine/settings.php before the php end tag but still nothing. The white page is still there. I'll try getting the htaccess from svn and i'll try with that, maybe it's a htaccess bug, found a message via google suggesting that.

  • @Adita

    you did not answer this --- "..manual purge of the plugin list from the database" ==> what did you do here ? that is dangerous !

    While people are trying to give you help, we are shooting in the dark. Try posting your whole apache error log - eg the bottom 20-50 lines or so. We might  notice something !

    And remember "A white screen with Elgg usually almost always means there is some sort of PHPerror ." -- even if the error log does not show any relevant message there.

    I believe your "..manual purge of plugins using phpMyAdmin.." broke your site.

     

  • well :) i think that purge was the problem, hence the nail in the thumb logo that i chose for avatar :P

    i managed then to get the site up&running, and it's been running fine except for the part  where i cannot enable/disable plugins directly.

    when i did the purge, basically what i did was to search in phpmyadmin for the name of that misbehaving plugin that i had deleted from disk and delete it from the database too (elggmetastrings table, elggobjects_entity table, and then deleted the associated guid from the elggentities table)

    at the end i reset the plugin order ( and other ordered stuff in the process.. i know... but at least it worked ) by deleting all order entries from the table elggprivate_settings.

    This got me to a working site state, that buggy plugin caused the entire site to display a white screen, even the elgg front page was coming up white. Since I had already tried the trick with the marker file to disable all plugins, and that didn't work (i was still getting the white page), performing a bit of brain surgery on the elgg database was my only option short of a full reinstall, since i didn't want to lose the registered users or reinstall elgg and tell them to re-register again.

     

    P.S. it's almost 2 AM here, i'll take a break from elgg until tomorrow evening.