Upgrade to 3.0.2
This commit is contained in:
6
kirby/vendor/composer/autoload_classmap.php
vendored
6
kirby/vendor/composer/autoload_classmap.php
vendored
@@ -97,8 +97,10 @@ return array(
|
||||
'Kirby\\Cms\\UserRules' => $baseDir . '/src/Cms/UserRules.php',
|
||||
'Kirby\\Cms\\Users' => $baseDir . '/src/Cms/Users.php',
|
||||
'Kirby\\Cms\\Visitor' => $baseDir . '/src/Cms/Visitor.php',
|
||||
'Kirby\\ComposerInstaller\\Installer' => $vendorDir . '/getkirby/composer-installer/src/Installer.php',
|
||||
'Kirby\\ComposerInstaller\\Plugin' => $vendorDir . '/getkirby/composer-installer/src/Plugin.php',
|
||||
'Kirby\\ComposerInstaller\\CmsInstaller' => $vendorDir . '/getkirby/composer-installer/src/ComposerInstaller/CmsInstaller.php',
|
||||
'Kirby\\ComposerInstaller\\Installer' => $vendorDir . '/getkirby/composer-installer/src/ComposerInstaller/Installer.php',
|
||||
'Kirby\\ComposerInstaller\\Plugin' => $vendorDir . '/getkirby/composer-installer/src/ComposerInstaller/Plugin.php',
|
||||
'Kirby\\ComposerInstaller\\PluginInstaller' => $vendorDir . '/getkirby/composer-installer/src/ComposerInstaller/PluginInstaller.php',
|
||||
'Kirby\\Data\\Data' => $baseDir . '/src/Data/Data.php',
|
||||
'Kirby\\Data\\Handler' => $baseDir . '/src/Data/Handler.php',
|
||||
'Kirby\\Data\\Json' => $baseDir . '/src/Data/Json.php',
|
||||
|
3
kirby/vendor/composer/autoload_psr4.php
vendored
3
kirby/vendor/composer/autoload_psr4.php
vendored
@@ -12,7 +12,6 @@ return array(
|
||||
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
|
||||
'Kirby\\ComposerInstaller\\' => array($vendorDir . '/getkirby/composer-installer/src'),
|
||||
'Kirby\\' => array($baseDir . '/src'),
|
||||
'Kirby\\' => array($baseDir . '/src', $vendorDir . '/getkirby/composer-installer/src'),
|
||||
'' => array($vendorDir . '/league/color-extractor/src'),
|
||||
);
|
||||
|
12
kirby/vendor/composer/autoload_static.php
vendored
12
kirby/vendor/composer/autoload_static.php
vendored
@@ -38,7 +38,6 @@ class ComposerStaticInit12091bebabd81c9aba88b2aeec22c8d7
|
||||
),
|
||||
'K' =>
|
||||
array (
|
||||
'Kirby\\ComposerInstaller\\' => 24,
|
||||
'Kirby\\' => 6,
|
||||
),
|
||||
);
|
||||
@@ -68,13 +67,10 @@ class ComposerStaticInit12091bebabd81c9aba88b2aeec22c8d7
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
|
||||
),
|
||||
'Kirby\\ComposerInstaller\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/getkirby/composer-installer/src',
|
||||
),
|
||||
'Kirby\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/src',
|
||||
1 => __DIR__ . '/..' . '/getkirby/composer-installer/src',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -191,8 +187,10 @@ class ComposerStaticInit12091bebabd81c9aba88b2aeec22c8d7
|
||||
'Kirby\\Cms\\UserRules' => __DIR__ . '/../..' . '/src/Cms/UserRules.php',
|
||||
'Kirby\\Cms\\Users' => __DIR__ . '/../..' . '/src/Cms/Users.php',
|
||||
'Kirby\\Cms\\Visitor' => __DIR__ . '/../..' . '/src/Cms/Visitor.php',
|
||||
'Kirby\\ComposerInstaller\\Installer' => __DIR__ . '/..' . '/getkirby/composer-installer/src/Installer.php',
|
||||
'Kirby\\ComposerInstaller\\Plugin' => __DIR__ . '/..' . '/getkirby/composer-installer/src/Plugin.php',
|
||||
'Kirby\\ComposerInstaller\\CmsInstaller' => __DIR__ . '/..' . '/getkirby/composer-installer/src/ComposerInstaller/CmsInstaller.php',
|
||||
'Kirby\\ComposerInstaller\\Installer' => __DIR__ . '/..' . '/getkirby/composer-installer/src/ComposerInstaller/Installer.php',
|
||||
'Kirby\\ComposerInstaller\\Plugin' => __DIR__ . '/..' . '/getkirby/composer-installer/src/ComposerInstaller/Plugin.php',
|
||||
'Kirby\\ComposerInstaller\\PluginInstaller' => __DIR__ . '/..' . '/getkirby/composer-installer/src/ComposerInstaller/PluginInstaller.php',
|
||||
'Kirby\\Data\\Data' => __DIR__ . '/../..' . '/src/Data/Data.php',
|
||||
'Kirby\\Data\\Handler' => __DIR__ . '/../..' . '/src/Data/Handler.php',
|
||||
'Kirby\\Data\\Json' => __DIR__ . '/../..' . '/src/Data/Json.php',
|
||||
|
@@ -4,7 +4,6 @@ namespace Kirby\ComposerInstaller;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Composer\Config;
|
||||
use Composer\Installer\LibraryInstaller;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
@@ -14,7 +13,7 @@ use Composer\Package\PackageInterface;
|
||||
* @copyright Bastian Allgeier
|
||||
* @license MIT
|
||||
*/
|
||||
class Installer extends LibraryInstaller
|
||||
class CmsInstaller extends Installer
|
||||
{
|
||||
/**
|
||||
* Decides if the installer supports the given type
|
80
kirby/vendor/getkirby/composer-installer/src/ComposerInstaller/Installer.php
vendored
Executable file
80
kirby/vendor/getkirby/composer-installer/src/ComposerInstaller/Installer.php
vendored
Executable file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Kirby\ComposerInstaller;
|
||||
|
||||
use RuntimeException;
|
||||
use Composer\Installer\LibraryInstaller;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\InstalledRepositoryInterface;
|
||||
|
||||
/**
|
||||
* @package Kirby Composer Installer
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license MIT
|
||||
*/
|
||||
class Installer extends LibraryInstaller
|
||||
{
|
||||
/**
|
||||
* Decides if the installer supports the given type
|
||||
*
|
||||
* @param string $packageType
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($packageType): bool
|
||||
{
|
||||
throw new RuntimeException('This method needs to be overridden.'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs specific package.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $package package instance
|
||||
*/
|
||||
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
|
||||
{
|
||||
// first install the package normally...
|
||||
parent::install($repo, $package);
|
||||
|
||||
// ...then run custom code
|
||||
$this->postInstall($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates specific package.
|
||||
*
|
||||
* @param InstalledRepositoryInterface $repo repository in which to check
|
||||
* @param PackageInterface $initial already installed package version
|
||||
* @param PackageInterface $target updated version
|
||||
*
|
||||
* @throws InvalidArgumentException if $initial package is not installed
|
||||
*/
|
||||
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
|
||||
{
|
||||
// first update the package normally...
|
||||
parent::update($repo, $initial, $target);
|
||||
|
||||
// ...then run custom code
|
||||
$this->postInstall($target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom handler that will be called after each package
|
||||
* installation or update
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
*/
|
||||
protected function postInstall(PackageInterface $package)
|
||||
{
|
||||
// remove the package's `vendor` directory to avoid duplicated autoloader and vendor code
|
||||
$packageVendorDir = $this->getInstallPath($package) . '/vendor';
|
||||
if (is_dir($packageVendorDir)) {
|
||||
$success = $this->filesystem->removeDirectory($packageVendorDir);
|
||||
if (!$success) {
|
||||
throw new RuntimeException('Could not completely delete ' . $path . ', aborting.'); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -23,7 +23,8 @@ class Plugin implements PluginInterface
|
||||
*/
|
||||
public function activate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
$installer = new Installer($io, $composer);
|
||||
$composer->getInstallationManager()->addInstaller($installer);
|
||||
$installationManager = $composer->getInstallationManager();
|
||||
$installationManager->addInstaller(new CmsInstaller($io, $composer));
|
||||
$installationManager->addInstaller(new PluginInstaller($io, $composer));
|
||||
}
|
||||
}
|
102
kirby/vendor/getkirby/composer-installer/src/ComposerInstaller/PluginInstaller.php
vendored
Executable file
102
kirby/vendor/getkirby/composer-installer/src/ComposerInstaller/PluginInstaller.php
vendored
Executable file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Kirby\ComposerInstaller;
|
||||
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* @package Kirby Composer Installer
|
||||
* @author Lukas Bestle <lukas@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license MIT
|
||||
*/
|
||||
class PluginInstaller extends Installer
|
||||
{
|
||||
/**
|
||||
* Decides if the installer supports the given type
|
||||
*
|
||||
* @param string $packageType
|
||||
* @return bool
|
||||
*/
|
||||
public function supports($packageType): bool
|
||||
{
|
||||
return $packageType === 'kirby-plugin';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the installation path of a package
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string path
|
||||
*/
|
||||
public function getInstallPath(PackageInterface $package): string
|
||||
{
|
||||
// place into `vendor` directory as usual if Pluginkit is not supported
|
||||
if ($this->supportsPluginkit($package) !== true) {
|
||||
return parent::getInstallPath($package);
|
||||
}
|
||||
|
||||
// get the extra configuration of the top-level package
|
||||
if ($rootPackage = $this->composer->getPackage()) {
|
||||
$extra = $rootPackage->getExtra();
|
||||
} else {
|
||||
$extra = [];
|
||||
}
|
||||
|
||||
// use base path from configuration, otherwise fall back to default
|
||||
$basePath = $extra['kirby-plugin-path'] ?? 'site/plugins';
|
||||
|
||||
// determine the plugin name from its package name;
|
||||
// can be overridden in the plugin's `composer.json`
|
||||
$prettyName = $package->getPrettyName();
|
||||
$pluginExtra = $package->getExtra();
|
||||
if (!empty($pluginExtra['installer-name'])) {
|
||||
$name = $pluginExtra['installer-name'];
|
||||
} elseif (strpos($prettyName, '/') !== false) {
|
||||
// use name after the slash
|
||||
$name = explode('/', $prettyName)[1];
|
||||
} else {
|
||||
$name = $prettyName;
|
||||
}
|
||||
|
||||
// build destination path from base path and plugin name
|
||||
return $basePath . '/' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom handler that will be called after each package
|
||||
* installation or update
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
*/
|
||||
protected function postInstall(PackageInterface $package)
|
||||
{
|
||||
// only continue if Pluginkit is supported
|
||||
if ($this->supportsPluginkit($package) !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::postInstall($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the package has explicitly required this installer;
|
||||
* otherwise (if the Pluginkit is not yet supported by the plugin)
|
||||
* the installer will fall back to the behavior of the LibraryInstaller
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return bool
|
||||
*/
|
||||
protected function supportsPluginkit(PackageInterface $package): bool
|
||||
{
|
||||
foreach ($package->getRequires() as $link) {
|
||||
if ($link->getTarget() === 'getkirby/composer-installer') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// no required package is the installer
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user