-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pcov extension * Add command * Better --------- Co-authored-by: Christian Fritsch <[email protected]>
- Loading branch information
1 parent
7f0b9c2
commit 2fd5a36
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
## #ddev-generated | ||
## Description: Enable or disable pcov | ||
## Usage: pcov on|off|enable|disable|true|false|toggle|status | ||
## Example: "ddev pcov" (default is "on"), "ddev pcov off", "ddev pcov on", "ddev pcov toggle", "ddev pcov status" | ||
## ExecRaw: false | ||
## Flags: [] | ||
## AutocompleteTerms: ["on","off","enable","disable","toggle","status"] | ||
|
||
get_pcov_status() { | ||
php -r 'echo extension_loaded("pcov") ? "1" : "0";' | ||
} | ||
|
||
enable_pcov() { | ||
phpenmod -v "${DDEV_PHP_VERSION}" pcov | ||
} | ||
|
||
disable_pcov() { | ||
phpdismod -v "${DDEV_PHP_VERSION}" pcov | ||
} | ||
|
||
if [ $# -eq 0 ] ; then | ||
enable_pcov | ||
exit | ||
fi | ||
|
||
case $1 in | ||
on|true|enable) | ||
enable_pcov | ||
;; | ||
off|false|disable) | ||
disable_pcov | ||
;; | ||
toggle) | ||
status=$(get_pcov_status) | ||
if [ "${status}" = "1" ]; then | ||
disable_pcov | ||
else | ||
enable_pcov | ||
fi | ||
;; | ||
status) | ||
status=$(get_pcov_status) | ||
if [ "${status}" = "1" ]; then | ||
result="pcov enabled" | ||
else | ||
result="pcov disabled" | ||
fi | ||
echo $result | ||
;; | ||
*) | ||
echo "Invalid argument: $1" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ENV extension=pcov | ||
SHELL ["/bin/bash", "-c"] | ||
# Install the needed development packages | ||
RUN (apt-get update || true) && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests build-essential php-pear php${DDEV_PHP_VERSION}-dev | ||
# Install the extension | ||
RUN pecl install ${extension} | ||
RUN echo "extension=${extension}.so" > /etc/php/${DDEV_PHP_VERSION}/mods-available/${extension}.ini && chmod 666 /etc/php/${DDEV_PHP_VERSION}/mods-available/${extension}.ini |