comparison php/save.php @ 2639:2d9955974316

Possible catch on rogue findNodeByAttribute
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 19 Jan 2017 13:10:59 +0000
parents 82b6b75a91bc
children 3a0cd11bf232
comparison
equal deleted inserted replaced
2638:82b6b75a91bc 2639:2d9955974316
108 if ($n2->length == 0) { 108 if ($n2->length == 0) {
109 $n2 = 0; 109 $n2 = 0;
110 } 110 }
111 foreach($n1 as $page) { 111 foreach($n1 as $page) {
112 $ref = $page->getAttribute("ref"); 112 $ref = $page->getAttribute("ref");
113 $pn2 = findNodeByAttribute($n2, "ref", $ref); 113 if (!empty($ref)) {
114 if ($pn2 != 0 && $pn2.getAttribute("state") != "complete") { 114 $pn2 = findNodeByAttribute($n2, "ref", $ref);
115 $saved_root->removeChild($pn2); 115 if ($pn2 != 0 && $pn2.getAttribute("state") != "complete") {
116 $pn2 = 0; 116 $saved_root->removeChild($pn2);
117 } 117 $pn2 = 0;
118 if ($pn2 == 0) { 118 }
119 $pn1 = $doc->importNode($page->item(0), true); 119 if ($pn2 == 0) {
120 $docRoot->appendChild($pn1); 120 $pn1 = $doc->importNode($page->item(0), true);
121 $docRoot->appendChild($pn1);
122 }
121 } 123 }
122 } 124 }
123 } 125 }
124 126
125 // Iterate through new doc 127 // Iterate through new doc