blank site -- db_prefix bug

phildu - August 30, 2007 - 04:36
Project:footermap: a footer site map
Version:6.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:mradcliffe
Status:closed
Description

each time i try to install it my site become .. blank ??
nothing in the source code to ??

#1

mradcliffe - August 30, 2007 - 12:32
Assigned to:Anonymous» mradcliffe
Status:active» postponed (maintainer needs more info)

Hmm, I just re-installed the module on my 5.x test site.

Do you have access to your httpd server error log, and could you print any message it prints out relating to footermap?

Just to clarify, the blank page doesn't happen until after you check the box and install the module correct? It doesn't happen when you're just going to your admin page?

#2

phildu - August 30, 2007 - 19:22

it happens when i validate the form of "modulle install " module

#3

mradcliffe - August 30, 2007 - 19:37
Category:bug report» support request

What is displayed in the httpd error log?

My guess is either a php error or a php memory timeout. Do you have many modules installed?

#4

phildu - August 31, 2007 - 17:40

don't where i can find httpd log error ?
and i have... moderate number of module
i have add others modules after
maybe my theme ?

#5

mradcliffe - August 31, 2007 - 17:50

The server error logs may be anywhere. Is your web site on a "virtual hosting" service or a "dedicated server"?

Perhaps they are in /etc/httpd/log. You may not have access to this directory on your server. Your hosting company may have server error logs usually on their web control panel (cpanel?).

#6

mradcliffe - August 31, 2007 - 17:52

Also drupal's watchdog module may display the server error messages.

admin/logs/watchdog.

#7

mradcliffe - September 6, 2007 - 21:48
Status:postponed (maintainer needs more info)» closed

Closing.

#8

sonicthoughts - March 5, 2008 - 01:54
Status:closed» active

I have the same issue. Absolutely blank site. tried with different themes. pretty bad because i had to go in and modify system database and deactivate the module to recover.

got this error:
call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'footermap_settings' was given in /home/yo/public_html/drupal/includes/form.inc on line 218.

drupal 5.6

#9

mradcliffe - March 5, 2008 - 14:01
Status:active» needs review

That's odd, I went and double-checked the latest version on a drupal-5 test site, and I wasn't able to find the changes (this is also essentially the same code as in drupal-6). I played around a bit. When I changed the footermap_settings() function name to say footermap_aseuthaesuthausth_settings() without modifying the appropriate callback hash key in hook_menu I received this error.

I wonder if the version of footermap you have has 'function footermap_settings()' defined?

In any case if you have shell access please download this attachment into the footermap/ module directory, and run the following command:

patch -p0 < footermap-5.x-settings-hook.patch

Something else I would try is to remove the footermap/ directory and download a fresh copy from drupal.org if that patch fails or you cannot patch.

AttachmentSize
footermap-5.x-settings-hook.patch 960 bytes

#10

sonicthoughts - March 5, 2008 - 15:25

thanks - but which version are you referring to?

#11

mradcliffe - March 5, 2008 - 15:59

I'm running drupal-5.7 on my test site.

#12

sonicthoughts - March 20, 2008 - 17:50

I had some trouble with the patch - has anyone else experienced this and had it resolved by this patch? Are there any other modules that can act as alternative to using a menu as a footer?

thanks,

S.

#13

matthewgisonno - July 1, 2008 - 03:02

Ya, I just added the module and my site went completely blank. I removed the /modules/footermap/ folder and the site came back. I tried to extract the files again and the site just disappeared again without enabling the module. I've removed the directory again, but please tell me what database entries I need to remove? I cannot risk any problems at this point... please help.

#14

matthewgisonno - July 1, 2008 - 03:14
Title:blank site ??» blank site ?? - The Real Problem... I think

From the attached screenshot, I think it's because I gave my drupal database a 'prefix' of 'd_' so everything is 'd_menu' rather tan 'menu' and it looks like the database calls are hard coded to 'menu'

I will attempt to fix this myself... but this should be updated.

AttachmentSize
Untitled-6.gif 81.72 KB

#15

matthewgisonno - July 1, 2008 - 03:28
Title:blank site ?? - The Real Problem... I think» blank site ?? - The Fix!!!!

This only happens if you gave your database a 'prefix':

1) If you haven't already enabled the module, do so (Your site will or is blank now).

2) If you already enabled the module and deleted the directory to get your site to come back up, re-download the files and unzip them to the footermap/ directory.

