|
|
@ -15,6 +15,8 @@ use Composer\Repository\PathRepository; |
|
|
|
use Composer\Repository\RepositoryManager; |
|
|
|
use Composer\Repository\RepositoryManager; |
|
|
|
use Composer\Repository\VcsRepository; |
|
|
|
use Composer\Repository\VcsRepository; |
|
|
|
use Exception; |
|
|
|
use Exception; |
|
|
|
|
|
|
|
use Composer\Script\Event as ScriptEvent; |
|
|
|
|
|
|
|
use Composer\Script\ScriptEvents; |
|
|
|
use Seacms\ComposerInstaller\Handler; |
|
|
|
use Seacms\ComposerInstaller\Handler; |
|
|
|
use Seacms\ComposerInstaller\NotFoundFileException; |
|
|
|
use Seacms\ComposerInstaller\NotFoundFileException; |
|
|
|
use Seacms\ComposerInstaller\ParentPlugin; |
|
|
|
use Seacms\ComposerInstaller\ParentPlugin; |
|
|
@ -48,9 +50,19 @@ class Plugin extends ParentPlugin |
|
|
|
$this->io = $io; |
|
|
|
$this->io = $io; |
|
|
|
if (!self::IS_TOP_FLOOR_PLUGIN){ |
|
|
|
if (!self::IS_TOP_FLOOR_PLUGIN){ |
|
|
|
// do nothing |
|
|
|
// do nothing |
|
|
|
|
|
|
|
$this->handler = null; |
|
|
|
return ; |
|
|
|
return ; |
|
|
|
} |
|
|
|
} |
|
|
|
$this->handler = new Handler($composer, $io); |
|
|
|
$this->handler = new Handler($composer, $io); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* manage preupdate event |
|
|
|
|
|
|
|
* @param ScriptEvent $event |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function onPreUpdate(ScriptEvent $event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!is_null($this->handler)){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
list('config' => $config,'path' => $path) = $this->getConfigJsonFile(); |
|
|
|
list('config' => $config,'path' => $path) = $this->getConfigJsonFile(); |
|
|
|
$this->updateRepositoryManager($config); |
|
|
|
$this->updateRepositoryManager($config); |
|
|
@ -59,6 +71,7 @@ class Plugin extends ParentPlugin |
|
|
|
// do nothing |
|
|
|
// do nothing |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get config.json File from root path |
|
|
|
* get config.json File from root path |
|
|
@ -223,4 +236,11 @@ class Plugin extends ParentPlugin |
|
|
|
'Composer\Plugin\Capability\CommandProvider' => 'Seacms\\Command\\Command', |
|
|
|
'Composer\Plugin\Capability\CommandProvider' => 'Seacms\\Command\\Command', |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* === implements EventsSubscriberInterface === */ |
|
|
|
|
|
|
|
public static function getSubscribedEvents() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return [ |
|
|
|
|
|
|
|
ScriptEvents::PRE_UPDATE_CMD => 'onPreUpdate' |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |