Skip to content

Commit 8fbd438

Browse files
Merge branch 'master' into 5.1
2 parents 13e8715 + 89e4e80 commit 8fbd438

File tree

7 files changed

+93
-89
lines changed

7 files changed

+93
-89
lines changed

build.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<include name="**/*.php"/>
121121
</fileset>
122122
</copy>
123-
<copy todir="${basedir}/build/phar/lib/collect">
123+
<copy todir="${basedir}/build/phar/lib/tightenco">
124124
<fileset dir="${basedir}/vendor/tightenco/collect/src">
125125
<include name="**/*.php"/>
126126
</fileset>
@@ -389,13 +389,12 @@
389389
</fileset>
390390
</copy>
391391

392-
<!-- SWIFTMAILER -->
393-
<copy file="${basedir}/vendor/swiftmailer/swiftmailer/LICENSE"
394-
tofile="${basedir}/build/phar/lib/swiftmailer/LICENSE"/>
395-
<copy todir="${basedir}/build/phar/lib/swiftmailer">
396-
<fileset dir="${basedir}/vendor/swiftmailer/swiftmailer/lib">
392+
<!-- PHPMAILER -->
393+
<copy file="${basedir}/vendor/phpmailer/phpmailer/LICENSE"
394+
tofile="${basedir}/build/phar/lib/phpmailer/LICENSE"/>
395+
<copy todir="${basedir}/build/phar/lib/phpmailer">
396+
<fileset dir="${basedir}/vendor/phpmailer/phpmailer/src">
397397
<include name="**/*.php"/>
398-
<exclude name="**/swift_required_pear.php"/>
399398
</fileset>
400399
</copy>
401400