3) Download footermap.module to your computers hard drive or edit it via any software.

4) Update the 'footermap_get_menu' function in 'footermap.module'

OLD FUNCTION:


/*
* Retrieve menu recursively
* @param mid menu_id
* @param level what level we are in the tree
* @param hastree has sub menus
* @param temp reference to a string to output
* @return boolean a boolean to tell whether or not to carraige return
*/
  function footermap_get_menu($mid,$arrcnt,$level,&$mapref,$limit)
  {
      $x = 0;
      $a = 0;
      if( ($limit != 0 ) && ($level > $limit) )
           return 0;

      if( $paths )
           $r = db_query("SELECT menu.*, (SELECT dst FROM url_alias WHERE src = menu.path) AS alias FROM menu WHERE pid = $mid ORDER BY pid,weight")
               or die(db_error());
      else
           $r = db_query("SELECT * FROM menu WHERE pid = $mid ORDER BY pid,weight")
              or die(db_error());

      while( $h = db_fetch_object($r) )
      {
          unset($cur);  // let's make sure we unset things first
          $cur = 'menu' . $h->mid;
          if ( dechex($h->type) %10 != 0 )
          {
              if ( $h->path != '' )
                  $a = 1;
              else if ( (variable_get('menu_headers',0) == 1) && ($h->path == '') )
                  $a = 1;
              else
                  $a = 2;
          }
          else
              $a = 0;

          if( $a > 0 )
          {
              if ( $a == 1 ) // menu_headers enabled
              {
                  if ( $h->alias )
                      $mapref[$arrcnt][$cur][href] = $h->alias;
                  else
                      $mapref[$arrcnt][$cur][href] = $h->path;
                  if ( $h->path == "/" )
                      $mapref[$arrcnt][$cur][href] = $base_url;

                  $mapref[$arrcnt][$cur][title] = $h->title;
               }
              $x = 1;

              $hastree = footermap_get_menu($h->mid,$arrcnt,($level+1),$mapref,$limit);
              if ( $level == 1 && $hastree == 1)
                  $arrcnt++;
          }
      }
      return $x;

  } // function footermap_get_menu()

NEW FUNCTION: (My prefix is 'd_' as you can see below, I changed 'menu' to 'd_menu' in 4 places)

/*
* Retrieve menu recursively
* @param mid menu_id
* @param level what level we are in the tree
* @param hastree has sub menus
* @param temp reference to a string to output
* @return boolean a boolean to tell whether or not to carraige return
*/
  function footermap_get_menu($mid,$arrcnt,$level,&$mapref,$limit)
  {
      $x = 0;
      $a = 0;
      if( ($limit != 0 ) && ($level > $limit) )
           return 0;

      if( $paths )
           $r = db_query("SELECT d_menu.*, (SELECT dst FROM url_alias WHERE src = d_menu.path) AS alias FROM menu WHERE pid = $mid ORDER BY pid,weight")
               or die(db_error());
      else
           $r = db_query("SELECT * FROM d_menu WHERE pid = $mid ORDER BY pid,weight")
              or die(db_error());

      while( $h = db_fetch_object($r) )
      {
          unset($cur);  // let's make sure we unset things first
          $cur = 'd_menu' . $h->mid;
          if ( dechex($h->type) %10 != 0 )
          {
              if ( $h->path != '' )
                  $a = 1;
              else if ( (variable_get('menu_headers',0) == 1) && ($h->path == '') )
                  $a = 1;
              else
                  $a = 2;
          }
          else
              $a = 0;

          if( $a > 0 )
          {
              if ( $a == 1 ) // menu_headers enabled
              {
                  if ( $h->alias )
                      $mapref[$arrcnt][$cur][href] = $h->alias;
                  else
                      $mapref[$arrcnt][$cur][href] = $h->path;
                  if ( $h->path == "/" )
                      $mapref[$arrcnt][$cur][href] = $base_url;

                  $mapref[$arrcnt][$cur][title] = $h->title;
               }
              $x = 1;

              $hastree = footermap_get_menu($h->mid,$arrcnt,($level+1),$mapref,$limit);
              if ( $level == 1 && $hastree == 1)
                  $arrcnt++;
          }
      }
      return $x;

  } // function footermap_get_menu()

5) Save, Re-upload, and overwrite the old file. The module now works.

#16

mradcliffe - July 1, 2008 - 18:47
Title:blank site ?? - The Fix!!!!» blank site -- db_prefix bug
Status:needs review» fixed

