Exemplo n.º 1
0
 protected function doUpgrades($targetVersion, $currentVersion)
 {
     if ($targetVersion === null) {
         $targetVersion = $currentVersion;
         $this->output->notice('Checking for unapplied changes up to the current version [' . $currentVersion . ']');
     } else {
         $this->output->notice('Checking for unapplied changes between current version [' . $currentVersion . '] and requested target version [' . $targetVersion . ']');
     }
     $available = $this->getAvailableSets();
     $applied = $this->getAppliedSets();
     $lastVersion = 0;
     foreach ($available as $version => $changes) {
         if (version_compare($version, $targetVersion) > 0) {
             break;
         }
         $unapplied = array_diff($changes, $applied);
         if (!empty($unapplied)) {
             $this->output->notice('Found unapplied changes in ' . $this->versionPrefix . $version);
             $this->applyChanges($version, $unapplied);
         }
         $lastVersion = $version;
     }
     if (version_compare($currentVersion, $lastVersion) < 0) {
         $this->output->notice('Updating current version to [' . $lastVersion . ']');
         $this->processor->metaVersion('UPDATE _metaVersion SET currentVersion = ?', $lastVersion);
     }
 }