Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

Commit a2e0097

Browse files
committed
Deprecate db:size and mount:size commands
1 parent 28af248 commit a2e0097

5 files changed

Lines changed: 35 additions & 18 deletions

File tree

src/Command/CommandBase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ abstract class CommandBase extends Command implements MultiAwareInterface
4545

4646
const STABILITY_STABLE = 'STABLE';
4747
const STABILITY_BETA = 'BETA';
48+
const STABILITY_DEPRECATED = 'DEPRECATED';
4849

4950
const DEFAULT_ENVIRONMENT_CODE = '.';
5051

@@ -565,7 +566,7 @@ protected function checkMigrateToNewCLI()
565566
return;
566567
}
567568

568-
$message = "<comment>Warning:</comment>"
569+
$message = "<options=bold;fg=yellow>Warning:</>"
569570
. "\nRunning the CLI directly under PHP is now referred to as the \"Legacy CLI\", and is no longer recommended.";
570571
if ($config->has('migrate.docs_url')) {
571572
$message .= "\nInstall the latest release for your operating system by following these instructions: "
@@ -2062,7 +2063,8 @@ public function getDescription() {
20622063
$description = parent::getDescription();
20632064

20642065
if ($this->stability !== self::STABILITY_STABLE) {
2065-
$prefix = '<fg=white;bg=red> ' . strtoupper($this->stability) . ' </> ';
2066+
$tag = $this->stability === self::STABILITY_DEPRECATED ? '<fg=black;bg=yellow>' : '<fg=white;bg=red>';
2067+
$prefix = $tag . strtoupper($this->stability) . '</> ';
20662068
$description = $prefix . $description;
20672069
}
20682070

src/Command/Db/DbSizeCommand.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ protected function configure() {
3636
->addOption('cleanup', 'C', InputOption::VALUE_NONE, 'Check if tables can be cleaned up and show me recommendations (InnoDb only).');
3737
$help = self::ESTIMATE_WARNING;
3838
if ($this->config()->getWithDefault('api.metrics', false)) {
39-
$help .= "\n\n" . \sprintf('To see more accurate disk usage, run: <info>%s disk</info>', $this->config()->get('application.executable'));
39+
$this->stability = self::STABILITY_DEPRECATED;
40+
$help .= "\n\n";
41+
$help .= '<options=bold;fg=yellow>Deprecated:</>';
42+
$help .= "\nThis command is deprecated and will be removed in a future version.\n";
43+
$help .= \sprintf('To see more accurate disk usage, run: <comment>%s disk</comment>', $this->config()->get('application.executable'));
4044
}
4145
$this->setHelp($help);
4246
$this->addProjectOption()->addEnvironmentOption()->addAppOption();
@@ -211,21 +215,19 @@ private function showInaccessibleSchemas(Service $service, array $database) {
211215
private function showWarnings($percentageUsed) {
212216
if ($percentageUsed > self::RED_WARNING_THRESHOLD) {
213217
$this->stdErr->writeln('');
214-
$this->stdErr->writeln('<options=bold;fg=red>Warning</>');
218+
$this->stdErr->writeln('<options=bold;fg=red>Warning:</>');
215219
$this->stdErr->writeln('Databases tend to need extra space for starting up and temporary storage when running large queries.');
216220
$this->stdErr->writeln(sprintf('Please increase the allocated space in %s', $this->config()->get('service.project_config_dir') . '/services.yaml'));
217221
}
218222

219-
if ($this->config()->getWithDefault('api.metrics', false)
220-
&& ($data = $this->getSelectedEnvironment()->getData())
221-
&& isset($data['_links']['#metrics'])) {
222-
$this->stdErr->writeln('');
223-
$this->stdErr->writeln('<options=bold;fg=yellow>Notice</>');
224-
$this->stdErr->writeln('This environment supports the Metrics API');
225-
$this->stdErr->writeln(\sprintf('You can see disk usage much more accurately by running: <info>%s disk</info>', $this->config()->get('application.executable')));
223+
$this->stdErr->writeln('');
224+
225+
if ($this->config()->getWithDefault('api.metrics', false) && $this->config()->isCommandEnabled('metrics:disk')) {
226+
$this->stdErr->writeln('<options=bold;fg=yellow>Deprecated:</>');
227+
$this->stdErr->writeln('This command is deprecated and will be removed in a future version.');
228+
$this->stdErr->writeln(\sprintf('To see more accurate disk usage, run: <comment>%s disk</comment>', $this->config()->get('application.executable')));
226229
} else {
227-
$this->stdErr->writeln('');
228-
$this->stdErr->writeln('<options=bold;fg=yellow>Warning</>');
230+
$this->stdErr->writeln('<options=bold;fg=yellow>Warning:</>');
229231
$this->stdErr->writeln(self::ESTIMATE_WARNING);
230232
}
231233
}

src/Command/Domain/DomainDeleteCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6464
})) > 0;
6565
if ($hasNonProductionActiveEnvs) {
6666
$this->stdErr->writeln([
67-
'<options=bold>Warning</>',
67+
'<options=bold>Warning:</>',
6868
'If this domain has non-production domains attached to it, they will also be deleted.',
6969
'Non-production environments will not be automatically redeployed.',
7070
'Consider redeploying these environments so that routes are updated correctly.',

src/Command/Mount/MountSizeCommand.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,21 @@ protected function configure()
3838
$this->addProjectOption();
3939
$this->addEnvironmentOption();
4040
$this->addRemoteContainerOptions();
41-
$this->setHelp(<<<EOF
41+
$help = <<<EOF
4242
Use this command to check the disk size and usage for an application's mounts.
4343
4444
Mounts are directories mounted into the application from a persistent, writable
4545
filesystem. They are configured in the <info>mounts</info> key in the application configuration.
4646
4747
The filesystem's total size is determined by the <info>disk</info> key in the same file.
48-
EOF
49-
);
48+
EOF;
49+
if ($this->config()->getWithDefault('api.metrics', false)) {
50+
$this->stability = self::STABILITY_DEPRECATED;
51+
$help .= "\n\n";
52+
$help .= '<options=bold;fg=yellow>Deprecated:</>';
53+
$help .= sprintf("\nThis command is deprecated and will be removed in a future version.\nTo see disk metrics, run: <comment>%s disk</comment>", $this->config()->get('application.executable'));
54+
}
55+
$this->setHelp($help);
5056
}
5157

5258
/**
@@ -159,6 +165,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
159165
$this->stdErr->writeln(
160166
'To increase the available space, edit the <info>disk</info> key in the application configuration.'
161167
);
168+
169+
if ($this->config()->getWithDefault('api.metrics', false) && $this->config()->isCommandEnabled('metrics:disk')) {
170+
$this->stdErr->writeln('');
171+
$this->stdErr->writeln('<options=bold;fg=yellow>Deprecated:</>');
172+
$this->stdErr->writeln('This command is deprecated and will be removed in a future version.');
173+
$this->stdErr->writeln(sprintf('To see disk metrics, run: <comment>%s disk</comment>', $this->config()->get('application.executable')));
174+
}
162175
}
163176

164177
return 0;

src/Service/CurlCli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function run($baseUrl, InputInterface $input, OutputInterface $output) {
106106
$stdErr->writeln(sprintf('Running command: <info>%s</info>', str_replace($token, '[token]', $commandline)), OutputInterface::VERBOSITY_VERBOSE);
107107

108108
if ($output->isVeryVerbose()) {
109-
$stdErr->writeln("\n<fg=yellow;options=bold>Warning</>\nVerbose mode is enabled. Do not copy and paste the output as it may contain sensitive headers.\n");
109+
$stdErr->writeln("\n<fg=yellow;options=bold>Warning:</>\nVerbose mode is enabled. Do not copy and paste the output as it may contain sensitive headers.\n");
110110
}
111111

112112
$process = proc_open($commandline, [STDIN, STDOUT, STDERR], $pipes);

0 commit comments

Comments
 (0)