public function update(RepositoryInterface $repo, UpdateOperation $operation)
 {
     $this->updated[] = array($operation->getInitialPackage(), $operation->getTargetPackage());
     $this->trace[] = (string) $operation;
     $repo->removePackage($operation->getInitialPackage());
     $repo->addPackage(clone $operation->getTargetPackage());
 }
 public function update(RepositoryInterface $repo, UpdateOperation $operation)
 {
     $initial = $operation->getInitialPackage();
     $target = $operation->getTargetPackage();
     $initialType = $initial->getType();
     $targetType = $target->getType();
     if ($initialType === $targetType) {
         $installer = $this->getInstaller($initialType);
         $installer->update($repo, $initial, $target);
         $this->markForNotification($target);
     } else {
         $this->getInstaller($initialType)->uninstall($repo, $initial);
         $this->getInstaller($targetType)->install($repo, $target);
     }
 }
Example #3
0
 /**
  * @param string $composerType
  *
  * @return PackageEvent
  */
 protected function createEvent($composerType)
 {
     $this->package->expects($this->any())->method('getType')->will($this->returnValue($composerType));
     $this->operation->expects($this->any())->method('getTargetPackage')->will($this->returnValue($this->package));
     $this->operation->expects($this->any())->method('getPackage')->will($this->returnValue($this->package));
     return new PackageEvent('foo-event', $this->composer, $this->io, true, $this->operation);
 }
Example #4
0
 /**
  * @param string $composerType
  *
  * @return PackageEvent
  */
 protected function createEvent($composerType)
 {
     $this->package->expects($this->any())->method('getType')->will($this->returnValue($composerType));
     $this->operation->expects($this->any())->method('getTargetPackage')->will($this->returnValue($this->package));
     $this->operation->expects($this->any())->method('getPackage')->will($this->returnValue($this->package));
     /* @var PolicyInterface $policy */
     $policy = $this->getMock('Composer\\DependencyResolver\\PolicyInterface');
     /* @var Pool $pool */
     $pool = $this->getMockBuilder('Composer\\DependencyResolver\\Pool')->disableOriginalConstructor()->getMock();
     /* @var CompositeRepository $installedRepo */
     $installedRepo = $this->getMockBuilder('Composer\\Repository\\CompositeRepository')->disableOriginalConstructor()->getMock();
     /* @var Request $request */
     $request = $this->getMockBuilder('Composer\\DependencyResolver\\Request')->disableOriginalConstructor()->getMock();
     $operations = array($this->getMock('Composer\\DependencyResolver\\Operation\\OperationInterface'));
     return new PackageEvent('foo-event', $this->composer, $this->io, true, $policy, $pool, $installedRepo, $request, $operations, $this->operation);
 }
 /**
  * Executes update operation.
  *
  * @param   InstallOperation    $operation  operation instance
  */
 public function update(UpdateOperation $operation)
 {
     $initial = $operation->getInitialPackage();
     if ($initial instanceof AliasPackage) {
         $initial = $initial->getAliasOf();
     }
     $target = $operation->getTargetPackage();
     if ($target instanceof AliasPackage) {
         $target = $target->getAliasOf();
         $target->setInstalledAsAlias(true);
     }
     $initialType = $initial->getType();
     $targetType = $target->getType();
     if ($initialType === $targetType) {
         $installer = $this->getInstaller($initialType);
         $installer->update($initial, $target);
     } else {
         $this->getInstaller($initialType)->uninstall($initial);
         $this->getInstaller($targetType)->install($target);
     }
 }
 public function onUpdate(UpdateOperation $operation, &$postinstall_queue)
 {
     $package = $operation->getTargetPackage();
     $app_code = $this->getApplicationCode($package);
     //$this->runPhing($app_code, 'upgrade');
     $postinstall_queue[] = ['upgrade', $app_code];
 }
Example #7
0
 /**
  * Executes update operation.
  *
  * @param   InstallOperation    $operation  operation instance
  */
 public function update(UpdateOperation $operation)
 {
     $initial = $operation->getInitialPackage();
     $target = $operation->getTargetPackage();
     $initialType = $initial->getType();
     $targetType = $target->getType();
     if ($initialType === $targetType) {
         $installer = $this->getInstaller($initialType);
         $installer->update($initial, $target);
     } else {
         $this->getInstaller($initialType)->uninstall($initial);
         $this->getInstaller($targetType)->install($target);
     }
 }
Example #8
0
 /**
  * {@inheritDoc}
  */
 public function update(RepositoryInterface $repo, UpdateOperation $operation)
 {
     $this->packageInformation->set($this->packageInformation->escape($operation->getInitialPackage()->getPrettyName()), ['type' => 'update', 'reason' => $this->getReason($operation), 'package' => $this->dumper->dump($operation->getInitialPackage()), 'target' => $this->dumper->dump($operation->getTargetPackage())]);
     parent::update($repo, $operation);
 }