Support from Acquia helps fund testing for Drupal Acquia logo

Comments

minghui.yu created an issue. See original summary.

minghui.yu’s picture

Issue summary: View changes
arpee’s picture

I am observing the same.

Replacements are listed for undo but not executed.

vimokkhadipa’s picture

is the same for me

SomebodySysop’s picture

Same exact issue here. Can anyone report whether this is a bug or a configuration problem on our end? What is the solution?

gtoffoli’s picture

It looks like the module assumes that the field content to replace is set to the same language as the node.

At line 1032 in the function scanner_execute, I added a check if the language is actually used, otherwise LANGUAGE_NONE is used.

$language = isset($node->{$matches[1]}[$node->language]) ? $node->language : LANGUAGE_NONE;
          
          $node->{$matches[1]}[$language][$row->delta]['value'] = $content_new;
          // Summary.
          if (isset($node->{$matches[1]}[$language][$row->delta]['summary'])) {
            $summary = $node->{$matches[1]}[$language][$row->delta]['summary'];
            $node->{$matches[1]}[$language][$row->delta]['summary'] = preg_replace("/$search_php/$flag", $replace, $summary, -1, $hits_summary);
            $hits += $hits_summary;
          }

Now it works.

Hope this helps.

Giulio

_vid’s picture

Awesome @gtoffoli. Thanks.
That worked for me on the latest version: 7.x-1.0-beta1; starting at line 999.

I git cloned the module and made your change into a patch.

Patched against HEAD on 7.x-1.x.
Details:
622898d (HEAD, tag: 7.x-1.0-beta1, origin/HEAD, origin/7.x-1.x, 7.x-1.x)

Eric_A’s picture

@gtoffoli, @_vid, here's a version that matches the original code that went in and regressed later. (Assuming it wasn't deleted on purpose.)

Original patch: https://www.drupal.org/files/issues/scanner-use_correct_field_language-1...
#1668686-24: Replacement is not happening in drupal 7 version (with non-standard language) got in in October 2105. See http://cgit.drupalcode.org/scanner/commit/?id=bd29f83
(This was before "Support search and replace in summary part of text area fields" and "Text field deltas not respected" got in.)

Status: Needs review » Needs work

Eric_A’s picture

Status: Needs work » Needs review

Eric_A’s picture

Re-uploading with "Do not test" value for "Test with" selector.

petschep’s picture

Thanks for the patch, worked perfect for me

suraj_vantagode’s picture

#6 worked for me. Thanks a lot..
I have one concern that is, Can I execute this module through drush commands. Because I cant able extend max_execution_time in stage and production so.
I tried with the Drush search and replace module, but that will replace entire thing, I can't able to restrict replace should only for body content.

danheisel’s picture

#6 worked for me as well. Any idea when this will be rolled into a release?

xaa’s picture

#18 working here. thanks

urix’s picture

#18 works for me, version 7.x-1.x-dev.

#6 will not work, because of different position of patch

hass’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! With patch #18 all my content is preplaced properly now.

Patch looks good to go.

Eric_A’s picture

Patch #18 (RTBC'ed) is a re-upload of #8 but without the testing facilities active. The test infrastructure should be working again now with this project, so re-testing both #7 and #8.

Eric_A’s picture

Title: Replacement does not work » [regression] field language broken, replacement does not work (with non-standard language)

All green.

DamienMcKenna’s picture

DamienMcKenna’s picture

Title: [regression] field language broken, replacement does not work (with non-standard language) » Field language broken

  • DamienMcKenna committed 27dbffa on 7.x-1.x
    Issue #2616640 by Eric_A, DamienMcKenna, _vid, gtoffoli, petschep,...
DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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