From 92a15037fb0e23cb16f83ebb48e53c31d3eacaa6 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 14 Dec 2023 16:09:48 -0500 Subject: [PATCH 1/5] add .nvmrc as v16 --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..6f7f377 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16 From 7e7764fd64edfa293cb33bdddad4c3164546bdcf Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 14 Dec 2023 16:10:06 -0500 Subject: [PATCH 2/5] fix autofixable lint issues in test file --- tests/cypress/integration/performance.cy.js | 90 ++++++++++----------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/tests/cypress/integration/performance.cy.js b/tests/cypress/integration/performance.cy.js index 5473eb0..eab3f11 100644 --- a/tests/cypress/integration/performance.cy.js +++ b/tests/cypress/integration/performance.cy.js @@ -1,61 +1,59 @@ // -describe('Performance Page', function () { - let appClass = '.' + Cypress.env('appId'); - - before(() => { - cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/performance'); +describe( 'Performance Page', function () { + const appClass = '.' + Cypress.env( 'appId' ); + + before( () => { + cy.visit( + '/wp-admin/admin.php?page=' + + Cypress.env( 'pluginId' ) + + '#/performance' + ); cy.injectAxe(); - - }); + } ); - it('Is Accessible', () => { - cy.wait(500); - cy.checkA11y( appClass + '-app-body'); - }); + it( 'Is Accessible', () => { + cy.wait( 500 ); + cy.checkA11y( appClass + '-app-body' ); + } ); - it('Has Cache Settings', () => { - cy.get('.newfold-cache-settings') + it( 'Has Cache Settings', () => { + cy.get( '.newfold-cache-settings' ) .scrollIntoView() - .should('be.visible'); - }); + .should( 'be.visible' ); + } ); - it('Has Clear Cache Settings', () => { - cy.get('.newfold-clear-cache') + it( 'Has Clear Cache Settings', () => { + cy.get( '.newfold-clear-cache' ) .scrollIntoView() - .should('be.visible'); - }); - - it('Clear Cache Disabled when Cache is Disabled', () => { + .should( 'be.visible' ); + } ); - cy.get('input[type="radio"]#cache-level-0').check(); + it( 'Clear Cache Disabled when Cache is Disabled', () => { + cy.get( 'input[type="radio"]#cache-level-0' ).check(); - cy.wait(500); + cy.wait( 500 ); - cy.get('.clear-cache-button') + cy.get( '.clear-cache-button' ) .scrollIntoView() - .should('have.attr', 'disabled'); + .should( 'have.attr', 'disabled' ); - cy.get('input[type="radio"]#cache-level-1').check(); + cy.get( 'input[type="radio"]#cache-level-1' ).check(); - cy.get('.clear-cache-button') + cy.get( '.clear-cache-button' ) .scrollIntoView() - .should('not.have.attr', 'disabled'); - - cy.get('.nfd-notifications') - .contains('p', 'Cache') - .should('be.visible'); - }); - - it('Clear Cache Button Functions', () => { - - cy.get('.clear-cache-button').click(); - - - cy.get('.nfd-notifications') - .contains('p', 'Cache cleared') - .should('be.visible'); - - }); - -}); + .should( 'not.have.attr', 'disabled' ); + + cy.get( '.nfd-notifications' ) + .contains( 'p', 'Cache' ) + .should( 'be.visible' ); + } ); + + it( 'Clear Cache Button Functions', () => { + cy.get( '.clear-cache-button' ).click(); + + cy.get( '.nfd-notifications' ) + .contains( 'p', 'Cache cleared' ) + .should( 'be.visible' ); + } ); +} ); From a1aef63bd2ead8ec26e22d8079d9628db8ee296c Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 14 Dec 2023 16:10:20 -0500 Subject: [PATCH 3/5] add brand plugin test workflow --- .github/workflows/brand-plugin-test.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/brand-plugin-test.yml diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml new file mode 100644 index 0000000..e69de29 From 83596ee5fbf234d05ac29a5a8ba73a4fa3223d20 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 14 Dec 2023 16:12:05 -0500 Subject: [PATCH 4/5] add brand plugin test workflow --- .github/workflows/brand-plugin-test.yml | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml index e69de29..f31d801 100644 --- a/.github/workflows/brand-plugin-test.yml +++ b/.github/workflows/brand-plugin-test.yml @@ -0,0 +1,74 @@ +name: Build and Test Module Updates in Brand Plugins +on: + pull_request: + types: [ opened, reopened, ready_for_review, synchronize ] + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.extract_branch.outputs.branch }} + steps: + + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + bluehost: + name: Bluehost Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'bluehost/bluehost-wordpress-plugin' + secrets: inherit + + hostgator: + name: HostGator Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-hostgator' + secrets: inherit + + web: + name: Web.com Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-web' + secrets: inherit + + crazydomains: + name: Crazy Domains Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-crazy-domains' + secrets: inherit + + mojo: + name: Mojo Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-mojo' + secrets: inherit From 3f05819ed43940763e1f537beac27abfbf41a229 Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Thu, 22 Feb 2024 13:37:46 -0500 Subject: [PATCH 5/5] Ensure that the URL has a trailing slash. This ensures that the PHP_URL_PATH is always set, which prevents the str_replace() call from outputting "Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated" --- includes/CacheTypes/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/CacheTypes/File.php b/includes/CacheTypes/File.php index c9a0b77..a88e569 100644 --- a/includes/CacheTypes/File.php +++ b/includes/CacheTypes/File.php @@ -7,8 +7,8 @@ use NewfoldLabs\WP\Module\Performance\Performance; use NewfoldLabs\WP\ModuleLoader\Container; use WP_Forge\WP_Htaccess_Manager\htaccess; - use wpscholar\Url; + use function NewfoldLabs\WP\Module\Performance\getCacheLevel; use function NewfoldLabs\WP\Module\Performance\removeDirectory; use function NewfoldLabs\WP\Module\Performance\shouldCachePages; @@ -299,7 +299,7 @@ protected function getStoragePathForRequest() { if ( ! isset( $path ) ) { $url = new Url(); - $basePath = wp_parse_url( home_url(), PHP_URL_PATH ); + $basePath = wp_parse_url( home_url('/'), PHP_URL_PATH ); $path = trailingslashit( self::CACHE_DIR . str_replace( $basePath, '', esc_url( $url->path ) ) ); }