-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add support for users * Upgrade shivammathur/setup-php in CI (#35) * add support for users * Upgrade CI (#34) from https://github.com/ergebnis/php-library-template * Upgrade shivammathur/setup-php in CI Co-authored-by: leogermani <[email protected]> * fix retun of get_metadata when meta is not found * remove unecessary inheritance * make test more strict * Use szepeviktor/phive-install action (#36) It is a brand new GitHub action * fix linting * fix no user found return value * add test for non existent meta * enable WP_debug fix delete_option fix tests with wp_debug on * Fix CS (#38) * Do not abuse existing domain names (#37) Please see https://tools.ietf.org/html/rfc2606#section-2 * Handle cache gently * remove useless declaration. avoid conflict * Update README.md Co-authored-by: Viktor Szépe <[email protected]> Co-authored-by: Viktor Szépe <[email protected]>
- Loading branch information
1 parent
ef84448
commit f3e55e0
Showing
16 changed files
with
820 additions
and
336 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 |
---|---|---|
|
@@ -32,7 +32,7 @@ jobs: | |
uses: "actions/[email protected]" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/setup-php@2.4.1" | ||
uses: "shivammathur/setup-php@2.8.0" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
|
@@ -43,39 +43,31 @@ jobs: | |
run: "composer validate --strict" | ||
|
||
- name: "Determine composer cache directory" | ||
id: "determine-composer-cache-directory" | ||
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | ||
shell: "bash" | ||
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" | ||
|
||
- name: "Cache PHAR files installed with phive" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "~/.phive" | ||
path: "${{ runner.temp }}/.phive" | ||
key: "php-${{ matrix.php-version }}-phive-${{ matrix.dependencies }}-${{ hashFiles('.phive/phars.xml') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-phive-${{ matrix.dependencies }}-" | ||
|
||
- name: "Install phive from cache" | ||
run: | | ||
if [ ! -r "${HOME}/.phive/phive.phar" ]; then | ||
mkdir -p "${HOME}/bin" "${HOME}/.phive" | ||
wget -O "${HOME}/.phive/phive.phar" "https://phar.io/releases/phive.phar" | ||
wget -O "${HOME}/.phive/phive.phar.asc" "https://phar.io/releases/phive.phar.asc" | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=30 --recv-keys 0x9D8A98B29B2D5D79 \ | ||
|| gpg --batch --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=30 --recv-keys 0x9D8A98B29B2D5D79 | ||
if ! gpg --batch --verify "${HOME}/.phive/phive.phar.asc" "${HOME}/.phive/phive.phar"; then | ||
echo "Invalid phive signature" 1>&2 | ||
rm -f "${HOME}/.phive/phive.phar" | ||
exit 11 | ||
fi | ||
rm "${HOME}/.phive/phive.phar.asc" | ||
fi | ||
install --verbose --mode=0755 -T -D "${HOME}/.phive/phive.phar" "${HOME}/bin/phive" | ||
echo "::add-path::${HOME}/bin" | ||
"${HOME}/bin/phive" install --trust-gpg-keys C00543248C87FB13,31C7E470E2138192 | ||
- name: "Install PHIVE" | ||
uses: "szepeviktor/phive@v1" | ||
with: | ||
home: "${{ runner.temp }}/.phive" | ||
|
||
- name: "Install PHP tools with PHIVE" | ||
uses: "szepeviktor/phive-install@v1" | ||
with: | ||
home: "${{ runner.temp }}/.phive" | ||
trustGpgKeys: "C00543248C87FB13,31C7E470E2138192" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | ||
path: "${{ env.COMPOSER_CACHE_DIR }}" | ||
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" | ||
|
||
|
@@ -118,47 +110,39 @@ jobs: | |
uses: "actions/[email protected]" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/setup-php@2.4.1" | ||
uses: "shivammathur/setup-php@2.8.0" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
coverage: "none" | ||
tools: "composer:v1" | ||
|
||
- name: "Determine composer cache directory" | ||
id: "determine-composer-cache-directory" | ||
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | ||
shell: "bash" | ||
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" | ||
|
||
- name: "Cache PHAR files installed with phive" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "~/.phive" | ||
path: "${{ runner.temp }}/.phive" | ||
key: "php-${{ matrix.php-version }}-phive-${{ matrix.dependencies }}-${{ hashFiles('.phive/phars.xml') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-phive-${{ matrix.dependencies }}-" | ||
|
||
- name: "Install phive from cache" | ||
run: | | ||
if [ ! -r "${HOME}/.phive/phive.phar" ]; then | ||
mkdir -p "${HOME}/bin" "${HOME}/.phive" | ||
wget -O "${HOME}/.phive/phive.phar" "https://phar.io/releases/phive.phar" | ||
wget -O "${HOME}/.phive/phive.phar.asc" "https://phar.io/releases/phive.phar.asc" | ||
gpg --batch --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=30 --recv-keys 0x9D8A98B29B2D5D79 \ | ||
|| gpg --batch --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=30 --recv-keys 0x9D8A98B29B2D5D79 | ||
if ! gpg --batch --verify "${HOME}/.phive/phive.phar.asc" "${HOME}/.phive/phive.phar"; then | ||
echo "Invalid phive signature" 1>&2 | ||
rm -f "${HOME}/.phive/phive.phar" | ||
exit 11 | ||
fi | ||
rm "${HOME}/.phive/phive.phar.asc" | ||
fi | ||
install --verbose --mode=0755 -T -D "${HOME}/.phive/phive.phar" "${HOME}/bin/phive" | ||
echo "::add-path::${HOME}/bin" | ||
"${HOME}/bin/phive" install --trust-gpg-keys C00543248C87FB13,31C7E470E2138192 | ||
- name: "Install PHIVE" | ||
uses: "szepeviktor/phive@v1" | ||
with: | ||
home: "${{ runner.temp }}/.phive" | ||
|
||
- name: "Install PHP tools with PHIVE" | ||
uses: "szepeviktor/phive-install@v1" | ||
with: | ||
home: "${{ runner.temp }}/.phive" | ||
trustGpgKeys: "C00543248C87FB13,31C7E470E2138192" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | ||
path: "${{ env.COMPOSER_CACHE_DIR }}" | ||
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" | ||
|
||
|
@@ -211,21 +195,21 @@ jobs: | |
uses: "actions/[email protected]" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/setup-php@2.4.1" | ||
uses: "shivammathur/setup-php@2.8.0" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
coverage: "none" | ||
tools: "composer:v1" | ||
|
||
- name: "Determine composer cache directory" | ||
id: "determine-composer-cache-directory" | ||
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | ||
shell: "bash" | ||
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | ||
path: "${{ env.COMPOSER_CACHE_DIR }}" | ||
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" | ||
|
||
|
@@ -265,21 +249,21 @@ jobs: | |
uses: "actions/[email protected]" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/setup-php@2.4.1" | ||
uses: "shivammathur/setup-php@2.8.0" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.PHP_EXTENSIONS }}" | ||
coverage: "none" | ||
tools: "composer:v1" | ||
|
||
- name: "Determine composer cache directory" | ||
id: "determine-composer-cache-directory" | ||
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | ||
shell: "bash" | ||
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
with: | ||
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" | ||
path: "${{ env.COMPOSER_CACHE_DIR }}" | ||
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" | ||
|
||
|
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
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
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,28 @@ | ||
<?php | ||
|
||
namespace WorDBless; | ||
|
||
trait ClearCacheGroup { | ||
|
||
/** | ||
* Clears the cache for the current group | ||
* | ||
* @return void | ||
*/ | ||
public function clear_cache_group() { | ||
global $wp_object_cache; | ||
|
||
if ( ! $this->cache_group ) { | ||
return; | ||
} | ||
|
||
if ( ! isset( $wp_object_cache->cache[ $this->cache_group ] ) || ! is_array( $wp_object_cache->cache[ $this->cache_group ] ) ) { | ||
return; | ||
} | ||
|
||
foreach ( array_keys( $wp_object_cache->cache[ $this->cache_group ] ) as $key ) { | ||
wp_cache_delete( $key, $this->cache_group ); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.
f3e55e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