Hi

I made a clean install of drupal-cvs and export_opml-cvs and when I go to the modules page I get:

Fatal error: Cannot redeclare book_node_visitor_opml_pre() (previously declared in /var/www/fhsstadmin/modules/book.module:967) in /var/www/fhsstadmin/modules/export_opml/export_opml.module on line 82

It seems that there is some incompatibility - is this just a teething problem on the way to 4.7?

Mark

Comments

puregin’s picture

Assigned: Unassigned » puregin
Status: Active » Closed (works as designed)

Hi,

You are correct - there is a conflict.

You will also need to apply the patch at

http://drupal.org/files/issues/book_31_0.patch,

since this has not yet been commited to CVS.

Once you do, please test let me know if
things are working as you want (and vote
for the patch, at http://drupal.org/node/1482.

If you have any problems or questions about
applying the patch, please contact me.

Djun (puregin)

marknewlyn’s picture

Hi

Thanks for responding.

I tried the patch and it was rejected - it was a clean install of drupal-cvs at No 29 10pm PST. The patch saved the following rejection file below.

I saw on one of the developer blogs that the book module was being worked on - it might just be a syncronisation thing?

***************
*** 863,991 ****
  }

  /**
-  * Generates XML for a given node. This function is a 'pre-node'
-  * visitor function for book_recurse().  The generated XML is valid
-  * DocBook, but each node's HTML content is wrapped in a CDATA
-  * section, and put inside a <literallayout> element.  The node body
-  * has an md5-hash applied; the value of this is stored as node
-  * metadata to allow importing code to determine if contents have
-  * changed.  The weight of a node is also stored as metadata to
-  * allow the node to be properly re-imported.
-  *
-  * @param $node
-  *   - the node to generate output for.
-  * @param $depth
-  *   - the depth of the given node in the hierarchy. This
-  *   is currently not used.
-  * @param $nid
-  *   - the node id (nid) of the given node. This
-  *   is used only for generating output (e.g., id attribute)
-  * @return
-  *   - the generated XML for the given node.
-  */
- function book_node_visitor_xml_pre($node, $depth, $nid) {
-   // Output the content:
-   if (node_hook($node, 'content')) {
-     $node = node_invoke($node, 'content');
-   }
-   // Allow modules to change $node->body before viewing.
-   node_invoke_nodeapi($node, 'export_xml', $node->body, false);
-
-   $releaseinfo  = "<releaseinfo>\n";
-   $releaseinfo .= "md5-hash:" . md5($node->body) . "\n";
-   $releaseinfo .= "weight:". $node->weight . "\n";
-   $releaseinfo .= "depth:". $depth . "\n";
-   $releaseinfo .= "</releaseinfo>\n";
-
-   $title = "<title>". check_plain($node->title) ."</title>\n";
-
-   // wrap the node body in a CDATA declaration
-   $content = "<literallayout>";
-   $content .= "<![CDATA[";
-   if ($node->body) {
-     $content .= $node->body;
-   }
-   $content .= "]]>";
-   $content .= "</literallayout>\n";
-
-   if ($depth == 1) {
-       $output .= "<book>\n";
-       $output .= $title;
-       $output .= "<bookinfo>\n$releaseinfo</bookinfo>\n";
-       $output .= "<preface>\n";
-       $output .= "<title>Preface</title>\n";
-       $output .= $content;
-       $output .= "</preface>\n";
-   }
-   else if ($depth == 2) {
-       $output .= "<chapter id=\"node-".$node->nid ."\">\n";
-       $output .= "<chapterinfo>\n$releaseinfo</chapterinfo>\n";
-       $output .= $title;
-       $output .= $content;
-   }
-   else {
-       $output .= "<section id=\"node-".$node->nid ."\">\n";
-       $output .= "<sectioninfo>\n$releaseinfo</sectioninfo>\n";
-       $output .= $title;
-       $output .= $content;
-   }
-
-   return $output;
- }
-
- /**
-  * Completes the XML generation for the node. This function is a
-  * 'post-node' visitor function for book_recurse().
-  */
- function book_node_visitor_xml_post($node, $depth) {
-   if ($depth == 1) {
-     return "</book>\n";
-   }
-   else if ($depth == 2) {
-     return "</chapter>\n";
-   }
-   else {
-     return "</section>\n";
-   }
- }
-
- /**
-  * Generates OPML for a node.  This function is a 'pre-node' visitor
-  * function for book_recurse().
-  *
-  * @param $node
-  *   - the node to generate output for.
-  * @param $depth
-  *   - the depth of the given node in the hierarchy. This is used only
-  *   for generating output.
-  * @param $nid
-  *   - the node id (nid) of the given node. This is used only for
-  *   generating output.
-  * @return
-  *   - the OPML generated for the given node.
-  */
- function book_node_visitor_opml_pre($node, $depth, $nid) {
-   // Output the content:
-   if (node_hook($node, 'content')) {
-     $node = node_invoke($node, 'content');
-   }
-
-   $output .= "<outline type=\"id:node-". $node->nid ."\"\n";
-   $text = check_plain($node->title);
-   $output .= "text=\"$text\">\n";
-   return $output;
- }
-
- /**
-  * Finishes up generation of OPML after visiting a node. This function
-  * is a 'post-node' visitor function for book_recurse().
-  */
- function book_node_visitor_opml_post($node, $depth) {
-   return "</outline>\n";
- }
-
- /**
-  * Creates a row for the 'admin' view of a book.  Each row represents a page in the book, in the tree representing the book
   */
  function book_admin_edit_line($node, $depth = 0) {
    $form['#tree'] = TRUE;
--- 849,856 ----
  }

  /**
+  * Creates a row for the 'admin' view of a book.  Each row represents
+  * a page in the book, in the tree representing the book
   */
  function book_admin_edit_line($node, $depth = 0) {
    $form['#tree'] = TRUE;
puregin’s picture

There's been a number of people working on book module lately - could have been any of their blogs, or mine :)

Could you check that your version of book module is up to date? It should say

// $Id: book.module,v 1.333 2005/11/24 19:24:38 dries Exp $

or something to that effect. 1.333 is the current version number. The latest patch (book_34.patch) should apply against that.

If your version of book.module is older than 1.333, you'll need to do a CVS update on your
installation (followed by running upgrade.php, as administrator... do a database dump first :)

Regards, Djun