|
58 | 58 | $original_command = getenv('SSH_ORIGINAL_COMMAND');
|
59 | 59 | }
|
60 | 60 |
|
| 61 | + $workflows = id(new PhutilSymbolLoader()) |
| 62 | + ->setAncestorClass('PhabricatorSSHWorkflow') |
| 63 | + ->loadObjects(); |
| 64 | + |
| 65 | + $workflow_names = mpull($workflows, 'getName', 'getName'); |
| 66 | + |
61 | 67 | // Now, rebuild the original command.
|
62 | 68 | $original_argv = id(new PhutilShellLexer())
|
63 | 69 | ->splitArguments($original_command);
|
64 | 70 | if (!$original_argv) {
|
65 |
| - throw new Exception("No interactive logins."); |
| 71 | + throw new Exception( |
| 72 | + pht( |
| 73 | + "Welcome to Phabricator.\n\n". |
| 74 | + "You are logged in as %s.\n\n". |
| 75 | + "You haven't specified a command to run. This means you're requesting ". |
| 76 | + "an interactive shell, but Phabricator does not provide an ". |
| 77 | + "interactive shell over SSH.\n\n". |
| 78 | + "Usually, you should run a command like `git clone` or `hg push` ". |
| 79 | + "rather than connecting directly with SSH.\n\n". |
| 80 | + "Supported commands are: %s.", |
| 81 | + $user->getUsername(), |
| 82 | + implode(', ', $workflow_names))); |
66 | 83 | }
|
67 | 84 |
|
68 | 85 | $ssh_log->setData(
|
|
78 | 95 |
|
79 | 96 | $original_args = new PhutilArgumentParser($original_argv);
|
80 | 97 |
|
81 |
| - $workflows = array( |
82 |
| - new ConduitSSHWorkflow(), |
83 |
| - new DiffusionSSHSubversionServeWorkflow(), |
84 |
| - new DiffusionSSHMercurialServeWorkflow(), |
85 |
| - new DiffusionSSHGitUploadPackWorkflow(), |
86 |
| - new DiffusionSSHGitReceivePackWorkflow(), |
87 |
| - ); |
88 |
| - |
89 |
| - $workflow_names = mpull($workflows, 'getName', 'getName'); |
90 | 98 | if (empty($workflow_names[$command])) {
|
91 | 99 | throw new Exception("Invalid command.");
|
92 | 100 | }
|
|
0 commit comments