<?php

final class PhabricatorStorageManagementShellWorkflow
  extends PhabricatorStorageManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('shell')
      ->setExamples('**shell** [__options__]')
      ->setSynopsis(pht('Launch an interactive shell.'));
  }

  protected function isReadOnlyWorkflow() {
    return true;
  }

  public function execute(PhutilArgumentParser $args) {
    $api = $this->getAPI();
    list($host, $port) = $this->getBareHostAndPort($api->getHost());

    $flag_port = $port
      ? csprintf('--port %d', $port)
      : '';

    $flag_password = '';
    $password = $api->getPassword();
    if ($password) {
      if (strlen($password->openEnvelope())) {
        $flag_password = csprintf('--password=%P', $password);
      }
    }

    return phutil_passthru(
      'mysql --protocol=TCP --default-character-set=utf8 '.
      '-u %s %C -h %s %C',
      $api->getUser(),
      $flag_password,
      $host,
      $flag_port);
  }

}

<?php

final class PhabricatorStorageManagementShellWorkflow
  extends PhabricatorStorageManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('shell')
      ->setExamples('**shell** [__options__]')
      ->setSynopsis(pht('Launch an interactive shell.'));
  }

  protected function isReadOnlyWorkflow() {
    return true;
  }

  public function execute(PhutilArgumentParser $args) {
    $api = $this->getAPI();
    list($host, $port) = $this->getBareHostAndPort($api->getHost());

    $flag_port = $port
      ? csprintf('--port %d', $port)
      : '';

    $flag_password = '';
    $password = $api->getPassword();
    if ($password) {
      if (strlen($password->openEnvelope())) {
        $flag_password = csprintf('--password=%P', $password);
      }
    }

    return phutil_passthru(
      'mysql --protocol=TCP --default-character-set=utf8mb4 '.
      '-u %s %C -h %s %C',
      $api->getUser(),
      $flag_password,
      $host,
      $flag_port);
  }

}

Convert bin/storage workflow to presume utf8mb4 as the default encoding
Convert bin/storage workflow to presume utf8mb4 as the default encoding

Summary: see comments on rP68904d941c54

Test Plan: run ,/bin/storage upgrade

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16370
