Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27223

updatenbxmlcontents.php corrupting database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: 5.4.9
    • Fix Version/s: Customer request
    • Component/s: Legacy stack
    • Labels:
      None

      Description

      If you execute the updatenbxmlcontents.php script, all your archived versions will be erased and replaced by the latest version.

      There's a suggested fix that could be considered (it wasn't tested yet):

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      --- ezpublish_legacy/update/common/scripts/updatenbxmlcontents.php	2017-04-06 16:25:36.944000000 +0100
      +++ ezpublish_legacy/update/common/scripts/updatenbxmlcontents.php	2017-03-23 11:26:57.224000000 +0000
      @@ -74,7 +74,7 @@
           if ( !$optDryRun ) {
               $db = eZDB::instance();
               $xmlData = $db->escapeString( $xmlData );
      -        $db->query( "UPDATE ezcontentobject_attribute SET data_text='$xmlData' WHERE id='$id' AND version='$version'" );
      +        $db->query( "UPDATE ezcontentobject_attribute SET data_text='$xmlData' WHERE id='$id'" );
           }
       }
       
      @@ -120,4 +120,3 @@
       $cli->output( "Update has been completed." );
       
       $script->shutdown();
      -
      
      
      Steps to reproduce
      • Create a content object with four versions and make sure they all have {{ \xc2\x92}} in the xml text. It's not possible to create it with the admin interface so, there's an attached bundle which does that for you.
      • Update the content with a SQL instruction to identify each version (ver 01, ver 02, ver 03) in the xml text.
      • Execute the updatenbxmlcontents.php script
      • Make sure all versions were replaced by the latest one

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: