/** * Execute After Packages are installed * @param PackageInterface $initPackage * @param PackageInterface $targetPackage * @return boolean */ protected function execPostPackageUpdate($initPackage, $targetPackage) { if ($initPackage->getType() != 'horisen-cms_mod') { return true; } //$this->io->write("Updating version from: " . $initPackage->getVersion() . ", to: " . $targetPackage->getVersion()); //$this->io->write("Updating version from: " . $initPackage->getPrettyVersion() . ", to: " . $targetPackage->getPrettyVersion()); $extras = $initPackage->getExtra(); if (!isset($extras['installer-name'])) { return true; } $updatesDir = $this->dir . '/application/modules/' . $extras['installer-name'] . '/db_updates'; //$updatesDir = __DIR__ . '/test_updates'; $this->processUpdates($updatesDir, $initPackage->getPrettyVersion(), $targetPackage->getPrettyVersion(), $extras['installer-name']); }
/** * Generate archive filename for a particular version of a package. * * @param PackageInterface $package The package to get a name for * * @return string A filename without an extension */ public function getPackageFilename($package) { $nameParts = array(preg_replace('#[^a-z0-9-_/]#i', '-', $package->getName())); if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) { $nameParts = array_merge($nameParts, array($package->getDistReference())); } else { $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference())); } return implode('-', array_filter($nameParts, function ($p) { return !empty($p); })); }