build/phar-autoload.php.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ if ($execute) {
4545
require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/guzzle/functions_include.php';
4646
require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/psr7/functions_include.php';
4747
require __PHPBU_PHAR_ROOT__ . '/lib/guzzlehttp/promises/functions_include.php';
48-
// swift dependency init
49-
require __PHPBU_PHAR_ROOT__ . '/lib/swiftmailer/swift_init.php';
50-
48+
// dropbox collection helper
49+
require __PHPBU_PHAR_ROOT__ . '/lib/tightenco/Collect/Support/helpers.php';
50+
require __PHPBU_PHAR_ROOT__ . '/lib/tightenco/Collect/Support/alias.php';
51+
5152
phpbu\App\Cmd::main();
5253
}
5354

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"sebastian/environment": "~1.1|~2.0|~3.0",
3939
"sebastianfeldmann/cli": "~2.0",
4040
"sebastianfeldmann/ftp": "~0.9",
41-
"swiftmailer/swiftmailer": "~5.3|~6.0",
41+
"phpmailer/phpmailer": "~6.0",
4242
"symfony/event-dispatcher": "~2.6|~3.0|~4.0"
4343
},
4444
"require-dev": {

src/Adapter/Util.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,19 @@
1616
abstract class Util
1717
{
1818
/**
19-
* Finds all adapter references in a value string.
19+
* Finds all adapter references in a value string
2020
*
21-
* @param string $value
21+
* This returns a list of all found adapter references in an array like:
22+
* [
23+
* [
24+
* 'search' => 'adapter:name:path',
25+
* 'adapter' => 'name',
26+
* 'path' => 'path'
27+
* ],
28+
* ...
29+
* ]
30+
*
31+
* @param string $value
2232
* @return array
2333
*/
2434
public static function getAdapterReplacements(string $value) : array

src/Configuration/Loader/File.php

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use phpbu\App\Util\Path as PathUtil;
99

1010
/**
11-
* Base class for file based phpbu configuration.
11+
* Base class for file based phpbu configuration
1212
*
1313
* @package phpbu
1414
* @subpackage App
@@ -21,28 +21,28 @@
2121
abstract class File
2222
{
2323
/**
24-
* Path to config file.
24+
* Path to config file
2525
*
2626
* @var string
2727
*/
2828
protected $filename;
2929

3030
/**
31-
* Path to config file.
31+
* Path to config file
3232
*
3333
* @var array
3434
*/
3535
protected $adapters;
3636

3737
/**
38-
* Handling the bootstrapping.
38+
* Handling the bootstrapping
3939
*
4040
* @var \phpbu\App\Configuration\Bootstrapper
4141
*/
4242
protected $bootstrapper;
4343

4444
/**
45-
* File constructor.
45+
* File constructor
4646
*
4747
* @param string $file
4848
* @param \phpbu\App\Configuration\Bootstrapper $bootstrapper
@@ -54,7 +54,7 @@ public function __construct(string $file, Configuration\Bootstrapper $bootstrapp
5454
}
5555

5656
/**
57-
* Returns the phpbu Configuration.
57+
* Returns the phpbu Configuration
5858
*
5959
* @param \phpbu\App\Factory $factory
6060
* @return \phpbu\App\Configuration
@@ -77,7 +77,7 @@ public function getConfiguration(AppFactory $factory)
7777
}
7878

7979
/**
80-
* Load all available config adapters.
80+
* Load all available config adapters
8181
*
8282
* @param \phpbu\App\Factory $factory
8383
* @throws \phpbu\App\Exception
@@ -90,7 +90,7 @@ protected function setupAdapters(AppFactory $factory)
9090
}
9191

9292
/**
93-
* Return a registered adapter.
93+
* Return a registered adapter
9494
*
9595
* @param string $name
9696
* @return \phpbu\App\Adapter
@@ -105,37 +105,37 @@ protected function getAdapter($name)
105105
}
106106

107107
/**
108-
* Return list of adapter configs.
108+
* Return list of adapter configs
109109
*
110110
* @return array
111111
*/
112112
abstract protected function getAdapterConfigs();
113113

114114
/**
115-
* Set the phpbu application settings.
115+
* Set the phpbu application settings
116116
*
117117
* @param \phpbu\App\Configuration $configuration
118118
*/
119119
abstract public function setAppSettings(Configuration $configuration);
120120

121121
/**
122-
* Set the log configuration.
122+
* Set the log configuration
123123
*
124124
* @param \phpbu\App\Configuration $configuration
125125
* @throws \phpbu\App\Exception
126126
*/
127127
abstract public function setLoggers(Configuration $configuration);
128128

129129
/**
130-
* Set the backup configurations.
130+
* Set the backup configurations
131131
*
132132
* @param \phpbu\App\Configuration $configuration
133133
* @throws \phpbu\App\Exception
134134
*/
135135
abstract public function setBackups(Configuration $configuration);
136136

137137
/**
138-
* Handles the bootstrap file inclusion.
138+
* Handles the bootstrap file inclusion
139139
*
140140
* @param \phpbu\App\Configuration $configuration
141141
* @throws \phpbu\App\Exception
@@ -146,7 +146,7 @@ protected function handleBootstrap(Configuration $configuration)
146146
}
147147

148148
/**
149-
* Converts a path to an absolute one if necessary.
149+
* Converts a path to an absolute one if necessary
150150
*
151151
* @param string $path
152152
* @param boolean $useIncludePath
@@ -158,7 +158,7 @@ protected function toAbsolutePath($path, $useIncludePath = false)
158158
}
159159

160160
/**
161-
* Return option value.
161+
* Return option value
162162
* Checks if the value should be fetched from an Adapter, if not it just returns the value.
163163
*
164164
* @param string $value
@@ -167,16 +167,18 @@ protected function toAbsolutePath($path, $useIncludePath = false)
167167
*/
168168
protected function getAdapterizedValue($value)
169169
{
170-
foreach (Util::getAdapterReplacements($value) as $replacement) {
171-
$search = $replacement['search'];
172-
$replace = $this->getAdapter($replacement['adapter'])->getValue($replacement['path']);
173-
$value = str_replace($search, $replace, $value);
170+
if (!empty($value)) {
171+
foreach (Util::getAdapterReplacements($value) as $replacement) {
172+
$search = $replacement['search'];
173+
$replace = $this->getAdapter($replacement['adapter'])->getValue($replacement['path']);
174+
$value = str_replace($search, $replace, $value);
175+
}
174176
}
175177
return $value;
176178
}
177179

178180
/**
179-
* Load the file.
181+
* Load the file
180182
*
181183
* @param string $filename
182184
* @throws \phpbu\App\Exception

src/Configuration/Loader/Json.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function setBackups(Configuration $configuration)
175175
*/
176176
private function getBackupConfig(array $json)
177177
{
178-
$name = $this->getAdapterizedValue(Arr::getValue($json, 'name'));
178+
$name = $this->getAdapterizedValue(Arr::getValue($json, 'name', ''));
179179
$stopOnFailure = Arr::getValue($json, 'stopOnFailure', false);
180180
$backup = new Configuration\Backup($name, $stopOnFailure);
181181

@@ -222,8 +222,8 @@ protected function getTarget(array $json)
222222
throw new Exception('backup requires a target config');
223223
}
224224
$compress = Arr::getValue($json['target'], 'compress');
225-
$filename = $this->getAdapterizedValue(Arr::getValue($json['target'], 'filename'));
226-
$dirname = $this->getAdapterizedValue(Arr::getValue($json['target'], 'dirname'));
225+
$filename = $this->getAdapterizedValue(Arr::getValue($json['target'], 'filename',''));
226+
$dirname = $this->getAdapterizedValue(Arr::getValue($json['target'], 'dirname', ''));
227227

228228
if ($dirname) {
229229
$dirname = $this->toAbsolutePath($dirname);
@@ -316,10 +316,11 @@ protected function setCleanup(Configuration\Backup $backup, array $json)
316316
}
317317

318318
/**
319-
* Extracts all option tags.
319+
* Extracts all option tags
320320
*
321321
* @param array $json
322322
* @return array
323+
* @throws \phpbu\App\Exception
323324
*/
324325
protected function getOptions(array $json)
325326
{

0 commit comments

Comments
 (0)