/**
  * @param $extensionKey
  */
 public function addExtensionInformation($extensionKey)
 {
     $packageManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\PackageManager');
     $extensionInformationRepository = ExtensionInformationRepositoryFactory::create();
     if ($extensionKey === 'integrity') {
         $packages = $packageManager->getAvailablePackages();
     } else {
         $packages = array($packageManager->getPackage($extensionKey));
     }
     // There is no other way to find out, if an extension was downloaded from TER
     // If downloaded from TER we enforce to rewrite current checksums
     $extensionManagerVariables = GeneralUtility::_GP('tx_extensionmanager_tools_extensionmanagerextensionmanager');
     if (isset($extensionManagerVariables['action']) && $extensionManagerVariables['action'] === 'installFromTer') {
         $extensionInformationRepository->updateExtensionInformation($packages);
     } else {
         $extensionInformationRepository->addExtensionInformation($packages);
     }
 }
 /**
  * Finds current extension changes in your system and sends information email.
  *
  * @param string $recipients Comma separated email addresses of recipients
  * @param string $senderEmail Sender email address
  * @param string $senderName Sender name
  * @param string $subject Email subject
  */
 public function checkCommand($recipients, $senderEmail = '', $senderName = '', $subject = 'TYPO3 Integrity Warning Notification')
 {
     $packageManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\PackageManager');
     $extensionInformationRepository = ExtensionInformationRepositoryFactory::create();
     $diffArray = array();
     /** @var Package $package */
     foreach ($packageManager->getAvailablePackages() as $package) {
         $differences = $extensionInformationRepository->findDifferentExtensionInformation($package);
         if (empty($differences)) {
             continue;
         }
         $diffArray[$package->getPackageKey()] = array('package' => $package, 'differences' => $differences);
     }
     if (empty($diffArray)) {
         return;
     }
     $this->sendNotificationMail($diffArray, $recipients, $senderEmail, $senderName, $subject);
 }
 /**
  * Asserts the expected differences are found
  */
 protected function assertFixtureExtensionChangesAreFound()
 {
     $package = $this->packageManager->getPackage($this->fixtureExtensionKey);
     $repository = ExtensionInformationRepositoryFactory::create();
     $this->assertSame($this->expectedDifferences, $repository->findDifferentExtensionInformation($package));
 }