public function update(CompletePackage $package, $installPath = null) { $plugin = $this->findOneByName($package->getName()); if ($plugin == null) { error_log('Tried to update a plugin that wasn\'t in the database: ' . $package->getName()); } $plugin->setVersion($package->getVersion()); $plugin->setDescription($package->getDescription()); $plugin->setHomepage($package->getHomepage()); $plugin->setAuthors($package->getAuthors()); // getSupport() is always going to return empty an array. Maybe this will change in the future $plugin->setSupport($package->getSupport()); $plugin->setDateUpdated(new \DateTime()); // Get full package json file. The package json from composer update/install does not include support properties // https://github.com/CourseBit/Inkstand/issues/4 if ($installPath != null) { $packageJson = json_decode(file_get_contents(sprintf('%s/composer.json', $installPath))); if (!empty($packageJson) && isset($packageJson->support)) { $plugin->setSupport($packageJson->support); } } $plugin->setBundleClass($package->getExtra()['bundle_class']); $plugin->setBundleTitle($package->getExtra()['bundle_title']); $this->entityManager->persist($plugin); $this->entityManager->flush(); }
/** * {@inheritdoc} */ public function getHomepage() { $this->initialize(); return parent::getHomepage(); }