Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare v3.6 release #2375

Merged
merged 145 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
f1c1194
Merge pull request #2316 from Varying-Vagrant-Vagrants/stable
tomjn Dec 11, 2020
97dd0e2
begin the 3.6.0 release cycle
tomjn Dec 11, 2020
9aaa23e
XDebug 3 improvements
tomjn Dec 15, 2020
70ff6b7
fix including the helper file from non-provisioners and add basic for…
tomjn Dec 15, 2020
f0a08d2
use the new formatters in the php debugmod script and move xdebug log…
tomjn Dec 15, 2020
d8ce714
updated the changelog and added the 3.6 headings
tomjn Dec 15, 2020
8a96100
switch vvv_info to use vvv_output
tomjn Dec 15, 2020
1dc4194
use the helper functions for output in top level provisioner files, a…
tomjn Dec 15, 2020
ee5a8d9
more fixes for vvv_output, and improved network check output
tomjn Dec 15, 2020
3136f77
better SQL import script output
tomjn Dec 15, 2020
837586c
better database backup output
tomjn Dec 15, 2020
7dd9c94
apply colours and new formatting to the post provision/up scripts
tomjn Dec 15, 2020
056ce77
only install shyaml if it isn't installed, and switch the vvv provisi…
tomjn Dec 15, 2020
edc03b6
fix a return code handling in the composer provisioner, separate upda…
tomjn Dec 15, 2020
7cea4e0
improve provisioner output and add bash strict checking and failure i…
tomjn Dec 15, 2020
66c0e00
set the right composer flags in the PHPCS provisioner and switch the …
tomjn Dec 15, 2020
aa796a1
update changelog
tomjn Dec 15, 2020
5a7c8af
improve db backup output, skip the unit tests database, and skip data…
tomjn Dec 15, 2020
99fd2f8
fix a typo in the dashboard provisioner
tomjn Dec 15, 2020
508d7e6
don't import the unit tests database, and improve the output colours …
tomjn Dec 15, 2020
3fd1d71
add more pipe fails and output improvements
tomjn Dec 15, 2020
efca59c
dim the info text and add better bold format resetting
tomjn Dec 15, 2020
ed4387f
improve DB backup output
tomjn Dec 15, 2020
0d3ebd3
update changelog
tomjn Dec 15, 2020
5a1d40b
fix missing highlight on the DB name when skipping the mysql database
tomjn Dec 15, 2020
5b5a5f3
fix an unhandled error code in the WP CLI setup
tomjn Dec 16, 2020
027094a
fix the listing of failed provisioners
tomjn Dec 16, 2020
b429dee
switch to more local variables
tomjn Dec 16, 2020
469dff6
more local variables in the provision-site script
tomjn Dec 16, 2020
1eddb39
add shdocs to the site provision script and use the first parameter o…
tomjn Dec 16, 2020
26b2af1
remove a deprecated parameter and revert to the default port 9003
tomjn Dec 18, 2020
5c7aea8
Merge pull request #2317 from Varying-Vagrant-Vagrants/add/better-pro…
tomjn Dec 18, 2020
5527e43
update shelldocs for provision-site.sh
tomjn Dec 18, 2020
d23f588
add xdebug info to the phpinnfo page if it's available
tomjn Dec 18, 2020
41005c1
remove deprecated xdebug parameters
tomjn Dec 18, 2020
d0b5a96
add a default VSCode XDebug config
tomjn Dec 18, 2020
049bc9a
add VSCode tasks for common vagrant actions
tomjn Dec 18, 2020
b5dd513
tell VSCode not to prompt for problem matchers when running tasks, an…
tomjn Dec 18, 2020
514a663
turn XDebug on when debugging with XDebug
tomjn Dec 18, 2020
5b73ac5
set the xdebug client host to _gateway
tomjn Dec 18, 2020
ec7812c
update output of debug mod switcher script to fix xdebug caplitalisation
tomjn Dec 19, 2020
1865b5a
fix Xdebug name in VSCode configs
tomjn Dec 19, 2020
baadf93
disable xdebug discover client host and remove a duplicated key
tomjn Dec 19, 2020
c091723
fix typo
tomjn Dec 19, 2020
2f7ca3e
Merge pull request #2322 from Varying-Vagrant-Vagrants/xdebug/port
tomjn Dec 23, 2020
70f0285
Merge pull request #2318 from Varying-Vagrant-Vagrants/modify/provisi…
tomjn Dec 24, 2020
ff71867
document provision-helpers.sh
tomjn Dec 24, 2020
f6ed56f
documents env.sh
tomjn Dec 24, 2020
7233051
documents deprecated.sh
tomjn Dec 24, 2020
deaefe0
change to /usr/bin/env bash and add a description to the provision files
tomjn Dec 24, 2020
ca5ff4c
move the provision.sh file description to an shdoc
tomjn Dec 24, 2020
e2962fc
add shdocs to provisioners.sh
tomjn Dec 24, 2020
efe981b
shdoc fixes
tomjn Dec 24, 2020
0ac2ac9
tweak the deprecated distro message
tomjn Dec 24, 2020
d23be0c
update changelog
tomjn Dec 24, 2020
29f51f4
Merge pull request #2325 from Varying-Vagrant-Vagrants/add/shdocs
tomjn Dec 24, 2020
f370682
activate debug develop aids and profiling at the same time in Xdebug
tomjn Dec 26, 2020
0208ce7
remove unnecessary sudo commands, and only run ifconfig if it's avail…
tomjn Dec 27, 2020
39d0e88
Fix a bad exit code when checking for lsb_release
tomjn Dec 27, 2020
af3ab69
only private ppas get https so switch back to http for launchpad
tomjn Dec 27, 2020
1188e23
don't enable and restart mailhog systemctl service if there is no sys…
tomjn Dec 27, 2020
6edaad6
don't perform network checks on docker
tomjn Dec 27, 2020
db949a9
don't reload systemctl on docker
tomjn Dec 27, 2020
36433f0
don't enable/start mailhog service on docker build
tomjn Dec 27, 2020
faccfe7
remove unnecessary sudo in WP CLI provisioner and ensure a folder is …
tomjn Dec 27, 2020
1d869fe
wp cli provisioning fixes
tomjn Dec 27, 2020
8551cee
don't cleanup the hosts file if it's a docker build
tomjn Dec 27, 2020
078c3ea
avoid restarting services during a docker build
tomjn Dec 27, 2020
917ab5a
dont restart nginx in docker builds
tomjn Dec 27, 2020
a13b640
print out that a hook has started
tomjn Dec 27, 2020
7d9fad5
dont run run mysql setup on docker build
tomjn Dec 27, 2020
9f774ad
limit the provisioners that run on docker build
tomjn Dec 27, 2020
cc3e5dc
time the running of hooks
tomjn Dec 27, 2020
fe62c9a
fix hook message output
tomjn Dec 27, 2020
9ae03f1
Use HTTPS instead of SSH for WP CLI Doctor
tomjn Dec 28, 2020
5bb7792
Update CHANGELOG.md
tomjn Dec 28, 2020
15c864b
Merge pull request #2330 from Varying-Vagrant-Vagrants/modify/wpclido…
tomjn Dec 28, 2020
70bf186
Improve php config installation (#2326)
tomjn Dec 29, 2020
d09ed31
add support for running composer update/install/create-project via co…
tomjn Dec 29, 2020
c24c928
document composer folders change and update changelog
tomjn Dec 29, 2020
653bba6
add support for npm and refactor how the subkeys are read so that the…
tomjn Dec 29, 2020
b82d952
refactor npm and composer folders processing to run them in the order…
tomjn Dec 29, 2020
a0a7014
fix else syntax error in provision-site
tomjn Dec 29, 2020
0aaae35
switch apt sources to node 14
tomjn Jan 4, 2021
b0d7888
force node 14, expand messaging, and force copy of the apt source
tomjn Jan 4, 2021
57185b0
Merge pull request #2333 from Varying-Vagrant-Vagrants/modify/node14
tomjn Jan 19, 2021
4e922a9
Update provision.sh
tomjn Jan 20, 2021
bee686b
add a vagrant command
tomjn Jan 20, 2021
8daa443
Merge pull request #2338 from Varying-Vagrant-Vagrants/add/vagrant-vm…
tomjn Jan 21, 2021
a48b337
Merge pull request #2337 from Varying-Vagrant-Vagrants/modify/php-con…
tomjn Jan 22, 2021
4b506e4
Update provision/core/vvv/provision.sh
tomjn Jan 22, 2021
10a3e9c
Merge branch 'develop' into fixes/docker
tomjn Jan 25, 2021
8c99583
Merge pull request #2329 from Varying-Vagrant-Vagrants/fixes/docker
tomjn Jan 25, 2021
fdc4be2
resave the Sequel Pro/Sequel Ace preset
tomjn Jan 28, 2021
fcf5e65
Add Nodesource PPA to the network checks
tomjn Feb 4, 2021
8cc4cef
Update provision.sh
tomjn Feb 4, 2021
bee4631
remove npm update
tomjn Feb 4, 2021
35acaba
Merge pull request #2353 from Varying-Vagrant-Vagrants/modify/node-apt
tomjn Feb 4, 2021
a648cb9
if /usr/bin/npm does not exist, purge and reinstall nodejs
tomjn Feb 5, 2021
8481a0a
Merge pull request #2354 from Varying-Vagrant-Vagrants/fix/missing-npm
tomjn Feb 5, 2021
bfb3e98
Merge pull request #2350 from Varying-Vagrant-Vagrants/add/nodesource…
tomjn Feb 5, 2021
1430d8a
Fix nodejs installation
Mte90 Feb 17, 2021
9a9c3ff
Merge pull request #2360 from Varying-Vagrant-Vagrants/Mte90-patch-1
tomjn Feb 17, 2021
34bd58c
fix(provision-site): fixing copy paste mistake, updating to search fo…
spenserhale Feb 22, 2021
4318d03
Merge pull request #2369 from spenserhale/fix_vvv_provision_site_script
tomjn Feb 22, 2021
80a9206
Merge pull request #2348 from Varying-Vagrant-Vagrants/fix/db_presets
tomjn Feb 22, 2021
ceed671
feat(log): print current log file in case of error
Mte90 Feb 25, 2021
fbe8b4c
feat(log): print current log file in case of error
Mte90 Feb 25, 2021
0002ab7
Make xdebug actually work
evertiro Mar 2, 2021
225303f
Make xdebug actually work
evertiro Mar 2, 2021
b3324d0
Merge pull request #2377 from evertiro/develop
tomjn Mar 2, 2021
05ba83d
Change "global" phpcs provisioning to be more modern.
msaggiorato Feb 16, 2021
067fdc2
Fix short option not available in v1
msaggiorato Feb 16, 2021
d2238bc
Changelog update
msaggiorato Feb 16, 2021
fcfddf3
Merge pull request #2378 from Varying-Vagrant-Vagrants/upgrade-phpcs-…
tomjn Mar 5, 2021
a510b72
added 2 helper functions to test if a module is enabled and if it's i…
tomjn Mar 5, 2021
f28e063
remove reliance on enabled mods for disabing and instead check ground…
tomjn Mar 5, 2021
a3ef5aa
refactor php debug module switcher, now checks if a mod is enabled an…
tomjn Mar 5, 2021
5f0e391
document the switch_php_debugmod changes
tomjn Mar 5, 2021
0e28a11
improve PHPCS provisioning logging
tomjn Mar 7, 2021
fcf6f3a
Update Vagrantfile
tomjn Mar 7, 2021
9069e35
Merge pull request #2383 from Varying-Vagrant-Vagrants/modify/splash-…
tomjn Mar 7, 2021
8468294
ensure a failed provisioner still says it failed after printing the l…
tomjn Mar 7, 2021
89610d9
Merge pull request #2374 from Varying-Vagrant-Vagrants/mte90/2096
tomjn Mar 7, 2021
59f2981
linting fixes
tomjn Mar 7, 2021
25b0700
Merge branch 'develop' into add/site-composer
tomjn Mar 8, 2021
7fd783a
Merge branch 'develop' into modify/better-php-debug-switcher
tomjn Mar 8, 2021
9a4f23b
Merge pull request #2381 from Varying-Vagrant-Vagrants/modify/better-…
tomjn Mar 8, 2021
4ad8611
change the default PHP from 7.3 to 7.4
tomjn Feb 23, 2021
f577fc0
Add a command to reset the default PHP if it has changed
tomjn Feb 23, 2021
a4bccc9
Merge pull request #2331 from Varying-Vagrant-Vagrants/add/site-composer
tomjn Mar 8, 2021
a44283c
Merge pull request #2371 from Varying-Vagrant-Vagrants/modify/php-74-…
tomjn Mar 8, 2021
44c41b3
Create config.yml
tomjn Mar 10, 2021
f77690b
fix an infinite loop when provisioners fail
tomjn Mar 13, 2021
f1035e9
fix a provisioning issue with PHP 8 packages being installed without …
tomjn Mar 13, 2021
89f386b
make the main provisioner files executable
tomjn Mar 13, 2021
994670e
fix a warning during first provision
tomjn Mar 13, 2021
7402586
Add Xdebug Info file
evertiro Mar 15, 2021
95902f5
Add Xdebug Info file
evertiro Mar 15, 2021
7b86b36
Update changelog
evertiro Mar 15, 2021
cdee793
Make the phpinfo/xdebug_info pages slightly more consistent and attra…
evertiro Mar 15, 2021
4531bbe
fix(noroot): on utilities
Mte90 Mar 15, 2021
4c8bba3
Merge pull request #2392 from Varying-Vagrant-Vagrants/mte90/fix-util…
tomjn Mar 15, 2021
11ddd62
Merge pull request #2391 from evertiro/issue/2382
tomjn Mar 15, 2021
549b356
fix inverted if check
tomjn Mar 15, 2021
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
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: VVV Troubleshooting
url: https://varyingvagrantvagrants.org/docs/en-US/troubleshooting/
about: Run through these to solve common issues
- name: VVV Support on Slack
url: https://varyingvagrantvagrants.org/docs/en-US/slack/
about: Join our support channel for help
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Icon\r\r
# And we provide our default host names in a dat file.
!/www/vvv-hosts

# not the phpinfo
!/www/phpinfo

# But not the custom phpMyAdmin config in the database-admin directory.
/www/default/database-admin/config.inc.custom.php
/certificates
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "VVV Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/srv/www/": "${workspaceRoot}/www/"
},
"preLaunchTask": "VVV Xdebug on"
}
]
}
74 changes: 74 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "2.0.0",
"tasks": [
{
"label": "VVV up/on",
"type": "shell",
"command": "vagrant up",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "VVV halt/off",
"type": "shell",
"command": "vagrant halt",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "VVV Reprovision",
"type": "shell",
"command": "vagrant up --provision",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "VVV back up databases",
"type": "shell",
"command": "vagrant ssh -c 'db_backup'",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "VVV Xdebug on",
"type": "shell",
"command": "vagrant ssh -c 'xdebug_on'",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "VVV Xdebug off",
"type": "shell",
"command": "vagrant ssh -c 'xdebug_off'",
"group": "vvv",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,45 @@ permalink: /docs/en-US/changelog/

# Changelog

## 3.5.x ( 2020 TBA )
## 3.6.x ( 2021 )

### Important Note

Lots of provisioners now run in strict mode. Your custom site and utility provisioners may fail if they do not handle bad return codes from commands correctly. For example if you ran `composer create-project` on a folder that was not empty, it will fail. In v3.5 this failure was ignored and the script continued despite the critical error, in v3.6 VVV will halt provisioning so that the error can be seen.

Make sure that commands are only ran at their appropriate times, e.g. only install things if they aren't installed, and if you're checking the return value of a command, do it in an if check, not as a temporary variable. If you're feeling adventurous you can unset the strict flags ( danger! ).

Finally, check that your custom modifications haven't been added in the official site templates.

### Enhancements

* Improve the way that PHPCS gets provisioned to avoid conflicts with composer v2 (#2357)
* PHP v7.4 is now the default PHP ( other versions are available on CLI if installed via `php73`, `php72`, etc )
* Beautify the PHP debug switcher script
* Support for basic formatting tags in `vvv_warn` `vvv_error` `vvv_info` and `vvv_success`
* A new `vvv_output` and `vvv_format_output` bash functions
* Minor refactors and colours added to the main provisioner
* Improved output of backup and import scripts
* SHDocs added to core provisioners
* Improved PHP configuration file installation
* Sites can now define composer create-project/install/update commands to run in their folders section in addition to the git options added in v3.5.1
* Adds a `vagrant` command inside the virtual machine to tell users they are still inside the VM and need to exit
* `switch_php_debugmod` now checks if a module is installed and enabled, with improved output to make it clearer which versions of PHP support the module
* Print provision log if there are errors
* Adds an Xdebug Info button to the dashboard when Xdebug is enabled

### Bug Fixes

* Fixed the use of `vvv_warn` `vvv_success` `vvv_error` and `vvv_info` outside of provisioners
* Don't try to install shyaml if it's already installed
* Global composer packages were only updated when composer itself was updated
* Skip the WordPress unit tests database when running backups
* Don't back up databases that have no tables
* Xdebug deprecated configuration option warnings fixed
* Use HTTPS instead of SSH for WP CLI Doctor subcommand installation
* Install missing library for Xdebug support

## 3.5.1 ( 2020 December 11th )

### Enhancements

Expand Down
13 changes: 10 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,19 @@ show_logo = false if ENV['VVV_SKIP_LOGO']
if show_logo
git_or_zip = 'zip-no-vcs'
branch = ''
commit = ''
if File.directory?("#{vagrant_dir}/.git")
git_or_zip = 'git::'
branch = `git --git-dir="#{vagrant_dir}/.git" --work-tree="#{vagrant_dir}" rev-parse --abbrev-ref HEAD`
branch = branch.chomp("\n"); # remove trailing newline so it doesn't break the ascii art
commit = `git --git-dir="#{vagrant_dir}/.git" --work-tree="#{vagrant_dir}" rev-parse --short HEAD`
commit = '(' + commit.chomp("\n") + ')'; # remove trailing newline so it doesn't break the ascii art
end

splashfirst = <<~HEREDOC
\033[1;38;5;196m#{red}__ #{green}__ #{blue}__ __
#{red}\\ V#{green}\\ V#{blue}\\ V / #{red}Varying #{green}Vagrant #{blue}Vagrants
#{red} \\_/#{green}\\_/#{blue}\\_/ #{purple}v#{version}#{creset}-#{branch_c}#{git_or_zip}#{branch}#{creset}
#{red} \\_/#{green}\\_/#{blue}\\_/ #{purple}v#{version}#{creset}-#{branch_c}#{git_or_zip}#{branch}#{commit}#{creset}

HEREDOC
puts splashfirst
Expand Down Expand Up @@ -303,7 +306,11 @@ if show_logo
platform << 'HyperV-Enabled '
end
platform << 'HyperV-Admin ' if Vagrant::Util::Platform.windows_hyperv_admin?
platform << 'HasWinAdminPriv ' if Vagrant::Util::Platform.windows_admin?
if Vagrant::Util::Platform.windows_admin?
platform << 'HasWinAdminPriv '
else
platform << 'missingWinAdminPriv ' unless Vagrant::Util::Platform.windows_admin?
end
else
platform << 'shell:' + ENV['SHELL'] if ENV['SHELL']
platform << 'systemd ' if Vagrant::Util::Platform.systemd?
Expand All @@ -317,7 +324,7 @@ if show_logo

platform << 'CaseSensitiveFS' if Vagrant::Util::Platform.fs_case_sensitive?
unless Vagrant::Util::Platform.terminal_supports_colors?
platform << 'NoColour'
platform << 'monochrome-terminal'
end

if defined? vvv_config['vm_config']['wordcamp_contributor_day_box']
Expand Down
33 changes: 24 additions & 9 deletions config/homebin/db_backup
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,46 @@
# Create individual SQL files for each database. These files
# are imported automatically during an initial provision if
# the databases exist per the import-sql.sh process.
set -eo pipefail

trap 'rm -rf $TMPFIFODIR' EXIT; TMPFIFODIR=$(mktemp -d); mkfifo $TMPFIFODIR/dbnames

source /srv/provision/provision-helpers.sh

mkdir -p /srv/database/backups
echo " * Performing Database Backups"
vvv_info " * Performing Database Backups"
databases=()

echo " * Querying Database names"
vvv_info " * Fetching Database names"
mysql --user="root" --password="root" -e 'show databases' | \
grep -v -F "Database" > $TMPFIFODIR/dbnames &
echo " * Processing names"
while read db_name
do
# skip these databases
[ "${db_name}" == "mysql" ] && echo " - skipped ${db_name}" && continue;
[ "${db_name}" == "information_schema" ] && echo " - skipped ${db_name}" && continue;
[ "${db_name}" == "performance_schema" ] && echo " - skipped ${db_name}" && continue;
[ "${db_name}" == "test" ] && echo " - skipped ${db_name}" && continue;
[ "${db_name}" == "mysql" ] && vvv_info " - skipped <b>${db_name}</b>" && continue;
[ "${db_name}" == "information_schema" ] && vvv_info " - skipped <b>${db_name}</b>" && continue;
[ "${db_name}" == "performance_schema" ] && vvv_info " - skipped <b>${db_name}</b>" && continue;
[ "${db_name}" == "test" ] && vvv_info " - skipped ${db_name}" && continue;
[ "${db_name}" == "wordpress_unit_tests" ] && vvv_info " - skipped <b>${db_name}</b>" && continue;

# don't back up databases with no tables
mysql_cmd="SHOW TABLES FROM \`${db_name}\`" # Required to support hyphens in database names
db_exist=$(mysql -u root -proot --skip-column-names -e "${mysql_cmd}")
if [ "$?" == "0" ]; then
if [ "" == "${db_exist}" ]; then
vvv_info " - skipped <b>${db_name}</b><info>, no tables in database to back up</info>" && continue;
fi
fi
databases+=( "${db_name}" )
done < $TMPFIFODIR/dbnames

count=0
for db in "${databases[@]}"
do
printf " - %2s/%s Backing up %-23s to 'database/backups/%s.sql'\n" "${count}" "${#databases[@]}" "'${db}'" "${db}"
OUTPUT=$(printf "<info> - %2s/%s Backing up </info><b>%-23s</b><info> to </info><b>'database/backups/%s.sql'</b>" "${count}" "${#databases[@]}" "'${db}'" "${db}")
vvv_output "${OUTPUT}"
mysqldump -uroot -proot "${db}" > "/srv/database/backups/${db}.sql";
let "count=count+1"
done
echo " * Finished backing up databases to the database/sql/backups folder"

vvv_success " * Finished backing up databases to the <b>database/sql/backups</b><success> folder</success>"
63 changes: 48 additions & 15 deletions config/homebin/switch_php_debugmod
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

set -eo pipefail


source /srv/provision/provision-helpers.sh

# Grab the currently active PHP mods, and lowercase it for comparison
enabled_mods=$(php -m)
enabled_mods=${enabled_mods,,}
Expand All @@ -22,47 +24,78 @@ disable_phpmods() {
# declare that our first param is an array
declare -a mods=("${!1}")

# Take the mods array and turn it into a commar separated list
local mods_joined=$(printf ", %s" "${mods[@]}")
mods_joined=${mods_joined:1}
mods_joined="${mods_joined#"${mods_joined%%[![:space:]]*}"}"
echo " * Disabling if present: '${mods_joined}'"

for i in "${mods[@]}"
do
if [[ ${enabled_mods,,} == *"${i}"* ]]; then
echo " * Disabling active module: '${i}'"
sudo phpdismod "${i}"
fi
for phpv in $(phpquery -V)
do
if is_module_enabled_fpm "${phpv}" "${i}"; then
vvv_info " ✘ Disabling active PHP <b>v${phpv}</b><info> debug mod: </info><b>'${i}'</b>"
sudo phpdismod -v "${phpv}" "${i}"
fi
done
done
}

enable_phpmod() {
echo " * Enabling '${1}'"
sudo phpenmod "${1}"
for phpv in $(phpquery -V)
do
if is_module_installed_fpm "${phpv}" "${1}"; then
vvv_info " * Enabling <b>'${1}'</b><info> for PHP <b>v${phpv}</b>"
sudo phpenmod -q -v "${phpv}" -s fpm "${1}"
sudo phpenmod -q -v "${phpv}" -s cli "${1}"
else
vvv_info " * Skipped enabling ${1} in PHP <b>v${phpv}</b><info>, module isn't installed for this version"
fi
done
}

is_module_enabled_fpm() {
if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ]; then
return 0
fi
return 1
}

is_module_installed_fpm() {
if [ -f "/etc/php/${1}/mods-available/${2}.ini" ]; then
return 0
fi
return 1
}

restart_phpfpm() {
echo " * Restarting PHP FPM's so the change takes effect"
vvv_info " * Restarting PHP FPM services so that the change takes effect"
find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;
}

echo " * Disabling active debug PHP mods"
disable_phpmods phpmods[@]

if [[ "${mod}" == "none" ]]; then
restart_phpfpm
vvv_success " ✔ All PHP Debug mods are now turned off."
exit 0
fi

if [[ "${mod}" == "pcov" ]]; then
vvv_info " * pcov supports PHP 7.1 and above, it is not available for 5.6 and 7.0"
fi

# Tideways needs 2 mods enabling
if [[ "${mod}" == "tideways" ]]; then
enable_phpmod "xhgui"
enable_phpmod "tideways_xhprof"
restart_phpfpm
vvv_success " ✔ PHP Debug mod switch to <b>${mod}</b><success> complete.</success>"
exit 0
fi

if [[ "${mod}" == "xdebug" ]]; then
# Ensure the log file for xdebug is group writeable.
vvv_info " * Making sure log/php/xdebug-remote.log is readable and present"
sudo touch /var/log/php/xdebug-remote.log
sudo chmod 664 /var/log/php/xdebug-remote.log
fi

enable_phpmod "${mod}"
restart_phpfpm
vvv_success " ✔ PHP Debug mod switch to <b>${mod}</b><success> on all available PHP versions complete.</success>"
15 changes: 15 additions & 0 deletions config/homebin/vagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -eo pipefail
source /srv/provision/provision-helpers.sh

echo -e "${CRESET}"
echo -e "${YELLOW} ? ▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄ ? ${CRESET}"
echo -e "${YELLOW} ✧█▒▒░░░░░░░░░▒▒█ ${CRESET}"
echo -e "${YELLOW} ? █░░█░░░░░█░░█ ? ${CRESET}"
echo -e "${YELLOW} █▄░▀█▀░░░░█ ? ${CRESET}"
echo -e "${YELLOW} █░░█░░░░░░▄▀ ${CRESET}"
echo -e "${YELLOW}──────────────────────${CRESET}"
echo ""
echo -e "${PURPLE} ! You're still SSH'd into the VVV virtual machine!${CRESET}"
echo -e "${PURPLE} Run exit and try again${CRESET}"
Loading