Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Package_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ private function create_default_composer_json( $composer_path ) {

$composer_dir = pathinfo( $composer_path, PATHINFO_DIRNAME );
if ( ! is_dir( $composer_dir ) ) {
if ( ! @mkdir( $composer_dir, 0777, true ) ) { // @codingStandardsIgnoreLine
if ( ! @mkdir( $composer_dir, 0700, true ) ) { // @codingStandardsIgnoreLine
$error = error_get_last();
WP_CLI::error( sprintf( "Composer directory '%s' for packages couldn't be created: %s", $composer_dir, $error['message'] ) );
}
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/ComposerJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function test_create_default_composer_json() {
$actual = $create_default_composer_json->invoke( $package, $expected );
$this->assertSame( $this->mac_safe_path( realpath( $expected ) ?: $expected ), $this->mac_safe_path( realpath( $actual ) ?: $actual ) );
$this->assertTrue( false !== strpos( file_get_contents( $actual ), 'wp-cli/wp-cli' ) );
if ( ! Utils\is_windows() ) {
$this->assertSame( '0700', substr( sprintf( '%o', fileperms( dirname( $actual ) ) ), -4 ) );
}
Comment thread
swissspidy marked this conversation as resolved.
unlink( $actual );
rmdir( dirname( $actual ) );
}
Expand Down
Loading