Skip to content

Commit

Permalink
Make clean() function to anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora committed Feb 22, 2024
1 parent c851063 commit e9a100c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions commands/clean/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Kirby\CLI\CLI;

function clean(
$cleanContent = function (
Generator $collection,
array|null $ignore = null,
string|null $lang = null
Expand Down Expand Up @@ -39,11 +39,11 @@ function clean(
$item->update($data, $lang);
}
}
}
};

return [
'description' => 'Deletes all fields from page, file or user content files that are not defined in the blueprint, no matter if they contain content or not.',
'command' => static function (CLI $cli): void {
'command' => static function (CLI $cli) use ($cleanContent): void {

$cli->confirmToContinue('This will delete all fields from content files that are not defined in blueprints, no matter if they contain content or not. Are you sure?');

Expand All @@ -64,11 +64,11 @@ function clean(
$languages = $kirby->languages();

foreach ($languages as $language) {
clean($collection, $ignore, $language->code());
$cleanContent($collection, $ignore, $language->code());
}

} else {
clean($collection, $ignore);
$cleanContent($collection, $ignore);
}

$cli->success('The content files have been cleaned');
Expand Down

0 comments on commit e9a100c

Please sign in to comment.