Skip to content

Commit a34550d

Browse files
committed
⬆️ upgrade dependencies
🎨 remove STDOUT checks that are not needed anymore ... since button will quiet automatically now Signed-off-by: bnomei <[email protected]>
1 parent e4a7f8c commit a34550d

35 files changed

+357
-329
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ return [
7878
$page = page($cli->arg('page'));
7979
8080
// output for the command line
81-
defined('STDOUT') && $cli->success(
81+
$cli->success(
8282
$page->title() . ' ' . $cli->arg('data')
8383
);
8484

commands/backupzip.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
$zip = new ZipArchive();
5454
if ($zip->open($output, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
55-
defined('STDOUT') && $cli->error('Failed to create: ' . $output);
55+
$cli->error('Failed to create: ' . $output);
5656
janitor()->data($cli->arg('command'), [
5757
'status' => 500,
5858
]);
@@ -102,16 +102,15 @@
102102
}
103103

104104
$zipped++;
105-
defined('STDOUT') && $cli->out("[$zipped/$count] " . $filePath);
105+
$cli->out("[$zipped/$count] " . $filePath);
106106

107107
if ($zipped % $ulimit === 0) {
108108
$zip->close();
109109
if ($zip->open($output) === false) {
110110
@unlink($output);
111111
$errorMessage = 'Hit ulimit but failed to reopen zip: ' . $output;
112-
if (defined('STDOUT')) {
113-
$cli->error($errorMessage);
114-
}
112+
$cli->error($errorMessage);
113+
115114
janitor()->data($cli->arg('command'), [
116115
'status' => 500,
117116
'error' => $errorMessage,
@@ -134,9 +133,9 @@
134133
];
135134
$data['message'] = $data['filename'] . '.zip [' .$data['nicesize'] .']';
136135

137-
defined('STDOUT') && $cli->blue($data['duration'] . ' sec');
138-
defined('STDOUT') && $cli->blue($data['nicesize']);
139-
defined('STDOUT') && $cli->success($output);
136+
$cli->blue($data['duration'] . ' sec');
137+
$cli->blue($data['nicesize']);
138+
$cli->success($output);
140139

141140
janitor()->data($cli->arg('command'), $data);
142141
}

commands/cleancontent.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ public static function cleanUp($cli, $collection, $ignore = null, string $lang =
4949
try {
5050
$item->update($data, $lang);
5151
$updated++;
52-
defined('STDOUT') && $cli->green('+++ ' . ($lang ? '[' . $lang . '] ' : '') . $item->id());
52+
$cli->green('+++ ' . ($lang ? '[' . $lang . '] ' : '') . $item->id());
5353
} catch (\Exception $e) {
54-
defined('STDOUT') && $cli->red('ERR ' . ($lang ? '[' . $lang . '] ' : '') . $item->id() . ': ' .$e->getMessage());
54+
$cli->red('ERR ' . ($lang ? '[' . $lang . '] ' : '') . $item->id() . ': ' .$e->getMessage());
5555
}
5656
} else {
57-
defined('STDOUT') && $cli->white('=== ' . ($lang ? '[' . $lang . '] ' : '') . $item->id());
57+
$cli->white('=== ' . ($lang ? '[' . $lang . '] ' : '') . $item->id());
5858
}
5959
}
6060

@@ -123,9 +123,9 @@ public static function cleanUp($cli, $collection, $ignore = null, string $lang =
123123
)
124124
);
125125

126-
defined('STDOUT') && $cli->blue($data['duration'] . ' sec');
127-
defined('STDOUT') && $cli->blue($data['count'] . ' checked');
128-
defined('STDOUT') && $cli->success($data['updated'] . ' needed cleaning');
126+
$cli->blue($data['duration'] . ' sec');
127+
$cli->blue($data['count'] . ' checked');
128+
$cli->success($data['updated'] . ' needed cleaning');
129129

130130
janitor()->data($cli->arg('command'), $data);
131131
}

commands/clipboard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
'description' => 'Pipe `data` to `clipboard` arg in Janitor or on CLI use pbcopy',
1414
'args' => [] + Janitor::ARGS, // page, file, user, site, data, model
1515
'command' => static function (CLI $cli): void {
16-
defined('STDOUT') && exec('echo "'.$cli->arg('data').'" | pbcopy');
17-
defined('STDOUT') && $cli->success('Copied "'.$cli->arg('data').'" to your clipboard.');
16+
exec('echo "'.$cli->arg('data').'" | pbcopy');
17+
$cli->success('Copied "'.$cli->arg('data').'" to your clipboard.');
1818

1919
janitor()->data($cli->arg('command'), [
2020
'status' => 200,

commands/download.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
] + Janitor::ARGS, // page, file, user, site, data, model
2323
'command' => static function (CLI $cli): void {
24-
defined('STDOUT') && $cli->success('download => ' . $cli->arg('data'));
24+
$cli->success('download => ' . $cli->arg('data'));
2525

2626
if (defined('STDOUT')) {
2727
$command = 'wget';

commands/flush.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
$cli->kirby()->cache($name)->flush();
2323

24-
defined('STDOUT') && $cli->success('The cache "' . $name . '" has been cleared.');
24+
$cli->success('The cache "' . $name . '" has been cleared.');
2525

2626
janitor()->data($cli->arg('command'), [
2727
'status' => 200,

commands/job.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
}
4949
} else {
5050
$result['message'] = t('janitor.model-not-found', 'No model provided');
51-
defined('STDOUT') && $cli->error('No model provided. Use `--page`, `--file`, `--user` or `--site`.');
51+
$cli->error('No model provided. Use `--page`, `--file`, `--user` or `--site`.');
5252
}
5353

54-
defined('STDOUT') && (A::get($result, 'status') === 200 ? $cli->success($key) : $cli->error($key));
55-
defined('STDOUT') && $cli->out(print_r($result, true));
54+
(A::get($result, 'status') === 200 ? $cli->success($key) : $cli->error($key));
55+
$cli->out(print_r($result, true));
5656

5757
janitor()->data($cli->arg('command'), $result);
5858
}

commands/maintenance.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
if ($down === false) {
3838
file_exists($maintenance) && unlink($maintenance);
3939
$message = t('janitor.maintenance.up', 'online');
40-
defined('STDOUT') && $cli->success($message);
40+
$cli->success($message);
4141
} elseif ($down === true) {
4242
file_put_contents($maintenance, date('c') . ' [' . $cli->arg('user') . ']');
4343
$message = t('janitor.maintenance.down', 'in maintenance');
44-
defined('STDOUT') && $cli->red($message);
44+
$cli->red($message);
4545
}
4646

4747
janitor()->data($cli->arg('command'), [

commands/open.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'description' => 'Pipe `data` to `open` arg in Janitor',
1414
'args' => [] + Janitor::ARGS, // page, file, user, site, data, model
1515
'command' => static function (CLI $cli): void {
16-
defined('STDOUT') && $cli->success('open => ' . $cli->arg('data'));
16+
$cli->success('open => ' . $cli->arg('data'));
1717

1818
janitor()->data($cli->arg('command'), [
1919
'status' => 200,

commands/pipe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
] + Janitor::ARGS, // page, file, user, site, data, model
2121
'command' => static function (CLI $cli): void {
2222
$pipe = $cli->arg('to');
23-
defined('STDOUT') && $cli->success($pipe . ' => ' . $cli->arg('data'));
23+
$cli->success($pipe . ' => ' . $cli->arg('data'));
2424

2525
janitor()->data($cli->arg('command'), [
2626
'status' => 200,

0 commit comments

Comments
 (0)