Skip to content

Commit

Permalink
3.9.0.1 (#3986)
Browse files Browse the repository at this point in the history
* Fixes #3478 Enable installation through composer v2 (PR #3928)

* update woocommerce from wpackagist
* update woocommerce paths
* use composer v2 in GH actions

* Re-add change to remove disable preload fonts when CPCSS is enabled (PR #3927)

* remove callback disabling preload fonts
* remove associated tests

* Stop preload while prewarmup is running (PR #3925)

* start automatic preload just after prewarmup finishes its work
* Block manual preload till finishing prewarmup
* check the RUCSS option enabled along with allow_optimization
* fix old tests
* [WIP] stop preload with enabling RUCSS
* migrate maybe_cancel_preload to RUCSS admin subscriber
* fix old tests

* remove charset=UTF-8 (PR #3946)

* remove charset=UTF-8
* remove charset=UTF-8 from delete

* Add unit tests code coverage (PR #3922)

* add code coverage command
* update incorrect annotations
* add cove coverage action
* enable xdebug for coverage

* Fix failing tests related to adding prewarmup functionality (PR #3949)

* Guard our code by checking if table is exists before updating prewarmup
* With switch_theme only start scanner when RUCSS is enabled

* change trigger event to push

* Fixes RUCSS tests: update time to prevent tests failures (PR #3973)

* Fixes #3600 add wpstage to staging servers list (PR #3948)

* add wpstage to staging servers

* remove image optimization when WP_ROCKET_WHITE_LABEL_ACCOUNT (PR #3956)

* remove image optimization menu when WP_ROCKET_WHITE_LABEL_ACCOUNT is used

* Add Hubspot iframe inline JS exclusion from combine JS (PR #3943)

* Fixes #3945 Display warning when WP Meteor is enabled with WP Rocket delay JS (PR #3974)

* add new add_plugins_incompatibility() method
* add options class to settings class dependencies
* updating existing tests
* add add_plugins_incompatibility() test file
* add unit & integration tests

* Fixes #3924 Remove unnecessary more info link in RUCSS pre-warmup copy (PR #3981)

* Compatibility with Impreza theme (PR #3972)

* Add Impreza inline script pattern to exclude
* Add Fixtures

Co-authored-by: Rémy Perona <remperona@gmail.com>

* Update delay JS script (PR #3971)

* update delay JS script
* update delay JS fixture
* add touchchancel and touchforcechange events
* update fixture with new events

* Fixes #2876 Remove beacon button when white label is enabled (PR #3965)

* remove beacon btn if white label is true
* remove ask support button too

* Add additional delay JS exclusions (PR #3975)

* Add additional exclusions from delay JS
* Update fixtures

* update plugin version to 3.9.0.1

* update operator in version_compare

Co-authored-by: Ahmed Saed <eng.ahmeds3ed@gmail.com>
Co-authored-by: mostafa-hisham <mostafa.hisham.mahmoud@gmail.com>
Co-authored-by: Natalia Drause <60236665+NataliaDrause@users.noreply.github.com>
Co-authored-by: Jonathan Buttigieg <jonathan@wp-media.me>
  • Loading branch information
5 people committed Jun 3, 2021
1 parent 0e3a5d1 commit 48f5466
Show file tree
Hide file tree
Showing 79 changed files with 707 additions and 332 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/code_coverage.yml
@@ -0,0 +1,74 @@
name: PHPUnit Code Coverage

on:
push:
branches:
- develop

jobs:
run:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4']
wp-versions: ['latest']

name: Code Coverage.

env:
WP_TESTS_DIR: "/tmp/tests/phpunit"
WP_CORE_DIR: "/tmp/wordpress-develop"
ROCKETCDN_EMAIL: ${{ secrets.ROCKETCDN_EMAIL }}
ROCKETCDN_PWD: ${{ secrets.ROCKETCDN_PWD }}
ROCKETCDN_TOKEN: ${{ secrets.ROCKETCDN_TOKEN }}
ROCKETCDN_URL: ${{ secrets.ROCKETCDN_URL }}
ROCKETCDN_WEBSITE_ID: ${{ secrets.ROCKETCDN_WEBSITE_ID }}
ROCKET_EMAIL: ${{ secrets.ROCKET_EMAIL }}
ROCKET_KEY: ${{ secrets.ROCKET_KEY }}
ROCKET_CLOUDFLARE_API_KEY: ${{ secrets.ROCKET_CLOUDFLARE_API_KEY }}
ROCKET_CLOUDFLARE_EMAIL: ${{ secrets.ROCKET_CLOUDFLARE_EMAIL }}
ROCKET_CLOUDFLARE_SITE_URL: ${{ secrets.ROCKET_CLOUDFLARE_SITE_URL }}
ROCKET_CLOUDFLARE_ZONE_ID: ${{ secrets.ROCKET_CLOUDFLARE_ZONE_ID }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
tools: composer:v1, phpunit

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-scripts

- name: Code Coverage
run: composer code-coverage

- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: tests/report/coverage.clover
8 changes: 4 additions & 4 deletions .github/workflows/lint_phpcs.yml
Expand Up @@ -11,13 +11,13 @@ on:
jobs:
run:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4']

name: WPRocket lint with PHPCS. PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.
steps:
- name: Checkout
Expand All @@ -28,7 +28,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
coverage: none # XDebug can be enabled here 'coverage: xdebug'
tools: composer:v1
tools: composer:v2

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-scripts
Expand All @@ -37,4 +37,4 @@ jobs:
run: |
vendor/bin/phpcs --config-set installed_paths ../../phpcompatibility/phpcompatibility-paragonie,../../phpcompatibility/phpcompatibility-wp,../../wp-coding-standards/wpcs,../../phpcompatibility/php-compatibility
composer phpcs
2 changes: 1 addition & 1 deletion .github/workflows/test_php8.yml
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
coverage: none # XDebug can be enabled here 'coverage: xdebug'
tools: composer:v1, phpunit
tools: composer:v2, phpunit

- name: Start mysql service
run: sudo /etc/init.d/mysql start
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_wprocket.yml
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
coverage: none # XDebug can be enabled here 'coverage: xdebug'
tools: composer:v1, phpunit
tools: composer:v2, phpunit

- name: Start mysql service
run: sudo /etc/init.d/mysql start
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/test_wprocket_legacy.yml
Expand Up @@ -11,16 +11,16 @@ on:
jobs:
run:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.1', '7.2']
wp-versions: ['5.3.6']

name: WP ${{ matrix.wp-versions }} with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}.

env:
WP_TESTS_DIR: "/tmp/tests/phpunit"
WP_CORE_DIR: "/tmp/wordpress-develop"
Expand All @@ -46,11 +46,11 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: mysqli
coverage: none # XDebug can be enabled here 'coverage: xdebug'
tools: composer:v1, phpunit
tools: composer:v2, phpunit

- name: Start mysql service
run: sudo /etc/init.d/mysql start

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

Expand All @@ -60,7 +60,7 @@ jobs:
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -70,13 +70,13 @@ jobs:

- name: Remove unmet dependencies by legacy versions
run: composer remove --dev --no-scripts phpstan/phpstan szepeviktor/phpstan-wordpress coenjacobs/mozart

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-scripts

- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-versions }}

- name: Mysql8 auth plugin workaround
run: sudo mysql -u root -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"

Expand Down
2 changes: 1 addition & 1 deletion assets/js/lazyload-scripts.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions assets/js/wpr-cpcss.js
Expand Up @@ -85,7 +85,7 @@ const checkCPCSSGeneration = ( timeout = null, is_mobile = false ) => {
};

xhttp.open( 'POST', rocket_cpcss.rest_url, true );
xhttp.setRequestHeader( 'Content-Type', 'application/json;charset=UTF-8' );
xhttp.setRequestHeader( 'Content-Type', 'application/json' );
xhttp.setRequestHeader( 'X-WP-Nonce', rocket_cpcss.rest_nonce );
xhttp.send( JSON.stringify( { timeout: timeout, is_mobile: is_mobile } ) );
}
Expand Down Expand Up @@ -125,7 +125,7 @@ const deleteCPCSS = () => {
};

xhttp.open( 'DELETE', rocket_cpcss.rest_url, true );
xhttp.setRequestHeader( 'Content-Type', 'application/json;charset=UTF-8' );
xhttp.setRequestHeader( 'Content-Type', 'application/json' );
xhttp.setRequestHeader( 'X-WP-Nonce', rocket_cpcss.rest_nonce );
xhttp.send();
}
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Expand Up @@ -21,7 +21,8 @@
"sort-packages": true,
"preferred-install": {
"wp-media/phpunit": "source"
}
},
"process-timeout": 0
},
"support": {
"issues": "https://github.com/wp-media/wp-rocket/issues",
Expand Down Expand Up @@ -53,7 +54,6 @@
"phpunit/phpunit": "^7.5",
"roave/security-advisories": "dev-master",
"szepeviktor/phpstan-wordpress": "^0.7.0",
"woocommerce/woocommerce": "^3.9",
"wp-coding-standards/wpcs": "^2",
"wp-media/background-processing": "^1.3",
"wp-media/cloudflare": "^1.0",
Expand All @@ -67,6 +67,7 @@
"wpackagist-plugin/pdf-embedder": "^4.6",
"wpackagist-plugin/simple-custom-css": "^4.0.3",
"wpackagist-plugin/spinupwp": "^1.1",
"wpackagist-plugin/woocommerce": "^4.9.2",
"wpackagist-plugin/wp-smushit": "^3.0"
},
"autoload": {
Expand Down Expand Up @@ -169,6 +170,7 @@
"post-update-cmd": [
"\"vendor/bin/mozart\" compose",
"composer dump-autoload"
]
],
"code-coverage": "\"vendor/bin/phpunit\" --testsuite unit --colors=always --configuration tests/Unit/phpunit.xml.dist --coverage-clover=tests/report/coverage.clover"
}
}
6 changes: 6 additions & 0 deletions inc/API/preload.php
Expand Up @@ -91,6 +91,12 @@ function do_admin_post_rocket_preload_cache() { // phpcs:ignore WordPress.Naming
die();
}

$prewarmup_stats = get_option( 'wp_rocket_prewarmup_stats' );
if ( get_rocket_option( 'remove_unused_css' ) && empty( $prewarmup_stats['allow_optimization'] ) ) {
wp_safe_redirect( wp_get_referer() );
die();
}

$preload_process = new FullProcess();

if ( $preload_process->is_process_running() ) {
Expand Down
6 changes: 5 additions & 1 deletion inc/Engine/Admin/Beacon/Beacon.php
Expand Up @@ -75,7 +75,11 @@ public static function get_subscribed_events() {
* @return void
*/
public function insert_script() {
if ( ! current_user_can( 'rocket_manage_options' ) ) {
if (
rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' )
||
! current_user_can( 'rocket_manage_options' )
) {
return;
}

Expand Down
6 changes: 5 additions & 1 deletion inc/Engine/Admin/Settings/Subscriber.php
Expand Up @@ -161,7 +161,11 @@ public function add_menu_tools_page( $navigation ) {
* @return array
*/
public function add_imagify_page( $navigation ) {
if ( Imagify_Partner::has_imagify_api_key() ) {
if (
rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' )
||
Imagify_Partner::has_imagify_api_key()
) {
return $navigation;
}

Expand Down

0 comments on commit 48f5466

Please sign in to comment.