continue; } } else { $cli->output(" Moving file to {$newPath}"); } if (!$optDryRun && $moveFile) { $clusterHandler->fileMove($filePath, $newPath); $db->query("UPDATE ezimagefile SET filepath = '{$newPath}' WHERE contentobject_attribute_id = {$imageAttributeId}"); } if (!isset($renamedFiles[$imageAttributeId])) { $renamedFiles[$imageAttributeId] = array(); } $renamedFiles[$imageAttributeId][$filePath] = $newPath; } foreach ($renamedFiles as $attributeId => $files) { $attributeObjects = eZContentObjectAttribute::fetchObjectList(eZContentObjectAttribute::definition(), null, array('id' => $attributeId)); /** @var eZContentObjectAttribute $attributeObject */ foreach ($attributeObjects as $attributeObject) { $dom = new DOMDocument('1.0', 'utf-8'); if (!$dom->loadXML($attributeObject->attribute('data_text'))) { continue; } foreach ($dom->getElementsByTagName('ezimage') as $ezimageNode) { // Update main image $oldPath = $ezimageNode->getAttribute('url'); if (isset($files[$oldPath])) { $ezimageNode->setAttribute('url', $files[$oldPath]); $ezimageNode->setAttribute('dirpath', dirname($files[$oldPath])); } // Update aliases foreach ($ezimageNode->getElementsByTagName('alias') as $ezimageAlias) {