Set the WordPress installation directory.

@param  \Composer\EventDispatcher\Event $event
@return void
962816
public function setWordPressInstallDirectory(PackageEvent $event)
    {
        if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
            return;
        }
        
        $composer = $event->getComposer();
        $rootPkg = $composer->getPackage();
        
        if (! $rootPkg) {
            return;
        }
        
        $extra = $rootPkg->getExtra();
        
        if (isset($extra['wordpress-install-dir']) && $extra['wordpress-install-dir']) {
            return;
        }
        
        $extra['wordpress-install-dir'] = static::$plugin->getPublicDirectory() . '/wp';
        
        $rootPkg->setExtra($extra);
        $composer->setPackage($rootPkg);
    }
375158
public function add($event) {
        $event->setParent($this->_parent);
        $this->_events[$event->getName()] = $event;
    }
1256738
public static function postAutoloadDump(Event $event): void
    {
        $event->getIO()->write('<info>    Packages Auto-Discovery [Executed]</info>');
        $vendorPath = $event->getComposer()->getConfig()->get('vendor-dir');
        $manifestPath = $vendorPath . '/../bootstrap/cache/packages.php';

        self::discoverPackages($vendorPath, $manifestPath);
    }
436376
public static function installDependencies( Event $event ) {
		if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) {
			define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) );
		}

		$input = new ArrayInput( [ 'install:dependencies' ] );
		$output = new ConsoleOutput();

		try {
			$application = static::create();
			$command = $application->find('install:dependencies');
			$command->run( $input, $output );
		} catch ( RuntimeException $e ) {
			$event->getIO()->write( '<error>' . $e->getMessage() . '</error>' );
		}
	}
859644
public function onInstalled(InstalledEvent $event)
    {
        if ($event->getPackage()->getType() == self::PLUGIN_TYPE) {
            $this->addPackage($event->getPackage());
        }
    }
1099117
public function onVichUploaderPreUpload(Event $event)
    {
        $media = $event->getObject();

        $this->checkIfThereIsAName($media);
        $this->checkIfNameEverExistInDatabase($media);
        $this->checkIfFileLocationIsChanging($media);
    }
1366361
public static function registerPackage(Event $event)
    {
        $installedPackage = $event->getOperation()->getPackage();

        if (!self::isBundle($installedPackage)) {
            return;
        }

        self::enablePackage($installedPackage);
    }
1139937
public static function postPackageInstall(Event $event)
    {
        $config = $event->getComposer()->getConfig();
        $binDir = $config->get("bin-dir");
        self::initScript($binDir);

    }
34460
public static function postInstall(Event $event)
    {
        require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';

        static::clearCompiled();
        static::artisanOptimize();
        static::artisanLangJS();
    }
1162786
public static function postInstall(Event $event)
    {
        static::init();

        $event->getIO()->write('<info>Writing resources.lock file</info>');

        $installed = json_decode(file_get_contents(static::$vendorPath.'/composer/installed.json'));

        $data = [];

        $finder = (new Finder)
            ->directories()
            ->ignoreVCS(true)
            ->in(static::$resourcesPath.'/packages');

        foreach ($installed as $package) {
            if ( ! property_exists($package, 'extra')) continue;

            $extra = $package->extra;

            if ( ! property_exists($extra, 'resources')) continue;

            $resources = $extra->resources;

            foreach ($resources as $resource => $namespaces) {
                foreach ($namespaces as $namespace => $path) {
                    $finder->exclude($namespace);

                    $data[$resource][$namespace] = $path;
                }
            }
        }

        // We turn the iterator to an array to
        // prevent an exception when we delete the directorys
        foreach (iterator_to_array($finder) as $file) {
            \Filesystem::deleteDirectory($file->getPathname());
        }

        file_put_contents(static::$resourcesPath.'/resources.lock', json_encode($data, JSON_PRETTY_PRINT));
    }
843965
public function installPackage(PackageEvent $event)
    {
        // Ensure module exists and requires exposure
        $library = $this->getLibrary($event);
        if (!$library) {
            return;
        }

        // Install found library
        $this->installLibrary($event->getIO(), $library);
    }
