I am having trouble with summaries not being imported from d6 teasers, and the problem is in lines 145-147 of /d6/node.inc:

// Don't populate summary if the teaser matches the generated summary.
if (empty($row->teaser) || $row->teaser != text_summary($row->body)) {
  $row->teaser = '';
}

I believe the '!=' should be '==' no? If I'm right about that, let me know and would be happy to provide a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roberttstephens’s picture

Component: D6-specific » Code

The D5 node class does it also, so it's in ./d5/node.inc and ./d6/node.inc . I changed the issue component from "D6-specific" to "Code".

I just had a general question, probably for mikeryan. What is the reason for making the teaser empty, whether the teaser matches text_summary($row->body) or not? In my opinion, it seems simplest to just say "If it has a teaser in the source, make it a summary in the destination".

Thanks!

criznach’s picture

This seems counter-intuitive to me as well. My client has specifically written summaries to be used in views, but the body is left blank. So this test always fails and the summary is set to the empty string. I switched != to == as @brockfanning suggested, and all of my 11 content types now migrate as expected.

For now I've overridden prepareRow in my node migration class because I don't want to track a patch with the project. I can roll a patch if everyone agrees it's a bug.

rclemings’s picture

Issue summary: View changes

I'm not clear on where this bug report stands after almost eight months but I'll just confirm that changing line 146 of /d6/node.inc from:
if (empty($row->teaser) || $row->teaser != text_summary($row->body)) {
to:
if (empty($row->teaser) || $row->teaser == text_summary($row->body)) {
fixed the problem I was having as well (problem being empty summary fields in nodes imported from d6 to d7).

So my vote is for a patch.

  • Commit da79742 on 7.x-2.x by mikeryan:
    Issue #2037653 by brockfanning: Properly recognize when teasers should...
mikeryan’s picture

Status: Active » Fixed

I've committed the fix for D5 and D6 (for future reference, it's best to submit a formal patch rather than describe in fix in a comment).

@robertstephens: In D7, an empty explicit summary indicates that a summary should be generated. The thinking here is that if the incoming explicit summary matches what would be generated, it's best to assume auto-generation is what is desired - for example, if we simply copied the explicit summary, then editing the first paragraph of the body would require also editing the summary.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sittard’s picture

I was having some issues with text summaries that have an explicit <!--break-> tag in the node body not appearing. It appears that migrate is not importing these to the summary field as the teaser matches the generated summary.

I was going to suggest that we needed to explicitly check for the <!--break-> tag as follows:

    // Don't populate summary if the teaser matches the generated summary.
    if (empty($row->teaser) || $row->teaser == text_summary($row->body)) {
      // Additional check for summaries using the <!--break--> tag.
      $delimiter = strpos($row->body, '<!--break-->');
      if ($delimiter == FALSE) {
        $row->teaser = '';
      }
    }

However the issue is really with the Filtered HTML text format, adding <!--> to the allowed input formats fixed this for me. See: https://www.drupal.org/node/881006#comment-5102160

FrancescoQ’s picture

Hi, i have a similar problem: the actual implementation doesn't work if in D6 was checked the "teaser include" checkbox.
In this case the teaser is correctly included in the body, but it's not present as teaser (it falls in the case $row->teaser = '' )
I solved in this way

    if (empty($row->teaser) || ($row->teaser == text_summary($row->body) && $row->teaser == $row->body)) {
      $row->teaser = '';
    }

So teaser is '' only if teaser and body are exactly the same.
I think ($row->teaser == $row->body) should be enough but i'm not shure.