Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
novicell/dds_core / drush / Commands / DDSSiteInstallCommands.php
Size: Mime:
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\AnnotationData;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DDSSiteInstallCommands extends DrushCommands {

  /**
   * @hook interact site-install
   */
  public function interact(InputInterface $input, OutputInterface $output, AnnotationData $annotationData) {
    $profile = $input->getArgument('profile');
    if (in_array('dds_premium', $profile, FALSE)) {
      if (getenv('IS_DDEV_PROJECT')) {
        // This is running in a docker container through DDEV.
        $site_folder = getenv('PREMIUM_SITE_FOLDER');
        if (!empty($site_folder) && $site_folder !== 'SITE_FOLDER_PLACEHOLDER') {
          $dds_project_domain = $site_folder;
        }
        else {
          $dds_project_domain = $this->io()
            ->ask('Project domain (used for creating sites folder)', getenv('VIRTUAL_HOST'));
        }

        $db_url = 'mysql://db:db@db:3306/db';
      }
      else {
        // This is probably not a docker container.
        $dds_project_domain = $this->io()
          ->ask('Project domain (used for creating sites folder)', 'premium.test');
        $db_url = 'mysql://root:root@127.0.0.1:3306/premium';
      }

      $input->setOption('sites-subdir', $dds_project_domain);

      // Set the db-url if it isn't passed as an option.
      if (!$input->hasOption('db-url') || $input->getOption('db-url') == '') {
        $input->setOption('db-url', $db_url);
      }

      $profile = [
        'dds_premium_installer',
        'dds_installer_configuration_form.project_domain='
        . $dds_project_domain,
        'install_configure_form.enable_update_status_module=NULL',
      ];

      $input->setArgument('profile', $profile);
      $input->setOption('account-name', 'novicell');
      $input->setOption('account-mail', 'php@novicell.dk');
      $input->setOption('site-mail', 'php@novicell.dk');
      $input->setOption('site-name', 'DDS Premium Website');
    }
  }

}