Is there a method to manually delete all biblio entries without uninstalling the biblio module?

I would like to replace our entire set of biblio nodes with an updated set via import from an RIS file. But I would also like to retain my current configuration settings. I am comfortable working directly on the biblio tables in the MySQL database as long as I only need to do fairly simple and standard MySQL things.

Eventually, I expect I may be able to simply import right over top of an earlier dataset and biblio will magically (with assistance!) figure out which nodes are new and which ones are simply updated versions of previous nodes. But until I can get that to work reliably, I think I may want to replace the entire dataset 2-4 times each year. This is the only way for me to be sure that I am keeping the biblio database synchronized with our Reference Manager database.

Alternatively, is there a way for me to export the biblio settings from one or more of the raw MySQL tables and then import the table(s) back in again after uninstalling and re-installing?

Thanks for any suggestions.

Phil.

Comments

rjerome’s picture

Hi Phil,

OK, the "poor mans" clean up should go like this... (ALL SQL commands working directly with the drupal tables).

Keep in mind that if other modules (such as upload for attached files) have references to these biblio nodes, they will be completely broken :-(

The only way to really get around associated module references is to go to the content management page and delete all "biblio" type content. (or write your own code which gets a list of all the bibio node ids and then calls node_delete all each).


  TRUNCATE TABLE bblio;
  TRUNCATE TABLE biblio_contributor;
  TRUNCATE TABLE biblio_contributor_data;
  TRUNCATE TABLE biblio_keyword;
  TRUNCATE TABLE biblio_keyword_data;

  DELETE FROM node_revisions WHERE nid IN (SELECT nid FROM node WHERE type='biblio');
  DELETE FROM node WHERE type='biblio';  

Ron.

rjerome’s picture

I forgot to mention... 6.2 should solve your duplicate entry issue and allow you to re-import a RIS file (with new entries) and not generate duplicate bilbio entries.

Ron.

pkiff’s picture

Thanks a ton, as usual, Ron! I added an "i" into the first biblio table name, and then it worked great:

  TRUNCATE TABLE biblio;
  TRUNCATE TABLE biblio_contributor;
  TRUNCATE TABLE biblio_contributor_data;
  TRUNCATE TABLE biblio_keyword;
  TRUNCATE TABLE biblio_keyword_data;

  DELETE FROM node_revisions WHERE nid IN (SELECT nid FROM node WHERE type='biblio');
  DELETE FROM node WHERE type='biblio';

I have purposely refrained from creating references to biblio nodes elsewhere on the site since I knew that our biblio database was still in a bit of a state of flux. Eventually, I expect we will stop needing to replace the entire database on a regular basis, and when that happens, there are several parts of our site where I plan to make use of biblio node references in some form or another.

But your MySQL code makes it almost entirely painless for us to replace the biblio database now. Of course we need to rebuild the search index now and re-enter our list of merged authors, but those are relatively minor tasks in the big scheme of things.

Thanks again,

Phil.

bekasu’s picture

Status: Active » Closed (fixed)

marking issue closed.
bekasu