Ejemplo n.º 1
0
 /**
  * temporary method to help understand the differences
  * between the changes array after compare and
  * the changes array after parsing
  *
  * the differences should be resolved sometime and this method removed :)
  *
  * @param string $output
  * @return unknown
  */
 function testChangeset($output = '')
 {
     if (file_exists($this->schema_trans) && file_exists($this->schema_final)) {
         $aPrev_definition = $this->oSchema->parseDatabaseDefinitionFile($this->schema_final);
         $aCurr_definition = $this->oSchema->parseDatabaseDefinitionFile($this->schema_trans);
         $aChanges = $this->oSchema->compareDefinitions($aCurr_definition, $aPrev_definition);
         $this->aDump_options['output'] = $output ? $output : $this->changes_trans;
         $this->aDump_options['xsl_file'] = "xsl/mdb2_changeset.xsl";
         $this->aDump_options['split'] = true;
         $aChanges['version'] = $aCurr_definition['version'];
         $aChanges['name'] = $aCurr_definition['name'];
         $aChanges['comments'] = '';
         $result = $this->oSchema->dumpChangeset($aChanges, $this->aDump_options);
         $aChangesX = $this->oSchema->parseChangesetDefinitionFile($this->changes_trans);
         $aChanges1 = $aChangesX['constructive'];
         $aChanges2 = $aChangesX['destructive'];
         //            echo '<div><pre>';
         //            foreach ($aChangesX['test'] as $k=>$v)
         //            {
         //                echo "case '{$v}': ";
         //            	echo "\n\tbreak;\n";
         //            }
         //            //var_dump($aChangesX['test']);
         //            echo '</pre></div>';
         echo '<div><pre>';
         var_dump($aChanges);
         echo '</pre></div>';
         echo '<div><pre>';
         var_dump($aChanges1);
         echo '</pre></div>';
         if (!Pear::iserror($result)) {
             return true;
         } else {
             $this->oLogger->logError($result->getUserInfo());
             return false;
         }
     }
     $this->oLogger->logError('one or more files do not exist:');
     $this->oLogger->logError($this->schema_trans);
     $this->oLogger->logError($this->schema_final);
     return false;
 }