Skip to content

Commit 917f534

Browse files
[#93] Moving the delating to after DB install (#98)
* [#93] moving the delating to after db install * [#93] Checking if WP is installed before removing plugin/themes
1 parent 0b324bb commit 917f534

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

bin/composer-scripts/ProjectEvents/PostInstallScript.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ public static function execute( Event $event ): void {
8787

8888
self::wait( 2 );
8989

90+
// Populate the database.
91+
self::populateDatabase();
92+
9093
// Remove the core Twenty-X themes.
9194
self::deleteCoreThemes();
9295

9396
// Remove Hello Dolly.
9497
self::deleteCorePlugins();
95-
96-
// Populate the database.
97-
self::populateDatabase();
9898
}
9999

100100
// Run the Viget WP Composer Install
@@ -194,6 +194,10 @@ private static function deleteCoreThemes(): void {
194194
* @return void
195195
*/
196196
private static function deleteCorePlugins(): void {
197+
if ( ! self::isWordPressInstalled() ) {
198+
self::writeError( 'WordPress installation failed. Can not delete stock WordPress plugins.' );
199+
return;
200+
}
197201
self::writeInfo( 'Deleting stock WordPress plugins...' );
198202

199203
foreach ( self::$deletePlugins as $plugin ) {
@@ -505,6 +509,10 @@ private static function installationCleanup(): void {
505509
* @return void
506510
*/
507511
private static function activatePlugins(): void {
512+
if ( ! self::isWordPressInstalled() ) {
513+
self::writeError( 'WordPress installation failed. Can not activate stock WordPress plugins.' );
514+
return;
515+
}
508516
self::writeComment( 'Activating plugins...' );
509517

510518
foreach ( self::$activatePlugins as $slug => $plugin ) {

0 commit comments

Comments
 (0)