Skip to content

Commit

Permalink
Merge pull request #1246 from lucasmezencio/check-laravel-version-bef…
Browse files Browse the repository at this point in the history
…ore-symlink-storage

Check laravel version before symlink storage
  • Loading branch information
antonmedv authored May 31, 2017
2 parents be47160 + 9279e2c commit 120dae4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
### Fixed
- Fixed upload / download with optional rsync ssh options [#1227]
- Disable maintenance mode when Magento2 deployment fails [#1251]
- Fixed storage link error when deploying Laravel < 5.3
- Helps [#1153]

## v5.0.1
[v5.0.0...v5.0.1](https://github.com/deployphp/deployer/compare/v5.0.0...v5.0.1)
Expand Down Expand Up @@ -228,6 +230,7 @@
[#1145]: https://github.com/deployphp/deployer/pull/1145
[#1146]: https://github.com/deployphp/deployer/pull/1146
[#1152]: https://github.com/deployphp/deployer/pull/1152
[#1153]: https://github.com/deployphp/deployer/issues/1153
[#1165]: https://github.com/deployphp/deployer/issues/1165
[#1175]: https://github.com/deployphp/deployer/pull/1175
[#330]: https://github.com/deployphp/deployer/pull/330
Expand Down
17 changes: 16 additions & 1 deletion recipe/laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
'storage/logs',
]);

set('laravel_version', function () {
$result = run('{{bin/php}} {{release_path}}/artisan --version');

preg_match_all('/([0-9\.])$/', $result, $matches);

$version = $matches[1][0] ?? 5.4;

return $version;
});

/**
* Helper tasks
*/
Expand Down Expand Up @@ -105,7 +115,12 @@

desc('Execute artisan storage:link');
task('artisan:storage:link', function () {
run('{{bin/php}} {{release_path}}/artisan storage:link');
$needsVersion = 5.3;
$currentVersion = get('laravel_version');

if (version_compare($currentVersion, $needsVersion, '>=')) {
run('{{bin/php}} {{release_path}}/artisan storage:link');
}
});

/**
Expand Down

0 comments on commit 120dae4

Please sign in to comment.