|
76 | 76 | desc('Reset opcache'); |
77 | 77 | task('opcache:reset', function () { |
78 | 78 |
|
79 | | - $ee_version = run('ee --version'); |
| 79 | + $ee_version = ''; |
| 80 | + try { |
| 81 | + $ee_version = run('ee --version'); |
| 82 | + } catch(\Exception $e) { |
| 83 | + echo 'Not using EasyEngine.'; |
| 84 | + } |
80 | 85 |
|
81 | 86 | if ( false !== strpos( $ee_version, 'EasyEngine v3' ) ) { |
82 | 87 |
|
|
98 | 103 | desc('Upgrade WordPress DB'); |
99 | 104 | task('core_db:update', function () { |
100 | 105 |
|
101 | | - $ee_version = run('ee --version'); |
| 106 | + $ee_version = ''; |
| 107 | + try { |
| 108 | + $ee_version = run('ee --version'); |
| 109 | + } catch(\Exception $e) { |
| 110 | + echo 'Not using EasyEngine.'; |
| 111 | + } |
102 | 112 |
|
103 | 113 | if ( false !== strpos( $ee_version, 'EasyEngine v3' ) ) { |
104 | 114 |
|
|
128 | 138 | */ |
129 | 139 | desc('Correct Permissions'); |
130 | 140 | task('permissions:set', function () { |
131 | | - $output = run('chown -R www-data:www-data {{deploy_path}}'); |
132 | | - writeln('<info>' . $output . '</info>'); |
| 141 | + |
| 142 | + try { |
| 143 | + $plesk_version = run('plesk version'); |
| 144 | + } catch(\Exception $e) { |
| 145 | + echo 'Not using Plesk.'; |
| 146 | + } |
| 147 | + |
| 148 | + if ( false !== strpos( $plesk_version, 'Plesk' ) ) { |
| 149 | + $branch = get('branch'); |
| 150 | + $hosts_parsed = yaml_parse_file("/hosts.yml"); |
| 151 | + $permission = ($hosts_parsed[$branch]['permission']); |
| 152 | + |
| 153 | + $output = run("chown -R $permission {{deploy_path}}"); |
| 154 | + writeln('<info>' . $output . '</info>'); |
| 155 | + $output = run("chmod o-rwx {{deploy_path}}/current"); |
| 156 | + writeln('<info>' . $output . '</info>'); |
| 157 | + } else { |
| 158 | + $output = run('chown -R www-data:www-data {{deploy_path}}'); |
| 159 | + writeln('<info>' . $output . '</info>'); |
| 160 | + } |
133 | 161 | }); |
134 | 162 |
|
135 | 163 | /* deployment task */ |
|
0 commit comments