Skip to content

Commit

Permalink
Added informational display
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfoell committed Feb 12, 2020
1 parent c7ba04e commit ba15eb6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,21 @@ public static function install( Event $event ) {
}

$vendor_dir = $event->getComposer()->getConfig()->get( 'vendor-dir' );

$base_path = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';
$base_path = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';
$file_path = $base_path . '/mu-plugins/mu-autoload.php';

// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents -- OK, local only.
file_put_contents(
$base_path . '/mu-plugins/mu-autoload.php',
$result = file_put_contents(
$file_path,
self::get_autoloader_contents( self::get_wp_autoload_path( $vendor_dir ) )
);

if ( false === $result ) {
echo "Unable to write file to: {$file_path}\n";
exit( 1 );
} else {
echo "Wrote {$result} bytes to: {$file_path}\n";
}
}

/**
Expand Down

0 comments on commit ba15eb6

Please sign in to comment.