Skip to content

Commit 054f451

Browse files
authored
Merge pull request #1 from wearerequired/fix/copy-template
Copy the template, no need to read and write the file.
2 parents cc41aa2 + 3dc70c5 commit 054f451

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8-
8+
### Changed
9+
- The deploy.tpl.php is copied now (before it was read and written to a new file).
10+
- Use correct path to deploy.php in uninstall event (path to the folder where the composer.json is located).
911

1012
## [0.1.0] - 2020-09-22
1113
### Added

src/Plugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ public function copyDeployerConfig( PackageEvent $event ) {
126126
$source = dirname( __DIR__ ) . '/res/deploy.tpl.php';
127127
$dest = $this->rootDir . '/deploy.php';
128128

129-
$copied = file_put_contents( $dest, file_get_contents( $source ) );
129+
$copied = copy( $source, $dest );
130130

131131
if ( false !== $copied ) {
132-
$this->io->writeError( ' deploy.php has been copied to ' . $dest . '.' );
132+
$this->io->writeError( ' deploy.php has been copied.' );
133133
} else {
134134
$this->io->writeError( '<error>deploy.php could not be copied to ' . $dest . '.</error>' );
135135
}
@@ -149,7 +149,7 @@ public function deleteDeployerConfig( PackageEvent $event ) {
149149
return;
150150
}
151151

152-
$deployConfigFile = dirname( __DIR__ ) . '/deploy.php';
152+
$deployConfigFile = $this->rootDir . '/deploy.php';
153153

154154
if ( is_file( $deployConfigFile ) ) {
155155
unlink( $deployConfigFile );

0 commit comments

Comments
 (0)