/**
  * Validates the product key provided in the license
  *
  * @param string $productKey
  * @return bool
  */
 private function isValidProductKey($productKey)
 {
     if (empty($productKey)) {
         return false;
     }
     $validKeys = ShopwareEdition::getValidEditions();
     return in_array($productKey, $validKeys, true);
 }
Example #2
0
 /**
  * @return ShopwareEdition
  */
 private function askEdition()
 {
     $choices = ['ce' => 'Shopware Community Edition (License: AGPL)', 'cm' => 'Shopware Commercial Version (License: Commercial / License key required) e.g. Professional, Professional Plus, Enterprise'];
     $hint = "For PE/EB/EC a Commercial License key is required)";
     $question = new ChoiceQuestion('Please select your edition' . "\n" . $hint, $choices);
     $question->setErrorMessage('Edition %s is invalid.');
     $edition = $this->IOHelper->ask($question);
     $flip = array_flip($choices);
     $edition = strtoupper($flip[$edition]);
     $license = null;
     if ($edition != ShopwareEdition::CE) {
         $license = $this->askLicence();
     }
     $shopwareEdition = ShopwareEdition::createFromEditionAndLicence($edition, $license);
     return $shopwareEdition;
 }