Skip to content

Commit 94c7ef9

Browse files
authored
Exit with an error when plugin installation fails
Fixes #14
1 parent cb77877 commit 94c7ef9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/bin/install-plugins.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,19 @@
5656

5757
// Activate the plugins.
5858
foreach ( $plugins_info as $plugin => $info ) {
59-
activate_plugin( $plugin, '', $info['network_wide'] );
59+
60+
$result = activate_plugin( $plugin, '', $info['network_wide'] );
61+
62+
if ( is_wp_error( $result ) ) {
63+
64+
echo "Error: Plugin activation failed for {$plugin}:" . PHP_EOL;
65+
66+
foreach ( $result->get_error_messages() as $message ) {
67+
echo "- {$message}" . PHP_EOL;
68+
}
69+
70+
exit( 1 );
71+
}
6072
}
6173

6274
// Load files to include after the plugins are installed.

0 commit comments

Comments
 (0)