CRM-21395 make patch safe for multiple composer runs
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 6 Nov 2017 21:25:23 +0000 (08:25 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 6 Nov 2017 21:25:29 +0000 (08:25 +1100)
tools/scripts/composer/dompdf-cleanup.sh
tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch

index 26345390dec8ed300c5953038df73bdcefa031af..bfe79d6ebd277eebee6a1156a6df50f9b751720d 100755 (executable)
@@ -130,4 +130,6 @@ make_font_readme > vendor/dompdf/dompdf/lib/fonts/README.DejaVuFonts.txt
 # Remove debug_print_backtrace(), which can leak system details. Put backtrace in log.
 simple_replace vendor/dompdf/dompdf/lib/html5lib/TreeBuilder.php 'debug_print_backtrace();' 'CRM_Core_Error::backtrace("backTrace", TRUE);'
 
-patch vendor/dompdf/dompdf/src/Dompdf.php < tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch
+if ! grep -q 'CRM-21395' vendor/dompdf/dompdf/src/Dompdf.php; then
+  patch vendor/dompdf/dompdf/src/Dompdf.php < tools/scripts/composer/patches/dompdf_no_block_level_parent_fix.patch
+fi
index ead3df6bd77f620d20d1d8db12f24baa4753b6d6..29dd309d4a2fe2556c8c291008a2967c9d9333cd 100644 (file)
@@ -18,7 +18,7 @@ index 40329063..bfb1c2b1 100644
              $doc->loadHTML($str);
              $doc->encoding = $encoding;
  
-+            // Remove #text children nodes in nodes that shouldn't have
++            // Remove #text children nodes in nodes that shouldn't have #CRM-21395
 +            $tag_names = array("html", "table", "tbody", "thead", "tfoot", "tr");
 +            foreach ($tag_names as $tag_name) {
 +                $nodes = $doc->getElementsByTagName($tag_name);