I have a multisite. In the other sites, xmlsitemap works fine. In this one site, I cannot get it to install.

I've experienced a ton of trouble trying to install this module and want to start clean, so I did the following:
1. rm -rf $DRUPAL/sites/all/modules/xmlsitemap
2. mysql -u chad --password=XXXX $DATABASE -e 'delete from system where info like "%xmlsitemap%"';
3. mysql -u chad --password=XXXX $DATABASE -e 'delete from menu_links where link_path like "%xmlsitemap%"';
4. (drop all tables in database that start with xmlsitemap)
5. drush -r /var/lib/drupal7 -l http://$SITE cc all

Would that completely purge all traces of the module?

Now, I try to reinstall. I'm specifically avoiding drush for the install. I'd normally drush dl, then drush updb, then drush enable, then drush updb and everything's fine.

Is using drush with this module still an issue?

1. cd /var/lib/drupal7/sites/all/modules
2. wget http://ftp.drupal.org/files/projects/xmlsitemap-7.x-2.0-beta3.tar.gz
3. tar xvf xmlsitemap-7.x-2.0-beta3.tar.gz
4. Go to http://$SITE/admin/modules, click to enable xmlsitemap, and "Save Configuration"
5. Visit http://$SITE/update.php, click 'Continue', and get "Some of the pending updates cannot be applied because their dependencies were not met."
6. Hmm. What about Drush?
$ drush -r /var/lib/drupal7 -l http://$SITE updb

The following updates are pending:

Do you wish to run all pending updates? (y/n): y
Finished performing updates.    

7. I wonder why there was no list of updates. So I run updb again and get the same output as step 6.
8. I wonder if xmlsitemap created its tables?

$ mysql -u chad --password=XXXX $DATABASE -e 'show tables' | grep xml
$

Nope.
9. Somewhere I read that I was supposed to run cron. So I visit the magical cron:
http://$SITE/cron.php?cron_key=$VERY_LONG_STRING
I get a white screen, as expected from that so I run cron in drush:

$ drush -r /var/lib/drupal7 -l http://$SITE cron
WD cron: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table                                   [error]
'$DATABASE.xmlsitemap_sitemap' doesn't exist: SELECT smid FROM {xmlsitemap_sitemap}; Array
(
)
 in xmlsitemap_regenerate_batch() (line 249 of
/var/lib/drupal7/sites/all/modules/xmlsitemap/xmlsitemap.generate.inc).
Cron run successfully.

Hmm. I wonder if the tables were created?

$ mysql -u chad --password=XXXX $DATABASE -e 'show tables' | grep xml
$

Nope. I wonder if there's an entry in the system table?

$ mysql -u chad --password=XXXX $DATABASE -e 'select * from system where info like "%xmls%"'
$

Nope. I wonder if drush can tell me if it's installed?

$ drush -r /var/lib/drupal7 -l http://$SITE pml | grep 
xml
 Example modules                      XMLRPC example (xmlrpc_example)                  Module  Not installed  7.x-1.x-dev    
 XML sitemap                          XML sitemap (xmlsitemap)                         Module  Enabled        7.x-2.0-beta3  
 XML sitemap                          XML sitemap custom (xmlsitemap_custom)           Module  Disabled       7.x-2.0-beta3  
 XML sitemap                          XML sitemap engines (xmlsitemap_engines)         Module  Disabled       7.x-2.0-beta3  
                                      (xmlsitemap_i18n)                                                                      
 XML sitemap                          XML sitemap menu (xmlsitemap_menu)               Module  Disabled       7.x-2.0-beta3  
 XML sitemap                          XML sitemap node (xmlsitemap_node)               Module  Disabled       7.x-2.0-beta3  
 XML sitemap                          XML sitemap taxonomy (xmlsitemap_taxonomy)       Module  Disabled       7.x-2.0-beta3  
 XML sitemap                          XML sitemap user (xmlsitemap_user)               Module  Disabled       7.x-2.0-beta3  

It claims to be installed.

