Example #1
0
 function filterInstalled(Tiki_Profile_Writer_ProfileFinder $finder)
 {
     $this->entries = array_filter($this->entries, function ($entry) use($finder) {
         $finder->lookup($entry['type'], $entry['object']);
         return !$finder->checkProfileAndFlush();
     });
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $repository = $input->getArgument('repository');
     $profile = $input->getArgument('profile');
     $full = $input->getOption('full-references');
     $writer = $this->getProfileWriter($input);
     $finder = new \Tiki_Profile_Writer_ProfileFinder();
     $symbols = $finder->getSymbols($repository, $profile);
     foreach ($symbols as $entry) {
         if ($full) {
             $reference = $writer->formatExternalReference($entry['symbol'], $profile, $repository);
         } else {
             $reference = $writer->formatExternalReference($entry['symbol'], $profile);
         }
         $writer->removeUnknown($entry['type'], $entry['id'], $reference);
     }
     $writer->save();
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $force = $input->getOption('force');
     $writer = $this->getProfileWriter($input);
     $remaining = $writer->getUnknownObjects();
     $process = true;
     if ($force) {
         foreach ($remaining as $entry) {
             $writer->removeUnknown($entry['type'], $entry['id'], $entry['id']);
         }
     } elseif (count($remaining)) {
         $objects = implode("\n", array_map(function ($entry) {
             return "* {$entry['type']} - {$entry['id']}";
         }, $remaining));
         $output->writeln("<error>Some of the remaining objects are unknown:\n{$objects}\n\nConsider adding them to the profile or use --force to write them directly (profile may not work in all environments).\n</error>");
         $profileFinder = new \Tiki_Profile_Writer_ProfileFinder();
         foreach ($remaining as $entry) {
             $profileFinder->lookup($entry['type'], $entry['id']);
         }
         $profiles = $profileFinder->getProfiles();
         if (count($profiles)) {
             $commands = implode("\n", array_map(function ($profile) {
                 return "* <info>profile:export:include-profile</info> {$profile['repository']} {$profile['profile']}";
             }, $profiles));
             $output->writeln("\n<info>It would seem like some pre-installed profiles cover unknown objects.</info>\n\nYou can run the following commands to include the references (try one at a time):\n{$commands}\n\nAdd the <info>--full-references</info> flag if the current profile will not be hosted in the same repository.");
         }
         $process = false;
     }
     if ($process && !$input->getOption('dry-run')) {
         $writer->clean();
         $writer->save();
         unlink("profiles/info.ini");
     }
     if ($input->getOption('dump')) {
         $output->writeln($writer->dump());
     }
 }