本文整理匯總了PHP中Composer\Script\Event::getOperation方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::getOperation方法的具體用法?PHP Event::getOperation怎麽用?PHP Event::getOperation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Script\Event
的用法示例。
在下文中一共展示了Event::getOperation方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: postPackageInstall
/**
* Installs index.php and themes.
*
* @param Event $event
* @return bool
*/
public static function postPackageInstall(Event $event)
{
$installedPackage = $event->getOperation()->getPackage();
// do stuff
// var_dump($event);
return true;
}
示例2: install
/**
* Install the "status" database into the project
*
* This should be added to the composer.json of the project requiring this
* package.
*
* {
* "require": {
* "zfcampus/zf-apigility-rest-example": "dev-master"
* },
* "scripts": {
* "post-package-install": "ZF\\ApiFirstRestExample\\Installer::install",
* "post-create-project-cmd": "ZF\\ApiFirstRestExample\\Installer::install"
* }
* }
*
*
* @param Event $event
* @return void
*/
public static function install(Event $event)
{
$composer = $event->getComposer();
$eventName = $event->getName();
if ($event instanceof PackageEvent) {
$package = $event->getOperation()->getPackage();
if ($package != 'zfcampus/zf-apigility-example') {
return;
}
} else {
$package = $composer->getRepositoryManager()->findPackage('zfcampus/zf-apigility-example');
if (null === $package) {
return;
}
}
$dataDir = getcwd() . '/data/db';
$dbTarget = $dataDir . '/status.db';
if (file_exists($dbTarget)) {
// If it's already present, do nothing
return;
}
if (!is_dir($dataDir)) {
mkdir($dataDir);
}
$installManager = $composer->getInstallationManager();
$packageDir = $installManager->getInstallPath($package);
copy($packageDir . '/data/status.db', $dbTarget);
chmod($dataDir . '/status.db', 0777);
}
示例3: postPackageUpdate
public static function postPackageUpdate(Event $event)
{
$updatedPackage = $event->getOperation()->getPackage();
// do stuff
$name = $installedPackage->getPrettyName();
if ($name == 'twitter/bootstrap') {
echo "Twitter Bootstrap udapted\n";
} else {
echo "Package {$name} updated\n";
}
}
示例4: registerPackage
/**
* On Composer's "post-package-install" event, register the package.
*
* @param Event $event
*/
public function registerPackage(Event $event)
{
$output = $event->getIo();
$installedPackage = $event->getOperation()->getPackage();
if (!$this->supports($installedPackage)) {
return;
}
try {
$this->enablePackage($installedPackage);
} catch (\RuntimeException $e) {
$output->write(sprintf('Bundle "%s" is already registered', $installedPackage));
}
}
示例5: postPackageUpdate
/**
* Executes ./yiic <vendor/<packageName>-<action>
*
* @static
* @param \Composer\Script\Event $event
*/
public static function postPackageUpdate(Event $event)
{
$installedPackage = $event->getOperation()->getTargetPackage();
$commandName = $installedPackage->getPrettyName() . '-update';
self::runHook($commandName);
}
示例6: postInstall
public static function postInstall(Event $event)
{
$installedPackage = $event->getOperation()->getPackage();
// do stuff
}
示例7: postPackageUpdate
public static function postPackageUpdate(Event $event)
{
$updated_package = $event->getOperation()->getInitialPackage();
Composer::createPublicSymlinks($updated_package);
}