Of course, I now cannot visit http://$SITE/admin. The error is:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '$DATABASE.xmlsitemap_sitemap' doesn't exist: SELECT xmlsitemap_sitemap.* FROM {xmlsitemap_sitemap} xmlsitemap_sitemap; Array ( ) in xmlsitemap_sitemap_load_multiple() (line 365 of /var/lib/drupal7/sites/all/modules/xmlsitemap/xmlsitemap.module).

Can someone suggest what I can do? Is there a way to call hook_install manually? Copy the tables from the other site?

Thank you,

Chad Matsalla

Comments

candotri’s picture

I copied the tables from the other site into this site as follows:

$ mysqldump -u chad --password=XXXX $WORKING_SITE xmlsitemap | mysql -u chad --password=XXXX $BUSTED_SITE
$ mysqldump -u chad --password=XXXX $WORKING_SITE xmlsitemap_sitemap | mysql -u chad --password=XXXX $BUSTED_SITE

I attempted to update the database using two methods:
1. The web - I got this message:

Some of the pending updates cannot be applied because their dependencies were not met.
Status message No pending updates.

2. Drush - I got this message:

$ drush -r /var/lib/drupal7 -l http://$SITE updb
The following updates are pending:

Do you wish to run all pending updates? (y/n): y
Finished performing updates.

But if I run the same command again I get the same message. I would expect that once the update is disappears from the queue.

If I disable the xmlsitemap module, everything is fine - update.php runs fine.

So I re-enable the xmlsitemap module and click 'Configure' at which point I get this:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '$DATABASE.xmlsitemap_sitemap' doesn't exist: SELECT xmlsitemap_sitemap.smid AS smid FROM {xmlsitemap_sitemap} xmlsitemap_sitemap ORDER BY updated ASC; Array ( ) in xmlsitemap_sitemap_list_form() (line 59 of /var/lib/drupal7/sites/$SITE/modules/xmlsitemap/xmlsitemap.admin.inc).

The thing is, that table exists:
$ mysql -u chad --password=XXXX $DATABASE -e 'show tables' | grep xml
xmlsitemap
xmlsitemap_sitemap

What can I do?

candotri’s picture

I also tried 'Reinstall Modules' in the Devel block. Same result.

candotri’s picture

I'm a bit of a novice module developer but any time I install a module it ends up in the system table. In this case, it does not. Ever. Maybe that's the root cause? What would case a module to not have an entry in the system table?

larowlan’s picture

+1 same issue here, upgrade from Drupal 5 -> Drupal 6 -> Drupal 7

larowlan’s picture

What worked for me

drush php-eval "module_load_install('xmlsitemap');drupal_install_schema('xmlsitemap');"

heaps of errors ensued but from then it worked.

candotri’s picture

@larowlan YOU RULE!!! That worked perfectly for me.

I thought I was on the right track with something like this:

drush -r /var/lib/drupal7 -t http://$SITE php-eval "include_once '/var/lib/drupal7/sites/all/modules/xmlsitemap/xmlsitemap.install'; xmlsitemap_install_schema();"

It didn't work, of course. Can you tell me how you knew to use drupal_install_schema? After searching for a while I didn't find that. Is there a page somewhere that describes the internals of:

  1. detecting that there's a new folder in a modules directory
  2. examining the info file
  3. doing necessary things, like installing folders.

Back to this problem... I still see this:

$ drush -r /var/lib/drupal7 -t http://$SITE updb
The following updates are pending:

Do you wish to run all pending updates? (y/n): y
Finished performing updates. 
$ drush -r /var/lib/drupal7 -t http://$SITE updb
The following updates are pending:

Do you wish to run all pending updates? (y/n): y
Finished performing updates. 
$

I'm fairly sure this is related to xmlsitemap. I've run cron. /update.php gives this:

Some of the pending updates cannot be applied because their dependencies were not met.
Status message No pending updates.

Perhaps this is a new issue?

Chad Matsalla

candotri’s picture

Issue summary: View changes

Added code markup to blocks.