/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { // Get current connection id $query = 'SELECT CONNECTION_ID()'; $conId = DatabaseConnection::getOne($query); $query = 'SHOW PROCESSLIST'; $processList = DatabaseConnection::getAll($query); // ######################## // Output // ######################## /** @var \Symfony\Component\Console\Helper\Table $table */ $table = new Table($output); $table->setHeaders(array_keys(reset($processList))); foreach ($processList as $row) { // Exclude current connection id if ($row['Id'] === $conId) { continue; } $table->addRow(array_values($row)); } $table->render(); return 0; }
/** * Add share domains (eg. for vagrantshare) * * @param string $suffix Domain suffix */ protected function addDuplicateDomains($suffix) { $devDomain = '.' . $this->getApplication()->getConfigValue('config', 'domain_dev'); $query = 'SELECT * FROM sys_domain'; $domainList = DatabaseConnection::getAll($query); foreach ($domainList as $domain) { unset($domain['uid']); $domainName = $domain['domainName']; // remove development suffix $domainName = preg_replace('/' . preg_quote($devDomain) . '$/', '', $domainName); // add share domain $domainName .= '.' . ltrim($suffix, '.'); $domain['domainName'] = $domainName; DatabaseConnection::insert('sys_domain', $domain); } }