537025
public static function postInstall(Event $event)
    {
        // Create core build file if it doesn't exist
        if (!file_exists('build.xml')) {
            $event->getIO()->write('build.xml does not exist, creating template');

            symlink('vendor/3ev/phingy/scripts/build.xml', 'build.xml');
        } else {
            $event->getIO()->write('build.xml exists, template not needed');
        }

        // Create project build file if it doesn't exist
        if (!file_exists('config/project.xml')) {
            $event->getIO()->write('config/project.xml does not exist, creating template');
            try {
                $temps   = implode(',', self::$templates);
                $default = self::$templates[0];

                $template = $event->getIO()->ask(
                    "Which template would you like to use ({$temps}) [{$default}] ? ", $default);
            } catch (Exception $e) {
                $template = $default;
            }

            copy("vendor/3ev/phingy/scripts/templates/{$template}.xml", 'config/project.xml');
        } else {
            $event->getIO()->write('config/project.xml exists, template not needed');
        }
    }
907170
public static function setupDatabase( Event $event )
	{
		$options = $env = array();

		if( $event->isDevMode() ) {
			$options[] = '--option=setup/default/demo:1';
		} else {
			$env[] = '--env=prod';
		}

		self::executeCommand( $event, 'aimeos:setup', $options + $env );
		self::executeCommand( $event, 'aimeos:cache', $env );
	}
239074
public function cleanWordPressInstallation(PackageEvent $event)
    {
        if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
            return;
        }
        
        static::$plugin->getInstanceOf(WordPressInstallationCleaner::class)->clean($event->getComposer(), $event->getIO());
    }
324410
public function onPostInstallOrUpdate(ScriptEvent $event)
    {
        // @codeCoverageIgnoreStart
        if ($this->state->isFirstInstall()) {
            $this->state->setFirstInstall(false);
            $this->logger->info(
                '<comment>' .
                'Running additional update to apply merge settings' .
                '</comment>'
            );

            $config = $this->composer->getConfig();

            $preferSource = $config->get('preferred-install') == 'source';
            $preferDist = $config->get('preferred-install') == 'dist';

            $installer = Installer::create(
                $event->getIO(),
                // Create a new Composer instance to ensure full processing of
                // the merged files.
                Factory::create($event->getIO(), null, false)
            );

            $installer->setPreferSource($preferSource);
            $installer->setPreferDist($preferDist);
            $installer->setDevMode($event->isDevMode());
            $installer->setDumpAutoloader($this->state->shouldDumpAutoloader());
            $installer->setOptimizeAutoloader(
                $this->state->shouldOptimizeAutoloader()
            );

            if ($this->state->forceUpdate()) {
                // Force update mode so that new packages are processed rather
                // than just telling the user that composer.json and
                // composer.lock don't match.
                $installer->setUpdate(true);
            }

            $installer->run();
        }
        // @codeCoverageIgnoreEnd
    }
1086561
public function runInstallers(Event $event)
    {
        foreach ($this->finder->getDependentPackages($event->isDevMode()) as $package) {
            $this->runner->runInstallers($package, $event->isDevMode());
        }
    }
333864
public function onVichUploaderPostUpload(Event $event)
    {
        $object = $event->getObject();
        $mapping = $event->getMapping();

        $absoluteDir = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object);
        $relativeDir = substr_replace($absoluteDir, '', 0, strlen($this->projectDir) + 1);

        $object->setRelativeDir($relativeDir);

        if (false !== strpos($object->getMimeType(), 'image/')) {
            $img = $mapping->getUploadDestination().'/'.$mapping->getUploadDir($object).'/'.$object->getMedia();
            $palette = Palette::fromFilename($img, Color::fromHexToInt('#FFFFFF'));
            $extractor = new ColorExtractor($palette);
            $colors = $extractor->extract();
            $object->setMainColor(Color::fromIntToHex($colors[0]));

            $this->generateCache('/'.$relativeDir.'/'.$object->getMedia());
        }
    }