Simpler fix, which was in the drupal-6.x version. The table names need to be enclosed in { }.

CVS Diff.

Can you download the development snapshot and review? The dev. snapshot should be updated in about 4 hours or 16 hours. Or you can apply the patch above.

EDIT: I made ported some changes from drupal-6 to drupal-5 version of this module. If you want to just test the patch, then please us the "CVS Diff" link above.

#17

Insydius - July 5, 2008 - 07:13
Version:5.x-2.x-dev» 6.x-1.3
Priority:normal» critical
Assigned to:mradcliffe» Insydius
Status:fixed» won't fix

I've recently installed this module today and immediately was given a blank page, using Drupal 6.2 and footermap 6.x-1.3, upon clicking the install module button everything just went blank. Looking through the footermap.module file I've noticed the db titles were already incased with { }, then I attempted to delete the old files and use the 6.x-1.x-dev files instead only to find that there was an error on line 100 stating there was an ; in place of a , and I made those changes myself and refreshed and still continue to have a blank page.

This was the only module I recently installed, have the latest Drupal, and yes I do have a table prefix at "drupal_" for the database.

Any ideas?

#18

mradcliffe - July 5, 2008 - 15:15
Status:won't fix» postponed (maintainer needs more info)

It would be great if you had access to any http server logs right after the incident. Like tail -v /path/to/my/error_log.

What other modules are you using? The WSOD usually occurs with a php error of some kind, which may be the result of php.ini, a bug in the module itself, or some inconsistency between modules.

Does the WSOD only appear on the admin/build/modules page?

Thank you for the report on the 6.x-dev version.

#19

wtnt - July 21, 2008 - 22:48

I just installed version 6.x-1.x with Drupal version 6.1 and got the blank site problem. I checked the error log and there were no new error messages from today.

I removed the footermap directory to get my site back up. When I came back to the site, I saw this message:
user warning: Unknown table 'menu_links' query: SELECT menu_links.*, coalesce(node.status,1) as nstatus FROM sitecontent_menu_links LEFT OUTER JOIN sitecontent_node ON substr(menu_links.link_path,6) = node.nid WHERE plid = 0 AND module <> 'system' AND hidden <> -1 ORDER BY plid,weight in /home/nyscasa/public_html/sites/all/modules/footermap/footermap.module on line 180.

#20

mradcliffe - July 22, 2008 - 01:24
Category:support request» bug report
Assigned to:Insydius» mradcliffe
Status:postponed (maintainer needs more info)» needs review

I see. There is a bug. Please test the dev version when it updates tomorrow (should update in a few hours).

retrieving revision 1.11.2.15
diff -r1.11.2.15 footermap.module
177c177
<          $r = db_query("SELECT menu_links.*, coalesce(node.status,1) as nstatus, (SELECT dst FROM {url_alias} WHERE src = menu_links.link_path) AS alias FROM {menu_links} LEFT OUTER JOIN {node} ON substr(menu_links.link_path,6) = node.nid WHERE plid = %d AND module <> 'system' AND hidden <> -1 ORDER BY plid,weight",$mlid)
---
>          $r = db_query("SELECT ml.*, coalesce(n.status,1) as nstatus, (SELECT ul.dst FROM {url_alias} ul WHERE src = ml.link_path) AS alias FROM {menu_links} ml LEFT OUTER JOIN {node} n ON substr(ml.link_path,6) = n.nid WHERE ml.plid = %d AND ml.module <> 'system' AND ml.hidden <> -1 ORDER BY ml.plid,ml.weight",$mlid)
180c180
<           $r = db_query("SELECT menu_links.*, coalesce(node.status,1) as nstatus FROM {menu_links} LEFT OUTER JOIN {node} ON substr(menu_links.link_path,6) = node.nid WHERE plid = %d AND module <> 'system' AND hidden <> -1  ORDER BY plid,weight", $mlid)
---
>           $r = db_query("SELECT ml.*, coalesce(n.status,1) as nstatus FROM {menu_links} ml LEFT OUTER JOIN {node} n ON substr(ml.link_path,6) = n.nid WHERE ml.plid = %d AND ml.module <> 'system' AND ml.hidden <> -1  ORDER BY ml.plid,ml.weight", $mlid)

#21

mradcliffe - November 6, 2008 - 18:41
Status:needs review» closed
 
 

Drupal is a registered trademark of Dries Buytaert.