Exemplo n.º 1
0
 public function handleUpdate(Args $args)
 {
     $flags = $args->isOptionSet('force') ? AssetManager::OVERRIDE | AssetManager::IGNORE_SERVER_NOT_FOUND : AssetManager::OVERRIDE;
     $mappingToUpdate = $this->getMappingByUuidPrefix($args->getArgument('uuid'));
     $path = $mappingToUpdate->getGlob();
     $serverPath = $mappingToUpdate->getServerPath();
     $serverName = $mappingToUpdate->getServerName();
     if ($args->isOptionSet('path')) {
         $path = Path::makeAbsolute($args->getOption('path'), $this->currentPath);
     }
     if ($args->isOptionSet('server-path')) {
         $serverPath = $args->getOption('server-path');
     }
     if ($args->isOptionSet('server')) {
         $serverName = $args->getOption('server');
     }
     $updatedMapping = new AssetMapping($path, $serverName, $serverPath, $mappingToUpdate->getUuid());
     if ($this->mappingsEqual($mappingToUpdate, $updatedMapping)) {
         throw new RuntimeException('Nothing to update.');
     }
     $this->assetManager->addRootAssetMapping($updatedMapping, $flags);
     return 0;
 }