Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #3457992 by alex.skrypnyk: Allow excluding provision types in civictheme_provision_cli(). #1281

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion web/themes/contrib/civictheme/theme-settings.provision.inc
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ function civictheme_provision(array $types = [], $clear_cache = TRUE, bool $verb
$types = array_keys($callbacks);
}

// Run callbacks in the order they are expected to be called and filter by
// the provided types.
foreach (array_keys($callbacks) as $callback_type) {
if (in_array($callback_type, $types)) {
if ($verbose) {
Expand Down Expand Up @@ -245,8 +247,25 @@ function civictheme_provision(array $types = [], $clear_cache = TRUE, bool $verb
*
* This will exit with a non-zero code if there was at least one provisioning
* failure.
*
* @param array $include_types
* Optional array of types to include in provisioning. If not provided - all
* types will be provisioned.
* @param array $exclude_types
* Optional array of types to exclude from provisioning. If not provided - no
* types will be excluded.
*/
function civictheme_provision_cli(array $types = []): void {
function civictheme_provision_cli(array $include_types = [], array $exclude_types = []): void {
$types = civictheme_provision_get_types();

if (!empty($include_types)) {
$types = array_intersect($types, $include_types);
}

if (!empty($exclude_types)) {
$types = array_diff($types, $exclude_types);
}

$results = civictheme_provision($types, TRUE, TRUE);
$errors = array_filter($results, static function ($value): bool {
return $value !== TRUE;
Expand Down
Loading